In sh
/bash
:
export arm='ARCH=arm CROSS_COMPILE=arm-eabi-'
make $arm
Doesn't really make sense. Environment variables are meant as variables passed to make
(so a reference to $(arm) in the Makefile for instance expands to its content). Environment variables are scalar, they can contain only one string value. Above you're relying on the split+glob operator of the shell that splits the variable into words passed to make
(as arguments).
But $arm
is expanded by the shell, so you don't need to export arm
to the environment of make
because make
makes no use of that $arm
variable.
Also, on a shell that supports them, it would make more sense to use arrays. In bash
/zsh
/ksh
:
arm=(ARCH=arm CROSS_COMPILE=arm-eabi-)
make "${arm[@]}"
With fish
:
set arm ARCH=arm CROSS_COMPILE=arm-eabi-
make $arm
With rc
/es
/zsh
:
arm=(ARCH=arm CROSS_COMPILE=arm-eabi-)
make $arm