coreboot-kgpe-d16/util/xcompile/xcompile
Patrick Georgi 26774f2b72 Make the kconfig-style build work in mingw:
* use relative paths in ldscript.ld and crt0_includes.h
* avoid use of dd(1) in xcompile
* build libregex for kconfig, if necessary
* work around missing utsname on win32
* unlink targets before rename on win32
* implement (crude) mkstemp for win32
* avoid open/read/close, use fopen/fread/fclose instead
* don't free certain data structures in romcc on win32 to
  avoid crashes (likely use-after-free())
* handle "\CRLF" and win32 style absolute paths (X:/ or X:\)
  in romcc
* make lzma (part of cbfstool) build on XP
* implement ntohl/htonl on win32
* handle CRLF in awk script
* set larger stack for romcc on win32

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4952 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
2009-11-21 19:54:02 +00:00

46 lines
1 KiB
Text

for make in make gmake gnumake; do
if [ "`$make --version 2>/dev/null | grep -c GNU`" -gt 0 ]; then
MAKE=$make
break
fi
done
GCCPREFIX=invalid
TMP=`mktemp /tmp/temp.XXXX 2>/dev/null || echo /tmp/temp.78gOIUGz`
echo "mov %eax, %eax" > ${TMP}.s
printf "\x7fELF\n" > ${TMP}.compare
for gccprefixes in `pwd`/util/crossgcc/xgcc/bin/i386-elf- i386-elf- ""; do
if which ${gccprefixes}as 2>/dev/null >/dev/null; then
printf ""
else
continue
fi
rm -f ${TMP}.o
if ${gccprefixes}as --32 -o ${TMP}.o ${TMP}.s; then
cut -c-4 ${TMP}.o > ${TMP}.test 2>/dev/null
if cmp ${TMP}.test ${TMP}.compare; then
GCCPREFIX=$gccprefixes
break
fi
fi
done
rm -f $TMP ${TMP}.s ${TMP}.o ${TMP}.compare ${TMP}.test
if [ "$GCCPREFIX" = "invalid" ]; then
echo '$(error no suitable gcc found)'
exit 1
fi
cat << afteroptions
AS:=${GCCPREFIX}as --32
CC:=${GCCPREFIX}gcc -m32
CPP:=${GCCPREFIX}cpp
AR:=${GCCPREFIX}ar
LD:=${GCCPREFIX}ld -b elf32-i386
STRIP:=${GCCPREFIX}strip
NM:=${GCCPREFIX}nm
OBJCOPY:=${GCCPREFIX}objcopy
OBJDUMP:=${GCCPREFIX}objdump
HOSTCC:=gcc
afteroptions