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 <ebl...@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