public inbox for linux-parisc@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: linux-parisc@vger.kernel.org, Helge Deller <deller@gmx.de>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: John David Anglin <dave.anglin@bell.net>
Subject: [PATCH] parisc: make default cross compiler search more robust
Date: Thu,  9 May 2013 01:08:35 -0400	[thread overview]
Message-ID: <1368076115-22262-1-git-send-email-vapier@gentoo.org> (raw)

People/distros vary how they prefix the toolchain name for 64bit builds.
Rather than enforce one convention over another, add a for loop which
does a search for all the general prefixes.  This code will run for both
native and cross builds when CROSS_COMPILE isn't explicitly set.

For 64bit builds, we now search for (in order):
	hppa64-unknown-linux-gnu
	hppa64-linux-gnu
	hppa64-linux

For 32bit builds, we look for:
	hppa-unknown-linux-gnu
	hppa-linux-gnu
	hppa-linux
	hppa1.1-unknown-linux-gnu
	hppa1.1-linux-gnu
	hppa1.1-linux
	hppa2.0-unknown-linux-gnu
	hppa2.0-linux-gnu
	hppa2.0-linux

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 arch/parisc/Makefile | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 2f967cc..523ae34 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -23,9 +23,6 @@ NM		= sh $(srctree)/arch/parisc/nm
 CHECKFLAGS	+= -D__hppa__=1
 LIBGCC		= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
-MACHINE		:= $(shell uname -m)
-NATIVE		:= $(if $(filter parisc%,$(MACHINE)),1,0)
-
 ifdef CONFIG_64BIT
 UTS_MACHINE	:= parisc64
 CHECKFLAGS	+= -D__LP64__=1 -m64
@@ -35,12 +32,17 @@ WIDTH		:=
 endif
 
 # attempt to help out folks who are cross-compiling
-ifeq ($(NATIVE),1)
-CROSS_COMPILE	:= hppa$(WIDTH)-linux-
-else
- ifeq ($(CROSS_COMPILE),)
- CROSS_COMPILE	:= hppa$(WIDTH)-linux-gnu-
- endif
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := $(shell \
+	arches="hppa$(WIDTH)"; \
+	[ -z "$(WIDTH)" ] && arches="$$a hppa1.1 hppa2.0"; \
+	for a in $$arches; do \
+		for p in unknown-linux-gnu linux-gnu linux; do \
+			c="$$a-$$p-"; \
+			command -v $${c}gcc >/dev/null 2>&1 && echo $$c && break 2; \
+		done; \
+	done \
+)
 endif
 
 OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
-- 
1.8.2.1


             reply	other threads:[~2013-05-09  5:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-09  5:08 Mike Frysinger [this message]
2013-05-09 12:28 ` [PATCH] parisc: make default cross compiler search more robust Jeroen Roovers
2013-05-09 13:14   ` Helge Deller
2013-05-09 19:24     ` Mike Frysinger
  -- strict thread matches above, loose matches on Subject: below --
2013-05-16 19:32 Helge Deller
2013-05-17 18:25 ` Greg KH
2013-05-17 20:06   ` Helge Deller

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=1368076115-22262-1-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=dave.anglin@bell.net \
    --cc=deller@gmx.de \
    --cc=jejb@parisc-linux.org \
    --cc=linux-parisc@vger.kernel.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