Vote count:
0
I'm trying to make a rule that will generate files regarding their names but regardless of the directory.
I'm starting from this makefile (see a previous question of mine):
TARGETS:=$(patsubst %_tpl,%,$(wildcard *_tpl))
.PHONY: all
all: $(TARGETS)
.SECONDEXPANSION:
$(TARGETS): %: $$(wildcard %*_tpl)
./generate $@_tpl > $@
With this, I can do, for instance, make foo.xml
. It looks if a set of foo.xml*_tpl
files are there, consider them as prerequisites and call the generate
script to generate the target.
What I would like to do is, for example, make ../ressources/foo.xml
and have make use the rule to create foo.xml
but creating it in the ../ressources/
directory, without having to explicitely specify this directory in the makefile.
What I have tried for the moment is adding this to the Makefile:
../ressources/%: $(notdir %)
mv $< $@
Which works, but I would like to avoid creating the file in the current directory before moving it to the destination folder. I would also like not having to specify the possible destination folders in the makefile (but this is less important).
But first of all, does this make any sense? Or is what I want to do just conceptually wrong?
Directory independent target in Makefile
Aucun commentaire:
Enregistrer un commentaire