[CRIU] [PATCH 1/2] make: Add .config file processing

Pavel Emelyanov xemul at virtuozzo.com
Mon Oct 31 20:19:50 PDT 2016


In this file one can add options with which to build CRIU.
Each line is (for now) expanded into CONFIG_$(TEXT) macros
defined in config.h that can be tested later in the code.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 Makefile.config | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile.config b/Makefile.config
index cce32fa..6ff42fe 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -14,6 +14,11 @@ endif
 
 export LIBS += $(LIBS_FEATURES)
 
+CONFIG_FILE = $(SRC_DIR)/.config
+
+$(CONFIG_FILE):
+	touch $(CONFIG_FILE)
+
 #
 # FIXME Bring back once libcompel complete
 #ifeq ($(SRCARCH),x86)
@@ -39,12 +44,13 @@ endif
 endef
 
 define config-header-rule
-$(CONFIG_HEADER): $(SRC_DIR)/scripts/feature-tests.mak
+$(CONFIG_HEADER): $(SRC_DIR)/scripts/feature-tests.mak $(CONFIG_FILE)
 	$$(call msg-gen, $$@)
 	$(Q) @echo '#ifndef __CR_CONFIG_H__'				> $$@
 	$(Q) @echo '#define __CR_CONFIG_H__'				>> $$@
 	$(Q) @echo ''							>> $$@
 $(call map,gen-feature-test,$(FEATURES_LIST))
+	$(Q) @cat $(CONFIG_FILE) | sed -n -e '/^[^#]/s/^/#define CONFIG_/p' >> $$@
 ifeq ($$(VDSO),y)
 	$(Q) @echo '#define CONFIG_VDSO'				>> $$@
 	$(Q) @echo ''							>> $$@
-- 
2.5.0



More information about the CRIU mailing list