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

Pavel Emelyanov xemul at virtuozzo.com
Tue Nov 1 16:16:46 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.

v2: Add .config to .gitignore

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

diff --git a/.gitignore b/.gitignore
index 2a062cc..9193c6f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.config
 *.o
 *.d
 *.a
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 ''							>> $$@



More information about the CRIU mailing list