[PATCH] parisc: make default cross compiler search more robust

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

 



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@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux