qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, mdroth@linux.vnet.ibm.com
Subject: [PATCH 7/6] Makefile: Make Makefile depend on generated qga files, too
Date: Fri, 29 Nov 2019 10:59:27 +0100	[thread overview]
Message-ID: <20191129095927.17382-1-armbru@redhat.com> (raw)
In-Reply-To: <20191120182551.23795-1-armbru@redhat.com>

Generated .h need to be generated before compiling any .c using them.
To know which .h a .c uses, we need to compile it.

Since commit 4115852bb0 "build: do not sprinkle around
GENERATED_HEADERS dependencies", we break this circular dependency the
simple & stupid way: the generated headers are a prerequisite of
Makefile, which causes Make to generate them first, then start over.

Except for qga we still use the older method of making all its .o
summarily depend on all its generated .h (commit 016c77ad62 "Makefile:
add missing deps on $(GENERATED_HEADERS)").

Add qga's generated files to generated-files-y to get rid of this
exception.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 Makefile | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 8dad949483..d4138343cd 100644
--- a/Makefile
+++ b/Makefile
@@ -130,6 +130,15 @@ GENERATED_QAPI_FILES += qapi/qapi-doc.texi
 
 generated-files-y += $(GENERATED_QAPI_FILES)
 
+GENERATED_QGA_FILES := qga-qapi-types.c qga-qapi-types.h
+GENERATED_QGA_FILES += qga-qapi-visit.c qga-qapi-visit.h
+GENERATED_QGA_FILES += qga-qapi-commands.h qga-qapi-commands.c
+GENERATED_QGA_FILES += qga-qapi-init-commands.h qga-qapi-init-commands.c
+GENERATED_QGA_FILES += qga-qapi-doc.texi
+GENERATED_QGA_FILES := $(addprefix qga/qapi-generated/, $(GENERATED_QGA_FILES))
+
+generated-files-y += $(GENERATED_QGA_FILES)
+
 generated-files-y += trace/generated-tcg-tracers.h
 
 generated-files-y += trace/generated-helpers-wrappers.h
@@ -608,12 +617,7 @@ $(SRC_PATH)/scripts/qapi/types.py \
 $(SRC_PATH)/scripts/qapi/visit.py \
 $(SRC_PATH)/scripts/qapi-gen.py
 
-qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
-qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h \
-qga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \
-qga/qapi-generated/qga-qapi-init-commands.h qga/qapi-generated/qga-qapi-init-commands.c \
-qga/qapi-generated/qga-qapi-doc.texi: \
-qga/qapi-generated/qapi-gen-timestamp ;
+$(GENERATED_QGA_FILES): qga/qapi-generated/qapi-gen-timestamp ;
 qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
 	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
 		-o qga/qapi-generated -p "qga-" $<, \
@@ -630,9 +634,6 @@ qapi-gen-timestamp: $(qapi-modules) $(qapi-py)
 		"GEN","$(@:%-timestamp=%)")
 	@>$@
 
-QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h qga-qapi-init-commands.h)
-$(qga-obj-y): $(QGALIB_GEN)
-
 qemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
 	$(call LINK, $^)
 
@@ -722,7 +723,7 @@ clean: recurse-clean
 	rm -f trace/generated-tracers-dtrace.h*
 	rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
 	rm -f qapi-gen-timestamp
-	rm -rf qga/qapi-generated
+	rm -f qga/qapi-generated/qapi-gen-timestamp
 	rm -f config-all-devices.mak
 
 VERSION ?= $(shell cat VERSION)
-- 
2.21.0



  parent reply	other threads:[~2019-11-29 10:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20 18:25 [PATCH 0/6] qapi: Module fixes and cleanups Markus Armbruster
2019-11-20 18:25 ` [PATCH 1/6] qapi: Tweak "command returns a nice type" check for clarity Markus Armbruster
2019-11-20 19:08   ` Eric Blake
2019-11-20 18:25 ` [PATCH 2/6] tests/Makefile.include: Fix missing test-qapi-emit-events.[ch] Markus Armbruster
2019-11-20 19:16   ` Eric Blake
2019-11-20 18:25 ` [PATCH 3/6] qapi: Generate command registration stuff into separate files Markus Armbruster
2019-11-20 19:26   ` Eric Blake
2019-11-27 16:12     ` Markus Armbruster
2019-11-20 18:25 ` [PATCH 4/6] qapi: Proper intermediate representation for modules Markus Armbruster
2019-11-20 20:31   ` Eric Blake
2019-11-20 18:25 ` [PATCH 5/6] qapi: Fix code generation for empty modules Markus Armbruster
2019-11-20 20:35   ` Eric Blake
2019-11-20 18:25 ` [PATCH 6/6] qapi: Simplify QAPISchemaModularCVisitor Markus Armbruster
2019-11-20 20:54   ` Eric Blake
2019-11-20 19:40 ` [PATCH 0/6] qapi: Module fixes and cleanups Markus Armbruster
2019-11-20 23:58 ` no-reply
2019-11-21  6:27 ` Markus Armbruster
2019-11-29  9:59 ` Markus Armbruster [this message]
2019-12-03 22:33   ` [PATCH 7/6] Makefile: Make Makefile depend on generated qga files, too Eric Blake
2019-12-04  6:56     ` Markus Armbruster
2019-12-04 12:58       ` Eric Blake
2019-12-04 13:19         ` Markus Armbruster
2019-12-03  9:01 ` [PATCH 0/6] qapi: Module fixes and cleanups Markus Armbruster

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=20191129095927.17382-1-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).