From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=39676 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OznBZ-00035n-OZ for qemu-devel@nongnu.org; Sun, 26 Sep 2010 05:06:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OznBY-0003g8-Ho for qemu-devel@nongnu.org; Sun, 26 Sep 2010 05:06:17 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:56373) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OznBY-0003g1-EP for qemu-devel@nongnu.org; Sun, 26 Sep 2010 05:06:16 -0400 Received: by qwk4 with SMTP id 4so1170532qwk.4 for ; Sun, 26 Sep 2010 02:06:16 -0700 (PDT) MIME-Version: 1.0 From: Blue Swirl Date: Sun, 26 Sep 2010 09:05:55 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: [Qemu-devel] [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: qemu-devel Add logic to detect changes in generated files. If the old and new files are identical, don't touch the generated file. This avoids a lot of churn since many files depend on trace.h. Signed-off-by: Blue Swirl --- Makefile | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ff39025..085e8ed 100644 --- a/Makefile +++ b/Makefile @@ -107,10 +107,24 @@ ui/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS) bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS) trace.h: $(SRC_PATH)/trace-events config-host.mak - $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -h < $< > $@," GEN $@") + $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -h < $< > $@.tmp," GEN $@") + @if test -f $@; then \ + if ! cmp -s $@ $@.tmp; then \ + mv $@.tmp $@; \ + fi; \ + else \ + mv $@.tmp $@; \ + fi trace.c: $(SRC_PATH)/trace-events config-host.mak - $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -c < $< > $@," GEN $@") + $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -c < $< > $@.tmp," GEN $@") + @if test -f $@; then \ + if ! cmp -s $@ $@.tmp; then \ + mv $@.tmp $@; \ + fi; \ + else \ + mv $@.tmp $@; \ + fi trace.o: trace.c $(GENERATED_HEADERS) -- 1.6.2.4