Pregunta

I have a list of variables:

VAR_LIST= var1 var2 var3 var4 var5

and a script (var_process.py)in recipe that uses the variable as one of the option.

How do i create a recurring instance that would sequentially process the var_process.py using VAR_LIST.

I have the makefile setup like this, but i cant figure out how can i setup VAR_LIST to be sequential.

target1: $(foreach var, $(VAR_LIST), $(var)_process_var.txt)

 %_process_var.txt:var_process.py %_var.txt
     python $< -i $(word 2, $^) -var VAR_LIST -o $@
¿Fue útil?

Solución

Doesn't it work to use $*? I would write it like this:

%_process_var.txt: var_process.py %_var.txt
        python $< -i $(word 2, $^) -var $* -o $@
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top