There are some configuration files in my project and they are generated from the same template like foo.tmpl => Foo . Now I would like to write a makefile that can generate a file related to the template.
I could not have had anything like this:
%:% .tmpl generate-to-tmpl $ & lt; Since this is the goal of all possible files, however, I only want to restrict my goal with the .tmpl correspondent. Now I've got the list of all templated files:
TEMPLATED_FILES = $ (shell search-type f -name "* .tmpl") GENERATED_FILES = $ (TEMPLATED_FILES: .tmpl =) < / Code> I have to do something that looks like:
$ (foreach GENERATED_FILES): $ @ Tmpl generated-to-tmpl $ & lt; How can I get it? Thank you.
%:% .tmpl will try to match the target % , but if there is no match % If the Tmpl file exists, then that method will completely leave for that goal.
I believe in what you really want
$ (GENERATED_FILES):%: Do you have some reasons not to think like that? It is being said that if you want to be more specific, then what do you want:% .tmpl generated-to-tmpl $ & lt;
which will only apply to files in $ (GENERATED_FILES) .
In addition, if your template files are only in your directory, then you can use:
TEMPLATED_FILES = $ (wildcard * .tmpl) instead of shell and find (there are also recursive wildcard defines available but find is appropriate if you need it).
No comments:
Post a Comment