fix cross compilationor libpayload / coreinfo by honoring
authorStefan Reinauer <stepan@coresystems.de>
Thu, 7 Aug 2008 15:22:01 +0000 (15:22 +0000)
committerStefan Reinauer <stepan@openbios.org>
Thu, 7 Aug 2008 15:22:01 +0000 (15:22 +0000)
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

payloads/coreinfo/Makefile
payloads/libpayload/bin/lpgcc

index 403eb56e16e3e01944259765ee73dc7ea677ed89..077aaa22762da64160badf0c2a81ed4ea8a7e7a7 100644 (file)
@@ -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
 
index bfd6c1b77744742f7936a522f497cfcec38dba05..da8b48115532a15c93fea2d8e1a7cb494599abfe 100755 (executable)
 
 # 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