From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42136 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0AWT-0003Wj-Mo for qemu-devel@nongnu.org; Mon, 27 Sep 2010 06:01:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P0ANJ-00014W-1H for qemu-devel@nongnu.org; Mon, 27 Sep 2010 05:51:58 -0400 Received: from mail-iw0-f173.google.com ([209.85.214.173]:64879) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0ANI-00014N-SB for qemu-devel@nongnu.org; Mon, 27 Sep 2010 05:51:57 -0400 Received: by iwn38 with SMTP id 38so5183876iwn.4 for ; Mon, 27 Sep 2010 02:51:56 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4CA06938.7030106@redhat.com> Date: Mon, 27 Sep 2010 11:51:52 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 2/2] trace: avoid unnecessary recompilation if nothing changed List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Blue Swirl , qemu-devel 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. > > armbru@blackfin:~/tmp$ cat Makefile > foo: bar > echo "Remaking foo" > > bar: > [ -f $@ ] || touch $@&& echo "Touched bar" > armbru@blackfin:~/tmp$ rm -f foo > armbru@blackfin:~/tmp$ make > [ -f bar ] || touch bar&& echo "Touched bar" > Touched bar > echo "Remaking foo" > Remaking foo > armbru@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