Skip to content

Commit 402928b

Browse files
committed
powerpc/Makefile: Auto detect cross compiler
If no cross compiler is specified, try to auto detect one. Look for various combinations, matching: powerpc(64(le)?)?(-unknown)?-linux(-gnu)?- There are more possibilities, but the above is known to find a compiler on Fedora and Ubuntu (which use linux-gnu-), and also detects the kernel.org cross compilers (which use linux-). This allows cross compiling with simply: # Ubuntu $ sudo apt install gcc-powerpc-linux-gnu # Fedora $ sudo dnf install gcc-powerpc64-linux-gnu $ make ARCH=powerpc defconfig $ make ARCH=powerpc -j 4 Inspired by arch/parisc/Makefile. Acked-by: Segher Boessenkool <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 22f17b0 commit 402928b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/powerpc/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@
1010
# Rewritten by Cort Dougan and Paul Mackerras
1111
#
1212

13+
ifdef cross_compiling
14+
ifeq ($(CROSS_COMPILE),)
15+
# Auto detect cross compiler prefix.
16+
# Look for: (powerpc(64(le)?)?)(-unknown)?-linux(-gnu)?-
17+
CC_ARCHES := powerpc powerpc64 powerpc64le
18+
CC_SUFFIXES := linux linux-gnu unknown-linux-gnu
19+
CROSS_COMPILE := $(call cc-cross-prefix, $(foreach a,$(CC_ARCHES), \
20+
$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
21+
endif
22+
endif
23+
1324
HAS_BIARCH := $(call cc-option-yn, -m32)
1425

1526
# Set default 32 bits cross compilers for vdso and boot wrapper

0 commit comments

Comments
 (0)