From 4f04f13c2a9aba874797d89a5e37b1f6b5993835 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 28 Feb 2017 12:29:00 +0000 Subject: makefile: merge GENERATED_HEADERS & GENERATED_SOURCES variables The only functional difference between the GENERATED_HEADERS and GENERATED_SOURCES variables is that 'Makefile' has a dependancy on GENERATED_HEADERS, causing generated header files to be created immediatey at the start of the build process. There is no reason why this early creation should be restricted to the .h files, and not include .c files too. Merge both of the variables into a single GENERATED_FILES variable to make it clear it is for any type of generated file. Signed-off-by: Daniel P. Berrange Reviewed-by: Fam Zheng Message-id: 20170228122901.24520-2-berrange@redhat.com Signed-off-by: Stefan Hajnoczi --- Makefile | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1c4c04f6f2..a8024c03be 100644 --- a/Makefile +++ b/Makefile @@ -50,24 +50,24 @@ endif include $(SRC_PATH)/rules.mak -GENERATED_HEADERS = qemu-version.h config-host.h qemu-options.def -GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h -GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c -GENERATED_HEADERS += qmp-introspect.h -GENERATED_SOURCES += qmp-introspect.c +GENERATED_FILES = qemu-version.h config-host.h qemu-options.def +GENERATED_FILES += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h +GENERATED_FILES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c +GENERATED_FILES += qmp-introspect.h +GENERATED_FILES += qmp-introspect.c -GENERATED_HEADERS += trace/generated-tcg-tracers.h +GENERATED_FILES += trace/generated-tcg-tracers.h -GENERATED_HEADERS += trace/generated-helpers-wrappers.h -GENERATED_HEADERS += trace/generated-helpers.h -GENERATED_SOURCES += trace/generated-helpers.c +GENERATED_FILES += trace/generated-helpers-wrappers.h +GENERATED_FILES += trace/generated-helpers.h +GENERATED_FILES += trace/generated-helpers.c ifdef CONFIG_TRACE_UST -GENERATED_HEADERS += trace-ust-all.h -GENERATED_SOURCES += trace-ust-all.c +GENERATED_FILES += trace-ust-all.h +GENERATED_FILES += trace-ust-all.c endif -GENERATED_HEADERS += module_block.h +GENERATED_FILES += module_block.h TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h) TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c) @@ -80,8 +80,8 @@ ifdef CONFIG_TRACE_UST TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h) endif -GENERATED_HEADERS += $(TRACE_HEADERS) -GENERATED_SOURCES += $(TRACE_SOURCES) +GENERATED_FILES += $(TRACE_HEADERS) +GENERATED_FILES += $(TRACE_SOURCES) trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g') @@ -485,11 +485,10 @@ clean: rm -f fsdev/*.pod rm -f qemu-img-cmds.h rm -f ui/shader/*-vert.h ui/shader/*-frag.h - @# May not be present in GENERATED_HEADERS + @# May not be present in GENERATED_FILES rm -f trace/generated-tracers-dtrace.dtrace* rm -f trace/generated-tracers-dtrace.h* - rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp) - rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp) + rm -f $(foreach f,$(GENERATED_FILES),$(f) $(f)-timestamp) rm -rf qapi-generated rm -rf qga/qapi-generated for d in $(ALL_SUBDIRS); do \ @@ -784,7 +783,7 @@ endif # CONFIG_WIN # Add a dependency on the generated files, so that they are always # rebuilt before other object files ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) -Makefile: $(GENERATED_HEADERS) +Makefile: $(GENERATED_FILES) endif .SECONDARY: $(TRACE_HEADERS) $(TRACE_HEADERS:%=%-timestamp) \ -- cgit v1.2.1 From 4175304e591ba3e09861906a8651f243564c0530 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 28 Feb 2017 12:29:01 +0000 Subject: makefile: generate trace-events-all upfront Files should not be created in the build dir during the 'make install' phase. List 'trace-events-all' as a generated file so that it gets created upfront during build. Signed-off-by: Daniel P. Berrange Reviewed-by: Fam Zheng Message-id: 20170228122901.24520-3-berrange@redhat.com Signed-off-by: Stefan Hajnoczi --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a8024c03be..62917641f1 100644 --- a/Makefile +++ b/Makefile @@ -82,6 +82,7 @@ endif GENERATED_FILES += $(TRACE_HEADERS) GENERATED_FILES += $(TRACE_SOURCES) +GENERATED_FILES += $(BUILD_DIR)/trace-events-all trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g') @@ -592,8 +593,7 @@ endif endif -install: all $(if $(BUILD_DOCS),install-doc) $(BUILD_DIR)/trace-events-all \ -install-datadir install-localstatedir +install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir ifneq ($(TOOLS),) $(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir)) endif -- cgit v1.2.1 From 8755b4afbdcf1c274cab7545a9f76d3d6c7f5c29 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 15 Mar 2017 12:34:21 +0000 Subject: trace: ensure $(tracetool-y) is defined in top level makefile The build rules for trace files have a dependancy on $(tracetool-y). This variable populated in the trace/Makefile.objs file and thus its definition gets pulled into the top level makefile. This happens too late in the process though, so by the time $(tracetool-y) is defined, make has already evaluated $(tracetool-y) in the dependancies and found it to be empty. The result is that when the tracetool source is changed, the generated files are not rebuilt. The solution is to define the variable in the top level makefile too Signed-off-by: Daniel P. Berrange Reviewed-by: Eric Blake Tested-by: Eric Blake Message-id: 20170315123421.28815-1-berrange@redhat.com Signed-off-by: Stefan Hajnoczi --- Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 62917641f1..108b984fb9 100644 --- a/Makefile +++ b/Makefile @@ -86,6 +86,9 @@ GENERATED_FILES += $(BUILD_DIR)/trace-events-all trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g') +tracetool-y = $(SRC_PATH)/scripts/tracetool.py +tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py") + %/trace.h: %/trace.h-timestamp @cmp $< $@ >/dev/null 2>&1 || cp $< $@ %/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) -- cgit v1.2.1