From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
configure | 4 ++++
hw/Makefile.objs | 1 -
hw/meson.build | 1 +
hw/xen/Makefile.objs | 6 ------
hw/xen/meson.build | 18 ++++++++++++++++++
meson.build | 6 ++++++
6 files changed, 29 insertions(+), 7 deletions(-)
create mode 100644 hw/meson.build
delete mode 100644 hw/xen/Makefile.objs
create mode 100644 hw/xen/meson.build
diff --git a/configure b/configure
index cfc7a5352c..aa51bb783c 100755
--- a/configure
+++ b/configure
@@ -2494,6 +2494,8 @@ if test "$xen" != "no" ; then
fi
QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
+ xen_cflags="$($pkg_config --cflags $xen_pc)"
+ xen_libs="$($pkg_config --libs $xen_pc)"
else
xen_libs="-lxenstore -lxenctrl -lxenguest"
@@ -7014,6 +7016,8 @@ fi
if test "$xen" = "yes" ; then
echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
+ echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak
+ echo "XEN_LIBS=$xen_libs" >> $config_host_mak
fi
if test "$linux_aio" = "yes" ; then
echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index 660e2b4373..f0ca15595a 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -35,7 +35,6 @@ devices-dirs-y += usb/
devices-dirs-$(CONFIG_VFIO) += vfio/
devices-dirs-y += virtio/
devices-dirs-y += watchdog/
-devices-dirs-y += xen/
devices-dirs-$(CONFIG_MEM_DEVICE) += mem/
devices-dirs-$(CONFIG_NUBUS) += nubus/
devices-dirs-y += semihosting/
diff --git a/hw/meson.build b/hw/meson.build
new file mode 100644
index 0000000000..08112a5e4b
--- /dev/null
+++ b/hw/meson.build
@@ -0,0 +1 @@
+subdir('xen')
diff --git a/hw/xen/Makefile.objs b/hw/xen/Makefile.objs
deleted file mode 100644
index 84df60a928..0000000000
--- a/hw/xen/Makefile.objs
+++ /dev/null
@@ -1,6 +0,0 @@
-# xen backend driver support
-common-obj-$(CONFIG_XEN) += xen-legacy-backend.o xen_devconfig.o xen_pvdev.o xen-common.o xen-bus.o xen-bus-helper.o xen-backend.o
-
-obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
-obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_graphics.o xen_pt_msi.o
-obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt_load_rom.o
diff --git a/hw/xen/meson.build b/hw/xen/meson.build
new file mode 100644
index 0000000000..e9587b61ce
--- /dev/null
+++ b/hw/xen/meson.build
@@ -0,0 +1,18 @@
+softmmu_ss.add(when: ['CONFIG_XEN', xen], if_true: files(
+ 'xen-backend.c',
+ 'xen-bus-helper.c',
+ 'xen-bus.c',
+ 'xen-common.c',
+ 'xen-legacy-backend.c',
+ 'xen_devconfig.c',
+ 'xen_pvdev.c',
+))
+
+specific_ss.add(when: 'CONFIG_XEN_PCI_PASSTHROUGH', if_true: files(
+ 'xen-host-pci-device.c',
+ 'xen_pt.c',
+ 'xen_pt_config_init.c',
+ 'xen_pt_graphics.c',
+ 'xen_pt_load_rom.c',
+ 'xen_pt_msi.c',
+))
diff --git a/meson.build b/meson.build
index 701f079345..583c42ccf5 100644
--- a/meson.build
+++ b/meson.build
@@ -294,6 +294,11 @@ numa = declare_dependency()
if 'CONFIG_NUMA' in config_host
numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
endif
+xen = declare_dependency()
+if 'CONFIG_XEN_BACKEND' in config_host
+ xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
+ link_args: config_host['XEN_LIBS'].split())
+endif
create_config = find_program('scripts/create_config')
minikconf = find_program('scripts/minikconf.py')
@@ -628,6 +633,7 @@ subdir('migration')
subdir('monitor')
subdir('net')
subdir('replay')
+subdir('hw')
mods = []
block_mods = []
--
2.21.0