makefile - gmake - loop through and process runtime variables -


i have makefile following content:

m_one = 1 m_two = 2 m_three = 3  numbers = $(foreach v, $(shell echo "$(.variables)" | sed 's/ /'$$"\n"'/g' | grep "^m_" | xargs), $(info $(v)=$($(v)))) get-numbers:         numbers=$(numbers) ;\         echo -e "numbers: \n$$numbers" ;\         echo -e "numbers: \n$(numbers)" 

i have variables start same pattern, here "m_". want retrieve values of variables run-time, , execute shell tasks each 1 of them.

when execute command here get:

$ gmake --silent get-numbers m_two=2 m_one=1 m_three=3 m_two=2 m_one=1 m_three=3 numbers:   numbers:  

it's if variable 'numbers' empty. don't understand why since escaped it's declaration. , actually, it's if gmake variable 'numbers' empty too.

what want loop through "key=values" , file processing (sedding). how can solve this, or approach consider ot so?

that seems lot of work want do. numbers =... expression not assigning '$(info...)' command output numbers; it's writing stdout; echo commands being executed (hence out of sequence output).

a simple way want, using gmake gives you, might be:

m_one = 1 m_two = 2 m_three = 3 get-numbers : $(filter m_%, ${.variables:=.print}) %.print     :;@ echo $*=${$*} 

yes, not provide numbers: numbers: labels. fair assume want info more formatting?

hth


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -