lkml.org 
[lkml]   [2007]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2007-10-18 23:15    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site