[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071018211420.GA23397@uranus.ravnborg.org>
Date: Thu, 18 Oct 2007 23:14:20 +0200
From: Sam Ravnborg <sam@...nborg.org>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Finn Thain <fthain@...egraphics.com.au>,
Rob Landley <rob@...dley.net>,
LKML <linux-kernel@...r.kernel.org>,
Linux/m68k <linux-m68k@...r.kernel.org>
Subject: Re: [PATCH] Make m68k cross compile like every other architecture.
>
> 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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists