arg in Makefile
$(FOO)
env variable
FOO=BAR make
command arg
make FOO=BAR
Makefile
send:
echo $(MESSAGE1) $(MESSAGE2)
Run
$ make send MESSAGE1=YES MESSAGE2=OK
echo YES OK
YES OK
$ make send MESSAGE1= MESSAGE2=
echo
$ make send
echo
environment variable
# specify env variables directly
$ MESSAGE1=YES MESSAGE2=OK make send
echo YES OK
YES OK
$ MESSAGE1=YES make send MESSAGE2=OK
echo YES OK
YES OK
# args overwrite env ?
$ MESSAGE1=NO MESSAGE2=NG make send
echo NO NG
NO NG
$ MESSAGE1=NO MESSAGE2=NG make send MESSAGE1=YES MESSAGE2=OK
echo YES OK
YES OK
# export env variable works
$ export MESSAGE1=YES
$ make send
echo YES
YES
$ export MESSAGE2=OK
$ make send
echo YES OK
YES OK
Ref
makefile - Passing additional variables from command line to make - Stack Overflow
JP
Comment passer des arguments à la commande make
Original by Github issue
https://github.com/YumaInaura/YumaInaura/issues/2831