From 35d5206a64c88d49e5b8c91b91d8710bca1d4c8e Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 31 Oct 2018 12:11:03 +0100 Subject: Upgrade the autobuild script This update the autobuild script generated by the CMakeAfbTemplates module making clearer build dir variable and change the way to build using the classic way with cmake .. ; make etc. Remove also an intermediate target that wasn't needed. Change the directory where the autobuild script is generated. Added a README instruction about the autobuild script coming from the SPEC-495 description Change-Id: I24905b348adbdba2dca5ffa146812461a4030690 Signed-off-by: Romain Forlot --- template.d/autobuild/linux/autobuild.in | 34 ++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'template.d/autobuild/linux/autobuild.in') diff --git a/template.d/autobuild/linux/autobuild.in b/template.d/autobuild/linux/autobuild.in index 83097ab..a832db4 100755 --- a/template.d/autobuild/linux/autobuild.in +++ b/template.d/autobuild/linux/autobuild.in @@ -1,5 +1,5 @@ #!/usr/bin/make -f -# Copyright (C) 2015, 2016 "IoT.bzh" +# Copyright (C) 2015 - 2018 "IoT.bzh" # Author "Romain Forlot" # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,8 +15,8 @@ # limitations under the License. THISFILE := $(lastword $(MAKEFILE_LIST)) -BUILD_DIR := $(abspath $(dir $(THISFILE)/../../../../..)/build) -DEST := ${BUILD_DIR}/target +BUILD_DIR := $(abspath $(dir $(THISFILE))/../../build) +DEST := ${BUILD_DIR} .PHONY: all clean distclean configure build package help update @@ -33,19 +33,21 @@ help: @echo "- package: output a widget file '*.wgt'" @echo "- install: install in your ${CMAKE_INSTALL_DIR} directory" @echo "" - @echo "Usage: ./conf.d/autobuild/agl/autobuild package DEST=${HOME}/opt" + @echo "Usage: ./autobuild/agl/autobuild package DEST=${HOME}/opt" @echo "Don't use your build dir as DEST as wgt file is generated at this location" update: configure @cmake --build ${BUILD_DIR} --target autobuild clean: - @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} clean) || echo Nothing to clean + @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} ${CLEAN_ARGS} clean) || echo Nothing to clean distclean: @rm -rf ${BUILD_DIR} -configure: ${BUILD_DIR}/Makefile +configure: + @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR} + @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CONFIGURE_ARGS} ..) build: configure @cmake --build ${BUILD_DIR} ${BUILD_ARGS} --target all @@ -56,12 +58,18 @@ package: build @mkdir -p ${BUILD_DIR}/$@/lib @mkdir -p ${BUILD_DIR}/$@/htdocs @mkdir -p ${BUILD_DIR}/$@/var - @cmake --build ${BUILD_DIR} --target widget - @mkdir -p ${DEST} && cp ${BUILD_DIR}/*wgt ${DEST} + @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target widget + @mkdir -p ${DEST} && cp ${BUILD_DIR}/*.wgt ${DEST} -install: build - @cmake --build ${BUILD_DIR} --target install +package-test: build + @mkdir -p ${BUILD_DIR}/$@/bin + @mkdir -p ${BUILD_DIR}/$@/etc + @mkdir -p ${BUILD_DIR}/$@/lib + @mkdir -p ${BUILD_DIR}/$@/htdocs + @mkdir -p ${BUILD_DIR}/$@/var + @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target widget + @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target test_widget + @mkdir -p ${DEST} && cp ${BUILD_DIR}/*.wgt ${DEST} -${BUILD_DIR}/Makefile: - @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR} - @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CONFIGURE_ARGS} ..) +install: build + @cmake --build ${BUILD_DIR} ${INSTALL_ARGS} --target install -- cgit 1.2.3-korg