diff options
author | Patrick Georgi <patrick@georgi-clan.de> | 2014-05-14 14:23:28 +0200 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2014-05-15 10:07:01 +0200 |
commit | d387c63576098f63d18e11a45faf0fe5d1f57dee (patch) | |
tree | dacc1be7699a1d086b60df10016ce9fe56313e42 /util/xcompile | |
parent | aab174088199d7012b32e21753d75014d9c2aef5 (diff) |
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>
Diffstat (limited to 'util/xcompile')
-rw-r--r-- | util/xcompile/xcompile | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile index 160b73bf23..2ac82b62dd 100644 --- a/util/xcompile/xcompile +++ b/util/xcompile/xcompile @@ -142,34 +142,38 @@ trap clean_up EXIT # Architecture definition SUPPORTED_ARCHITECTURE="x86 armv7 aarch64" -# ARM Architecture -TARCH_armv7="armv7" -TBFDARCH_armv7="littlearm" -TCLIST_armv7="armv7a armv7-a" -TWIDTH_armv7="32" - -# AARCH64 -- armv8 -TARCH_aarch64="aarch64" -TBFDARCH_aarch64="littleaarch64" -TCLIST_aarch64="aarch64" -TWIDTH_aarch64="64" - -# X86 Architecture -TARCH_x86="i386" -TBFDARCH_x86="i386" -TCLIST_x86="i386 x86_64" -TWIDTH_x86="32" +arch_config_armv7() { + TARCH="armv7" + TBFDARCH="littlearm" + TCLIST="armv7a armv7-a" + TWIDTH="32" +} + +arch_config_aarch64() { + TARCH="aarch64" + TBFDARCH="littleaarch64" + TCLIST="aarch64" + TWIDTH="64" +} + +arch_config_x86() { + TARCH="i386" + TBFDARCH="i386" + TCLIST="i386 x86_64" + TWIDTH="32" +} + XGCCPATH=${1:-"`pwd`/util/crossgcc/xgcc/bin/"} # This loops over all supported architectures. for architecture in $SUPPORTED_ARCHITECTURE; do GCCPREFIX="invalid" - TARCH="$(eval echo \$TARCH_$architecture)" - TBFDARCH="$(eval echo \$TBFDARCH_$architecture)" - TCLIST="$(eval echo \$TCLIST_$architecture)" - TWIDTH="$(eval echo \$TWIDTH_$architecture)" - [ -z "$TARCH" -o -z "$TCLIST" -o -z "$TWIDTH" ] && - die "Missing architecture definition for $architecture." + if type arch_config_$architecture > /dev/null; then + arch_config_$architecture + else + echo "no architecture definition for $architecture" + exit 1 + fi # To override toolchain, define CROSS_COMPILE_$arch or CROSS_COMPILE as # environment variable. |