Makefiles are really really useful. But, the syntax is somewhat complex and limited. For a project, I need to create targets 1 to n, and would really like to write something like this:
all : target1 ... target100
target%d : target%d.pre
./script.py %d
I would like to have make
capture the variable (%d
) and then use it throughout the rule. I could imagine that is is possible to do this with a complex use of patterns (%.xyz) and patsubst
s, but this would be very clumsy and unreadable.
I'm thinking of using a template engine like Cheetah to write a template (which can contain loops) that would then be converted into a Makefile. Does anyone have a better idea, or experience with this?