On Mon, Sep 27, 2010 at 9:51 AM, Paolo Bonzini <pbonz...@redhat.com> wrote:
> 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).

I just copied the rule from %/config-devices.mak. Is also that rule
then incorrect?

Perhaps there could be a macro for this, not unlike move-if-change
script in various GNU packages?

Reply via email to