summaryrefslogtreecommitdiff
path: root/util/xcompile
diff options
context:
space:
mode:
authorPatrick Georgi <patrick.georgi@coresystems.de>2009-08-12 15:00:51 +0000
committerRonald G. Minnich <rminnich@gmail.com>2009-08-12 15:00:51 +0000
commit0588d19abef62dad63a7794a37bdd6a71c526d9e (patch)
tree1c507caa1ffed6ceb73d3e13fc9b766a713d16e2 /util/xcompile
parent38cd29ebd7282333650cf11ed50c7f2fd4031e80 (diff)
downloadcoreboot-0588d19abef62dad63a7794a37bdd6a71c526d9e.tar.xz
Kconfig!
Works on Kontron, qemu, and serengeti. Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> tested on abuild only. Acked-by: Ronald G. Minnich <rminnich@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4534 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/xcompile')
-rw-r--r--util/xcompile/xcompile45
1 files changed, 45 insertions, 0 deletions
diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile
new file mode 100644
index 0000000000..d3990cf8c8
--- /dev/null
+++ b/util/xcompile/xcompile
@@ -0,0 +1,45 @@
+
+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`
+echo "mov %eax, %eax" > ${TMP}.s
+printf "\x7fELF" > ${TMP}.compare
+for gccprefixes in `pwd`/../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
+ dd bs=4 count=1 if=${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
+AR:=${GCCPREFIX}ar
+LD:=${GCCPREFIX}ld -b elf32-i386
+STRIP:=${GCCPREFIX}strip
+NM:=${GCCPREFIX}nm
+OBJCOPY:=${GCCPREFIX}objcopy
+OBJDUMP:=${GCCPREFIX}objdump
+HOSTCC:=gcc
+afteroptions