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

Pavel Emelyanov xemul at virtuozzo.com
Tue Nov 1 21:29:27 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
v3: Don't check that make mrproper removes .config

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>

---

 .gitignore                    | 1 +
 Makefile.config               | 8 +++++++-
 scripts/build/Dockerfile.tmpl | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

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 ''							>> $$@
diff --git a/scripts/build/Dockerfile.tmpl b/scripts/build/Dockerfile.tmpl
index 34b4930..61c9afc 100644
--- a/scripts/build/Dockerfile.tmpl
+++ b/scripts/build/Dockerfile.tmpl
@@ -28,5 +28,5 @@ RUN make mrproper
 RUN make -j $(nproc) CC=$CC criu/parasite-syscall.o
 RUN make -j $(nproc) CC=$CC
 RUN make mrproper
-RUN bash -c 'CLEAN="$(git clean -ndx --exclude=scripts/build)"; echo "${CLEAN}"; test -z "${CLEAN}"; exit $?'
+RUN bash -c 'CLEAN="$(git clean -ndx --exclude=scripts/build --exclude=.config)"; echo "${CLEAN}"; test -z "${CLEAN}"; exit $?'
 #RUN make test/compel/handle_binary && ./test/compel/handle_binary
-- 
2.5.0



More information about the CRIU mailing list