qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Lluís Vilanova" <vilanova@ac.upc.edu>
To: qemu-devel@nongnu.org
Cc: stefanha@gmail.com
Subject: [Qemu-devel] [PATCH 2/3] [trivial] Simpler handling of tracetool-generated files in makfiles
Date: Fri, 03 Feb 2012 22:15:27 +0100	[thread overview]
Message-ID: <20120203211527.31173.65983.stgit@ginnungagap.bsc.es> (raw)
In-Reply-To: <20120203211457.31173.55544.stgit@ginnungagap.bsc.es>

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 Makefile.objs |   19 +++++++++----------
 rules.mak     |    6 ++++++
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/Makefile.objs b/Makefile.objs
index 941386b..b187d17 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -349,18 +349,17 @@ libdis-$(CONFIG_SPARC_DIS) += sparc-dis.o
 # trace
 
 ifeq ($(TRACE_BACKEND),dtrace)
-trace.h: trace.h-timestamp trace-dtrace.h
-else
-trace.h: trace.h-timestamp
+TRACE_H_EXTRA_DEPS=trace-dtrace.h
 endif
+trace.h: trace.h-timestamp $(TRACE_H_EXTRA_DEPS)
 trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=h --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace.h")
-	@cmp -s $@ trace.h || cp $@ trace.h
+	$(call tracetool-gen,h,$(TRACE_BACKEND))
+	$(call tracetool-ci)
 
 trace.c: trace.c-timestamp
 trace.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=c --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace.c")
-	@cmp -s $@ trace.c || cp $@ trace.c
+	$(call tracetool-gen,c,$(TRACE_BACKEND))
+	$(call tracetool-ci)
 
 trace.o: trace.c $(GENERATED_HEADERS)
 
@@ -372,11 +371,11 @@ trace-dtrace.h: trace-dtrace.dtrace
 # rule file. So we use '.dtrace' instead
 trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp
 trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=d --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace-dtrace.dtrace")
-	@cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace
+	$(call tracetool-gen,d,$(TRACE_BACKEND))
+	$(call tracetool-ci)
 
 trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS)
-	$(call quiet-command,dtrace -o $@ -G -s $<, "  GEN trace-dtrace.o")
+	$(call quiet-command,dtrace -o $@ -G -s $<, "  GEN   trace-dtrace.o")
 
 ifeq ($(LIBTOOL),)
 trace-dtrace.lo: trace-dtrace.dtrace
diff --git a/rules.mak b/rules.mak
index 04a9198..a7e58a0 100644
--- a/rules.mak
+++ b/rules.mak
@@ -59,6 +59,12 @@ find-in-path = $(if $(find-string /, $1), \
         $(wildcard $1), \
         $(wildcard $(patsubst %, %/$1, $(subst :, ,$(PATH)))))
 
+# Generate files with tracetool
+
+TRACETOOL=$(SRC_PATH)/scripts/tracetool.py
+tracetool-gen=$(call quiet-command,$(PYTHON) $(TRACETOOL) $(3) --format=$(1) --backend=$(2) < $< > $@,"  GEN   $(subst -timestamp,,$@)")
+tracetool-ci=@cmp -s $@ $(subst -timestamp,,$@) || cp $@ $(subst -timestamp,,$@)
+
 # Generate timestamp files for .h include files
 
 %.h: %.h-timestamp

  parent reply	other threads:[~2012-02-03 21:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-03 21:14 [Qemu-devel] [PATCH 0/3] More concise handling of tracetool-generated files Lluís Vilanova
2012-02-03 21:15 ` [Qemu-devel] [PATCH 1/3] [trivial] Generic elimination of auto-generated files Lluís Vilanova
2012-02-03 21:15 ` Lluís Vilanova [this message]
2012-02-03 21:15 ` [Qemu-devel] [PATCH 3/3] [trivial] Regenerate files when tracetool changes Lluís Vilanova
2012-03-14 13:31 ` [Qemu-devel] [PATCH 0/3] More concise handling of tracetool-generated files Lluís Vilanova

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=20120203211527.31173.65983.stgit@ginnungagap.bsc.es \
    --to=vilanova@ac.upc.edu \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /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).