[CRIU] [PATCH 2/2] compel: do not pass DEFINES two times to HOSTCFLAGS

Dmitry Safonov dsafonov at virtuozzo.com
Wed May 4 07:35:13 PDT 2016


I think, it's more pretty to pass -DCONFIG_X86_* instead of all
$DEFINES. That simplifies the statement and makes it more readable.

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 compel/Makefile | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/compel/Makefile b/compel/Makefile
index ce5c78363c2c..ca4b761744b4 100644
--- a/compel/Makefile
+++ b/compel/Makefile
@@ -6,7 +6,7 @@ ccflags-y	+= -iquote compel/arch/$(ARCH)/include
 ccflags-y	+= -DCOMPEL_VERSION=\"$(COMPEL_SO_VERSION_MAJOR).$(COMPEL_SO_VERSION_MINOR)\"
 
 host-ccflags-y	+= $(ccflags-y)
-HOSTCFLAGS	+= $(WARNINGS) $(DEFINES)
+HOSTCFLAGS	+= $(WARNINGS) $(filter-out -DCONFIG_X86_64,$(DEFINES))
 HOSTLDFLAGS	+= $(LDFLAGS)
 
 hostprogs-y	+= compel
@@ -14,16 +14,13 @@ compel-objs	+= main.o
 compel-objs	+= handle-elf.o
 compel-objs	+= arch/$(ARCH)/handle-elf.o
 
-# Add $(DEFINES) to CFLAGS of compel-objs.
-# We can't do ccflags-y += $(DEFINES)
-# as we need to build handle-elf-32.o
-# with -DCONFIG_X86_32
+ifeq ($(ARCH),x86)
+# Add -DCONFIG_X86_64 or -DCONFIG_X86_32 to HOSTCFLAGS
 define ccflags-defines
-        HOSTCFLAGS_$(notdir $(1)) += $(DEFINES)
+        HOSTCFLAGS_$(notdir $(1)) += -DCONFIG_X86_64
 endef
 $(eval $(call map,ccflags-defines,$(compel-objs)))
 
-ifeq ($(ARCH),x86)
-        compel-objs += handle-elf-32.o
-        HOSTCFLAGS_handle-elf-32.o += -DCONFIG_X86_32
-endif
+compel-objs += handle-elf-32.o
+HOSTCFLAGS_handle-elf-32.o += -DCONFIG_X86_32
+endif # ARCH == x86
-- 
2.8.0



More information about the CRIU mailing list