[CRIU] [PATCH 7/9] make: propagate config DEFINES in CFLAGS

Dmitry Safonov dsafonov at virtuozzo.com
Thu Aug 4 07:49:48 PDT 2016


The problem:
$(DEFINES) array added to $(CFLAGS) in a global Makefile.
But, in criu/Makefile we include Makefile.config, which
adds feature-based config options to $(DEFINES).
We need to propagate this new defines again to CFLAGS array.

Previously, I added:
ccflags-y		+= $(DEFINES)
to Makefile.crtools, but those $(DEFINES) are useful not only
in the crtools makefile.

Let's just propagate this feature defines to CFLAGS and DEFINES
in place.

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/Makefile.config  | 11 +++++++----
 criu/Makefile.crtools |  1 -
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/criu/Makefile.config b/criu/Makefile.config
index 0052f2f6e5c2..375408a94d24 100644
--- a/criu/Makefile.config
+++ b/criu/Makefile.config
@@ -3,15 +3,18 @@ include $(__nmk_dir)msg.mk
 include $(SRC_DIR)/scripts/feature-tests.mak
 
 ifeq ($(call try-cc,$(FEATURE_TEST_LIBBSD_DEV),-lbsd),true)
-        LIBS	+= -lbsd
-        DEFINES	+= -DCONFIG_HAS_LIBBSD
+        LIBS		+= -lbsd
+        FEATURE_DEFINES	+= -DCONFIG_HAS_LIBBSD
 endif
 
 ifeq ($(call pkg-config-check,libselinux),y)
-        LIBS	+= -lselinux
-        DEFINES	+= -DCONFIG_HAS_SELINUX
+        LIBS		+= -lselinux
+        FEATURE_DEFINES	+= -DCONFIG_HAS_SELINUX
 endif
 
+export DEFINES += $(FEATURE_DEFINES)
+export CFLAGS += $(FEATURE_DEFINES)
+
 FEATURES_LIST	:= TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \
 	SETPROCTITLE_INIT MEMFD
 
diff --git a/criu/Makefile.crtools b/criu/Makefile.crtools
index 8e9c3b48d1a3..52c00ecd776a 100644
--- a/criu/Makefile.crtools
+++ b/criu/Makefile.crtools
@@ -1,5 +1,4 @@
 ccflags-y		+= -iquote criu/$(ARCH)
-ccflags-y		+= $(DEFINES)
 obj-y			+= action-scripts.o
 obj-y			+= aio.o
 obj-y			+= bfd.o
-- 
2.9.0



More information about the CRIU mailing list