Skip to contentSkip to conversation

push CROSS_COMPILE out to $(ARCH)_config.mk

PATCH New Mike Frysinger 2 participants 3 messages Jun 15, 2009 – Jul 19, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 push CROSS_COMPILE out to $(ARCH)_config.mk

Each arch should handle setting a proper default CROSS_COMPILE value in their own config.mk file rather than having to maintain a large ugly list in the Makefile. By using conditional assignment, we don't have to worry about the variable already being set (env/cmdline/etc...).

The common config.mk file takes care of exporting CROSS_COMPILE already, and while a few variables (toolchain ones) utilize CROSS_COMPILE before including the arch config.mk, they do so with deferred assignment.

---
 Makefile             |   44 ++------------------------------------------
 arm_config.mk        |    2 ++
 avr32_config.mk      |    2 ++
 blackfin_config.mk   |    2 ++
 i386_config.mk       |    2 ++
 m68k_config.mk       |    2 ++
 microblaze_config.mk |    2 ++
 mips_config.mk       |    2 ++
 nios2_config.mk      |    2 ++
 nios_config.mk       |    2 ++
 ppc_config.mk        |    2 ++
 sh_config.mk         |    2 ++
 sparc_config.mk      |    2 ++
 13 files changed, 26 insertions(+), 42 deletions(-)
Makefile +2 -42
index acec1a0..4d058b1 100644
@@ -151,50 +151,10 @@ ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))
 include $(obj)include/config.mk
 export	ARCH CPU BOARD VENDOR SOC
 
-ifndef CROSS_COMPILE
+# set default to nothing for native builds
 ifeq ($(HOSTARCH),$(ARCH))
-CROSS_COMPILE =
-else
-ifeq ($(ARCH),ppc)
-CROSS_COMPILE = ppc_8xx-
-endif
-ifeq ($(ARCH),arm)
-CROSS_COMPILE = arm-linux-
-endif
-ifeq ($(ARCH),i386)
-CROSS_COMPILE = i386-linux-
-endif
-ifeq ($(ARCH),mips)
-CROSS_COMPILE = mips_4KC-
-endif
-ifeq ($(ARCH),nios)
-CROSS_COMPILE = nios-elf-
-endif
-ifeq ($(ARCH),nios2)
-CROSS_COMPILE = nios2-elf-
-endif
-ifeq ($(ARCH),m68k)
-CROSS_COMPILE = m68k-elf-
+CROSS_COMPILE ?=
 endif
-ifeq ($(ARCH),microblaze)
-CROSS_COMPILE = mb-
-endif
-ifeq ($(ARCH),blackfin)
-CROSS_COMPILE = bfin-uclinux-
-endif
-ifeq ($(ARCH),avr32)
-CROSS_COMPILE = avr32-linux-
-endif
-ifeq ($(ARCH),sh)
-CROSS_COMPILE = sh4-linux-
-endif
-ifeq ($(ARCH),sparc)
-CROSS_COMPILE = sparc-elf-
-endif	# sparc
-endif	# HOSTARCH,ARCH
-endif	# CROSS_COMPILE
-
-export	CROSS_COMPILE
 
 # load other configuration
 include $(TOPDIR)/config.mk
arm_config.mk +2 -0
index c4cf99d..a13603e 100644
@@ -21,6 +21,8 @@
 # MA 02111-1307 USA
 #
 
+CROSS_COMPILE ?= arm-linux-
+
 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
 
 LDSCRIPT := $(SRCTREE)/cpu/$(CPU)/u-boot.lds
avr32_config.mk +2 -0
index 441caa4..c258b4b 100644
@@ -21,5 +21,7 @@
 # MA 02111-1307 USA
 #
 
+CROSS_COMPILE ?= avr32-linux-
+
 PLATFORM_RELFLAGS	+= -ffixed-r5 -fPIC -mno-init-got -mrelax
 PLATFORM_LDFLAGS	+= --relax
blackfin_config.mk +2 -0
index 989e976..9357e20 100644
@@ -21,6 +21,8 @@
 # MA 02111-1307 USA
 #
 
