I want to write something along these lines:
$(foreach (var1, var2), ($(LIST1), $(LIST2)), cp $(var1) $(var2);)
How do I go about doing this in a GNU makefile?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Beta’s suggestion to use join is on the right track, but the problem is that it’s not so easy to use it in a way that constructs a command line containing whitespace, such as the one you originally wanted:
because join joins words together: it was originally intended for constructing filenames. However you can play a trick; here’s an example of a way to use join that gives you the output you are looking for:
If you think your lists might contain
^characters then choose something else. Let me know if you need this unpacked/explained.