qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Blue Swirl <blauwirbel@gmail.com>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH 2/2] trace: avoid unnecessary recompilation if nothing changed
Date: Sun, 26 Sep 2010 09:05:55 +0000	[thread overview]
Message-ID: <AANLkTik--YoLr8OqDeYEcaxjmbsC6PM2aNbcXSKeHZE1@mail.gmail.com> (raw)

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 <blauwirbel@gmail.com>
---
 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

             reply	other threads:[~2010-09-26  9:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-26  9:05 Blue Swirl [this message]
2010-09-26 16:15 ` [Qemu-devel] [PATCH 2/2] trace: avoid unnecessary recompilation if nothing changed Stefan Hajnoczi
2010-09-27  8:32 ` Markus Armbruster
2010-09-27  9:51   ` [Qemu-devel] " Paolo Bonzini
2010-09-27 16:13     ` Blue Swirl
2010-09-27 16:16       ` Paolo Bonzini
2010-09-28  8:58   ` [Qemu-devel] " Markus Armbruster
2010-09-29 11:42     ` [Qemu-devel] " Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTik--YoLr8OqDeYEcaxjmbsC6PM2aNbcXSKeHZE1@mail.gmail.com \
    --to=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).