+CROSS_COMPILE ?= bfin-uclinux-
+
 CONFIG_BFIN_CPU := $(strip $(subst ",,$(CONFIG_BFIN_CPU)))
 CONFIG_BFIN_BOOT_MODE := $(strip $(subst ",,$(CONFIG_BFIN_BOOT_MODE)))
 CONFIG_ENV_OFFSET := $(strip $(subst ",,$(CONFIG_ENV_OFFSET)))
i386_config.mk +2 -0
index 9e6d37d..5fe36d5 100644
@@ -21,4 +21,6 @@
 # MA 02111-1307 USA
 #
 
+CROSS_COMPILE ?= i386-linux-
+
 PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__
m68k_config.mk +2 -0
index 12bd27c..f41d1b3 100644
@@ -21,5 +21,7 @@
 # MA 02111-1307 USA
 #
 
+CROSS_COMPILE ?= m68k-elf-
+
 PLATFORM_CPPFLAGS += -DCONFIG_M68K -D__M68K__
 PLATFORM_LDFLAGS  += -n
microblaze_config.mk +2 -0
index e44c79e..68e7e21 100644
@@ -24,4 +24,6 @@
 # MA 02111-1307 USA
 #
 
+CROSS_COMPILE ?= mb-
+
 PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
mips_config.mk +2 -0
index 05eb05d..c785677 100644
@@ -21,6 +21,8 @@
 # MA 02111-1307 USA
 #
 
+CROSS_COMPILE ?= mips_4KC-
+
 PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 
 #
nios2_config.mk +2 -0
index 3f23b56..59931c2 100644
@@ -22,5 +22,7 @@
 # MA 02111-1307 USA
 #
 
+CROSS_COMPILE ?= nios2-elf-
+
 PLATFORM_CPPFLAGS += -DCONFIG_NIOS2 -D__NIOS2__
 PLATFORM_CPPFLAGS += -ffixed-r15 -G0
nios_config.mk +2 -0
index 1cf0f32..3ed7170 100644
@@ -22,4 +22,6 @@
 # MA 02111-1307 USA
 #
 
+CROSS_COMPILE ?= nios-elf-
+
 PLATFORM_CPPFLAGS += -m32 -DCONFIG_NIOS -D__NIOS__ -ffixed-g7 -gstabs
ppc_config.mk +2 -0
index c95b3b1..d91ef7f 100644
@@ -21,6 +21,8 @@
 # MA 02111-1307 USA
 #
 
+CROSS_COMPILE ?= ppc_8xx-
+
 PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__
 PLATFORM_LDFLAGS  += -n
 
sh_config.mk +2 -0
index 49d50f7..306cb59 100644
@@ -21,4 +21,6 @@
 # MA 02111-1307 USA
 #
 
+CROSS_COMPILE ?= sh4-linux-
+
 PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
sparc_config.mk +2 -0
index 87f745f..07b528c 100644
@@ -21,4 +21,6 @@
 # MA 02111-1307 USA
 #
 
+CROSS_COMPILE ?= sparc-elf-
+
 PLATFORM_CPPFLAGS += -DCONFIG_SPARC -D__sparc__
Signature · 1 line
1.6.3.1
#1 lore raw

PATCH 1/1 push CROSS_COMPILE out to $(ARCH)_config.mk

Quoted 8 lines · On Sunday 14 June 2009 23:33:14 Mike Frysinger wrote:

Each arch should handle setting a proper default CROSS_COMPILE value in their own config.mk file rather than having to maintain a large ugly list in the Makefile. By using conditional assignment, we don't have to worry about the variable already being set (env/cmdline/etc...).

The common config.mk file takes care of exporting CROSS_COMPILE already, and while a few variables (toolchain ones) utilize CROSS_COMPILE before including the arch config.mk, they do so with deferred assignment.

with people looking at moving these files/etc..., can this be merged sooner rather than later ? i just dont want to induce unnecessary conflicts. -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090709/13de2c9a/attachment.pgp

#2 lore raw

PATCH 1/1 push CROSS_COMPILE out to $(ARCH)_config.mk

In reply to Mike Frysinger

Dear Mike Frysinger,

Quoted 10 lines · In message <[email protected]> you wrote:

Each arch should handle setting a proper default CROSS_COMPILE value in their own config.mk file rather than having to maintain a large ugly list in the Makefile. By using conditional assignment, we don't have to worry about the variable already being set (env/cmdline/etc...).

The common config.mk file takes care of exporting CROSS_COMPILE already, and while a few variables (toolchain ones) utilize CROSS_COMPILE before including the arch config.mk, they do so with deferred assignment.

Quoted 15 lines
---
 Makefile             |   44 ++------------------------------------------
 arm_config.mk        |    2 ++
 avr32_config.mk      |    2 ++
 blackfin_config.mk   |    2 ++
 i386_config.mk       |    2 ++
 m68k_config.mk       |    2 ++
 microblaze_config.mk |    2 ++
 mips_config.mk       |    2 ++
 nios2_config.mk      |    2 ++
 nios_config.mk       |    2 ++
 ppc_config.mk        |    2 ++
 sh_config.mk         |    2 ++
 sparc_config.mk      |    2 ++
 13 files changed, 26 insertions(+), 42 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I read part of it all the way through.