core: create conf.h from CFG_* Makefile variables
Simplify the use of makefile configuration variables from C code.
With this patch, one can #include <generated/conf.h> instead of adding
CPP flags definitions to the .mk files.
- CFG_* variables that are set to 'y' are converted to: #define CFG_FOO 1
- Undefined variables, or variables set to 'n' remain undefined in conf.h
- CFG_* variables with any other value are output unchanged
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
diff --git a/mk/lib.mk b/mk/lib.mk
index c012801..389fd41 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -3,6 +3,7 @@
# libname tells the name of the lib and
# libdir tells directory of lib which also is used as input to
# mk/subdir.mk
+# conf-file [optional] if set, all objects will depend on $(conf-file)
#
# Output
#
@@ -37,6 +38,8 @@
$(eval $(call process-lib))
+$(objs): $(conf-file)
+
# Clean residues from processing
objs :=
libname :=