[CRIU] [PATCH 2/8] build: Import nmk on toplevel

Cyrill Gorcunov gorcunov at openvz.org
Fri Feb 5 01:01:14 PST 2016


 - no more x86_64 in @ARCH, as in kernel it's traditional x86 entry
 - @build renamed to @build-old, will be deprecated

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 Makefile            | 69 +++++++++++++++++++++--------------------------------
 Makefile.inc        | 12 ----------
 arch/x86/Makefile   |  8 +++----
 pie/Makefile        |  2 +-
 pie/piegen/Makefile |  2 +-
 5 files changed, 33 insertions(+), 60 deletions(-)

diff --git a/Makefile b/Makefile
index 8a0a23055767..85dfb440c889 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,9 @@
+# Import the build engine first
+__nmk_dir=$(CURDIR)/scripts/nmk/scripts/
+export __nmk_dir
+
+include $(__nmk_dir)/include.mk
+
 VERSION_MAJOR		:= 1
 VERSION_MINOR		:= 8
 VERSION_SUBLEVEL	:=
@@ -42,25 +48,7 @@ export HOSTCC
 export HOSTLD
 export HOSTCFLAGS
 
-#
-# Fetch ARCH from the uname if not yet set
-#
-ARCH ?= $(shell uname -m | sed		\
-		-e s/i.86/i386/		\
-		-e s/sun4u/sparc64/	\
-		-e s/s390x/s390/	\
-		-e s/parisc64/parisc/	\
-		-e s/mips.*/mips/	\
-		-e s/sh[234].*/sh/)
-
-ifeq ($(ARCH),i386)
-	SRCARCH      := x86-32
-	DEFINES      := -DCONFIG_X86_32
-	VDSO         := y
-	PROTOUFIX    := y
-	export PROTOUFIX
-endif
-ifeq ($(ARCH),x86_64)
+ifeq ($(ARCH),x86)
 	SRCARCH      := x86
 	DEFINES      := -DCONFIG_X86_64
 	LDARCH       := i386:x86-64
@@ -121,20 +109,17 @@ ifeq ($(shell echo $(ARCH) | sed -e 's/ppc64.*/ppc64/'),ppc64)
 	VDSO	:= y
 endif
 
-SRCARCH		?= $(ARCH)
 LDARCH		?= $(SRCARCH)
 
 SRC_DIR		?= $(CURDIR)
 ARCH_DIR	:= arch/$(SRCARCH)
 
-export ARCH SRCARCH
-
 $(if $(wildcard $(ARCH_DIR)),,$(error "The architecture $(ARCH) isn't supported"))
 
 #
 # piegen might be disabled by hands. Don't use it  until
 # you know what you're doing.
-ifneq ($(filter i386 ia32 x86_64 ppc64le, $(ARCH)),)
+ifneq ($(filter ia32 x86 ppc64le, $(ARCH)),)
 ifneq ($(PIEGEN),no)
 	piegen-y := y
 	export piegen-y
@@ -194,8 +179,8 @@ include scripts/Makefile.rules
 
 #
 # shorthand
-build := -r -R -f scripts/Makefile.build makefile=Makefile obj
-build-crtools := -r -R -f scripts/Makefile.build makefile=Makefile.crtools obj
+build-old := -r -R -f scripts/Makefile.build makefile=Makefile obj
+build-old-crtools := -r -R -f scripts/Makefile.build makefile=Makefile.crtools obj
 
 PROGRAM		:= criu
 
@@ -207,20 +192,20 @@ all: config pie $(VERSION_HEADER) $(CRIU-LIB)
 	$(Q) $(MAKE) crit
 
 protobuf/%::
-	$(Q) $(MAKE) $(build)=protobuf $@
+	$(Q) $(MAKE) $(build-old)=protobuf $@
 protobuf:
-	$(Q) $(MAKE) $(build)=protobuf all
+	$(Q) $(MAKE) $(build-old)=protobuf all
 
 $(ARCH_DIR)/%:: protobuf config
-	$(Q) $(MAKE) $(build)=$(ARCH_DIR) $@
+	$(Q) $(MAKE) $(build-old)=$(ARCH_DIR) $@
 $(ARCH_DIR): protobuf config
-	$(Q) $(MAKE) $(build)=$(ARCH_DIR) all
+	$(Q) $(MAKE) $(build-old)=$(ARCH_DIR) all
 
 ifeq ($(piegen-y),y)
 pie/piegen/%: config
-	$(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS)" $(MAKE) $(build)=pie/piegen $@
+	$(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS)" $(MAKE) $(build-old)=pie/piegen $@
 pie/piegen: config
-	$(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS)" $(MAKE) $(build)=pie/piegen all
+	$(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS)" $(MAKE) $(build-old)=pie/piegen all
 $(piegen): pie/piegen/built-in.o
 	$(E) "  LINK    " $@
 	$(Q) $(HOSTCC) $(HOSTCFLAGS) $^ $(LDFLAGS) -o $@
@@ -228,17 +213,17 @@ $(piegen): pie/piegen/built-in.o
 endif
 
 pie: $(ARCH_DIR) $(piegen)
-	$(Q) $(MAKE) $(build)=pie all
+	$(Q) $(MAKE) $(build-old)=pie all
 
 %.o %.i %.s %.d: $(VERSION_HEADER) pie
-	$(Q) $(MAKE) $(build-crtools)=. $@
+	$(Q) $(MAKE) $(build-old-crtools)=. $@
 built-in.o: $(VERSION_HEADER) pie
-	$(Q) $(MAKE) $(build-crtools)=. $@
+	$(Q) $(MAKE) $(build-old-crtools)=. $@
 
 lib/%:: $(VERSION_HEADER) config built-in.o
