Patchwork [25/27] build: some simplifications for "trace/Makefile.objs"

login
register
mail settings
Submitter Paolo Bonzini
Date Jan. 12, 2013, 5:35 p.m.
Message ID <1358012138-21613-26-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/211537/
State New
Headers show

Comments

Paolo Bonzini - Jan. 12, 2013, 5:35 p.m.
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 trace.h => include/trace.h |  0
 trace/Makefile.objs        | 26 +++++++++++++-------------
 2 files changed, 13 insertions(+), 13 deletions(-)
 rename trace.h => include/trace.h (100%)
Lluís Vilanova - Jan. 14, 2013, 3:19 p.m.
Paolo Bonzini writes:

> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  trace.h => include/trace.h |  0
>  trace/Makefile.objs        | 26 +++++++++++++-------------
>  2 files changed, 13 insertions(+), 13 deletions(-)
>  rename trace.h => include/trace.h (100%)

> diff --git a/trace.h b/include/trace.h
> similarity index 100%
> rename from trace.h
> rename to include/trace.h
> diff --git a/trace/Makefile.objs b/trace/Makefile.objs
> index 40febce..ed2e30b 100644
> --- a/trace/Makefile.objs
> +++ b/trace/Makefile.objs
> @@ -1,12 +1,9 @@
>  # -*- mode: makefile -*-
 
>  ######################################################################
> -# Auto-generated tracing routines
> +# Auto-generated header for tracing routines
 
