If I have a list of n commands, c = c1 ... cn, how can I execute them in order for a given target? I tried the foreach construct
$(foreach x,$(c),./$(x))
but that puts all the commands on one line. Any clues?
If I have a list of n commands, c = c1 ... cn, how can I execute them in order for a given target? I tried the foreach construct
$(foreach x,$(c),./$(x))
but that puts all the commands on one line. Any clues?
If there is no need to check for success, then adding semicolon should work:
$(foreach x,$c,./$(x);)
If you need to fail if one of the command in the list returns failure, you need to break it in steps. Instead of directly executing the commands, we wrap the execution in a make function:
define execute-command
$(1)
endef
execute-list:
$(foreach x,$(c),$(call execute-command,./$(x)))