diff mbox

[U-Boot,RFC,17/17] kconfig: add CONFIG_CROSS_COMPILE

Message ID 1395046392-1212-18-git-send-email-yamada.m@jp.panasonic.com
State RFC
Delegated to: Tom Rini
Headers show

Commit Message

Masahiro Yamada March 17, 2014, 8:53 a.m. UTC
Copy from Linux Kernel (with a few adjustments in comments).

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 Kconfig  |  9 +++++++++
 Makefile | 20 ++++++++++++++------
 2 files changed, 23 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/Kconfig b/Kconfig
index 4e383d2..1bf488e 100644
--- a/Kconfig
+++ b/Kconfig
@@ -41,6 +41,15 @@  config TPL
 	prompt "Build TPL image" if !SPL_BUILD
 	default y if TPL_BUILD
 
+config CROSS_COMPILE
+	string "Cross-compiler tool prefix"
+	depends on !SPL_BUILD
+	help
+	  Same as running 'make CROSS_COMPILE=prefix-' but stored for
+	  default make runs in this U-Boot build directory.  You don't
+	  need to set this unless you want the configured U-Boot build
+	  directory to select the cross-compiler automatically.
+
 endmenu		# General setup
 
 source "arch/Kconfig"
diff --git a/Makefile b/Makefile
index 8953922..440defd 100644
--- a/Makefile
+++ b/Makefile
@@ -188,12 +188,20 @@  HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
 
 export	HOSTARCH HOSTOS
 
-#########################################################################
-
-# set default to nothing for native builds
-ifeq ($(HOSTARCH),$(ARCH))
-CROSS_COMPILE ?=
-endif
+# Cross compiling and selecting different set of gcc/bin-utils
+# ---------------------------------------------------------------------------
+#
+# CROSS_COMPILE specify the prefix used for all executables used
+# during compilation. Only gcc and related bin-utils executables
+# are prefixed with $(CROSS_COMPILE).
+# CROSS_COMPILE can be set on the command line
+# make CROSS_COMPILE=ia64-linux-
+# Alternatively CROSS_COMPILE can be set in the environment.
+# A third alternative is to store a setting in .config so that plain
+# "make" in the configured kernel build directory always uses that.
+# Default value for CROSS_COMPILE is not to prefix executables
+# Note: Some architectures assign CROSS_COMPILE in their arch/*/config.mk
+CROSS_COMPILE	?= $(CONFIG_CROSS_COMPILE:"%"=%)
 
 KCONFIG_CONFIG	?= .config
 export KCONFIG_CONFIG