build/nmk: Provide proper SUBARCH

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>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
This commit is contained in:
Dmitry Safonov 2019-11-21 21:56:36 +00:00 committed by Andrei Vagin
parent a4fa4162d4
commit df66aa99b6

View file

@ -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