@@ -44,6 +44,13 @@ ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
endif
endif
+GENERATED_BLOCK_HEADERS = block/qapi-generated/qmp-commands.h
+GENERATED_BLOCK_HEADERS += block/qapi-generated/qapi-types.h
+GENERATED_BLOCK_HEADERS += block/qapi-generated/qapi-visit.h
+GENERATED_BLOCK_SOURCES = block/qapi-generated/qmp-marshal.c
+GENERATED_BLOCK_SOURCES += block/qapi-generated/qapi-types.c
+GENERATED_BLOCK_SOURCES += block/qapi-generated/qapi-visit.c
+
GENERATED_HEADERS = config-host.h qemu-options.def
GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h
GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c
@@ -136,6 +143,7 @@ dummy := $(call unnest-vars,, \
qga-vss-dll-obj-y \
block-obj-y \
block-obj-m \
+ qapi-block-obj-y \
common-obj-y \
common-obj-m)
@@ -212,7 +220,8 @@ util/module.o-cflags = -D'CONFIG_BLOCK_MODULES=$(block-modules)'
qemu-img.o: qemu-img-cmds.h
qemu-img$(EXESUF): qemu-img.o $(block-obj-y) libqemuutil.a libqemustub.a
-qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) libqemuutil.a libqemustub.a
+qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) libqemuutil.a libqemustub.a \
+ $(qapi-block-obj-y)
qemu-io$(EXESUF): qemu-io.o $(block-obj-y) libqemuutil.a libqemustub.a
qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
@@ -262,6 +271,22 @@ $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
$(gen-out-type) -o "." -m -i $<, \
" GEN $@")
+block/qapi-generated/qapi-types.c block/qapi-generated/qapi-types.h :\
+$(SRC_PATH)/qapi/block-core.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
+ $(gen-out-type) -o block/qapi-generated -b -i $<, \
+ " GEN $@")
+block/qapi-generated/qapi-visit.c block/qapi-generated/qapi-visit.h :\
+$(SRC_PATH)/qapi/block-core.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
+ $(gen-out-type) -o block/qapi-generated -b -i $<, \
+ " GEN $@")
+block/qapi-generated/qmp-commands.h block/qapi-generated/qmp-marshal.c :\
+$(SRC_PATH)/qapi/block-core.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
+ $(gen-out-type) -o block/qapi-generated -m -i $<, \
+ " GEN $@")
+
QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
@@ -282,8 +307,11 @@ clean:
rm -f trace/generated-tracers-dtrace.h*
rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
+ rm -f $(foreach f,$(GENERATED_BLOCK_HEADERS),$(f) $(f)-timestamp)
+ rm -f $(foreach f,$(GENERATED_BLOCK_SOURCES),$(f) $(f)-timestamp)
rm -rf qapi-generated
rm -rf qga/qapi-generated
+ rm -rf block/qapi-generated
for d in $(ALL_SUBDIRS); do \
if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
rm -f $$d/qemu-options.def; \
@@ -548,7 +576,8 @@ endif # CONFIG_WIN
# Add a dependency on the generated files, so that they are always
# rebuilt before other object files
ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
-Makefile: $(GENERATED_HEADERS)
+Makefile: $(GENERATED_HEADERS) $(GENERATED_BLOCK_HEADERS)\
+ $(GENERATED_BLOCK_SOURCES)
endif
# Include automatically generated dependency files
@@ -21,6 +21,10 @@ block-obj-y += coroutine-$(CONFIG_COROUTINE_BACKEND).o
block-obj-m = block/
+qapi-block-obj-y = block/qapi-generated/qmp-marshal.o blockdev.o qmp.o
+qapi-block-obj-y += qmp-stub.o qemu-log.o
+qapi-block-obj-y += block/
+qapi-block-obj-y += qom/
######################################################################
# smartcard
@@ -20,10 +20,13 @@ block-obj-$(CONFIG_GLUSTERFS) += gluster.o
block-obj-$(CONFIG_LIBSSH2) += ssh.o
endif
-common-obj-y += stream.o
-common-obj-y += commit.o
-common-obj-y += mirror.o
-common-obj-y += backup.o
+block-job-obj-y = stream.o
+block-job-obj-y += commit.o
+block-job-obj-y += mirror.o
+block-job-obj-y += backup.o
+
+common-obj-y += $(block-job-obj-y)
+qapi-block-obj-y += $(block-job-obj-y)
iscsi.o-cflags := $(LIBISCSI_CFLAGS)
iscsi.o-libs := $(LIBISCSI_LIBS)
new file mode 100644
@@ -0,0 +1,77 @@
+/*
+ * QEMU monitor
+ *
+ * Copyright (c) 2003-2004 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* this file contains function stubs and variables required to link
+ * monitor.o with something other than vl.o.
+ * It's used to link monitor.o with qemu-nbd and qemu-io.
+ */
+
+#include "sysemu/sysemu.h"
+#include "sysemu/kvm.h"
+#include "sysemu/char.h"
+#include "ui/console.h"
+
+bool is_daemonized(void)
+{
+ return 0;
+}
+
+CharDriverState *vc_init(ChardevVC *vc)
+{
+ return NULL;
+}
+
+void qemu_add_machine_init_done_notifier(Notifier *notify)
+{
+}
+
+void kvm_cpu_synchronize_post_init(CPUState *cpu)
+{
+
+}
+
+void kvm_cpu_synchronize_state(CPUState *cpu)
+{
+}
+
+int runstate_is_running(void)
+{
+ return 1;
+}
+
+CharDriverState *qemu_chr_open_msmouse(void)
+{
+ return NULL;
+}
+
+CharDriverState *serial_hds[MAX_SERIAL_PORTS];
+
+struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
+
+bool kvm_allowed;
+
+int autostart;
+
+const uint32_t arch_type = -1;
+
@@ -1,3 +1,6 @@
-common-obj-y = object.o container.o qom-qobject.o
-common-obj-y += cpu.o
-common-obj-y += object_interfaces.o
+qom-obj-y = object.o container.o qom-qobject.o
+qom-obj-y += cpu.o
+qom-obj-y += object_interfaces.o
+
+common-obj-y += $(qom-obj-y)
+qapi-block-obj-y += $(qom-obj-y)
Compile and link QAPI block core code into qemu-nbd. This patch circle around unwanted dependecies by stubing some functions in qmp-stub.c. Signed-off-by: Benoit Canet <benoit@irqsave.net> --- Makefile | 33 +++++++++++++++++++++-- Makefile.objs | 4 +++ block/Makefile.objs | 11 +++++--- qmp-stub.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ qom/Makefile.objs | 9 ++++--- 5 files changed, 125 insertions(+), 9 deletions(-) create mode 100644 qmp-stub.c