[OpenBIOS] [PATCH] switch-arch: Add non-standard compiler prefix support

Programmingkid programmingkidx at gmail.com
Sun May 10 23:08:33 CEST 2015


On May 10, 2015, at 5:23 AM, Mark Cave-Ayland wrote:

> Allow a user-defined compiler prefix to be specified via the CROSS_COMPILE
> variable when running switch-arch, e.g.
> 
>    CROSS_COMPILE=powerpc-linux- ./config/scripts/switch-arch ppc
> 
> Based upon an original patch by John Arbuckle <programmingkidx at gmail.com>.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
> ---
> openbios-devel/config/scripts/switch-arch |    8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/openbios-devel/config/scripts/switch-arch b/openbios-devel/config/scripts/switch-arch
> index 868eae6..d5e2f77 100755
> --- a/openbios-devel/config/scripts/switch-arch
> +++ b/openbios-devel/config/scripts/switch-arch
> @@ -99,7 +99,13 @@ archname()
> 
> select_prefix()
> {
> -    for TARGET in ${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-
> +    TARGETS="${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-"
> +
> +    if [ x"$CROSS_COMPILE" != "x" ]; then
> +        TARGETS=$CROSS_COMPILE
> +    fi
> +
> +    for TARGET in $TARGETS
>     do
>         if type ${TARGET}gcc > /dev/null 2>&1
>         then
> -- 
> 1.7.10.4
> 

I still prefer CROSS_COMPILER to CROSS_COMPILE, but I can live with the change. 

What advantage does the code  "if [ x"$CROSS_COMPILE" != "x" ];" have over "if [ "$CROSS_COMPILE" ];"? 


More information about the OpenBIOS mailing list