aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 26 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 9c1b49611..78c701ec0 100644
--- a/Makefile
+++ b/Makefile
@@ -142,17 +142,6 @@ VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
142export srctree objtree VPATH TOPDIR 142export srctree objtree VPATH TOPDIR
143 143
144 144
145# SUBARCH tells the usermode build what the underlying arch is. That is set
146# first, and if a usermode build is happening, the "ARCH=um" on the command
147# line overrides the setting of ARCH below. If a native build is happening,
148# then ARCH is assigned, getting whatever value it gets normally, and
149# SUBARCH is subsequently ignored.
150
151SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
152 -e s/arm.*/arm/ -e s/sa110/arm/ \
153 -e s/s390x/s390/ -e s/parisc64/parisc/ \
154 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
155
156# Cross compiling and selecting different set of gcc/bin-utils 145# Cross compiling and selecting different set of gcc/bin-utils
157# --------------------------------------------------------------------------- 146# ---------------------------------------------------------------------------
158# 147#
@@ -172,8 +161,33 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
172# Default value for CROSS_COMPILE is not to prefix executables 161# Default value for CROSS_COMPILE is not to prefix executables
173# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile 162# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
174 163
175ARCH ?= $(SUBARCH)
176CROSS_COMPILE ?= 164CROSS_COMPILE ?=
165# bbox: we may have CONFIG_CROSS_COMPILER_PREFIX in .config,
166# and it has not been included yet... thus using an awkward syntax.
167ifeq ($(CROSS_COMPILE),)
168CROSS_COMPILE := $(shell grep ^CONFIG_CROSS_COMPILER_PREFIX .config 2>/dev/null)
169CROSS_COMPILE := $(subst CONFIG_CROSS_COMPILER_PREFIX=,,$(CROSS_COMPILE))
170CROSS_COMPILE := $(subst ",,$(CROSS_COMPILE))
171endif
172
173# SUBARCH tells the usermode build what the underlying arch is. That is set
174# first, and if a usermode build is happening, the "ARCH=um" on the command
175# line overrides the setting of ARCH below. If a native build is happening,
176# then ARCH is assigned, getting whatever value it gets normally, and
177# SUBARCH is subsequently ignored.
178
179ifneq ($(CROSS_COMPILE),)
180SUBARCH := $(shell echo $(CROSS_COMPILE) | cut -d- -f1)
181else
182SUBARCH := $(shell uname -m)
183endif
184SUBARCH := $(shell echo $(SUBARCH) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
185 -e s/arm.*/arm/ -e s/sa110/arm/ \
186 -e s/s390x/s390/ -e s/parisc64/parisc/ \
187 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
188
189ARCH ?= $(SUBARCH)
190$(warning ARCH=$(ARCH) SUBARCH=$(SUBARCH))
177 191
178# Architecture as present in compile.h 192# Architecture as present in compile.h
179UTS_MACHINE := $(ARCH) 193UTS_MACHINE := $(ARCH)