> > What we need is a rule that forces a rebuild when data.h > is missing. > > > > data.c: data.foo > > foo data.foo > > data.h: data.c > > @if test -f $@; then :; else \ > > rm -f data.c; \ > > $(MAKE) $(AM_MAKEFLAGS) data.c; \ > > fi > > > > I believe this fails on the following corner case. Suppose the > date ordering is like this (with data.h being the oldest): > data.h data.foo data.c > > data.h is out of date with respect to data.foo, so one wants to > rebuild it, but I don't think that will happen: > - data.c is up to date with respect to data.foo, so the first > rule doesn't fire > - data.h is out of date with respect to data.c, so the second > rule does fire, but its action doesn't do anything because > data.h already exists
Wouldn't this help somewhat for a case like this: data.h: data.c @if test -f $@; then \ touch $@; \ else \ rm -f data.c; \ $(MAKE) $(AM_MAKEFLAGS) data.c; \ fi It wouldn't do anything about the contents of the file (but, like Robert said, the user made a boo-boo by editing/touching data.c in the first place), but it would prevent rerunning this rule's commands on every subsequent make invocation.