I'd like to have a makefile for compiling a project, and I need some files (binaries) to be downloaded if they are missing, as it's not a good idea to track them with git.
I have a list of URLs and a list of given names for them (and I'd like to be able to choose the name to save them, as I cannot control the URL name and mostly names are quite awful and non-descriptive). Let's say that the files will always be the same or that we don't care if they change in the server (we do not need to download them again).
So my idea was to write something like this in my makefile:
files = one two three four
main : $(files)
command to do when files are present
but I want each of them to be downloaded if they are not already present, and each one from its own URL, so I'd need something like an iteration over the elements of $(files).
I'll write the idea I have in my mind mixing python code and what I know from makefiles. I know it's rubbish, but I don't know any other way to do it (the question is how to write it well, basically) and I think it's quite easy to understand.
urls = url1 url2 url3 url4
for i in len(files):
$(files)[i] :
curl -Lo $(files)[i] $(urls)[i]
Therefore the question is: how should I do this?
I've been looking the make documentation for a while and I cannot find the proper way to do it without writing the filename several times (which I think should be avoided and variables should be used instead). Maybe canned recipes are the way, but I cannot see how.