[PATCH] make: Simplify ARCH retrieval

Cyrill Gorcunov gorcunov at openvz.org
Wed Jan 23 09:48:46 EST 2013


Actually the former code was being expanding
uname_M variable which is not set that early
(this was not a problem since we assign it a
line below, still it was a dead code which
should be fixed).

Also update

 | ifeq ($(findstring arm,$(ARCH)),arm)

to simple

 | ifeq ($(ARCH),arm)

Reported-by: Andrey Vagin <avagin at openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
Acked-by: Alexander Kartashov <alekskartashov at parallels.com>
---
 Makefile | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 66ec99d..6bab850 100644
--- a/Makefile
+++ b/Makefile
@@ -24,25 +24,31 @@ SH		:= bash
 MAKE		:= make
 OBJCOPY		:= objcopy
 
-# Additional ARCH settings for x86
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
-                  -e s/arm.*/arm/ -e s/sa110/arm/ \
-                  -e s/s390x/s390/ -e s/parisc64/parisc/ \
-                  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
-                  -e s/sh[234].*/sh/ )
-
-uname_M      := $(shell uname -m | sed -e s/i.86/i386/)
-ifeq ($(uname_M),i386)
+#
+# 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/arm.*/arm/		\
+		-e s/sa110/arm/		\
+		-e s/s390x/s390/	\
+		-e s/parisc64/parisc/	\
+		-e s/ppc.*/powerpc/	\
+		-e s/mips.*/mips/	\
+		-e s/sh[234].*/sh/)
+
+ifeq ($(ARCH),i386)
 	ARCH         := x86-32
 	DEFINES      := -DCONFIG_X86_32
 endif
-ifeq ($(uname_M),x86_64)
+ifeq ($(ARCH),x86_64)
 	ARCH         := x86
 	DEFINES      := -DCONFIG_X86_64
 	LDARCH       := i386:x86-64
 endif
 
-ifeq ($(findstring arm,$(uname_M)),arm)
+ifeq ($(ARCH),arm)
 	ARCH         := arm
 	ARCH_DEFINES := -DCONFIG_ARM
 	LDARCH       := arm
-- 
1.8.1


--6c2NcOVqGQ03X4Wi--


More information about the CRIU mailing list