All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2/2] trace: avoid unnecessary recompilation if nothing changed
@ 2010-09-26  9:05 Blue Swirl
  2010-09-26 16:15 ` Stefan Hajnoczi
  2010-09-27  8:32 ` Markus Armbruster
  0 siblings, 2 replies; 8+ messages in thread
From: Blue Swirl @ 2010-09-26  9:05 UTC (permalink / raw)
  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 <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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-09-29 11:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-26  9:05 [Qemu-devel] [PATCH 2/2] trace: avoid unnecessary recompilation if nothing changed Blue Swirl
2010-09-26 16:15 ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.