On 09/27/2010 10:32 AM, Markus Armbruster wrote: > Why the conditional? cmp -s fails fine when argument files don't exist. > > Note that common versions of make including GNU Make do not stat a > rule's target to check whether the rule changed it. Instead, they > assume it changed, and remake everything depending on it. > > arm...@blackfin:~/tmp$ cat Makefile > foo: bar > echo "Remaking foo" > > bar: > [ -f $@ ] || touch $@&& echo "Touched bar" > arm...@blackfin:~/tmp$ rm -f foo > arm...@blackfin:~/tmp$ make > [ -f bar ] || touch bar&& echo "Touched bar" > Touched bar > echo "Remaking foo" > Remaking foo > arm...@blackfin:~/tmp$ make > echo "Remaking foo" > Remaking foo > > I doubt your patch avoids churn as advertized with such makes.
Indeed, see how it's done for config-*.h. # Uses generic rule in rules.mak trace.h: trace.h-timestamp trace.h-timestamp: $(SRC_PATH)/trace-events config-host.mak $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -h < $< > $@," GEN trace.h) @cmp $@ trace.h >/dev/null 2>&1 || cp $@ trace.h (untested). Paolo