From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, armbru@redhat.com, xiezhide@huawei.com,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qapi: Reduce Makefile boilerplate
Date: Thu, 15 Nov 2018 16:37:36 -0600 [thread overview]
Message-ID: <b600b483-0e46-5c2e-f52b-2f330ebaa5a7@redhat.com> (raw)
In-Reply-To: <20181115215449.1300769-1-eblake@redhat.com>
On 11/15/18 3:54 PM, Eric Blake wrote:
> Adding a new qapi module had some rather tedious repetition to
> wire it into Makefile. Add some indirection by taking advantage
> of GNU Make string processing to expand a list of module names
> into all the required artifacts, so that future additions of a
> new module need only touch the list of module names.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>
> I finally found time to follow through with my threats to make it
> MUCH easier to add a new qapi/FOO.json file.
>
> Should be no semantic change, but as it is not fixing an actual
> bug, I don't care if it goes in 3.1 or 4.0.
>
> Makefile | 194 +++++++------------------------------------------------
> 1 file changed, 25 insertions(+), 169 deletions(-)
I'm trying to do the same thing to Makefile.objs, but when I use:
common-obj-y += $(QAPI_MODULES:%=qapi/qapi-commands-%.o)
or the longer $(patsubst %,qapi,qapi-commands-%.o,$(QAPI_MODULES))
both before and after the change, 'make print-common-obj-y | grep qapi'
returns identical content, but after the change, the linker fails with:
LINK x86_64-softmmu/qemu-system-x86_64
monitor.o: In function `monitor_init_qmp_commands':
/home/eblake/qemu/monitor.c:1200: undefined reference to
`qmp_marshal_qmp_capabilities'
monitor.o: In function `qmp_greeting':
/home/eblake/qemu/monitor.c:4342: undefined reference to
`qmp_marshal_query_version'
../qapi/qapi-commands.o: In function `qmp_init_marshal':
/home/eblake/qemu/qapi/qapi-commands.c:30: undefined reference to
`qmp_marshal_query_status'
...
So something about variable expansions is NOT playing nicely with our
dummy := $(call unnest-vars,, \
stub-obj-y \
chardev-obj-y \
...
common-obj-y \
that builds up the set of files the linker needs to see. But I have
_no_ idea what is going wrong that makes unnest-vars unable to see
through a variable expansion of .o files. Ideas on how to compress
Makefile.objs to avoid the redundancy would be appreciated.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2018-11-15 22:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-15 21:54 [Qemu-devel] [PATCH] qapi: Reduce Makefile boilerplate Eric Blake
2018-11-15 22:37 ` Eric Blake [this message]
2018-11-15 22:43 ` Eric Blake
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=b600b483-0e46-5c2e-f52b-2f330ebaa5a7@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=xiezhide@huawei.com \
/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).