build: Support for integrating third party build systems

For projects like JerryScript and Micropython we are starting to see
hybrid build systems emerge where the application (which targets a
variety of OSs and already includes a complex build system) is compiled
using the applications own build system before handing over to the
zephyr build system for the final link.

Currently the integration is becoming quite complex as the applications
build integration tries to figure out sane values for CC and CFLAGS.
Much of this complexity can be avoided if we allow the zephyr build
system to export its configuration in a manner that can easily be
consumed by the alien build system.

Change-Id: I4ea4cda2ed0437222d9550c50f0b07e51d9ac91b
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
This commit is contained in:
Daniel Thompson 2016-09-22 15:00:21 +01:00 committed by Anas Nashif
commit 90f6ae1532

View file

@ -396,17 +396,33 @@ LDFLAGS += $(call ld-option,-static)
KERNELVERSION = $(VERSION_MAJOR)$(if $(VERSION_MINOR),.$(VERSION_MINOR)$(if $(PATCHLEVEL),.$(PATCHLEVEL)))$(EXTRAVERSION)
export VERSION_MAJOR VERSION_MINOR PATCHLEVEL VERSION_RESERVED EXTRAVERSION
export KERNELRELEASE KERNELVERSION
export ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC CXX
export CPP AR NM STRIP OBJCOPY OBJDUMP GDB
export MAKE AWK INSTALLKERNEL PERL PYTHON GENIDT GENOFFSET_H
export HOSTCXX HOSTCXXFLAGS CHECK CHECKFLAGS
exports += VERSION_MAJOR VERSION_MINOR PATCHLEVEL VERSION_RESERVED EXTRAVERSION
exports += KERNELRELEASE KERNELVERSION
exports += ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC CXX
exports += CPP AR NM STRIP OBJCOPY OBJDUMP GDB
exports += MAKE AWK INSTALLKERNEL PERL PYTHON GENIDT GENOFFSET_H
exports += HOSTCXX HOSTCXXFLAGS CHECK CHECKFLAGS
export KBUILD_CPPFLAGS NOSTDINC_FLAGS ZEPHYRINCLUDE OBJCOPYFLAGS LDFLAGS
export KBUILD_CFLAGS KBUILD_CXXFLAGS CFLAGS_GCOV KBUILD_AFLAGS AFLAGS_KERNEL
export KBUILD_ARFLAGS
exports += KBUILD_CPPFLAGS NOSTDINC_FLAGS ZEPHYRINCLUDE OBJCOPYFLAGS LDFLAGS
exports += KBUILD_CFLAGS KBUILD_CXXFLAGS CFLAGS_GCOV KBUILD_AFLAGS AFLAGS_KERNEL
exports += KBUILD_ARFLAGS
# Push the exports to sub-processes
export $(exports)
# Make the exports available to third-party build systems
PHONY += outputexports
outputexports: Makefile.export
Makefile.export: include/config/auto.conf FORCE
$(call filechk,Makefile.export)
define filechk_Makefile.export
(echo "# file is auto-generated, do not modify !"; \
echo "BOARD=$(BOARD)"; \
echo; \
$(foreach e,$(exports),echo $(e)=$($e);) echo; \
echo "include $(O)/.config";)
endef
# Files to ignore in find ... statements