Re: [PATCH] Make m68k cross compile like every other architecture.

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Geert Uytterhoeven <geert@...>
Cc: Finn Thain <fthain@...>, Rob Landley <rob@...>, LKML <linux-kernel@...>, Linux/m68k <linux-m68k@...>
Date: Thursday, October 18, 2007 - 5:14 pm

> 

Here is my first try.
We only touch CROSS_COMPILE is empty and building for another arch.

I can obviously move crossgcc part of this to core kbuild.
Any better name?

	Sam


diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 4a1bd44..6465bbe 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -13,17 +13,26 @@
 # Copyright (C) 1994 by Hamish Macdonald
 #
 
-# test for cross compiling
-COMPILE_ARCH = $(shell uname -m)
+# usage:
+# CROSS_COMPILE := $(call crossgcc, foo bar /usr/bin/)
+# CROSS_COMPILE will be assinged the first prefix that point
+# to a gcc in the path
+crossgcc =  $(word 1, $(foreach c,$(1),                               \
+		$(shell set -e;                                       \
+		if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \
+			echo $(c);                                    \
+		fi)))
+
+ifneq ($(SUBARCH),$(ARCH))
+        ifeq ($(CROSS_COMPILE),)
+                CROSS_COMPILE := $(call crossgcc, m68k-linux-gnu-)
+        endif
+endif
 
 # override top level makefile
 AS += -m68020
 LDFLAGS := -m m68kelf
 LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
-ifneq ($(COMPILE_ARCH),$(ARCH))
-	# prefix for cross-compiling binaries
-	CROSS_COMPILE = m68k-linux-gnu-
-endif
 
 ifdef CONFIG_SUN3
 LDFLAGS_vmlinux = -N
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] Make m68k cross compile like every other archite..., Geert Uytterhoeven, (Thu Oct 11, 3:25 am)
Re: [PATCH] Make m68k cross compile like every other archite..., Geert Uytterhoeven, (Thu Oct 11, 8:46 am)
Re: [PATCH] Make m68k cross compile like every other archite..., Geert Uytterhoeven, (Thu Oct 11, 11:12 am)
Re: [PATCH] Make m68k cross compile like every other archite..., Geert Uytterhoeven, (Fri Oct 12, 2:51 am)
Re: [PATCH] Make m68k cross compile like every other archite..., Geert Uytterhoeven, (Fri Oct 12, 4:51 am)
Re: [PATCH] Make m68k cross compile like every other archite..., Geert Uytterhoeven, (Mon Oct 15, 4:25 pm)
Re: [PATCH] Make m68k cross compile like every other archite..., Sam Ravnborg, (Thu Oct 18, 5:14 pm)