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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> 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?

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux