2 # Copyright (C) 2015 - 2018 "IoT.bzh"
3 # Author "Romain Forlot" <romain.forlot@iot.bzh>
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 THISFILE := $(lastword $(MAKEFILE_LIST))
18 BUILD_DIR := $(abspath $(dir $(THISFILE))/../../build)
21 .PHONY: all clean distclean configure build package help update configure-debug configure-coverage build-debug build-coverage package-test package-debug package-coverage package-debug package-debug-test package-coverage-test package-all package-all-1 package-all-2
26 @echo "List of targets available:"
32 @echo "- build: compilation, link and prepare files for package into a widget"
33 @echo "- package: output a widget file '*.wgt'"
34 @echo "- install: install in your ${CMAKE_INSTALL_DIR} directory"
36 @echo "Usage: ./autobuild/agl/autobuild package DEST=${HOME}/opt"
37 @echo "Don't use your build dir as DEST as wgt file is generated at this location"
40 @cmake --build ${BUILD_DIR} --target autobuild
43 @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} ${CLEAN_ARGS} clean) || echo Nothing to clean
49 @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR}
50 @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CONFIGURE_ARGS} ..)
53 @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR}
54 @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake -DCMAKE_BUILD_TYPE=DEBUG ${CONFIGURE_ARGS} ..)
57 @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR}
58 @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake -DCMAKE_BUILD_TYPE=COVERAGE ${CONFIGURE_ARGS} ..)
61 @cmake --build ${BUILD_DIR} ${BUILD_ARGS} --target all
63 build-debug: configure-debug
64 @cmake --build ${BUILD_DIR} ${BUILD_ARGS} --target all
66 build-coverage: configure-coverage
67 @cmake --build ${BUILD_DIR} ${BUILD_ARGS} --target all
70 @mkdir -p ${BUILD_DIR}/$@/bin
71 @mkdir -p ${BUILD_DIR}/$@/etc
72 @mkdir -p ${BUILD_DIR}/$@/lib
73 @mkdir -p ${BUILD_DIR}/$@/htdocs
74 @mkdir -p ${BUILD_DIR}/$@/var
75 @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target widget
76 @if [ "${DEST}" != "${BUILD_DIR}" ]; then \
77 mkdir -p ${DEST} && cp ${BUILD_DIR}/*.wgt ${DEST}; \
81 @mkdir -p ${BUILD_DIR}/$@/bin
82 @mkdir -p ${BUILD_DIR}/$@/etc
83 @mkdir -p ${BUILD_DIR}/$@/lib
84 @mkdir -p ${BUILD_DIR}/$@/htdocs
85 @mkdir -p ${BUILD_DIR}/$@/var
86 @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target widget
87 @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target test_widget
88 @if [ "${DEST}" != "${BUILD_DIR}" ]; then \
89 mkdir -p ${DEST} && cp ${BUILD_DIR}/*.wgt ${DEST}; \
92 package-debug: build-debug
93 @mkdir -p ${BUILD_DIR}/$@/bin
94 @mkdir -p ${BUILD_DIR}/$@/etc
95 @mkdir -p ${BUILD_DIR}/$@/lib
96 @mkdir -p ${BUILD_DIR}/$@/htdocs
97 @mkdir -p ${BUILD_DIR}/$@/var
98 @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target widget
99 @if [ "${DEST}" != "${BUILD_DIR}" ]; then \
100 mkdir -p ${DEST} && cp ${BUILD_DIR}/*.wgt ${DEST}; \
103 package-coverage: build-coverage
104 @mkdir -p ${BUILD_DIR}/$@/bin
105 @mkdir -p ${BUILD_DIR}/$@/etc
106 @mkdir -p ${BUILD_DIR}/$@/lib
107 @mkdir -p ${BUILD_DIR}/$@/htdocs
108 @mkdir -p ${BUILD_DIR}/$@/var
109 @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target widget
110 @if [ "${DEST}" != "${BUILD_DIR}" ]; then \
111 mkdir -p ${DEST} && cp ${BUILD_DIR}/*.wgt ${DEST}; \
114 package-coverage-test: build-coverage
115 @mkdir -p ${BUILD_DIR}/$@/bin
116 @mkdir -p ${BUILD_DIR}/$@/etc
117 @mkdir -p ${BUILD_DIR}/$@/lib
118 @mkdir -p ${BUILD_DIR}/$@/htdocs
119 @mkdir -p ${BUILD_DIR}/$@/var
120 @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target widget
121 @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target test_widget
122 @if [ "${DEST}" != "${BUILD_DIR}" ]; then \
123 mkdir -p ${DEST} && cp ${BUILD_DIR}/*.wgt ${DEST}; \
127 package-debug-test: build-debug
128 @mkdir -p ${BUILD_DIR}/$@/bin
129 @mkdir -p ${BUILD_DIR}/$@/etc
130 @mkdir -p ${BUILD_DIR}/$@/lib
131 @mkdir -p ${BUILD_DIR}/$@/htdocs
132 @mkdir -p ${BUILD_DIR}/$@/var
133 @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target widget
134 @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target test_widget
135 @if [ "${DEST}" != "${BUILD_DIR}" ]; then \
136 mkdir -p ${DEST} && cp ${BUILD_DIR}/*.wgt ${DEST}; \
139 package-all-1: package
140 @rm ${BUILD_DIR}/Makefile
141 @rm ${BUILD_DIR}/CMakeCache.txt
143 package-all-2: package-all-1 package-coverage
144 @rm ${BUILD_DIR}/Makefile
145 @rm ${BUILD_DIR}/CMakeCache.txt
147 package-all: package-all-2 package-debug
150 @cmake --build ${BUILD_DIR} ${INSTALL_ARGS} --target install