Sunday, 15 April 2012

makefile - GNU make: make ignores some exported variables? -



makefile - GNU make: make ignores some exported variables? -

given makefile:

ifndef deis_num_instances deis_num_instances=3 endif ifndef deis_hosts deis_hosts = $(shell seq -f "172.17.8.%g" -s " " 100 1 `expr $(deis_num_instances) + 99` ) endif dummy: host in $(deis_hosts); echo $$host; done

no matter export deis_hosts to, ifndef deis_hosts evaluated:

bash-3.2$ export deis_hosts="1.2.3.4 2.3.4.5" bash-3.2$ create host in 172.17.8.100 172.17.8.101 172.17.8.102 ; echo $host; done 172.17.8.100 172.17.8.101 172.17.8.102

however, passing variables right make seems work:

bash-3.2$ deis_hosts="1.2.3.4 2.3.4.5" create host in 1.2.3.4 2.3.4.5; echo $host; done 1.2.3.4 2.3.4.5

can explain behavior? it's quite confusing, considering deis_num_instances doesn't work way:

bash-3.2$ export deis_num_instances=6 bash-3.2$ create host in 172.17.8.100 172.17.8.101 172.17.8.102 172.17.8.103 172.17.8.104 172.17.8.105 ; echo $host; done 172.17.8.100 172.17.8.101 172.17.8.102 172.17.8.103 172.17.8.104 172.17.8.105

so, embarrassing. coming problem today, works intended. have no thought changed between yesterday , today... makefile same. anyway, confirming indeed crazy!

makefile make gnu-make

No comments:

Post a Comment