Allow XGCCPATH to be set on the make command line.
[coreboot.git] / util / xcompile / xcompile
index 19103c7ade61b06d168380ad9452c2d4842ecf1d..9a0a295c75d86e2a91b9bf09978e5db1bce23aa8 100644 (file)
@@ -35,13 +35,15 @@ for make in make gmake gnumake; do
 done
 
 GCCPREFIX=invalid
+XGCCPATH=${1:-"`pwd`/util/crossgcc/xgcc/bin/"}
+echo '#XGCCPATH='${XGCCPATH}
 TMPFILE=`mktemp /tmp/temp.XXXX 2>/dev/null || echo /tmp/temp.78gOIUGz`
 touch $TMPFILE
 
 # This should be a loop over all supported architectures
 TARCH=i386
 TWIDTH=32
-for gccprefixes in `pwd`/util/crossgcc/xgcc/bin/${TARCH}-elf- ${TARCH}-elf- ""; do
+for gccprefixes in ${XGCCPATH}${TARCH}-elf- ${TARCH}-elf- ""; do
        if ! which ${gccprefixes}as 2>/dev/null >/dev/null; then
                continue
        fi
@@ -78,6 +80,10 @@ CC="${GCCPREFIX}gcc"
 testcc "$CC" "$CFLAGS-Wa,--divide " && CFLAGS="$CFLAGS-Wa,--divide "
 testcc "$CC" "$CFLAGS-fno-stack-protector " && CFLAGS="$CFLAGS-fno-stack-protector "
 testcc "$CC" "$CFLAGS-Wl,--build-id=none " && CFLAGS="$CFLAGS-Wl,--build-id=none "
+# GCC 4.6 is much more picky about unused variables. Turn off it's warnings for
+# now:
+testcc "$CC" "$CFLAGS-Wno-unused-but-set-variable " && \
+              CFLAGS="$CFLAGS-Wno-unused-but-set-variable "
 
 if which gcc 2>/dev/null >/dev/null; then
        HOSTCC=gcc
@@ -85,6 +91,12 @@ else
        HOSTCC=cc
 fi
 
+if [ "`${XGCCPATH}/iasl 2>/dev/null | grep -c ACPI`" -gt 0 ]; then
+       IASL=${XGCCPATH}iasl
+else
+       IASL=iasl
+fi
+
 cat << EOF
 # elf${TWIDTH}-${TARCH} toolchain
 AS:=${GCCPREFIX}as ${ASFLAGS}
@@ -96,6 +108,8 @@ NM:=${GCCPREFIX}nm
 OBJCOPY:=${GCCPREFIX}objcopy
 OBJDUMP:=${GCCPREFIX}objdump
 
+IASL:=${IASL}
+
 # native toolchain
 HOSTCC:=${HOSTCC}
 EOF