diff options
-rwxr-xr-x | autobuild/linux/autobuild.mk | 47 | ||||
-rw-r--r-- | default/cmake/macros.cmake | 14 |
2 files changed, 54 insertions, 7 deletions
diff --git a/autobuild/linux/autobuild.mk b/autobuild/linux/autobuild.mk new file mode 100755 index 0000000..5f8f595 --- /dev/null +++ b/autobuild/linux/autobuild.mk @@ -0,0 +1,47 @@ +#!/usr/bin/make -f +# Copyright (C) 2015, 2016 "IoT.bzh" +# Author "Romain Forlot" <romain.forlot@iot.bzh> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +BUILD_DIR := build +PACKAGING_DIR := packaging/wgt + +VPATH = etc:$(PACKAGING_DIR):$(PACKAGING_DIR)/etc:$(BUILD_DIR) + +.PHONY: all clean mrproper package + +all: build + +clean: + @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} clean) || echo Nothing to clean + +mrproper: + @rm -rf ${BUILD_DIR} + +build: ${BUILD_DIR}/Makefile + @cmake --build ${BUILD_DIR} --target all + +package: config.xml.in icon.png.in build | $(PKG_FILELIST) + @mkdir -p ${BUILD_DIR}/$@/bin + @mkdir -p ${BUILD_DIR}/$@/etc + @mkdir -p ${BUILD_DIR}/$@/lib + @mkdir -p ${BUILD_DIR}/$@/htdocs + @mkdir -p ${BUILD_DIR}/$@/data + @mkdir -p package + @cmake --build ${BUILD_DIR} --target widget + @cp ${BUILD_DIR}/*wgt package + +${BUILD_DIR}/Makefile: + @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR} + @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CMAKE_OPTS} ..) diff --git a/default/cmake/macros.cmake b/default/cmake/macros.cmake index b1a5f68..9650ad0 100644 --- a/default/cmake/macros.cmake +++ b/default/cmake/macros.cmake @@ -166,8 +166,8 @@ macro(wgt_package_build) endmacro(wgt_package_build) macro(rpm_package_build) - if(NOT EXISTS ${PROJECT_RPM_DIR}/config.rpm.in) - MESSAGE(STATUS "Missing mandatory files: you needconfig.rpm.in in ${PROJECT_RPM_DIR} folder.") + if(NOT EXISTS ${PROJECT_RPM_DIR}/config.spec.in) + MESSAGE(STATUS "Missing mandatory files: you need config.spec.in in ${PROJECT_RPM_DIR} folder.") else() # extract PROJECT_PKG_DEPS and replace ; by , for RPM spec file get_property(PROJECT_PKG_DEPS GLOBAL PROPERTY PROJECT_PKG_DEPS) @@ -176,16 +176,16 @@ macro(rpm_package_build) endforeach() # build rpm spec file from template - configure_file(${PROJECT_RPM_DIR}/config.rpm.in ${PROJECT_PKG_DIR}/config.rpm) + configure_file(${PROJECT_RPM_DIR}/config.spec.in ${PROJECT_PKG_DIR}/config.spec) - add_custom_command(OUTPUT ${PROJECT_NAME}.rpm + add_custom_command(OUTPUT ${PROJECT_NAME}.spec DEPENDS ${PROJECT_TARGETS} - COMMAND rpmbuild -ba ${PROJECT_PKG_DIR}/config.rpm + COMMAND rpmbuild -ba ${PROJECT_PKG_DIR}/config.spec ) - add_custom_target(rpm DEPENDS ${PROJECT_NAME}.rpm) + add_custom_target(rpm DEPENDS ${PROJECT_NAME}.spec) add_dependencies(rpm populate) - set(ADDITIONAL_MAKE_CLEAN_FILES, "${PROJECT_NAME}.rpm") + set(ADDITIONAL_MAKE_CLEAN_FILES, "${PROJECT_NAME}.spec") if(PACKAGE_MESSAGE) add_custom_command(TARGET rpm |