Hi people,
Say I am able to construct a file F.OUT, from a file
F.IN and another file F.OPT that is optional. That is,
I can always build F.OUT from F.IN but the presence of
F.OPT can specify additional constraints on the built
and I don't want that make try to create OPT if it is
missing.
I can write such a rule as:
F.OUT : F.IN $(wildcard F.OPT)
construct $@
A bit tricky, but it does works. Unfortunatly, I can't
specify pattern rules in the same way:
%.OUT : %.IN $(wildcard %.OPT) # won't work
construct $@
%.OUT : %.IN $(wildcard $*.OPT) # won't work either
construct $@
I have to be a bit more tricky:
ifdef OPT_FILE
%.OUT : %.IN $(filter-out DUMMY, $(OPT_FILE))
construct $@
else
FORCE :
%.OUT : FORCE
make $@ OPT_FILE="$(wildcard [email protected]) DUMMY"
endif
Yet, this requires an additional runs of make for each .OUT file
that should be built, even if the child make have nothing to
do because the target is up to date.
It would be nice if there could be a way to get make
support such optional dependencies (or does it already ?
maybe I missed something). However I have no idea what
syntax could be dedicated to theses.
Regards,
--
Alexandre Duret-Lutz