[CRIU] [PATCH 04/10] build: Use SUBARCH

Dmitry Safonov dima at arista.com
Fri Nov 22 00:56:37 MSK 2019


Instead of doing additional `uname -m` - use provided $(SUBARCH) to detect
what architecture flavour the build should produce the result for.

Fixes two things:
- zdtm make now correctly supplies $(USERCFLAGS)
- subtly fixes cross compilation by providing a way to specify $(SUBARCH)

Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 Makefile               |  6 ++----
 test/zdtm/Makefile.inc | 25 +++++++++++++------------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index 2e62f6f39ea5..ef76d706c201 100644
--- a/Makefile
+++ b/Makefile
@@ -17,8 +17,6 @@ ifeq ($(origin HOSTCFLAGS), undefined)
         HOSTCFLAGS := $(CFLAGS) $(USERCFLAGS)
 endif
 
-UNAME-M := $(shell uname -m)
-
 #
 # Supported Architectures
 ifneq ($(filter-out x86 arm aarch64 ppc64 s390,$(ARCH)),)
@@ -27,14 +25,14 @@ endif
 
 # The PowerPC 64 bits architecture could be big or little endian.
 # They are handled in the same way.
-ifeq ($(UNAME-M),ppc64)
+ifeq ($(SUBARCH),ppc64)
         error := $(error ppc64 big endian is not yet supported)
 endif
 
 #
 # Architecture specific options.
 ifeq ($(ARCH),arm)
-        ARMV		:= $(shell echo $(UNAME-M) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
+        ARMV		:= $(shell echo $(SUBARCH) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
 
         ifeq ($(ARMV),6)
                 USERCFLAGS += -march=armv6
diff --git a/test/zdtm/Makefile.inc b/test/zdtm/Makefile.inc
index d5c013a3e852..7584d3b0605c 100644
--- a/test/zdtm/Makefile.inc
+++ b/test/zdtm/Makefile.inc
@@ -1,17 +1,18 @@
 .SUFFIXES:
 MAKEFLAGS	+= -r
 
-ARCH ?= $(shell uname -m | sed          \
-                -e s/i.86/x86/          \
-                -e s/x86_64/x86/        \
-                -e s/sun4u/sparc64/     \
-                -e s/arm.*/arm/         \
-                -e s/sa110/arm/         \
-                -e s/s390x/s390/        \
-                -e s/parisc64/parisc/   \
-                -e s/ppc64.*/ppc64/     \
-                -e s/mips.*/mips/       \
-                -e s/sh[234].*/sh/      \
+SUBARCH ?= $(shell uname -m)
+ARCH	?= $(shell echo $(SUBARCH) | sed	\
+                -e s/i.86/x86/			\
+                -e s/x86_64/x86/		\
+                -e s/sun4u/sparc64/		\
+                -e s/arm.*/arm/			\
+                -e s/sa110/arm/			\
+                -e s/s390x/s390/		\
+                -e s/parisc64/parisc/		\
+                -e s/ppc64.*/ppc64/		\
+                -e s/mips.*/mips/		\
+                -e s/sh[234].*/sh/		\
                 -e s/aarch64.*/arm64/)
 
 ifeq ($(ARCH),arm64)
@@ -19,7 +20,7 @@ ifeq ($(ARCH),arm64)
 endif
 
 ifeq ($(ARCH),arm)
-	ARMV := $(shell echo $(UNAME-M) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
+	ARMV := $(shell echo $(SUBARCH) | sed -nr 's/armv([[:digit:]]).*/\1/p; t; i7')
 
 	ifeq ($(ARMV),6)
 		USERCFLAGS += -march=armv6
-- 
2.24.0



More information about the CRIU mailing list