Configure the marshaller, events and introspection with config host and
target headers. Keep the types, visitors, and command header generic
since it will only use what is actually needed, but needs all
declarations to be compatible with the various targets.

Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
---
 Makefile        | 15 +++++++++------
 Makefile.target | 12 +++++++-----
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 83d27fb..f83b208 100644
--- a/Makefile
+++ b/Makefile
@@ -267,20 +267,23 @@ qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx 
$(SRC_PATH)/scripts/hxtool
 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
 qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
 
+qapi-hconfig = config-host.h
+qapi-flags = $(patsubst %,-f %,$(qapi-hconfig))
+
 qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
-$(SRC_PATH)/qga/qapi-schema.json $(qapi-types-py)
+$(SRC_PATH)/qga/qapi-schema.json $(qapi-types-py) $(qapi-hconfig)
        $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
-               $(qapi-gen-type) -o qga/qapi-generated -p "qga-" $<, \
+               $(qapi-flags) $(qapi-gen-type) -o qga/qapi-generated -p "qga-" 
$<, \
                "  GEN   $@")
 qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
-$(SRC_PATH)/qga/qapi-schema.json $(qapi-visit-py)
+$(SRC_PATH)/qga/qapi-schema.json $(qapi-visit-py) $(qapi-hconfig)
        $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
-               $(qapi-gen-type) -o qga/qapi-generated -p "qga-" $<, \
+               $(qapi-flags) $(qapi-gen-type) -o qga/qapi-generated -p "qga-" 
$<, \
                "  GEN   $@")
 qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
-$(SRC_PATH)/qga/qapi-schema.json $(qapi-commands-py)
+$(SRC_PATH)/qga/qapi-schema.json $(qapi-commands-py) $(qapi-hconfig)
        $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
-               $(qapi-gen-type) -o qga/qapi-generated -p "qga-" $<, \
+               $(qapi-flags) $(qapi-gen-type) -o qga/qapi-generated -p "qga-" 
$<, \
                "  GEN   $@")
 
 qapi-types.c qapi-types.h :\
diff --git a/Makefile.target b/Makefile.target
index 6b672eb..c6c20bf 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -160,23 +160,25 @@ endif
 GENERATED_HEADERS += hmp-commands.h hmp-commands-info.h qmp-commands-old.h
 GENERATED_HEADERS += qmp-introspect.h
 GENERATED_SOURCES += qmp-introspect.c qmp-marshal.c qapi-event.c
+qapi-hconfig = ../config-host.h config-target.h
+qapi-flags = $(patsubst %,-f %,$(qapi-hconfig))
 
 qmp-marshal.c :\
-$(qapi-modules) $(qapi-commands-py)
+$(qapi-modules) $(qapi-commands-py) $(qapi-hconfig)
        $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
-               $(qapi-gen-type) -o "." -m $<, \
+               $(qapi-flags) $(qapi-gen-type) -o "." -m $<, \
                "  GEN   $(TARGET_DIR)$@")
 
 qapi-event.c :\
 $(qapi-modules) $(qapi-event-py)
        $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
-               $(qapi-gen-type) -o "." $<, \
+               $(qapi-flags) $(qapi-gen-type) -o "." $<, \
                "  GEN   $@")
 
 qmp-introspect.h qmp-introspect.c :\
-$(qapi-modules) $(qapi-introspect-py)
+$(qapi-modules) $(qapi-introspect-py) $(qapi-hconfig)
        $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
-               $(qapi-gen-type) -o "." $<, \
+               $(qapi-flags) $(qapi-gen-type) -o "." $<, \
                "  GEN   $(TARGET_DIR)$@")
 
 obj-y += qmp-marshal.o qmp-introspect.o qapi-event.o
-- 
2.9.0


Reply via email to