提交 23243c1a 编写于 作者: M Masahiro Yamada

arch: use cross_compiling to check whether it is a cross build or not

'cross_compiling' is defined by the top Makefile and available for
arch Makefiles to check whether it is a cross build or not. A good
thing is the variable name 'cross_compiling' is self-documenting.

This is a simple replacement for m68k, mips, sh, for which $(ARCH)
and $(SRCARCH) always match.

No functional change is intended for xtensa, either.

This is rather a fix for parisc because arch/parisc/Makefile defines
UTS_MATCHINE depending on CONFIG_64BIT, therefore cc-cross-prefix
is not working in Kconfig time.
Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Helge Deller <deller@gmx.de>  # parisc
Acked-by: Max Filippov <jcmvbkbc@gmail.com> # xtensa
上级 45799491
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
KBUILD_DEFCONFIG := multi_defconfig KBUILD_DEFCONFIG := multi_defconfig
ifneq ($(SUBARCH),$(ARCH)) ifdef cross_compiling
ifeq ($(CROSS_COMPILE),) ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(call cc-cross-prefix, \ CROSS_COMPILE := $(call cc-cross-prefix, \
m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-) m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
......
...@@ -50,7 +50,7 @@ tool-archpref = $(64bit-tool-archpref) ...@@ -50,7 +50,7 @@ tool-archpref = $(64bit-tool-archpref)
UTS_MACHINE := mips64 UTS_MACHINE := mips64
endif endif
ifneq ($(SUBARCH),$(ARCH)) ifdef cross_compiling
ifeq ($(CROSS_COMPILE),) ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux- $(tool-archpref)-linux-gnu- $(tool-archpref)-unknown-linux-gnu-) CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux- $(tool-archpref)-linux-gnu- $(tool-archpref)-unknown-linux-gnu-)
endif endif
......
...@@ -41,7 +41,7 @@ endif ...@@ -41,7 +41,7 @@ endif
export LD_BFD export LD_BFD
ifneq ($(SUBARCH),$(UTS_MACHINE)) ifdef cross_compiling
ifeq ($(CROSS_COMPILE),) ifeq ($(CROSS_COMPILE),)
CC_SUFFIXES = linux linux-gnu unknown-linux-gnu CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
CROSS_COMPILE := $(call cc-cross-prefix, \ CROSS_COMPILE := $(call cc-cross-prefix, \
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# License. See the file "COPYING" in the main directory of this archive # License. See the file "COPYING" in the main directory of this archive
# for more details. # for more details.
# #
ifneq ($(SUBARCH),$(ARCH)) ifdef cross_compiling
ifeq ($(CROSS_COMPILE),) ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(call cc-cross-prefix, sh-linux- sh-linux-gnu- sh-unknown-linux-gnu-) CROSS_COMPILE := $(call cc-cross-prefix, sh-linux- sh-linux-gnu- sh-unknown-linux-gnu-)
endif endif
......
...@@ -19,12 +19,8 @@ variant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME)) ...@@ -19,12 +19,8 @@ variant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME))
VARIANT = $(variant-y) VARIANT = $(variant-y)
export VARIANT export VARIANT
# Test for cross compiling
ifneq ($(VARIANT),) ifneq ($(VARIANT),)
COMPILE_ARCH = $(shell uname -m) ifdef cross_compiling
ifneq ($(COMPILE_ARCH), xtensa)
ifndef CROSS_COMPILE ifndef CROSS_COMPILE
CROSS_COMPILE = xtensa_$(VARIANT)- CROSS_COMPILE = xtensa_$(VARIANT)-
endif endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册