[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 090/143] meson: convert hw/usb
From: |
Paolo Bonzini |
Subject: |
[PATCH 090/143] meson: convert hw/usb |
Date: |
Thu, 6 Aug 2020 21:15:26 +0200 |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
Makefile.target | 1 +
hw/Makefile.objs | 1 -
hw/meson.build | 1 +
hw/usb/Makefile.objs | 71 ----------------------------------------------------
hw/usb/meson.build | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++
meson.build | 15 +++++++++++
6 files changed, 86 insertions(+), 72 deletions(-)
delete mode 100644 hw/usb/Makefile.objs
create mode 100644 hw/usb/meson.build
diff --git a/Makefile.target b/Makefile.target
index 386378b..3d5a2af 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -168,6 +168,7 @@ endif
LIBS := $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS) $(OPENGL_LIBS)
$(SECCOMP_LIBS)
LIBS := $(LIBS) $(COREAUDIO_LIBS) $(DSOUND_LIBS)
LIBS := $(LIBS) $(VDE_LIBS) $(SLIRP_LIBS)
+LIBS := $(LIBS) $(LIBUSB_LIBS) $(SMARTCARD_LIBS) $(USB_REDIR_LIBS)
# Hardware support
ifeq ($(TARGET_NAME), sparc64)
diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index f6e08f6..c2619bb 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -30,7 +30,6 @@ devices-dirs-y += sd/
devices-dirs-y += ssi/
devices-dirs-y += timer/
devices-dirs-$(CONFIG_TPM) += tpm/
-devices-dirs-y += usb/
endif
common-obj-y += $(devices-dirs-y)
diff --git a/hw/meson.build b/hw/meson.build
index 4dafc8a..89bd6ad 100644
--- a/hw/meson.build
+++ b/hw/meson.build
@@ -3,6 +3,7 @@ subdir('mem')
subdir('nubus')
subdir('semihosting')
subdir('smbios')
+subdir('usb')
subdir('vfio')
subdir('virtio')
subdir('watchdog')
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
deleted file mode 100644
index e342ff5..0000000
--- a/hw/usb/Makefile.objs
+++ /dev/null
@@ -1,71 +0,0 @@
-# usb subsystem core
-common-obj-y += core.o combined-packet.o bus.o libhw.o
-common-obj-$(CONFIG_USB) += desc.o desc-msos.o
-
-# usb host adapters
-common-obj-$(CONFIG_USB_UHCI) += hcd-uhci.o
-common-obj-$(CONFIG_USB_OHCI) += hcd-ohci.o
-common-obj-$(CONFIG_USB_OHCI_PCI) += hcd-ohci-pci.o
-common-obj-$(CONFIG_USB_EHCI) += hcd-ehci.o
-common-obj-$(CONFIG_USB_EHCI_PCI) += hcd-ehci-pci.o
-common-obj-$(CONFIG_USB_EHCI_SYSBUS) += hcd-ehci-sysbus.o
-common-obj-$(CONFIG_USB_XHCI) += hcd-xhci.o
-common-obj-$(CONFIG_USB_XHCI_NEC) += hcd-xhci-nec.o
-common-obj-$(CONFIG_USB_MUSB) += hcd-musb.o
-common-obj-$(CONFIG_USB_DWC2) += hcd-dwc2.o
-
-common-obj-$(CONFIG_TUSB6010) += tusb6010.o
-common-obj-$(CONFIG_IMX) += chipidea.o
-
-# emulated usb devices
-common-obj-$(CONFIG_USB) += dev-hub.o
-common-obj-$(CONFIG_USB) += dev-hid.o
-common-obj-$(CONFIG_USB_TABLET_WACOM) += dev-wacom.o
-common-obj-$(CONFIG_USB_STORAGE_BOT) += dev-storage.o
-common-obj-$(CONFIG_USB_STORAGE_UAS) += dev-uas.o
-common-obj-$(CONFIG_USB_AUDIO) += dev-audio.o
-common-obj-$(CONFIG_USB_SERIAL) += dev-serial.o
-common-obj-$(CONFIG_USB_NETWORK) += dev-network.o
-
-ifeq ($(CONFIG_USB_SMARTCARD),y)
-common-obj-y += dev-smartcard-reader.o
-ifeq ($(CONFIG_SMARTCARD),y)
-common-obj-m += smartcard.mo
-smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
-smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
-smartcard.mo-libs := $(SMARTCARD_LIBS)
-endif
-endif
-
-ifeq ($(CONFIG_POSIX),y)
-common-obj-$(CONFIG_USB_STORAGE_MTP) += dev-mtp.o
-endif
-
-# usb redirection
-ifeq ($(CONFIG_USB),y)
-ifeq ($(CONFIG_USB_REDIR),y)
-common-obj-m += redirect.mo
-redirect.mo-objs = redirect.o quirks.o
-redirect.mo-cflags = $(USB_REDIR_CFLAGS)
-redirect.mo-libs = $(USB_REDIR_LIBS)
-endif
-endif
-
-# usb pass-through
-ifeq ($(CONFIG_USB_LIBUSB)$(CONFIG_USB),yy)
-common-obj-y += host-libusb.o
-else
-common-obj-y += host-stub.o
-endif
-common-obj-$(CONFIG_ALL) += host-stub.o
-
-host-libusb.o-cflags := $(LIBUSB_CFLAGS)
-host-libusb.o-libs := $(LIBUSB_LIBS)
-
-ifeq ($(CONFIG_USB_LIBUSB),y)
-common-obj-$(CONFIG_XEN) += xen-usb.o
-xen-usb.o-cflags := $(LIBUSB_CFLAGS)
-xen-usb.o-libs := $(LIBUSB_LIBS)
-endif
-
-common-obj-$(CONFIG_IMX_USBPHY) += imx-usb-phy.o
diff --git a/hw/usb/meson.build b/hw/usb/meson.build
new file mode 100644
index 0000000..f40d158
--- /dev/null
+++ b/hw/usb/meson.build
@@ -0,0 +1,69 @@
+hw_usb_modules = []
+
+# usb subsystem core
+softmmu_ss.add(files(
+ 'bus.c',
+ 'combined-packet.c',
+ 'core.c',
+ 'libhw.c'
+))
+
+softmmu_ss.add(when: 'CONFIG_USB', if_true: files(
+ 'desc.c',
+ 'desc-msos.c',
+))
+
+# usb host adapters
+softmmu_ss.add(when: 'CONFIG_USB_UHCI', if_true: files('hcd-uhci.c'))
+softmmu_ss.add(when: 'CONFIG_USB_OHCI', if_true: files('hcd-ohci.c'))
+softmmu_ss.add(when: 'CONFIG_USB_OHCI_PCI', if_true: files('hcd-ohci-pci.c'))
+softmmu_ss.add(when: 'CONFIG_USB_EHCI', if_true: files('hcd-ehci.c'))
+softmmu_ss.add(when: 'CONFIG_USB_EHCI_PCI', if_true: files('hcd-ehci-pci.c'))
+softmmu_ss.add(when: 'CONFIG_USB_EHCI_SYSBUS', if_true: files('hcd-ehci.c',
'hcd-ehci-sysbus.c'))
+softmmu_ss.add(when: 'CONFIG_USB_XHCI', if_true: files('hcd-xhci.c'))
+softmmu_ss.add(when: 'CONFIG_USB_XHCI_NEC', if_true: files('hcd-xhci-nec.c'))
+softmmu_ss.add(when: 'CONFIG_USB_MUSB', if_true: files('hcd-musb.c'))
+softmmu_ss.add(when: 'CONFIG_USB_DWC2', if_true: files('hcd-dwc2.c'))
+
+softmmu_ss.add(when: 'CONFIG_TUSB6010', if_true: files('tusb6010.c'))
+softmmu_ss.add(when: 'CONFIG_IMX', if_true: files('chipidea.c'))
+softmmu_ss.add(when: 'CONFIG_IMX_USBPHY', if_true: files('imx-usb-phy.c'))
+
+# emulated usb devices
+softmmu_ss.add(when: 'CONFIG_USB', if_true: files('dev-hub.c'))
+softmmu_ss.add(when: 'CONFIG_USB', if_true: files('dev-hid.c'))
+softmmu_ss.add(when: 'CONFIG_USB_TABLET_WACOM', if_true: files('dev-wacom.c'))
+softmmu_ss.add(when: 'CONFIG_USB_STORAGE_BOT', if_true: files('dev-storage.c'))
+softmmu_ss.add(when: 'CONFIG_USB_STORAGE_UAS', if_true: files('dev-uas.c'))
+softmmu_ss.add(when: 'CONFIG_USB_AUDIO', if_true: files('dev-audio.c'))
+softmmu_ss.add(when: 'CONFIG_USB_SERIAL', if_true: files('dev-serial.c'))
+softmmu_ss.add(when: 'CONFIG_USB_NETWORK', if_true: files('dev-network.c'))
+softmmu_ss.add(when: ['CONFIG_POSIX', 'CONFIG_USB_STORAGE_MTP'], if_true:
files('dev-mtp.c'))
+
+# smartcard
+softmmu_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true:
files('dev-smartcard-reader.c'))
+
+if config_host.has_key('CONFIG_SMARTCARD')
+ hw_usb_modules += [['smartcard', files(
+ 'ccid-card-emulated.c',
+ 'ccid-card-passthru.c',
+ ), [cacard], ['CONFIG_USB_SMARTCARD']]]
+endif
+
+# usb redirect
+if config_host.has_key('CONFIG_USB_REDIR')
+ hw_usb_modules += [['redirect', files(
+ 'redirect.c',
+ 'quirks.c',
+ ), [usbredir], ['CONFIG_USB']]]
+endif
+
+# usb pass-through
+softmmu_ss.add(when: ['CONFIG_USB', 'CONFIG_USB_LIBUSB', libusb],
+ if_true: files('host-libusb.c'),
+ if_false: files('host-stub.c'))
+softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('host-stub.c'))
+
+softmmu_ss.add(when: ['CONFIG_USB', 'CONFIG_XEN', libusb], if_true:
files('xen-usb.c'))
+
+modules += { 'hw-usb': hw_usb_modules }
diff --git a/meson.build b/meson.build
index 550e454..e2a80b8 100644
--- a/meson.build
+++ b/meson.build
@@ -313,6 +313,21 @@ 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
+cacard = not_found
+if 'CONFIG_SMARTCARD' in config_host
+ cacard = declare_dependency(compile_args:
config_host['SMARTCARD_CFLAGS'].split(),
+ link_args: config_host['SMARTCARD_LIBS'].split())
+endif
+usbredir = not_found
+if 'CONFIG_USB_REDIR' in config_host
+ usbredir = declare_dependency(compile_args:
config_host['USB_REDIR_CFLAGS'].split(),
+ link_args:
config_host['USB_REDIR_LIBS'].split())
+endif
+libusb = not_found
+if 'CONFIG_USB_LIBUSB' in config_host
+ libusb = declare_dependency(compile_args:
config_host['LIBUSB_CFLAGS'].split(),
+ link_args: config_host['LIBUSB_LIBS'].split())
+endif
create_config = find_program('scripts/create_config')
minikconf = find_program('scripts/minikconf.py')
--
1.8.3.1
- [PATCH 081/143] meson: convert hw/xen, (continued)
- [PATCH 081/143] meson: convert hw/xen, Paolo Bonzini, 2020/08/06
- [PATCH 082/143] meson: convert hw/core, Paolo Bonzini, 2020/08/06
- [PATCH 084/143] meson: convert hw/nubus, Paolo Bonzini, 2020/08/06
- [PATCH 083/143] meson: convert hw/semihosting, Paolo Bonzini, 2020/08/06
- [PATCH 085/143] meson: convert hw/smbios, Paolo Bonzini, 2020/08/06
- [PATCH 087/143] meson: convert hw/watchdog, Paolo Bonzini, 2020/08/06
- [PATCH 086/143] meson: convert hw/mem, Paolo Bonzini, 2020/08/06
- [PATCH 088/143] meson: convert hw/virtio, Paolo Bonzini, 2020/08/06
- [PATCH 089/143] meson: convert hw/vfio, Paolo Bonzini, 2020/08/06
- [PATCH 091/143] meson: convert hw/tpm, Paolo Bonzini, 2020/08/06
- [PATCH 090/143] meson: convert hw/usb,
Paolo Bonzini <=
- [PATCH 093/143] meson: convert hw/rtc, Paolo Bonzini, 2020/08/06
- [PATCH 092/143] meson: convert hw/timer, Paolo Bonzini, 2020/08/06
- [PATCH 094/143] meson: convert hw/ssi, Paolo Bonzini, 2020/08/06
- [PATCH 095/143] meson: convert hw/sd, Paolo Bonzini, 2020/08/06
- [PATCH 096/143] meson: convert hw/scsi, Paolo Bonzini, 2020/08/06
- [PATCH 097/143] meson: convert hw/pcmcia, Paolo Bonzini, 2020/08/06
- [PATCH 098/143] meson: convert hw/pci-host, Paolo Bonzini, 2020/08/06
- [PATCH 099/143] meson: convert hw/pci-bridge, Paolo Bonzini, 2020/08/06
- [PATCH 100/143] meson: convert hw/pci, Paolo Bonzini, 2020/08/06