build-sys: make HMP source files conditional on have_hmp

Exclude all *-hmp-cmds.c files and HMP-only source files from the
build when HMP is disabled.

Also conditionalise the hmp-commands.hx header generation and the
test-hmp qtest.

Acked-by: Dr. David Alan Gilbert <dave@treblig.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260828-qemu-no-hmp-v5-45-9227de146347@redhat.com>
This commit is contained in:
Marc-André Lureau committed 2026-08-29 12:07:45 +04:00
1 parent be86cd220a
commit 34c5de5c6d
23 files changed
+86 -32

No files matched your search

+3 -1
View File
@@ -9,7 +9,9 @@ audio_ss.add(files(
))
# deprecated since v10.2, to be removed
system_ss.add(files('audio-hmp-cmds.c', 'wavcapture.c'))
if have_hmp
system_ss.add(files('audio-hmp-cmds.c', 'wavcapture.c'))
endif
audio_modules = {}
foreach m : [
+4 -1
View File
@@ -1,6 +1,5 @@
system_ss.add([files(
'cryptodev-builtin.c',
'cryptodev-hmp-cmds.c',
'cryptodev.c',
'hostmem-ram.c',
'hostmem.c',
@@ -10,6 +9,10 @@ system_ss.add([files(
'confidential-guest-support.c',
), numa])
if have_hmp
system_ss.add(files('cryptodev-hmp-cmds.c'))
endif
if host_os != 'windows'
system_ss.add(files('rng-random.c'))
if host_os != 'emscripten'
+3 -1
View File
@@ -1,3 +1,5 @@
system_ss.add(files('block-hmp-cmds.c'))
if have_hmp
system_ss.add(files('block-hmp-cmds.c'))
endif
block_ss.add(files('bitmap-qmp-cmds.c'))
system_ss.add(files('qmp-cmds.c'))
+4 -1
View File
@@ -30,11 +30,14 @@ endif
chardev_ss = chardev_ss.apply({})
system_ss.add(files(
'char-hmp-cmds.c',
'msmouse.c',
'wctablet.c',
'testdev.c'))
if have_hmp
system_ss.add(files('char-hmp-cmds.c'))
endif
chardev_modules = {}
if brlapi.found()
+3 -1
View File
@@ -20,5 +20,7 @@ common_ss.add(when: 'CONFIG_TCG', if_true: files(
'objdump.c'
))
common_ss.add(files('disas-common.c'))
system_ss.add(files('disas-mon.c'))
if have_hmp
system_ss.add(files('disas-mon.c'))
endif
specific_ss.add(capstone)
+4 -1
View File
@@ -1,3 +1,6 @@
system_ss.add([files('dump.c', 'dump-hmp-cmds.c'), snappy, lzo])
system_ss.add([files('dump.c'), snappy, lzo])
if have_hmp
system_ss.add(files('dump-hmp-cmds.c'))
endif
specific_ss.add(when: 'CONFIG_WINDUMP', if_true: files('win_dump-x86.c'))
system_ss.add(when: 'CONFIG_WINDUMP', if_false: files('win_dump-stubs.c'))
+3 -2
View File
@@ -26,13 +26,11 @@ system_ss.add(when: 'CONFIG_SPLIT_IRQ', if_true: files('split-irq.c'))
system_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('stream.c'))
system_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true: files('sysbus-fdt.c'))
system_ss.add(when: 'CONFIG_EIF', if_true: [files('eif.c'), zlib, libcbor, gnutls])
system_ss.add(files(
'cpu-system.c',
'fw-path-provider.c',
'hotplug.c',
'loader.c',
'machine-hmp-cmds.c',
'machine-qmp-cmds.c',
'machine.c',
'nmi.c',
@@ -46,6 +44,9 @@ system_ss.add(files(
'vm-change-state-handler.c',
'clock-vmstate.c',
))
if have_hmp
system_ss.add(files('machine-hmp-cmds.c'))
endif
user_ss.add(files(
'cpu-user.c',
'qdev-user.c',
+3 -1
View File
@@ -24,7 +24,9 @@ i386_ss.add(when: 'CONFIG_VTD', if_true: files('intel_iommu.c'))
i386_ss.add(when: 'CONFIG_VTD_ACCEL', if_true: files('intel_iommu_accel.c'))
i386_ss.add(when: 'CONFIG_SGX', if_true: files('sgx-epc.c','sgx.c'),
if_false: files('sgx-stub.c'))
stub_ss.add(files('sgx-hmp-stub.c'))
if have_hmp
stub_ss.add(files('sgx-hmp-stub.c'))
endif
i386_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-common.c'))
i386_ss.add(when: 'CONFIG_PC', if_true: files(
+3 -1
View File
@@ -67,6 +67,8 @@ system_ss.add(when: 'CONFIG_ROCKER', if_true: files(
'rocker/rocker_world.c',
))
stub_ss.add(files('rocker/rocker-stubs.c'))
system_ss.add(files('rocker/rocker-hmp-cmds.c'))
if have_hmp
system_ss.add(files('rocker/rocker-hmp-cmds.c'))
endif
subdir('can')
+3 -1
View File
@@ -5,12 +5,14 @@ pci_ss.add(files(
'pci.c',
'pci_bridge.c',
'pci_host.c',
'pci-hmp-cmds.c',
'pci-qmp-cmds.c',
'pcie_sriov.c',
'shpc.c',
'slotid_cap.c'
))
if have_hmp
pci_ss.add(files('pci-hmp-cmds.c'))
endif
# The functions in these modules can be used by devices too. Since we
# allow plugging PCIe devices into PCI buses, include them even if
# CONFIG_PCI_EXPRESS=n.
+3 -1
View File
@@ -100,6 +100,8 @@ stub_ss.add(files('vhost-user-stub.c'))
stub_ss.add(files('virtio-stub.c'))
stub_ss.add(files('virtio-md-stubs.c'))
system_ss.add(files('virtio-hmp-cmds.c'))
if have_hmp
system_ss.add(files('virtio-hmp-cmds.c'))
endif
system_ss.add(when: 'CONFIG_ACPI', if_true: files('virtio-acpi.c'))
+1 -1
View File
@@ -3548,7 +3548,7 @@ hx_headers = [
['qemu-options.hx', 'qemu-options.def'],
['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
]
if have_system
if have_system and have_hmp
hx_headers += [
['hmp-commands.hx', 'hmp-commands.h'],
['hmp-commands-info.hx', 'hmp-commands-info.h'],
+3 -1
View File
@@ -36,7 +36,9 @@ system_ss.add(files(
'socket.c',
'tls.c',
), gnutls, zlib)
system_ss.add([spice_headers, files('migration-hmp-cmds.c'), spice])
if have_hmp
system_ss.add([spice_headers, files('migration-hmp-cmds.c'), spice])
endif
if get_option('replication').allowed()
system_ss.add(files('colo-failover.c', 'colo.c', 'multifd-colo.c'))
-2
View File
@@ -1731,9 +1731,7 @@ static int get_monitor_def(MonitorHMP *hmp, int64_t *pval, const char *name)
if (cs == NULL) {
return -1;
}
#ifdef CONFIG_HMP
md = cs->cc->sysemu_ops->monitor_defs;
#endif
if (md == NULL) {
return -1;
}
+7 -2
View File
@@ -2,8 +2,13 @@ qmp_ss.add(files('monitor.c', 'qmp.c', 'qmp-cmds-control.c'))
system_ss.add(files(
'fds.c',
'hmp-cmds.c',
'hmp.c',
'qemu-config-qmp.c',
'qmp-cmds.c',
))
if have_hmp
system_ss.add(files(
'hmp-cmds.c',
'hmp.c',
))
endif
+3 -1
View File
@@ -8,7 +8,6 @@ system_ss.add(files(
'filter-mirror.c',
'filter.c',
'hub.c',
'net-hmp-cmds.c',
'net.c',
'queue.c',
'socket.c',
@@ -16,6 +15,9 @@ system_ss.add(files(
'stream_data.c',
'util.c',
))
if have_hmp
system_ss.add(files('net-hmp-cmds.c'))
endif
if get_option('replication').allowed() or \
get_option('colo_proxy').allowed()
+3 -1
View File
@@ -10,4 +10,6 @@ if have_system
endif
qmp_ss.add(files('qom-qmp-cmds.c'))
system_ss.add(files('qom-hmp-cmds.c'))
if have_hmp
system_ss.add(files('qom-hmp-cmds.c'))
endif
+4 -1
View File
@@ -1 +1,4 @@
system_ss.add(files('stats-hmp-cmds.c', 'stats-qmp-cmds.c'))
system_ss.add(files('stats-qmp-cmds.c'))
if have_hmp
system_ss.add(files('stats-hmp-cmds.c'))
endif
+7 -5
View File
@@ -86,11 +86,13 @@ if have_system
stub_ss.add(files('qmp-cpu.c'))
stub_ss.add(files('qmp-cpu-s390x.c'))
stub_ss.add(files('qmp-cpu-s390x-kvm.c'))
stub_ss.add(files('hmp-cmd-info_mem.c'))
stub_ss.add(files('hmp-cmd-info_sev.c'))
stub_ss.add(files('hmp-cmd-info_tlb.c'))
stub_ss.add(files('hmp-cmds-hw-s390x.c'))
stub_ss.add(files('hmp-cmds-target-i386.c'))
if have_hmp
stub_ss.add(files('hmp-cmd-info_mem.c'))
stub_ss.add(files('hmp-cmd-info_sev.c'))
stub_ss.add(files('hmp-cmd-info_tlb.c'))
stub_ss.add(files('hmp-cmds-hw-s390x.c'))
stub_ss.add(files('hmp-cmds-target-i386.c'))
endif
endif
if have_system or have_user
+8 -3
View File
@@ -9,7 +9,6 @@ system_ss.add(files(
'cpus.c',
'cpu-timers.c',
'dirtylimit.c',
'dirtylimit-hmp-cmds.c',
'dma-helpers.c',
'exit-with-parent.c',
'globals.c',
@@ -24,12 +23,18 @@ system_ss.add(files(
'qtest.c',
'rtc.c',
'runstate-action.c',
'runstate-hmp-cmds.c',
'runstate.c',
'tpm-hmp-cmds.c',
'watchpoint.c',
))
if have_hmp
system_ss.add(files(
'dirtylimit-hmp-cmds.c',
'runstate-hmp-cmds.c',
'tpm-hmp-cmds.c',
))
endif
if have_tpm
system_ss.add(files('tpm.c'))
endif
+7 -1
View File
@@ -26,7 +26,13 @@ qtests_generic = [
'qmp-test',
'qmp-cmd-test',
'qom-test',
'test-hmp',
]
if have_hmp
qtests_generic += [
'test-hmp',
]
endif
qtests_generic += [
'qos-test',
'readconfig-test',
'netdev-socket',
+4 -1
View File
@@ -1,4 +1,7 @@
system_ss.add(files('control-target.c', 'trace-hmp-cmds.c'))
system_ss.add(files('control-target.c'))
if have_hmp
system_ss.add(files('trace-hmp-cmds.c'))
endif
trace_rs_targets = []
trace_events_files = []
foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events
+3 -1
View File
@@ -56,10 +56,12 @@ system_ss.add(png)
system_ss.add(files(
'input-barrier.c',
'input.c',
'ui-hmp-cmds.c',
'ui-qmp-cmds.c',
'util.c',
))
if have_hmp
system_ss.add(files('ui-hmp-cmds.c'))
endif
system_ss.add(ui)
system_ss.add(when: pixman, if_true: files('console-vc.c'), if_false: files('console-vc-stubs.c'))
if dbus_display