3 ifneq ($(words $(subst :, ,$(CURDIR
))), 1)
4 $(error main directory cannot contain spaces nor colons
)
7 # Always point to the root of the build tree (needs GNU make).
10 # Before including a proper config-host.mak, assume we are in the source tree
13 UNCHECKED_GOALS
:= %clean TAGS cscope ctags
dist \
15 help check-help print-
% \
16 docker docker-
% vm-help vm-test vm-build-
%
18 # All following code might depend on configuration variables
19 ifneq ($(wildcard config-host.mak
),)
20 # Put the all: rule here so that config-host.mak can contain dependencies.
22 include config-host.mak
26 .PHONY
: git-submodule-update
28 git_module_status
:= $(shell \
30 GIT
="$(GIT)" .
/scripts
/git-submodule.sh status
$(GIT_SUBMODULES
); \
34 ifeq (1,$(git_module_status
))
35 ifeq (no
,$(GIT_UPDATE
))
37 $(call quiet-command
, \
39 echo
"GIT submodule checkout is out of date. Please run" && \
40 echo
" scripts/git-submodule.sh update $(GIT_SUBMODULES)" && \
41 echo
"from the source directory checkout $(SRC_PATH)" && \
46 $(call quiet-command
, \
47 (cd
$(SRC_PATH
) && GIT
="$(GIT)" .
/scripts
/git-submodule.sh update
$(GIT_SUBMODULES
)), \
48 "GIT","$(GIT_SUBMODULES)")
52 export NINJA
=.
/ninjatool
54 # Running meson regenerates both build.ninja and ninjatool, and that is
55 # enough to prime the rest of the build.
56 ninjatool
: build.ninja
58 # Only needed in case Makefile.ninja does not exist.
59 .PHONY
: ninja-clean ninja-distclean clean-ctlist
63 build.ninja
: config-host.mak
65 Makefile.ninja
: build.ninja ninjatool
66 .
/ninjatool
-t ninja2make
--omit
clean dist uninstall < $< > $@
67 -include Makefile.ninja
69 ${ninja-targets-c_COMPILER
} ${ninja-targets-cpp_COMPILER
}: .var.command
+= -MP
71 # If MESON is empty, the rule will be re-evaluated after Makefiles are
72 # reread (and MESON won't be empty anymore).
74 Makefile.mtest
: build.ninja scripts
/mtest2make.py
75 $(MESON
) introspect
--tests |
$(PYTHON
) scripts
/mtest2make.py
> $@
76 -include Makefile.mtest
79 .git-submodule-status
: git-submodule-update config-host.mak
81 # Check that we're not trying to do an out-of-tree build from
82 # a tree that's been used for an in-tree build.
83 ifneq ($(realpath
$(SRC_PATH
)),$(realpath .
))
84 ifneq ($(wildcard $(SRC_PATH
)/config-host.mak
),)
85 $(error This is an out of tree build but your source tree
($(SRC_PATH
)) \
86 seems to have been used for an in-tree build. You can fix this by running \
87 "$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree
)
91 CONFIG_SOFTMMU
:= $(if
$(filter %-softmmu
,$(TARGET_DIRS
)),y
)
92 CONFIG_USER_ONLY
:= $(if
$(filter %-user
,$(TARGET_DIRS
)),y
)
93 CONFIG_XEN
:= $(CONFIG_XEN_BACKEND
)
95 -include config-all-devices.mak
96 -include config-all-disas.mak
98 config-host.mak
: $(SRC_PATH
)/configure
$(SRC_PATH
)/pc-bios
$(SRC_PATH
)/VERSION
99 @echo
$@ is out-of-date
, running configure
100 @if
test -f meson-private
/coredata.dat
; then \
101 .
/config.status
--skip-meson
; \
106 # Force configure to re-run if the API symbols are updated
107 ifeq ($(CONFIG_PLUGIN
),y
)
108 config-host.mak
: $(SRC_PATH
)/plugins
/qemu-plugins.symbols
113 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
114 @echo
"Please call configure before running make!"
119 include $(SRC_PATH
)/rules.mak
121 # lor is defined in rules.mak
122 CONFIG_BLOCK
:= $(call lor
,$(CONFIG_SOFTMMU
),$(CONFIG_TOOLS
))
124 generated-files-y
= config-host.h
126 generated-files-y
+= module_block.h
128 generated-files-y
+= .git-submodule-status
130 # Don't try to regenerate Makefile or configure
131 # We don't generate any of them
135 .PHONY
: all clean cscope
distclean html
info install install-doc \
136 pdf txt recurse-all
dist msi FORCE
138 $(call set-vpath
, $(SRC_PATH
))
140 LIBS
+=-lz
$(LIBS_TOOLS
)
142 HELPERS-y
= $(HELPERS
)
144 # Sphinx does not allow building manuals into the same directory as
145 # the source files, so if we're doing an in-tree QEMU build we must
146 # build the manuals into a subdirectory (and then install them from
147 # there for 'make install'). For an out-of-tree build we can just
148 # use the docs/ subdirectory in the build tree as normal.
149 ifeq ($(realpath
$(SRC_PATH
)),$(realpath .
))
150 MANUAL_BUILDDIR
:= docs
/built
152 MANUAL_BUILDDIR
:= docs
156 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu
.1
157 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/qemu-img
.1
158 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/qemu-nbd
.8
159 DOCS
+=$(MANUAL_BUILDDIR
)/interop
/qemu-ga
.8
160 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
161 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/virtiofsd
.1
163 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu-block-drivers
.7
164 DOCS
+=docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7
165 DOCS
+=docs
/interop
/qemu-ga-ref.html docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7
166 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu-cpu-models
.7
167 DOCS
+=$(MANUAL_BUILDDIR
)/index.html
169 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/virtfs-proxy-helper
.1
171 ifdef CONFIG_TRACE_SYSTEMTAP
172 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/qemu-trace-stap
.1
178 SUBDIR_MAKEFLAGS
=$(if
$(V
),,--no-print-directory
--quiet
) BUILD_DIR
=$(BUILD_DIR
)
179 SUBDIR_DEVICES_MAK
=$(patsubst %, %/config-devices.mak
, $(filter %-softmmu
, $(TARGET_DIRS
)))
180 SUBDIR_DEVICES_MAK_DEP
=$(patsubst %, %.d
, $(SUBDIR_DEVICES_MAK
))
182 ifeq ($(SUBDIR_DEVICES_MAK
),)
183 config-all-devices.mak
: config-host.mak
184 $(call quiet-command
,echo
'# no devices' > $@
,"GEN","$@")
186 config-all-devices.mak
: $(SUBDIR_DEVICES_MAK
) config-host.mak
187 $(call quiet-command
, sed
-n \
188 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
189 $(SUBDIR_DEVICES_MAK
) |
sort -u
> $@
, \
193 -include $(SUBDIR_DEVICES_MAK_DEP
)
195 # This has to be kept in sync with Kconfig.host.
197 $(CONFIG_MINIKCONF_MODE
) \
198 $@
$*/config-devices.mak.d
$< $(SRC_PATH
)/Kconfig \
199 CONFIG_TCG
=$(CONFIG_TCG
) \
200 CONFIG_KVM
=$(CONFIG_KVM
) \
201 CONFIG_SPICE
=$(CONFIG_SPICE
) \
202 CONFIG_IVSHMEM
=$(CONFIG_IVSHMEM
) \
203 CONFIG_TPM
=$(CONFIG_TPM
) \
204 CONFIG_XEN
=$(CONFIG_XEN
) \
205 CONFIG_OPENGL
=$(CONFIG_OPENGL
) \
206 CONFIG_X11
=$(CONFIG_X11
) \
207 CONFIG_VHOST_USER
=$(CONFIG_VHOST_USER
) \
208 CONFIG_VHOST_KERNEL
=$(CONFIG_VHOST_KERNEL
) \
209 CONFIG_VIRTFS
=$(CONFIG_VIRTFS
) \
210 CONFIG_LINUX
=$(CONFIG_LINUX
) \
211 CONFIG_PVRDMA
=$(CONFIG_PVRDMA
)
213 MINIKCONF
= $(PYTHON
) $(SRC_PATH
)/scripts
/minikconf.py
215 $(SUBDIR_DEVICES_MAK
): %/config-devices.mak
: default-configs
/%.mak
$(SRC_PATH
)/Kconfig
$(BUILD_DIR
)/config-host.mak
216 $(call quiet-command
, $(MINIKCONF
) $(MINIKCONF_ARGS
) \
217 > $@.tmp
, "GEN", "$@.tmp")
218 $(call quiet-command
, if
test -f
$@
; then \
219 if cmp
-s
$@.old
$@
; then \
223 if
test -f
$@.old
; then \
224 echo
"WARNING: $@ (user modified) out of date.";\
226 echo
"WARNING: $@ out of date.";\
228 echo
"Run \"$(MAKE) defconfig\" to regenerate."; \
237 rm -f config-all-devices.mak
$(SUBDIR_DEVICES_MAK
)
239 ifneq ($(wildcard config-host.mak
),)
240 include $(SRC_PATH
)/Makefile.objs
243 dummy
:= $(call unnest-vars
,, \
247 storage-daemon-obj-y \
248 storage-daemon-obj-m \
254 include $(SRC_PATH
)/tests
/Makefile.
include
256 all: $(DOCS
) $(if
$(BUILD_DOCS
),sphinxdocs
) $(TOOLS
) $(HELPERS-y
) recurse-all modules
258 config-host.h
: config-host.h-timestamp
259 config-host.h-timestamp
: config-host.mak
261 TARGET_DIRS_RULES
:= $(foreach t
, all fuzz
clean install, $(addsuffix /$(t
), $(TARGET_DIRS
)))
263 SOFTMMU_ALL_RULES
=$(filter %-softmmu
/all, $(TARGET_DIRS_RULES
))
264 $(SOFTMMU_ALL_RULES
): $(authz-obj-y
)
265 $(SOFTMMU_ALL_RULES
): $(block-obj-y
)
266 $(SOFTMMU_ALL_RULES
): $(storage-daemon-obj-y
)
267 $(SOFTMMU_ALL_RULES
): $(chardev-obj-y
)
268 $(SOFTMMU_ALL_RULES
): $(crypto-obj-y
)
269 $(SOFTMMU_ALL_RULES
): $(io-obj-y
)
270 $(SOFTMMU_ALL_RULES
): $(qom-obj-y
)
271 $(SOFTMMU_ALL_RULES
): config-all-devices.mak
273 SOFTMMU_FUZZ_RULES
=$(filter %-softmmu
/fuzz
, $(TARGET_DIRS_RULES
))
274 $(SOFTMMU_FUZZ_RULES
): $(authz-obj-y
)
275 $(SOFTMMU_FUZZ_RULES
): $(block-obj-y
)
276 $(SOFTMMU_FUZZ_RULES
): $(chardev-obj-y
)
277 $(SOFTMMU_FUZZ_RULES
): $(crypto-obj-y
)
278 $(SOFTMMU_FUZZ_RULES
): $(io-obj-y
)
279 $(SOFTMMU_FUZZ_RULES
): config-all-devices.mak
280 $(SOFTMMU_FUZZ_RULES
): $(edk2-decompressed
)
282 .PHONY
: $(TARGET_DIRS_RULES
)
283 # The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
284 # $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
285 $(TARGET_DIRS_RULES
):
286 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" $(notdir $@
),)
288 # LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
289 DTC_MAKE_ARGS
=-I
$(SRC_PATH
)/dtc VPATH
=$(SRC_PATH
)/dtc
-C dtc V
="$(V)" LIBFDT_lib
=""
290 DTC_CFLAGS
=$(CFLAGS
) $(QEMU_CFLAGS
)
291 DTC_CPPFLAGS
=-I
$(SRC_PATH
)/dtc
/libfdt
294 dtc
/all: .git-submodule-status dtc
/libfdt
295 $(call quiet-command
,$(MAKE
) $(DTC_MAKE_ARGS
) CPPFLAGS
="$(DTC_CPPFLAGS)" CFLAGS
="$(DTC_CFLAGS)" LDFLAGS
="$(QEMU_LDFLAGS)" ARFLAGS
="$(ARFLAGS)" CC
="$(CC)" AR
="$(AR)" LD
="$(LD)" $(SUBDIR_MAKEFLAGS
) libfdt
,)
297 dtc
/%: .git-submodule-status
300 # Overriding CFLAGS causes us to lose defines added in the sub-makefile.
301 # Not overriding CFLAGS leads to mis-matches between compilation modes.
302 # Therefore we replicate some of the logic in the sub-makefile.
303 # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
304 # no need to annoy QEMU developers with such things.
305 CAP_CFLAGS
= $(patsubst -W
%,,$(CFLAGS
) $(QEMU_CFLAGS
))
306 CAP_CFLAGS
+= -DCAPSTONE_USE_SYS_DYN_MEM
307 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM
308 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM64
309 CAP_CFLAGS
+= -DCAPSTONE_HAS_POWERPC
310 CAP_CFLAGS
+= -DCAPSTONE_HAS_X86
313 capstone
/all: .git-submodule-status
314 $(call quiet-command
,$(MAKE
) -C
$(SRC_PATH
)/capstone CAPSTONE_SHARED
=no BUILDDIR
="$(BUILD_DIR)/capstone" CC
="$(CC)" AR
="$(AR)" LD
="$(LD)" RANLIB
="$(RANLIB)" CFLAGS
="$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS
) $(BUILD_DIR
)/capstone
/$(LIBCAPSTONE
))
317 slirp
/all: .git-submodule-status
318 $(call quiet-command
,$(MAKE
) -C
$(SRC_PATH
)/slirp \
319 BUILD_DIR
="$(BUILD_DIR)/slirp" \
320 PKG_CONFIG
="$(PKG_CONFIG)" \
321 CC
="$(CC)" AR
="$(AR)" LD
="$(LD)" RANLIB
="$(RANLIB)" \
322 CFLAGS
="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS
="$(QEMU_LDFLAGS)")
324 $(filter %/all, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
327 $(filter %/fuzz
, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
328 $(qom-obj-y
) $(crypto-user-obj-
$(CONFIG_USER_ONLY
))
330 ROM_DIRS
= $(addprefix pc-bios
/, $(ROMS
))
331 ROM_DIRS_RULES
=$(foreach t
, all clean, $(addsuffix /$(t
), $(ROM_DIRS
)))
332 # Only keep -O and -g cflags
333 .PHONY
: $(ROM_DIRS_RULES
)
335 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" CFLAGS
="$(filter -O% -g%,$(CFLAGS))" $(notdir $@
),)
337 .PHONY
: recurse-all recurse-clean recurse-install
338 recurse-all
: $(addsuffix /all, $(TARGET_DIRS
) $(ROM_DIRS
))
339 recurse-clean
: $(addsuffix /clean, $(TARGET_DIRS
) $(ROM_DIRS
))
340 recurse-install
: $(addsuffix /install, $(TARGET_DIRS
))
341 $(addsuffix /install, $(TARGET_DIRS
)): all
343 $(BUILD_DIR
)/version.o
: $(SRC_PATH
)/version.rc config-host.h
344 $(call quiet-command
,$(WINDRES
) -I
$(BUILD_DIR
) -o
$@
$<,"RC","version.o")
346 Makefile
: $(version-obj-y
)
348 ######################################################################
350 COMMON_LDADDS
= libqemuutil.a
352 qemu-img.o
: qemu-img-cmds.h
354 qemu-img
$(EXESUF
): qemu-img.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
355 qemu-nbd
$(EXESUF
): qemu-nbd.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
356 qemu-io
$(EXESUF
): qemu-io.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
357 qemu-storage-daemon
$(EXESUF
): qemu-storage-daemon.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(chardev-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(storage-daemon-obj-y
) $(COMMON_LDADDS
)
359 scsi
/qemu-pr-helper
$(EXESUF
): scsi
/qemu-pr-helper.o scsi
/utils.o
$(authz-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
361 scsi
/qemu-pr-helper
$(EXESUF
): LIBS
+= -ludev
-lmultipath
-lmpathpersist
364 module_block.h
: $(SRC_PATH
)/scripts
/modules
/module_block.py config-host.mak
365 $(call quiet-command
,$(PYTHON
) $< $@ \
366 $(addprefix $(SRC_PATH
)/,$(patsubst %.mo
,%.c
,$(block-obj-m
))), \
369 clean: recurse-clean ninja-clean clean-ctlist
370 -test -f ninjatool
&& .
/ninjatool
$(if
$(V
),-v
,) -t
clean
371 # avoid old build problems by removing potentially incorrect old files
372 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
373 rm -f qemu-options.def
374 find . \
( -name
'*.so' -o
-name
'*.dll' -o
-name
'*.mo' -o
-name
'*.[oda]' \
) -type f \
375 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-aarch64.a \
376 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-arm.a \
377 ! -path .
/roms
/edk2
/BaseTools
/Source
/Python
/UPT
/Dll
/sqlite3.dll \
379 rm -f
$(filter-out %.tlb
,$(TOOLS
)) $(HELPERS-y
) TAGS cscope.
* *.pod
*~
*/*~
380 rm -f fsdev
/*.pod scsi
/*.pod
381 rm -f
$(foreach f
,$(generated-files-y
),$(f
) $(f
)-timestamp
)
382 rm -f config-all-devices.mak
383 rm -f
$(SUBDIR_DEVICES_MAK
)
385 VERSION ?
= $(shell cat VERSION
)
387 dist: qemu-
$(VERSION
).
tar.bz2
390 $(SRC_PATH
)/scripts
/make-release
"$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
392 define clean-manual
=
393 rm -rf
$(MANUAL_BUILDDIR
)/$1/_static
394 rm -f
$(MANUAL_BUILDDIR
)/$1/objects.inv
$(MANUAL_BUILDDIR
)/$1/searchindex.js
$(MANUAL_BUILDDIR
)/$1/*.html
397 distclean: clean ninja-distclean
398 -test -f ninjatool
&& .
/ninjatool
$(if
$(V
),-v
,) -t
clean -g
399 rm -f config-host.mak config-host.h
* $(DOCS
)
400 rm -f tests
/tcg
/config-
*.mak
401 rm -f config-all-devices.mak config-all-disas.mak config.status
402 rm -f
$(SUBDIR_DEVICES_MAK
)
403 rm -f po
/*.mo tests
/qemu-iotests
/common.env
404 rm -f roms
/seabios
/config.mak roms
/vgabios
/config.mak
405 rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
406 rm -rf meson-private meson-logs meson-info compile_commands.json
407 rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest
409 rm -f linux-headers
/asm
410 rm -f docs
/version.texi
411 rm -f docs
/interop
/qemu-ga-qapi.texi docs
/interop
/qemu-qmp-qapi.texi
412 rm -f docs
/interop
/qemu-qmp-ref
.7 docs
/interop
/qemu-ga-ref
.7
413 rm -f docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
414 rm -f docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
415 rm -f docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html
417 $(call clean-manual
,devel
)
418 $(call clean-manual
,interop
)
419 $(call clean-manual
,specs
)
420 $(call clean-manual
,system
)
421 $(call clean-manual
,tools
)
422 $(call clean-manual
,user
)
423 for d in
$(TARGET_DIRS
); do \
424 rm -rf
$$d || exit
1 ; \
428 KEYMAPS
=da en-gb et fr fr-ch is lt no pt-br sv \
429 ar de en-us fi fr-be hr it lv nl pl ru th \
430 de-ch es fo fr-ca hu ja mk pt sl tr \
434 BLOBS
=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
435 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
436 vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
437 openbios-sparc32 openbios-sparc64 openbios-ppc QEMU
,tcx.bin QEMU
,cgthree.bin \
438 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
439 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
440 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
441 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
442 efi-e1000e.rom efi-vmxnet3.rom \
444 bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
445 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
446 s390-ccw.img s390-netboot.img \
447 slof.bin skiboot.lid \
449 u-boot.e500 u-boot-sam460-20100605.bin \
453 opensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
454 opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
459 # Note that we manually filter-out the non-Sphinx documentation which
460 # is currently built into the docs/interop directory in the build tree,
461 # and also any sphinx-built manpages.
462 define install-manual
=
463 for d in
$$(cd
$(MANUAL_BUILDDIR
) && find
$1 -type d
); do
$(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/$$d"; done
464 for f in
$$(cd
$(MANUAL_BUILDDIR
) && find
$1 -type f
-a
'!' '(' -name
'*.[0-9]' -o
-name
'qemu-*-qapi.*' -o
-name
'qemu-*-ref.*' ')' ); do
$(INSTALL_DATA
) "$(MANUAL_BUILDDIR)/$$f" "$(DESTDIR)$(qemu_docdir)/$$f"; done
467 # Note that we deliberately do not install the "devel" manual: it is
468 # for QEMU developers, and not interesting to our users.
469 .PHONY
: install-sphinxdocs
470 install-sphinxdocs
: sphinxdocs
471 $(call install-manual
,interop
)
472 $(call install-manual
,specs
)
473 $(call install-manual
,system
)
474 $(call install-manual
,tools
)
475 $(call install-manual
,user
)
477 install-doc
: $(DOCS
) install-sphinxdocs
478 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)"
479 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/index.html
"$(DESTDIR)$(qemu_docdir)"
480 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/interop"
481 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.html
"$(DESTDIR)$(qemu_docdir)/interop"
482 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.txt
"$(DESTDIR)$(qemu_docdir)/interop"
484 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
485 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu
.1 "$(DESTDIR)$(mandir)/man1"
486 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man7"
487 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref
.7 "$(DESTDIR)$(mandir)/man7"
488 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-block-drivers
.7 "$(DESTDIR)$(mandir)/man7"
489 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-cpu-models
.7 "$(DESTDIR)$(mandir)/man7"
490 ifeq ($(CONFIG_TOOLS
),y
)
491 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-img
.1 "$(DESTDIR)$(mandir)/man1"
492 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man8"
493 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-nbd
.8 "$(DESTDIR)$(mandir)/man8"
495 ifdef CONFIG_TRACE_SYSTEMTAP
496 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-trace-stap
.1 "$(DESTDIR)$(mandir)/man1"
498 ifeq ($(CONFIG_GUEST_AGENT
),y
)
499 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/interop
/qemu-ga
.8 "$(DESTDIR)$(mandir)/man8"
500 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/interop"
501 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.html
"$(DESTDIR)$(qemu_docdir)/interop"
502 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.txt
"$(DESTDIR)$(qemu_docdir)/interop"
503 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref
.7 "$(DESTDIR)$(mandir)/man7"
507 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
508 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/virtfs-proxy-helper
.1 "$(DESTDIR)$(mandir)/man1"
510 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
511 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/virtiofsd
.1 "$(DESTDIR)$(mandir)/man1"
515 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)"
517 install-localstatedir
:
519 ifeq ($(CONFIG_GUEST_AGENT
),y
)
520 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_localstatedir)"/run
524 ICON_SIZES
=16x16
24x24
32x32
48x48
64x64
128x128
256x256
512x512
527 $(INSTALL_DIR
) "$(DESTDIR)$(includedir)"
529 # Needed by "meson install"
531 install: all $(if
$(BUILD_DOCS
),install-doc
) \
532 install-datadir install-localstatedir install-includedir \
535 $(call install-prog
,$(TOOLS
),$(DESTDIR
)$(bindir))
537 ifneq ($(CONFIG_MODULES
),)
538 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_moddir)"
539 for s in
$(modules-m
:.mo
=$(DSOSUF
)); do \
540 t
="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
541 $(INSTALL_LIB
) $$s "$$t"; \
542 test -z
"$(STRIP)" ||
$(STRIP
) "$$t"; \
545 ifneq ($(HELPERS-y
),)
546 $(call install-prog
,$(HELPERS-y
),$(DESTDIR
)$(libexecdir
))
548 ifdef CONFIG_TRACE_SYSTEMTAP
549 $(INSTALL_PROG
) "scripts/qemu-trace-stap" $(DESTDIR
)$(bindir)
552 set
-e
; for x in
$(BLOBS
); do \
553 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/$$x "$(DESTDIR)$(qemu_datadir)"; \
556 for s in
$(ICON_SIZES
); do \
557 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
558 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_
$${s}.png \
559 "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
561 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
562 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_32x32.bmp \
563 "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
564 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
565 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu.svg \
566 "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
567 mkdir
-p
"$(DESTDIR)$(qemu_desktopdir)"
568 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/qemu.desktop \
569 "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
573 ifeq ($(CONFIG_PLUGIN
),y
)
574 $(INSTALL_DATA
) $(SRC_PATH
)/include/qemu
/qemu-plugin.h
"$(DESTDIR)$(includedir)/qemu-plugin.h"
576 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/keymaps"
577 set
-e
; for x in
$(KEYMAPS
); do \
578 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/keymaps
/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
580 for d in
$(TARGET_DIRS
); do \
581 $(MAKE
) $(SUBDIR_MAKEFLAGS
) TARGET_DIR
=$$d/ -C
$$d $@ || exit
1 ; \
586 MAKEINFOINCLUDES
= -I docs
-I
$(<D
) -I
$(@D
)
587 MAKEINFOFLAGS
=--no-split
--number-sections
$(MAKEINFOINCLUDES
)
588 TEXI2PODFLAGS
=$(MAKEINFOINCLUDES
) -DVERSION
="$(VERSION)" -DCONFDIR
="$(qemu_confdir)"
589 TEXI2PDFFLAGS
=$(if
$(V
),,--quiet
) -I
$(SRC_PATH
) $(MAKEINFOINCLUDES
)
591 docs
/version.texi
: $(SRC_PATH
)/VERSION config-host.mak
592 $(call quiet-command
,(\
593 echo
"@set VERSION $(VERSION)" && \
594 echo
"@set CONFDIR $(qemu_confdir)" \
597 %.html
: %.texi docs
/version.texi
598 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
599 --html
$< -o
$@
,"GEN","$@")
601 %.
info: %.texi docs
/version.texi
602 $(call quiet-command
,$(MAKEINFO
) $(MAKEINFOFLAGS
) $< -o
$@
,"GEN","$@")
604 %.txt
: %.texi docs
/version.texi
605 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
606 --plaintext
$< -o
$@
,"GEN","$@")
608 %.pdf
: %.texi docs
/version.texi
609 $(call quiet-command
,texi2pdf
$(TEXI2PDFFLAGS
) $< -o
$@
,"GEN","$@")
611 # Sphinx builds all its documentation at once in one invocation
612 # and handles "don't rebuild things unless necessary" itself.
613 # The '.doctrees' files are cached information to speed this up.
615 sphinxdocs
: $(MANUAL_BUILDDIR
)/devel
/index.html \
616 $(MANUAL_BUILDDIR
)/interop
/index.html \
617 $(MANUAL_BUILDDIR
)/specs
/index.html \
618 $(MANUAL_BUILDDIR
)/system
/index.html \
619 $(MANUAL_BUILDDIR
)/tools
/index.html \
620 $(MANUAL_BUILDDIR
)/user
/index.html
622 # Canned command to build a single manual
623 # Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
624 # Note the use of different doctree for each (manual, builder) tuple;
625 # this works around Sphinx not handling parallel invocation on
626 # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
627 build-manual
= $(call quiet-command
,CONFDIR
="$(qemu_confdir)" $(SPHINX_BUILD
) $(if
$(V
),,-q
) $(SPHINX_WERROR
) -b
$2 -D version
=$(VERSION
) -D release
="$(FULL_VERSION)" -d .doctrees
/$1-$2 $(SRC_PATH
)/docs
/$1 $(MANUAL_BUILDDIR
)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
628 # We assume all RST files in the manual's directory are used in it
629 manual-deps
= $(wildcard $(SRC_PATH
)/docs
/$1/*.rst
$(SRC_PATH
)/docs
/$1/*/*.rst
) \
630 $(SRC_PATH
)/docs
/defs.rst.inc \
631 $(SRC_PATH
)/docs
/$1/conf.py
$(SRC_PATH
)/docs
/conf.py \
632 $(SRC_PATH
)/docs
/sphinx
/*.py
633 # Macro to write out the rule and dependencies for building manpages
634 # Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps])
635 # 'extradeps' is optional, and specifies extra files (eg .hx files) that
636 # the manual page depends on.
637 define define-manpage-rule
638 $(call atomic
,$(foreach manpage
,$2,$(MANUAL_BUILDDIR
)/$1/$(manpage
)),$(call manual-deps
,$1) $3)
639 $(call build-manual
,$1,man
)
642 $(MANUAL_BUILDDIR
)/devel
/index.html
: $(call manual-deps
,devel
)
643 $(call build-manual
,devel
,html
)
645 $(MANUAL_BUILDDIR
)/interop
/index.html
: $(call manual-deps
,interop
)
646 $(call build-manual
,interop
,html
)
648 $(MANUAL_BUILDDIR
)/specs
/index.html
: $(call manual-deps
,specs
)
649 $(call build-manual
,specs
,html
)
651 $(MANUAL_BUILDDIR
)/system
/index.html
: $(call manual-deps
,system
) $(SRC_PATH
)/hmp-commands.hx
$(SRC_PATH
)/hmp-commands-info.hx
$(SRC_PATH
)/qemu-options.hx
652 $(call build-manual
,system
,html
)
654 $(MANUAL_BUILDDIR
)/tools
/index.html
: $(call manual-deps
,tools
) $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/docs
/qemu-option-trace.rst.inc
655 $(call build-manual
,tools
,html
)
657 $(MANUAL_BUILDDIR
)/user
/index.html
: $(call manual-deps
,user
)
658 $(call build-manual
,user
,html
)
660 $(call define-manpage-rule
,interop
,qemu-ga
.8)
662 $(call define-manpage-rule
,system
,qemu
.1 qemu-block-drivers
.7 qemu-cpu-models
.7)
664 $(call define-manpage-rule
,tools
,\
665 qemu-img
.1 qemu-nbd
.8 qemu-trace-stap
.1\
666 virtiofsd
.1 virtfs-proxy-helper
.1,\
667 $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/docs
/qemu-option-trace.rst.inc
)
669 $(MANUAL_BUILDDIR
)/index.html
: $(SRC_PATH
)/docs
/index.html.in qemu-version.h
670 @mkdir
-p
"$(MANUAL_BUILDDIR)"
671 $(call quiet-command
, sed
"s|@@VERSION@@|${VERSION}|g" $< >$@
, \
674 docs
/interop
/qemu-qmp-qapi.texi
: qapi
/qapi-doc.texi
677 docs
/interop
/qemu-ga-qapi.texi
: qga
/qga-qapi-doc.texi
680 html
: docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html sphinxdocs
681 info: docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-ga-ref.
info
682 pdf
: docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
683 txt
: docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
685 docs
/interop
/qemu-ga-ref.
dvi docs
/interop
/qemu-ga-ref.html \
686 docs
/interop
/qemu-ga-ref.
info docs
/interop
/qemu-ga-ref.pdf \
687 docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7: \
688 docs
/interop
/qemu-ga-ref.texi docs
/interop
/qemu-ga-qapi.texi
690 docs
/interop
/qemu-qmp-ref.
dvi docs
/interop
/qemu-qmp-ref.html \
691 docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-qmp-ref.pdf \
692 docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7: \
693 docs
/interop
/qemu-qmp-ref.texi docs
/interop
/qemu-qmp-qapi.texi
695 $(filter %.1 %.7 %.8,$(DOCS
)): scripts
/texi2pod.pl
699 %/coverage-report.html
:
701 $(call quiet-command
,\
702 gcovr
-r
$(SRC_PATH
) \
703 $(foreach t
, $(TARGET_DIRS
), --object-directory
$(BUILD_DIR
)/$(t
)) \
704 --object-directory
$(BUILD_DIR
) \
705 -p
--html
--html-details
-o
$@
, \
706 "GEN", "coverage-report.html")
708 .PHONY
: coverage-report
709 coverage-report
: $(CURDIR
)/reports
/coverage
/coverage-report.html
713 INSTALLER
= qemu-setup-
$(VERSION
)$(EXESUF
)
715 nsisflags
= -V2
-NOCD
717 ifneq ($(wildcard $(SRC_PATH
)/dll
),)
718 ifeq ($(ARCH
),x86_64
)
720 DLL_PATH
= $(SRC_PATH
)/dll
/w64
724 DLL_PATH
= $(SRC_PATH
)/dll
/w32
729 installer
: $(INSTALLER
)
731 INSTDIR
=/tmp
/qemu-nsis
733 $(INSTALLER
): $(SRC_PATH
)/qemu.nsi
734 $(MAKE
) install DESTDIR
=${INSTDIR}
736 (cd
${INSTDIR}/${bindir}; \
742 (cd
${INSTDIR}/${bindir}; \
743 for i in qemu-system-
*.exe
; do \
745 arch
=$${arch
#qemu-system-}; \
746 echo Section
\"$$arch\" Section_
$$arch; \
747 echo SetOutPath
\"\
$$INSTDIR\"; \
748 echo File
\"\
$${BINDIR}\\$$i\"; \
751 ) >${INSTDIR}/${bindir}/system-emulations.nsh
752 makensis
$(nsisflags
) \
753 $(if
$(BUILD_DOCS
),-DCONFIG_DOCUMENTATION
="y") \
754 $(if
$(CONFIG_GTK
),-DCONFIG_GTK
="y") \
755 -DBINDIR
="${INSTDIR}/${bindir}" \
756 $(if
$(DLL_PATH
),-DDLLDIR
="$(DLL_PATH)") \
757 -DSRCDIR
="$(SRC_PATH)" \
758 -DOUTFILE
="$(INSTALLER)" \
759 -DDISPLAYVERSION
="$(VERSION)" \
763 $(SIGNCODE
) $(INSTALLER
)
767 # Add a dependency on the generated files, so that they are always
768 # rebuilt before other object files
769 ifneq ($(wildcard config-host.mak
),)
770 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
771 Makefile
: $(generated-files-y
)
775 # Include automatically generated dependency files
776 # Dependencies in Makefile.objs files come from our recursive subdir rules
777 -include $(wildcard *.d tests
/*.d
)
779 include $(SRC_PATH
)/tests
/docker
/Makefile.
include
780 include $(SRC_PATH
)/tests
/vm
/Makefile.
include
782 print-help-run
= printf
" %-30s - %s\\n" "$1" "$2"
783 print-help
= $(quiet-@
)$(call print-help-run
,$1,$2)
787 @echo
'Generic targets:'
788 $(call print-help
,all,Build
all)
790 $(call print-help
,modules
,Build
all modules
)
792 $(call print-help
,dir/file.o
,Build specified target only
)
793 $(call print-help
,install,Install QEMU
, documentation and tools
)
794 $(call print-help
,ctags
/TAGS
,Generate
tags file for editors
)
795 $(call print-help
,cscope
,Generate cscope index
)
796 $(call print-help
,sparse
,Run sparse on the QEMU source
)
798 @
$(if
$(TARGET_DIRS
), \
799 echo
'Architecture specific targets:'; \
800 $(foreach t
, $(TARGET_DIRS
), \
801 $(call print-help-run
,$(t
)/all,Build for
$(t
)); \
802 $(if
$(CONFIG_FUZZ
), \
803 $(if
$(findstring softmmu
,$(t
)), \
804 $(call print-help-run
,$(t
)/fuzz
,Build fuzzer for
$(t
)); \
807 @
$(if
$(HELPERS-y
), \
808 echo
'Helper targets:'; \
809 $(foreach t
, $(HELPERS-y
), \
810 $(call print-help-run
,$(t
),Build
$(shell basename $(t
)));) \
813 echo
'Tools targets:'; \
814 $(foreach t
, $(TOOLS
), \
815 $(call print-help-run
,$(t
),Build
$(shell basename $(t
)) tool
);) \
817 @echo
'Cleaning targets:'
818 $(call print-help
,clean,Remove most generated files but keep the config
)
819 $(call print-help
,distclean,Remove
all generated files
)
820 $(call print-help
,dist,Build a distributable tarball
)
822 @echo
'Test targets:'
823 $(call print-help
,check,Run
all tests
(check-help for details
))
824 $(call print-help
,docker
,Help about targets running tests inside containers
)
825 $(call print-help
,vm-help
,Help about targets running tests inside VM
)
827 @echo
'Documentation targets:'
828 $(call print-help
,html
info pdf txt
,Build documentation in specified format
)
831 @echo
'Windows targets:'
832 $(call print-help
,installer
,Build NSIS-based installer for QEMU
)
833 ifdef QEMU_GA_MSI_ENABLED
834 $(call print-help
,msi
,Build MSI-based installer for qemu-ga
)
838 $(call print-help
,$(MAKE
) [targets
],(quiet build
, default
))
839 $(call print-help
,$(MAKE
) V
=1 [targets
],(verbose build
))