From nobody Tue Feb 10 16:22:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506958612264306.68549125959566; Mon, 2 Oct 2017 08:36:52 -0700 (PDT) Received: from localhost ([::1]:52865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2lr-000839-F3 for importer@patchew.org; Mon, 02 Oct 2017 11:36:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2bg-00081j-OE for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz2ba-0007vq-Gz for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49472) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dz2ba-0007ub-61 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:02 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 152FD81E1E; Mon, 2 Oct 2017 15:26:01 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-91.ams2.redhat.com [10.36.116.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 507EB99DE3; Mon, 2 Oct 2017 15:25:58 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9FE1F1156278; Mon, 2 Oct 2017 17:25:52 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 152FD81E1E Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=armbru@redhat.com From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 17:25:30 +0200 Message-Id: <20171002152552.27999-11-armbru@redhat.com> In-Reply-To: <20171002152552.27999-1-armbru@redhat.com> References: <20171002152552.27999-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 02 Oct 2017 15:26:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC PATCH 10/32] qapi: Don't run generators twice X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The generators always generate both .c and .h, but they can route one of them to the bit bucket. We run them twice, once to generate .c, and once to generate .h. Probably because the naive make rule FOO.c FOO.h: qapi-schema.json RECIPE runs RECIPE twice, once to generate FOO.c and once to generate FOO.h. Employ the usual make trick to generate multiple files in one rule: .INTERMEDIATE: FOO-gen FOO.c FOO.h: FOO-gen ; FOO-gen: qapi-schema.json RECIPE When make needs FOO.c or FOO.h, it runs RECIPE once to generate intermediate target FOO-gen, then considers both FOO.c and FOO.h updated. Signed-off-by: Markus Armbruster Reviewed-by: Marc-Andr=C3=A9 Lureau --- Makefile | 58 +++++++++++++++++++++++++++++++++-------------= ---- Makefile.objs | 2 +- tests/Makefile.include | 36 +++++++++++++++++++++---------- 3 files changed, 64 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index cee6e28659..784b601247 100644 --- a/Makefile +++ b/Makefile @@ -384,24 +384,33 @@ qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_P= ATH)/scripts/hxtool qemu-ga$(EXESUF): LIBS =3D $(LIBS_QGA) qemu-ga$(EXESUF): QEMU_CFLAGS +=3D -I qga/qapi-generated =20 -gen-out-type =3D $(subst .,-,$(suffix $@)) - qapi-py =3D $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py =20 +.INTERMEDIATE: qga/qapi-generated/qga-qapi-types-gen qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\ +qga/qapi-generated/qga-qapi-types-gen ; +qga/qapi-generated/qga-qapi-types-gen: \ $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-= py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \ - $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \ + -o $(dir $@) -p "qga-" $<, \ "GEN","$@") + +.INTERMEDIATE: qga/qapi-generated/qga-qapi-visit-gen qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\ +qga/qapi-generated/qga-qapi-visit-gen ; +qga/qapi-generated/qga-qapi-visit-gen: \ $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-= py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \ - $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \ + -o $(dir $@) -p "qga-" $<, \ "GEN","$@") + +.INTERMEDIATE: qga/qapi-generated/qga-qapi-commands-gen qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c= :\ +qga/qapi-generated/qga-qapi-commands-gen ; +qga/qapi-generated/qga-qapi-commands-gen: \ $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qa= pi-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \ - $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \ + -o $(dir $@) -p "qga-" $<, \ "GEN","$@") =20 qapi-modules =3D $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json= \ @@ -419,30 +428,39 @@ qapi-modules =3D $(SRC_PATH)/qapi-schema.json $(SRC_P= ATH)/qapi/common.json \ $(SRC_PATH)/qapi/transaction.json \ $(SRC_PATH)/qapi/ui.json =20 -qapi-types.c qapi-types.h :\ -$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py) +.INTERMEDIATE: qapi-types-gen +qapi-types.c qapi-types.h: qapi-types-gen ; +qapi-types-gen: $(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-p= y) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \ - $(gen-out-type) -o "." -b $<, \ + -b $<, \ "GEN","$@") -qapi-visit.c qapi-visit.h :\ -$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py) + +.INTERMEDIATE: qapi-visit-gen +qapi-visit.c qapi-visit.h: qapi-visit-gen ; +qapi-visit-gen: $(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-p= y) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \ - $(gen-out-type) -o "." -b $<, \ + -b $<, \ "GEN","$@") -qapi-event.c qapi-event.h :\ -$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py) + +.INTERMEDIATE: qapi-event-gen +qapi-event.c qapi-event.h: qapi-event-gen +qapi-event-gen: $(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-p= y) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \ - $(gen-out-type) -o "." $<, \ + $<, \ "GEN","$@") -qmp-commands.h qmp-marshal.c :\ -$(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) + +.INTERMEDIATE: qapi-commands-gen +qmp-commands.h qmp-marshal.c: qapi-commands-gen +qapi-commands-gen: $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(= qapi-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \ - $(gen-out-type) -o "." $<, \ + $<, \ "GEN","$@") -qmp-introspect.h qmp-introspect.c :\ -$(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py) + +.INTERMEDIATE: qapi-introspect-gen +qmp-introspect.h qmp-introspect.c: qapi-introspect-gen +qapi-introspect-gen: $(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.p= y $(qapi-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \ - $(gen-out-type) -o "." $<, \ + $<, \ "GEN","$@") =20 QGALIB_GEN=3D$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-vi= sit.h qga-qmp-commands.h) diff --git a/Makefile.objs b/Makefile.objs index bdfa3b6177..cc4f94d77a 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -2,7 +2,7 @@ # Common libraries for tools and emulators stub-obj-y =3D stubs/ crypto/ util-obj-y =3D util/ qobject/ qapi/ -util-obj-y +=3D qmp-introspect.o qapi-types.o qapi-visit.o qapi-event.o +util-obj-y +=3D qapi-types.o qapi-visit.o qapi-event.o =20 chardev-obj-y =3D chardev/ =20 diff --git a/tests/Makefile.include b/tests/Makefile.include index de4a713c25..5d53c58506 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -626,30 +626,44 @@ tests/test-logging$(EXESUF): tests/test-logging.o $(t= est-util-obj-y) tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-= y) \ $(test-block-obj-y) =20 -tests/test-qapi-types.c tests/test-qapi-types.h :\ +.INTERMEDIATE: tests/test-qapi-types-gen +tests/test-qapi-types.c tests/test-qapi-types.h: tests/test-qapi-types-gen= ; +tests/test-qapi-types-gen: \ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qa= pi-types.py $(qapi-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \ - $(gen-out-type) -o tests -p "test-" $<, \ + -o tests -p "test-" $<, \ "GEN","$@") -tests/test-qapi-visit.c tests/test-qapi-visit.h :\ + +.INTERMEDIATE: tests/test-qapi-visit-gen +tests/test-qapi-visit.c tests/test-qapi-visit.h: tests/test-qapi-visit-gen= ; +tests/test-qapi-visit-gen: \ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qa= pi-visit.py $(qapi-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \ - $(gen-out-type) -o tests -p "test-" $<, \ + -o tests -p "test-" $<, \ "GEN","$@") -tests/test-qmp-commands.h tests/test-qmp-marshal.c :\ + +.INTERMEDIATE: tests/test-qapi-commands-gen +tests/test-qmp-commands.h tests/test-qmp-marshal.c: tests/test-qapi-comman= ds-gen ; +tests/test-qapi-commands-gen: \ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qa= pi-commands.py $(qapi-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \ - $(gen-out-type) -o tests -p "test-" $<, \ + -o tests -p "test-" $<, \ "GEN","$@") -tests/test-qapi-event.c tests/test-qapi-event.h :\ + +.INTERMEDIATE: tests/test-qapi-event-gen +tests/test-qapi-event.c tests/test-qapi-event.h: tests/test-qapi-event-gen= ; +tests/test-qapi-event-gen: \ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qa= pi-event.py $(qapi-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \ - $(gen-out-type) -o tests -p "test-" $<, \ + -o tests -p "test-" $<, \ "GEN","$@") -tests/test-qmp-introspect.c tests/test-qmp-introspect.h :\ + +.INTERMEDIATE: tests/test-qapi-introspect-gen +tests/test-qmp-introspect.c tests/test-qmp-introspect.h: tests/test-qapi-i= ntrospect-gen ; +tests/test-qapi-introspect-gen: \ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qa= pi-introspect.py $(qapi-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \ - $(gen-out-type) -o tests -p "test-" $<, \ + -o tests -p "test-" $<, \ "GEN","$@") =20 tests/qapi-schema/doc-good.test.texi: $(SRC_PATH)/tests/qapi-schema/doc-go= od.json $(SRC_PATH)/scripts/qapi2texi.py $(qapi-py) @@ -660,7 +674,7 @@ tests/test-string-input-visitor$(EXESUF): tests/test-st= ring-input-visitor.o $(te tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) tests/test-qobject-output-visitor$(EXESUF): tests/test-qobject-output-visi= tor.o $(test-qapi-obj-y) tests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-= obj-y) -tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visito= r.o $(test-qapi-obj-y) +tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visito= r.o $(test-qapi-obj-y) qmp-introspect.o tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp= -marshal.o $(test-qapi-obj-y) tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serializatio= n.o $(test-qapi-obj-y) tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-ob= j-y) --=20 2.13.6