[PATCH] Calculate SUBARCH in common makefile

Antony Pavlov antonynpavlov at gmail.com
Tue Jul 26 03:16:00 EDT 2011


This patch make possible to use SUBARCH no only
in sandbox makefile.

E.g. this patch make possible CROSS_COMPILER variable
autoconstruction for mips architecture.

Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
---
 Makefile              |   12 ++++++++++++
 arch/sandbox/Makefile |    5 -----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 38dc3b0..ce1f72d 100644
--- a/Makefile
+++ b/Makefile
@@ -145,6 +145,18 @@ VPATH		:= $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
 
 export srctree objtree VPATH
 
+# SUBARCH tells the usermode build what the underlying arch is.  That is set
+# first, and if a usermode build is happening, the "ARCH=um" on the command
+# line overrides the setting of ARCH below.  If a native build is happening,
+# then ARCH is assigned, getting whatever value it gets normally, and
+# SUBARCH is subsequently ignored.
+
+SUBARCH := $(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/ )
+
 # Cross compiling and selecting different set of gcc/bin-utils
 # ---------------------------------------------------------------------------
 #
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index 4ca17ed..e7afda3 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -32,11 +32,6 @@ else
 CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
 endif
 
-SUBARCH := $(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/ )
-
 ifeq ($(SUBARCH),x86_64)
 ELF_ARCH   := i386:x86-64
 ELF_FORMAT := elf64-x86-64
-- 
1.7.5.4




More information about the barebox mailing list