[03/10] build/nmk: Provide proper SUBARCH

Submitted by Dmitry Safonov on Nov. 21, 2019, 9:56 p.m.

Details

Message ID 20191121215643.275552-4-dima@arista.com
State Accepted
Series "build: Test and support armv7 cross"
Commit 20cf188e1a3976d73e881231b96a1ef4f523a490
Headers show

Commit Message

Dmitry Safonov Nov. 21, 2019, 9:56 p.m.
It's always equal ARCH and not very useful (so nothing actually uses it).
Time for a change: SUBARCH now is meaningful and gives a way to detect
what kind of ARCH flavor build is dealing with.

Also, for cross-compiling sake don't set SUBARCH if the user supplied it.
(and don't call useless uname during cross compilation)

Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 scripts/nmk/scripts/include.mk | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

Patch hide | download patch | download mbox

diff --git a/scripts/nmk/scripts/include.mk b/scripts/nmk/scripts/include.mk
index ee0e32f62b15..c1c1e94af425 100644
--- a/scripts/nmk/scripts/include.mk
+++ b/scripts/nmk/scripts/include.mk
@@ -8,21 +8,20 @@  endif
 
 #
 # Common vars.
-SUBARCH := $(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.*/aarch64/)
 
-ARCH		?= $(SUBARCH)
-
 export SUBARCH ARCH
 
 ifndef ____nmk_defined__tools