I would to be able to expand Gnu make variables and macros appearing in a text 
file using values of .VARIABLES in the current execution environment.

This in effect is using Gnu make as a kind of [Template 
processor](https://en.wikipedia.org/wiki/Template_processor).

I find that this rule only copies the contents without expansion/interpolation

%.expanded: %
        $(file >$@,$(file < $<))

However the following seems to do exactly what I desire:

define \n :=


endef

%.expanded: %
        $(file >$@,$(eval define .x:=${\n}$(file < $<)${\n}endef ${\n})${.x})

My question is whether this is the best/fastest way to do what I desire. 

Thoughts?  Recommendations? Gothcas?


Reply via email to