xcompile: slightly refactor variable expansion magic

Change-Id: Iebe071c863c6c7139128a2ec59acfb9da0f83512
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/5741
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Patrick Georgi 2014-05-14 14:23:28 +02:00
parent aab1740881
commit d387c63576
1 changed files with 25 additions and 21 deletions

View File

@ -142,34 +142,38 @@ trap clean_up EXIT
# Architecture definition # Architecture definition
SUPPORTED_ARCHITECTURE="x86 armv7 aarch64" SUPPORTED_ARCHITECTURE="x86 armv7 aarch64"
# ARM Architecture arch_config_armv7() {
TARCH_armv7="armv7" TARCH="armv7"
TBFDARCH_armv7="littlearm" TBFDARCH="littlearm"
TCLIST_armv7="armv7a armv7-a" TCLIST="armv7a armv7-a"
TWIDTH_armv7="32" TWIDTH="32"
}
# AARCH64 -- armv8 arch_config_aarch64() {
TARCH_aarch64="aarch64" TARCH="aarch64"
TBFDARCH_aarch64="littleaarch64" TBFDARCH="littleaarch64"
TCLIST_aarch64="aarch64" TCLIST="aarch64"
TWIDTH_aarch64="64" TWIDTH="64"
}
arch_config_x86() {
TARCH="i386"
TBFDARCH="i386"
TCLIST="i386 x86_64"
TWIDTH="32"
}
# X86 Architecture
TARCH_x86="i386"
TBFDARCH_x86="i386"
TCLIST_x86="i386 x86_64"
TWIDTH_x86="32"
XGCCPATH=${1:-"`pwd`/util/crossgcc/xgcc/bin/"} XGCCPATH=${1:-"`pwd`/util/crossgcc/xgcc/bin/"}
# This loops over all supported architectures. # This loops over all supported architectures.
for architecture in $SUPPORTED_ARCHITECTURE; do for architecture in $SUPPORTED_ARCHITECTURE; do
GCCPREFIX="invalid" GCCPREFIX="invalid"
TARCH="$(eval echo \$TARCH_$architecture)" if type arch_config_$architecture > /dev/null; then
TBFDARCH="$(eval echo \$TBFDARCH_$architecture)" arch_config_$architecture
TCLIST="$(eval echo \$TCLIST_$architecture)" else
TWIDTH="$(eval echo \$TWIDTH_$architecture)" echo "no architecture definition for $architecture"
[ -z "$TARCH" -o -z "$TCLIST" -o -z "$TWIDTH" ] && exit 1
die "Missing architecture definition for $architecture." fi
# To override toolchain, define CROSS_COMPILE_$arch or CROSS_COMPILE as # To override toolchain, define CROSS_COMPILE_$arch or CROSS_COMPILE as
# environment variable. # environment variable.