mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Finn Thain <fthain@telegraphics.com.au>,
	Rob Landley <rob@landley.net>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux/m68k <linux-m68k@vger.kernel.org>
Subject: Re: [PATCH] Make m68k cross compile like every other architecture.
Date: Mon, 15 Oct 2007 22:25:35 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0710152217150.16889@anakin> (raw)
In-Reply-To: <20071012102124.GA18959@uranus.ravnborg.org>

On Fri, 12 Oct 2007, Sam Ravnborg wrote:
> On Fri, Oct 12, 2007 at 10:51:00AM +0200, Geert Uytterhoeven wrote:
> > On Fri, 12 Oct 2007, Finn Thain wrote:
> > > > If your cross-compiler is called differently than the default on in 
> > > > arch/*/Makefile,
> > > 
> > > Part of the problem is that there is no compelling default. The name of 
> > > the cross-compiler can vary depending on the chosen executable prefix or 
> > > the chosen target tuple.
> > > 
> > > Let's say I create new cross toolchains for both m68k and powerpc. I use 
> > > the "m68k-linux-gnu" to follow the m68k default, but let's assume powerpc 
> > > users prefer their default "powerpc-linux" so I follow that too. The 
> > > result is that I now have gcc's -B option working (or not working) in 
> > > suprising ways too.
> > > 
> > > Uniformity is more helpful downstream than a different arbitrary default 
> > > for each architecture. Debian should patch their default into their kernel 
> > > source packages if they've standardised on cross compiler prefixes.
> > > 
> > > > what's the problem with calling?
> > > > 
> > > >     make ARCH=myarch CROSS_COMPILE=my-cross-compile-prefx-
> > > > 
> > > > This has been working for +10 years on all non-ia32 platforms I ever worked on.
> > > 
> > > But there is no problem with calling that (?). Rob's patch doesn't change 
> > > this.
> > 
> > But it makes life harder for the people who use it daily.
> > 
> > If the consensus is to not provide default cross compiler prefixes in
> > arch/*/Makefile, fine for me, but IFF it's done for all architectures
> > (i.e. check with the blackfin, h8300, mips, parisc, and xtensa people
> > first).
> 
> Test if the expected gcc is available and set CROSS_COMPILE
> if it is present. Otherwise do not touch CROSS_COMPILE.
> 
> m68kgcc := $(shell "test if m68k-gcc is present and echo 'y' if so")
> ifeq ($(m68kgcc,y)
>         CROSS_COMPILE := m68k-foo
> endif
> 
> Then everyone is happy.
> parisc does something similar.

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

  reply	other threads:[~2007-10-15 20:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-10 22:22 Rob Landley
2007-10-11  7:25 ` Geert Uytterhoeven
2007-10-11 11:31   ` Rob Landley
2007-10-11 11:39   ` Sam Ravnborg
2007-10-11 12:46     ` Geert Uytterhoeven
2007-10-11 13:27       ` Rob Landley
2007-10-11 13:52         ` Paul Mundt
2007-10-11 15:12         ` Geert Uytterhoeven
2007-10-11 16:26           ` Finn Thain
2007-10-11 21:14             ` Rob Landley
2007-10-12  6:51               ` Geert Uytterhoeven
2007-10-12  7:54                 ` Finn Thain
2007-10-12  8:51                   ` Geert Uytterhoeven
2007-10-12 10:21                     ` Sam Ravnborg
2007-10-15 20:25                       ` Geert Uytterhoeven [this message]
2007-10-16  0:31                         ` Rob Landley
2007-10-16  4:15                           ` Sam Ravnborg
2007-10-18 21:14                         ` Sam Ravnborg
2007-10-19  6:38                           ` Rob Landley
2007-10-19 15:10                             ` Sam Ravnborg
2007-10-11 16:24       ` Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0710152217150.16889@anakin \
    --to=geert@linux-m68k.org \
    --cc=fthain@telegraphics.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=rob@landley.net \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®