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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Geert Uytterhoeven
Date: Monday, October 15, 2007 - 1:25 pm

On Fri, 12 Oct 2007, Sam Ravnborg wrote:

64-bit parisc tests if /usr/bin/hppa64-linux-gnu- exists.
If yes, it sets CROSS_COMPILE to hppa64-linux-gnu-.
If no, it sets CROSS_COMPILE to hppa64-linux-

32-bit parisc unconditionally sets CROSS_COMPILE to hppa-linux-.

This still breaks Rob's setup if his compiler is called differently.

Anyway, here's a try to make it autodetect m68k-linux-gnu-gcc and
m68k-linux-gcc. Perhaps it can be generalized in kbuild, to allow
arch/*/Makefile to set a list of possible cross-compiler prefixes?

Subject: m68k: Improve cross-compiler autodetection

m68k: Improve cross-compiler autodetection

Set CROSS_COMPILE to m68k-linux-gnu- resp. m68k-linux-, but only if such a
cross compiler is found in your $PATH

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/Makefile |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -22,7 +22,17 @@ 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-
+	m68k-linux-gnu-gcc := $(shell if [ `which m68k-linux-gnu-gcc` ]; then \
+		echo y; fi)
+	ifeq ($(m68k-linux-gnu-gcc),y)
+		CROSS_COMPILE := m68k-linux-gnu-
+	else
+		m68k-linux-gcc := $(shell if [ `which m68k-linux-gcc` ]; then \
+			echo y; fi)
+		ifeq ($(m68k-linux-gcc),y)
+			CROSS_COMPILE := m68k-linux-
+		endif
+	endif
 endif
 
 ifdef CONFIG_SUN3

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] Make m68k cross compile like every other archi ..., Geert Uytterhoeven, (Thu Oct 11, 12:25 am)
Re: [PATCH] Make m68k cross compile like every other archi ..., Geert Uytterhoeven, (Thu Oct 11, 5:46 am)
Re: [PATCH] Make m68k cross compile like every other archi ..., Geert Uytterhoeven, (Thu Oct 11, 8:12 am)
Re: [PATCH] Make m68k cross compile like every other archi ..., Geert Uytterhoeven, (Thu Oct 11, 11:51 pm)
Re: [PATCH] Make m68k cross compile like every other archi ..., Geert Uytterhoeven, (Fri Oct 12, 1:51 am)
Re: [PATCH] Make m68k cross compile like every other archi ..., Geert Uytterhoeven, (Mon Oct 15, 1:25 pm)