Is it possible to insert a new-line to be executed within a foreach
loop in a Makefile?
Currently, I have the following:
$(foreach my_lib,$(MY_LIBS),$(call my_func,results,boxer,$(my_lib)))
Now, assuming that I have:
MY_LIBS = lib1 \
lib2
The above foreach
loop would evaluate to:
lib1 lib2
I would like this to evaluate to:
lib1
lib2
Is it possible to insert a newline in the foreach
loop to accomplish this?
Thank you.
You can use
${\n}
in things like$(subst...)
.You could do this by using
In more complex cases, where you want to generate multiline makefile commands from the loop, you will need to use the
eval
function.