Patchwork [v4,3/5] Adapt Makefiles to the new LTTng ust interface.

login
register
mail settings
Submitter Mohamad Gebai
Date Oct. 18, 2013, 6:39 a.m.
Message ID <1382078393-11195-4-git-send-email-mohamad.gebai@polymtl.ca>
Download mbox | patch
Permalink /patch/284448/
State New
Headers show

Comments

Mohamad Gebai - Oct. 18, 2013, 6:39 a.m.
Add generation of new files for LTTng ust.

Signed-off-by: Mohamad Gebai <mohamad.gebai@polymtl.ca>
---
 Makefile            |    5 +++++
 trace/Makefile.objs |   29 +++++++++++++++++++++++++++--
 2 files changed, 32 insertions(+), 2 deletions(-)
Stefan Hajnoczi - Oct. 18, 2013, 2:10 p.m.
On Fri, Oct 18, 2013 at 02:39:51AM -0400, Mohamad Gebai wrote:
>  ######################################################################
> +# Auto-generated event descriptions for LTTng ust code
> +
> +ifeq ($(TRACE_BACKEND),ust)
> +$(obj)/generated-ust-provider.h: $(obj)/generated-ust-provider.h-timestamp
> +$(obj)/generated-ust-provider.h-timestamp: $(SRC_PATH)/trace-events
> +	$(call quiet-command,$(TRACETOOL) \
> +		--format=ust-events-h \
> +		--backend=events \
> +		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
> +	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
> +
> +$(obj)/generated-ust.c: $(obj)/generated-ust.c-timestamp $(BUILD_DIR)/config-host.mak
> +$(obj)/generated-ust.c-timestamp: $(SRC_PATH)/trace-events
> +	$(call quiet-command,$(TRACETOOL) \
> +		--format=ust-events-c \
> +		--backend=events \
> +		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
> +	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
> +
> +ust_provider=$(obj)/generated-ust-provider.h
> +ust=$(obj)/generated-ust.c

I think you can avoid the variables by defining single dependencies
upfront:

$(obj)/generated-events.h: $(obj)/generated-ust-provider.h
$(obj)/generated-events.c: $(obj)/generated-ust.c

Patch

diff --git a/Makefile b/Makefile
index 60fb87e..0c797c5 100644
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,11 @@  GENERATED_HEADERS += trace/generated-tracers-dtrace.h
 endif
 GENERATED_SOURCES += trace/generated-tracers.c
 
+ifeq ($(TRACE_BACKEND),ust)
+GENERATED_HEADERS += trace/generated-ust-provider.h
+GENERATED_SOURCES += trace/generated-ust.c
+endif
+
 # Don't try to regenerate Makefile or configure
 # We don't generate any of them
 Makefile: ;
diff --git a/trace/Makefile.objs b/trace/Makefile.objs
index 3b88e49..00880b3 100644
--- a/trace/Makefile.objs
+++ b/trace/Makefile.objs
@@ -1,9 +1,33 @@ 
 # -*- mode: makefile -*-
 
 ######################################################################
+# Auto-generated event descriptions for LTTng ust code
+
+ifeq ($(TRACE_BACKEND),ust)
+$(obj)/generated-ust-provider.h: $(obj)/generated-ust-provider.h-timestamp
+$(obj)/generated-ust-provider.h-timestamp: $(SRC_PATH)/trace-events
+	$(call quiet-command,$(TRACETOOL) \
+		--format=ust-events-h \
+		--backend=events \
+		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
+	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
+
+$(obj)/generated-ust.c: $(obj)/generated-ust.c-timestamp $(BUILD_DIR)/config-host.mak
+$(obj)/generated-ust.c-timestamp: $(SRC_PATH)/trace-events
+	$(call quiet-command,$(TRACETOOL) \
+		--format=ust-events-c \
+		--backend=events \
+		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
+	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
+
+ust_provider=$(obj)/generated-ust-provider.h
+ust=$(obj)/generated-ust.c
+endif
+
+######################################################################
 # Auto-generated event descriptions
 
-$(obj)/generated-events.h: $(obj)/generated-events.h-timestamp
+$(obj)/generated-events.h: $(obj)/generated-events.h-timestamp $(ust_provider)
 $(obj)/generated-events.h-timestamp: $(SRC_PATH)/trace-events
 	$(call quiet-command,$(TRACETOOL) \
 		--format=events-h \
@@ -11,7 +35,7 @@  $(obj)/generated-events.h-timestamp: $(SRC_PATH)/trace-events
 		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
 	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
 
-$(obj)/generated-events.c: $(obj)/generated-events.c-timestamp $(BUILD_DIR)/config-host.mak
+$(obj)/generated-events.c: $(obj)/generated-events.c-timestamp $(BUILD_DIR)/config-host.mak $(ust)
 $(obj)/generated-events.c-timestamp: $(SRC_PATH)/trace-events
 	$(call quiet-command,$(TRACETOOL) \
 		--format=events-c \
@@ -77,5 +101,6 @@  util-obj-$(CONFIG_TRACE_DEFAULT) += default.o
 util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o
 util-obj-$(CONFIG_TRACE_STDERR) += stderr.o
 util-obj-$(CONFIG_TRACE_FTRACE) += ftrace.o
+util-obj-$(CONFIG_TRACE_UST) += generated-ust.o
 util-obj-y += control.o
 util-obj-y += generated-tracers.o