[CRIU] [RFC 04/11] Use SRCARCH internally

Christopher Covington cov at codeaurora.org
Fri Feb 7 09:04:38 PST 2014


ARCH is a user-facing variable and setting it on the command line
clobbers any manipulation attempted in the makefile. Following
the example of the Linux kernel makefiles, use a SRCARCH variable
instead for the internal, potentially fixed-up, architecture name.
This fixes the following error.

make ARCH=x86_64
Makefile:69: *** "The architecture x86_64 isn't supported".  Stop.
---
 Makefile               | 11 +++++------
 test/zdtm/Makefile.inc |  8 +++++---
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 16d86b2..9fc3c99 100644
--- a/Makefile
+++ b/Makefile
@@ -43,20 +43,19 @@ ARCH ?= $(shell uname -m | sed		\
 		-e s/sh[234].*/sh/)
 
 ifeq ($(ARCH),i386)
-	ARCH         := x86-32
+	SRCARCH      := x86-32
 	DEFINES      := -DCONFIG_X86_32
 endif
 ifeq ($(ARCH),x86_64)
-	ARCH         := x86
+	SRCARCH      := x86
 	DEFINES      := -DCONFIG_X86_64
 	LDARCH       := i386:x86-64
 endif
 
 ifeq ($(shell echo $(ARCH) | sed -e 's/arm.*/arm/'),arm)
 	ARMV         := $(shell echo $(ARCH) | sed -r -e 's/armv([[:digit:]]).*/\1/')
-	ARCH         := arm
+	SRCARCH      := arm
 	DEFINES      := -DCONFIG_ARM -DCONFIG_ARMV$(ARMV)
-	LDARCH       := arm
 
 	ifeq ($(ARMV),6)
 		CFLAGS += -march=armv6
@@ -67,10 +66,10 @@ ifeq ($(shell echo $(ARCH) | sed -e 's/arm.*/arm/'),arm)
 	endif
 endif
 
-LDARCH		?= $(ARCH)
+LDARCH		?= $(SRCARCH)
 
 SRC_DIR		?= $(CURDIR)
-ARCH_DIR	:= arch/$(ARCH)
+ARCH_DIR	:= arch/$(SRCARCH)
 
 $(if $(wildcard $(ARCH_DIR)),,$(error "The architecture $(ARCH) isn't supported"))
 
diff --git a/test/zdtm/Makefile.inc b/test/zdtm/Makefile.inc
index 08e826f..215609b 100644
--- a/test/zdtm/Makefile.inc
+++ b/test/zdtm/Makefile.inc
@@ -9,15 +9,17 @@ ARCH ?= $(shell uname -m | sed		\
 		-e s/mips.*/mips/	\
 		-e s/sh[234].*/sh/)
 
+SRCARCH := $(ARCH)
+
 ifeq ($(ARCH),i386)
-	ARCH := x86
+	SRCARCH := x86
 endif
 
 ifeq ($(ARCH),x86_64)
-	ARCH := x86
+	SRCARCH := x86
 endif
 
-CPPFLAGS += -iquote $(LIBDIR)/arch/$(ARCH)/include
+CPPFLAGS += -iquote $(LIBDIR)/arch/$(SRCARCH)/include
 
 ifeq ($(strip $(V)),)
 	E = @echo
-- 
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by the Linux Foundation.



More information about the CRIU mailing list