If I have a list of n commands, c = c1 ... cn, how can I execute them for a given purpose? I tried the foreach construct
$(foreach x,$(c),./$(x))
but these are all commands on one line. Any clues?
You have identified the problem ("but these are all commands on the same line"). You just need to add a new line when you expand $xin your loop.
$x
define \n endef
Now just use $(foreach x,$c,./$(x)${\n})in your recipe.
$(foreach x,$c,./$(x)${\n})
If there is no need to verify success, add a semicolon:
$(foreach x,$c,./$(x);)
, , . make-:
define execute-command $(1) endef execute-list: $(foreach x,$(c),$(call execute-command,./$(x)))