coreboot-v2/util/xcompile/xcompile
<<
>>
Prefs
   1
   2for make in make gmake gnumake; do
   3        if [ "`$make --version 2>/dev/null | grep -c GNU`" -gt 0 ]; then
   4                MAKE=$make
   5                break
   6        fi
   7done
   8
   9GCCPREFIX=invalid
  10TMP=`mktemp /tmp/temp.XXXX`
  11echo "mov %eax, %eax" > ${TMP}.s
  12printf "\x7fELF" > ${TMP}.compare
  13for gccprefixes in `pwd`/util/crossgcc/xgcc/bin/i386-elf- i386-elf- ""; do
  14        if which ${gccprefixes}as 2>/dev/null >/dev/null; then
  15                printf ""
  16        else
  17                continue
  18        fi
  19        rm -f ${TMP}.o
  20        if ${gccprefixes}as --32 -o ${TMP}.o ${TMP}.s; then
  21                dd bs=4 count=1 if=${TMP}.o > ${TMP}.test 2>/dev/null
  22                if cmp ${TMP}.test ${TMP}.compare; then
  23                        GCCPREFIX=$gccprefixes
  24                        break
  25                fi
  26        fi
  27done
  28rm -f $TMP ${TMP}.s ${TMP}.o ${TMP}.compare ${TMP}.test
  29
  30if [ "$GCCPREFIX" = "invalid" ]; then
  31        echo '$(error no suitable gcc found)'
  32        exit 1
  33fi
  34
  35cat << afteroptions
  36AS:=${GCCPREFIX}as --32
  37CC:=${GCCPREFIX}gcc -m32
  38CPP:=${GCCPREFIX}cpp
  39AR:=${GCCPREFIX}ar
  40LD:=${GCCPREFIX}ld -b elf32-i386
  41STRIP:=${GCCPREFIX}strip
  42NM:=${GCCPREFIX}nm
  43OBJCOPY:=${GCCPREFIX}objcopy
  44OBJDUMP:=${GCCPREFIX}objdump
  45HOSTCC:=gcc
  46afteroptions
  47
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.