diff options
author | Helge Deller <deller@gmx.de> | 2013-06-11 22:00:18 +0200 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2013-06-11 22:00:18 +0200 |
commit | 9dd14d2c6a1c293dece2c3ff6d5d99f864070e29 (patch) | |
tree | 88fe36673f6c3aa36a49dc6f0d332038e04cb95b | |
parent | 7687d7a83300bbe84c2eb092252153603faf9fa0 (diff) | |
download | palo-9dd14d2c6a1c293dece2c3ff6d5d99f864070e29.tar.gz |
Better detection of hppa-linux-gcc 32bit cross compiler (e.g. running on 64bit
kernel, but we want to produce a 32bit palo iplboot image).
-rw-r--r-- | ipl/Makefile | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/ipl/Makefile b/ipl/Makefile index 51b3a97..1565252 100644 --- a/ipl/Makefile +++ b/ipl/Makefile @@ -9,14 +9,27 @@ INCLUDES=bootloader.h common.h load.h ###############{ -MACHINE := $(subst 64,,$(shell uname -m)) +# cc-cross-prefix +# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-) +# Return first prefix where a prefix$(CC) is found in PATH. +# If no $(CC) found in PATH with listed prefixes return nothing +cc-cross-prefix = \ + $(word 1, $(foreach c,$(1), \ + $(shell set -e; \ + if (which $(strip $(c))gcc) > /dev/null 2>&1 ; then \ + echo $(c); \ + fi))) -ifneq (${MACHINE},parisc) # cross compilation -CC = hppa-linux-gcc -LD = hppa-linux-ld -AR = hppa-linux-ar -endif +CC_ARCHES = hppa hppa1.1 +CC_SUFFIXES = linux linux-gnu unknown-linux-gnu +CROSS_COMPILE := $(call cc-cross-prefix, \ + $(foreach a,$(CC_ARCHES), \ + $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) + +CC = ${CROSS_COMPILE}gcc +AR = ${CROSS_COMPILE}ar +LD = ld # Source sharing with palo VPATH=../lib:. |