> -ifeq ($(TRACE_BACKEND),dtrace)
> -TRACE_H_EXTRA_DEPS=$(obj)/generated-tracers-dtrace.h
> -endif
> -$(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp $(TRACE_H_EXTRA_DEPS)
> +$(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp
>  $(obj)/generated-tracers.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
>  	$(call quiet-command,$(TRACETOOL) \
>  		--format=h \
> @@ -14,6 +11,10 @@ $(obj)/generated-tracers.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/conf
>  		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
>  	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
 
> +######################################################################
> +# Auto-generated tracing routines (non-DTrace)
> +
> +ifneq ($(TRACE_BACKEND),dtrace)
>  $(obj)/generated-tracers.c: $(obj)/generated-tracers.c-timestamp
>  $(obj)/generated-tracers.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
>  	$(call quiet-command,$(TRACETOOL) \
> @@ -23,9 +24,6 @@ $(obj)/generated-tracers.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/conf
>  	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
 
>  $(obj)/generated-tracers.o: $(obj)/generated-tracers.c $(obj)/generated-tracers.h
> -
> -ifneq ($(TRACE_BACKEND),dtrace)
> -trace-obj-y += generated-tracers.o
>  endif
 
 
> @@ -35,19 +33,20 @@ endif
>  # Normal practice is to name DTrace probe file with a '.d' extension
>  # but that gets picked up by QEMU's Makefile as an external dependency
>  # rule file. So we use '.dtrace' instead
> -$(obj)/generated-tracers-dtrace.dtrace: $(obj)/generated-tracers-dtrace.dtrace-timestamp
> -$(obj)/generated-tracers-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
> +ifeq ($(TRACE_BACKEND),dtrace)
> +$(obj)/generated-tracers.dtrace: $(obj)/generated-tracers.dtrace-timestamp
> +$(obj)/generated-tracers.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
>  	$(call quiet-command,$(TRACETOOL) \
>  		--format=d \
>  		--backend=$(TRACE_BACKEND) \
>  		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
>  	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
 
> -$(obj)/generated-tracers-dtrace.h: trace/generated-tracers-dtrace.dtrace
> +$(obj)/generated-tracers-dtrace.h: $(obj)/generated-tracers.dtrace
>  	$(call quiet-command,dtrace -o $@ -h -s $<, "  GEN   $@")
 
> -trace-obj-$(CONFIG_TRACE_DTRACE) += generated-tracers-dtrace.o
> -
> +$(obj)/generated-tracers.o: $(obj)/generated-tracers.dtrace
> +endif
 
>  ######################################################################
>  # Backend code

This patch looks outdated. Last revision in master has an explicit line to
generate a .o that reads:

#v+
$(obj)/generated-tracers-dtrace.o: trace/generated-tracers-dtrace.dtrace
	$(call quiet-command,dtrace -o $@ -G -s $<, "  GEN   $@")
#v-



> @@ -56,3 +55,4 @@ trace-obj-$(CONFIG_TRACE_DEFAULT) += default.o
>  trace-obj-$(CONFIG_TRACE_SIMPLE) += simple.o
>  trace-obj-$(CONFIG_TRACE_STDERR) += stderr.o
>  trace-obj-y += control.o
> +trace-obj-y += generated-tracers.o
> -- 
> 1.8.1


Lluis
Paolo Bonzini - Jan. 14, 2013, 3:30 p.m.
Il 14/01/2013 16:19, Lluís Vilanova ha scritto:
> This patch looks outdated. Last revision in master has an explicit line to
> generate a .o that reads:
> 
> #v+
> $(obj)/generated-tracers-dtrace.o: trace/generated-tracers-dtrace.dtrace
> 	$(call quiet-command,dtrace -o $@ -G -s $<, "  GEN   $@")
> #v-

See the earlier patch "build: move dtrace rules to rules.mak" in the
series.  I did this to simplify the introduction of libtool rules.

This pull request is a fast forward from master.

Paolo

Patch

diff --git a/trace.h b/include/trace.h
similarity index 100%
rename from trace.h
rename to include/trace.h
diff --git a/trace/Makefile.objs b/trace/Makefile.objs
index 40febce..ed2e30b 100644
--- a/trace/Makefile.objs
+++ b/trace/Makefile.objs
@@ -1,12 +1,9 @@ 
 # -*- mode: makefile -*-
 
 ######################################################################
-# Auto-generated tracing routines
+# Auto-generated header for tracing routines
 
-ifeq ($(TRACE_BACKEND),dtrace)
-TRACE_H_EXTRA_DEPS=$(obj)/generated-tracers-dtrace.h
-endif
-$(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp $(TRACE_H_EXTRA_DEPS)
+$(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp
 $(obj)/generated-tracers.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
 	$(call quiet-command,$(TRACETOOL) \
 		--format=h \
@@ -14,6 +11,10 @@  $(obj)/generated-tracers.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/conf
 		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
 	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
 
+######################################################################
+# Auto-generated tracing routines (non-DTrace)
+
+ifneq ($(TRACE_BACKEND),dtrace)
 $(obj)/generated-tracers.c: $(obj)/generated-tracers.c-timestamp
 $(obj)/generated-tracers.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
 	$(call quiet-command,$(TRACETOOL) \
@@ -23,9 +24,6 @@  $(obj)/generated-tracers.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/conf
 	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
 
 $(obj)/generated-tracers.o: $(obj)/generated-tracers.c $(obj)/generated-tracers.h
-
-ifneq ($(TRACE_BACKEND),dtrace)
-trace-obj-y += generated-tracers.o
 endif
 
 
@@ -35,19 +33,20 @@  endif
 # Normal practice is to name DTrace probe file with a '.d' extension
 # but that gets picked up by QEMU's Makefile as an external dependency
 # rule file. So we use '.dtrace' instead
-$(obj)/generated-tracers-dtrace.dtrace: $(obj)/generated-tracers-dtrace.dtrace-timestamp
-$(obj)/generated-tracers-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+ifeq ($(TRACE_BACKEND),dtrace)
+$(obj)/generated-tracers.dtrace: $(obj)/generated-tracers.dtrace-timestamp
+$(obj)/generated-tracers.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
 	$(call quiet-command,$(TRACETOOL) \
 		--format=d \
 		--backend=$(TRACE_BACKEND) \
 		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
 	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
 
-$(obj)/generated-tracers-dtrace.h: trace/generated-tracers-dtrace.dtrace
+$(obj)/generated-tracers-dtrace.h: $(obj)/generated-tracers.dtrace
 	$(call quiet-command,dtrace -o $@ -h -s $<, "  GEN   $@")
 
-trace-obj-$(CONFIG_TRACE_DTRACE) += generated-tracers-dtrace.o
-
+$(obj)/generated-tracers.o: $(obj)/generated-tracers.dtrace
+endif
 
 ######################################################################
 # Backend code
@@ -56,3 +55,4 @@  trace-obj-$(CONFIG_TRACE_DEFAULT) += default.o
 trace-obj-$(CONFIG_TRACE_SIMPLE) += simple.o
 trace-obj-$(CONFIG_TRACE_STDERR) += stderr.o
 trace-obj-y += control.o
+trace-obj-y += generated-tracers.o