-	$(Q) $(MAKE) $(build)=lib $@
+	$(Q) $(MAKE) $(build-old)=lib $@
 lib: $(VERSION_HEADER) config built-in.o
-	$(Q) $(MAKE) $(build)=lib all
+	$(Q) $(MAKE) $(build-old)=lib all
 
 PROGRAM-BUILTINS	+= protobuf/built-in.o
 PROGRAM-BUILTINS	+= built-in.o
@@ -260,12 +245,12 @@ test: zdtm
 
 clean-built:
 	$(Q) $(RM) $(VERSION_HEADER)
-	$(Q) $(MAKE) $(build)=$(ARCH_DIR) clean
-	$(Q) $(MAKE) $(build)=protobuf clean
-	$(Q) $(MAKE) $(build)=pie/piegen clean
-	$(Q) $(MAKE) $(build)=pie clean
-	$(Q) $(MAKE) $(build)=lib clean
-	$(Q) $(MAKE) $(build-crtools)=. clean
+	$(Q) $(MAKE) $(build-old)=$(ARCH_DIR) clean
+	$(Q) $(MAKE) $(build-old)=protobuf clean
+	$(Q) $(MAKE) $(build-old)=pie/piegen clean
+	$(Q) $(MAKE) $(build-old)=pie clean
+	$(Q) $(MAKE) $(build-old)=lib clean
+	$(Q) $(MAKE) $(build-old-crtools)=. clean
 	$(Q) $(MAKE) -C Documentation clean
 	$(Q) $(RM) ./include/config.h
 	$(Q) $(RM) ./$(PROGRAM)
diff --git a/Makefile.inc b/Makefile.inc
index 5f0a55202419..4782ea23939d 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -1,15 +1,3 @@
-# Silent make rules
-
-ifeq ($(strip $(V)),)
-	E = @echo
-	Q = @
-else
-	E = @\#
-	Q =
-endif
-
-export E Q
-
 # Installation paths
 PREFIX		?= /usr/local
 SBINDIR		?= $(PREFIX)/sbin
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 5ee12fc67876..d532f8f96d81 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -8,7 +8,7 @@ crtools-obj-y	+= crtools.o
 crtools-obj-y	+= cpu.o
 crtools-obj-y	+= prlimit.o
 
-ifeq ($(ARCH),x86_64)
+ifeq ($(ARCH),x86)
 SYS-DEF		:= syscall_64.tbl
 SYS-ASM-COMMON	:= syscall-common-x86-64.S
 else
@@ -22,14 +22,14 @@ SYS-PROTO	:= ../../include/syscall.h
 
 SYS-EXEC-TBL	:= sys-exec-tbl.c
 
-ifeq ($(ARCH),x86_64)
+ifeq ($(ARCH),x86)
 syscalls-asm-y-asmflags	:= -fpie -Wstrict-prototypes -Wa,--noexecstack
 else
 syscalls-asm-y-asmflags	:= -fno-pic -Wstrict-prototypes -Wa,--noexecstack
 endif
 syscalls-asm-y-asmflags += -nostdlib -fomit-frame-pointer -I$(obj)
 
-ifneq ($(ARCH),x86_64)
+ifneq ($(ARCH),x86)
 syscalls-obj-y += syscalls/syscall32.o
 $(obj)/syscalls/syscall32.o: $(obj)/$(SYS-CODES) $(obj)/$(SYS-PROTO)
 endif
@@ -54,7 +54,7 @@ $(obj)/$(SYS-PROTO): $(obj)/syscalls/$(SYS-DEF)
 	$(Q) echo "#define __ASM_CR_SYSCALL_PROTO_H__"							>> $@
 	$(Q) echo "#include \"syscall-codes.h\""							>> $@
 	$(Q) echo "#include \"syscall-types.h\""							>> $@
-ifneq ($(ARCH),x86_64)
+ifneq ($(ARCH),x86)
 	$(Q) echo "#include \"asm/syscall32.h\""							>> $@
 endif
 	$(Q) cat $< | awk  '/^__NR/{print "extern long", $$3, substr($$0, index($$0,$$4)), ";"}'	>> $@
diff --git a/pie/Makefile b/pie/Makefile
index 772f16fff845..fd48da92ea43 100644
--- a/pie/Makefile
+++ b/pie/Makefile
@@ -70,7 +70,7 @@ $(obj)/$(PIELDS): $(obj)/pie-reloc.lds.S.in
 	$(Q) echo "OUTPUT_ARCH($(LDARCH))"              >  $(obj)/$(PIELDS)
 	$(Q) cat $<					>> $(obj)/$(PIELDS)
 else
-ifeq ($(ARCH),x86_64)
+ifeq ($(ARCH),x86)
 $(obj)/$(PIELDS): $(obj)/pie-reloc.lds.S.in
 	$(E) "  GEN     " $@
 	$(Q) echo "OUTPUT_ARCH(i386:x86-64)"		>  $(obj)/$(PIELDS)
diff --git a/pie/piegen/Makefile b/pie/piegen/Makefile
index 530af8bf8d9c..5c3d68b84817 100644
--- a/pie/piegen/Makefile
+++ b/pie/piegen/Makefile
@@ -1,7 +1,7 @@
 CFLAGS += -iquote pie/piegen
 
 obj-y += main.o
-ifneq ($(filter i386 ia32 x86_64, $(ARCH)),)
+ifneq ($(filter ia32 x86, $(ARCH)),)
 obj-y += elf-x86-32.o
 obj-y += elf-x86-64.o
 endif
-- 
2.5.0



More information about the CRIU mailing list