summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2008-08-07 15:22:01 +0000
committerStefan Reinauer <stepan@openbios.org>2008-08-07 15:22:01 +0000
commitc359124ef465e714f1cd7c6ad31429071847b074 (patch)
treea5416300eb621932732d5a26b41dfe9b2e8bbf6e
parent695cff30e1e550f9492a365fe1109934a1a729e7 (diff)
downloadcoreboot-c359124ef465e714f1cd7c6ad31429071847b074.tar.xz
fix cross compilationor libpayload / coreinfo by honoring
the setting of CC in the payload (coreinfo) when calling make CC=i386-elf-gcc AS=i386-elf-as AR=i386-elf-ar STRIP=i386-elf-strip This still does not cope with the hardcoded -fno-stack-protector in libpayload's Makefile. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3477 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r--payloads/coreinfo/Makefile9
-rwxr-xr-xpayloads/libpayload/bin/lpgcc10
2 files changed, 12 insertions, 7 deletions
diff --git a/payloads/coreinfo/Makefile b/payloads/coreinfo/Makefile
index 403eb56e16..077aaa2276 100644
--- a/payloads/coreinfo/Makefile
+++ b/payloads/coreinfo/Makefile
@@ -45,8 +45,9 @@ HOSTCFLAGS := -I$(srck) -I$(objk)
HOSTCXXFLAGS := -I$(srck) -I$(objk)
LIBPAYLOAD_DIR := ../libpayload
-CC = $(LIBPAYLOAD_DIR)/bin/lpgcc
+XCC := CC=$(CC) $(LIBPAYLOAD_DIR)/bin/lpgcc
AS = $(LIBPAYLOAD_DIR)/bin/lpas
+STRIP ?= strip
INCLUDES = -Ibuild
CFLAGS := -Wall -Werror -Os $(INCLUDES)
@@ -68,9 +69,9 @@ all: prepare $(TARGET)
$(TARGET): $(src)/.config $(OBJS)
$(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n"
- $(Q)$(CC) -o $@ $(OBJS)
+ $(Q)$(XCC) -o $@ $(OBJS)
$(Q)printf " STRIP $(subst $(shell pwd)/,,$(@))\n"
- $(Q)strip -s $@
+ $(Q)$(STRIP) -s $@
$(obj)/%.S.o: $(src)/%.S
$(Q)printf " AS $(subst $(shell pwd)/,,$(@))\n"
@@ -78,7 +79,7 @@ $(obj)/%.S.o: $(src)/%.S
$(obj)/%.o: $(src)/%.c
$(Q)printf " CC $(subst $(shell pwd)/,,$(@))\n"
- $(Q)$(CC) $(CFLAGS) -c -o $@ $<
+ $(Q)$(XCC) $(CFLAGS) -c -o $@ $<
endif
diff --git a/payloads/libpayload/bin/lpgcc b/payloads/libpayload/bin/lpgcc
index bfd6c1b777..da8b481155 100755
--- a/payloads/libpayload/bin/lpgcc
+++ b/payloads/libpayload/bin/lpgcc
@@ -28,8 +28,11 @@
# GCC wrapper for libpayload
-DEFAULT_PREFIX=/opt
+if [ "$CC" != "" ]; then
+DEFAULT_CC=$CC
+else
DEFAULT_CC=gcc
+fi
BASE=`dirname $0`
@@ -37,9 +40,10 @@ BASE=`dirname $0`
. $BASE/lp.functions
trygccoption() {
- $DEFAULT_CC $1 -S -xc /dev/null -o .$$.tmp > /dev/null
+ $DEFAULT_CC $1 -S -xc /dev/null -o .$$.tmp &> /dev/null
+ RET=$?
rm -f .$$.tmp
- return $?
+ return $RET
}
DEBUGME=0