[Skiboot] [PATCH v2] Makefile: Search for distro-provided cross-compiler

Thiago Jung Bauermann bauerman at linux.ibm.com
Sat Jan 25 10:01:02 AEDT 2020


Search for different variations of cross-compiler prefixes that might be in
the PATH, in this order of preference:

1. powerpc64-linux-gcc
2. powerpc64le-linux-gcc
3. powerpc64-linux-gnu-gcc
4. powerpc64le-linux-gnu-gcc

The latter two are available as distro packages in at least Debian, Fedora
and Ubuntu.

Tested with GNU Make 3.82 (CentOS 7) and GNU make 4.2.1 (Fedora 30).

Signed-off-by: Thiago Jung Bauermann <bauerman at linux.ibm.com>
---
 Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

Changes in v2:
- Also search for little-endian toolchains (suggested by Nick Piggin).
- Use "else if" statements to keep code clearer.

I didn't add Andrew Donnellan's Reviewed-by and Tested-by because the
patch changed somewhat from what he reviewed and tested.

diff --git a/Makefile b/Makefile
index f938a062e..8122e0cc2 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,15 @@ ifdef CROSS_COMPILE
 endif
 ifneq ("$(ARCH)", "ppc64")
 ifneq ("$(ARCH)", "ppc64le")
+ifneq ($(shell which powerpc64-linux-gcc 2> /dev/null),)
 	CROSS ?= powerpc64-linux-
+else ifneq ($(shell which powerpc64le-linux-gcc 2> /dev/null),)
+	CROSS ?= powerpc64le-linux-
+else ifneq ($(shell which powerpc64-linux-gnu-gcc 2> /dev/null),)
+	CROSS ?= powerpc64-linux-gnu-
+else ifneq ($(shell which powerpc64le-linux-gnu-gcc 2> /dev/null),)
+	CROSS ?= powerpc64le-linux-gnu-
+endif
 endif
 endif
 


More information about the Skiboot mailing list