[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 2/2] trace: avoid unnecessary recompilation if n
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] Re: [PATCH 2/2] trace: avoid unnecessary recompilation if nothing changed |
Date: |
Mon, 27 Sep 2010 11:51:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.3 |
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.
>
> address@hidden:~/tmp$ cat Makefile
> foo: bar
> echo "Remaking foo"
>
> bar:
> [ -f $@ ] || touch $@&& echo "Touched bar"
> address@hidden:~/tmp$ rm -f foo
> address@hidden:~/tmp$ make
> [ -f bar ] || touch bar&& echo "Touched bar"
> Touched bar
> echo "Remaking foo"
> Remaking foo
> address@hidden:~/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