>>> "pds" == Paul D Smith <[EMAIL PROTECTED]> writes:

[...]

 pds> I assume you have some specific behavior you want make to undertake WRT
 pds> to this "optional" file; can you be more specific?

One context were I would like that sort of behaviour is the following.

$(OUTDIR)/%.bin : %.cc 
        $(CXX) $(CXXFLAGS) $(CPPFLAGS) \
        $(shell [ -f $*.cc.opts ] && cat $*.cc.opts) -o $@ $<

F.bin is compiled from F.cc with respect to additional options taken
from F.cc.opts when that file exists.  If F.cc.opts exists I want 
F.bin to be rebuilt each time F.cc or F.cc.opts is modified, otherwise, 
if F.cc.opts does not exists rebuilt should only happends
when F.cc is modified.

Of course, I could create empty options files (*.cc.opts) for each source
file (*.cc) that doesn't have one.  But in my build only a few files needs
such additional options and I don't want to get polluted with dozens of
empty files.

My present solution is :

ifdef OPTS
$(OUTDIR)/%.bin : %.cc $(OUTDIR_CREATE) $(filter-out NIL, $(OPTS))
        $(CXX) $(CXXFLAGS) $(CPPFLAGS) \
        $(shell [ -f $*.cc.opts ] && cat $*.cc.opts) -o $@ $<
else
FORCE : 

$(OUTDIR)/%.bin : FORCE
        make $@ OPTS="$(wildcard $*.cc.opts) NIL"
endif

which as I said is not efficient.

 pds> Do you mean that if the file doesn't exist, it should be ignored
 pds> completely by make, but if it does exist it should go through all the
 pds> "normal" prerequisite processing (making sure it's up-to-date, etc.)?

Precisely.

-- 
Alexandre Duret-Lutz

Reply via email to