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 qemu-options.def
126 generated-files-y
+= module_block.h
128 generated-files-y
+= .git-submodule-status
130 edk2-decompressed
= $(basename $(wildcard pc-bios
/edk2-
*.fd.bz2
))
131 pc-bios
/edk2-
%.fd
: pc-bios
/edk2-
%.fd.bz2
132 $(call quiet-command
,bzip2
-d
-c
$< > $@
,"BUNZIP2",$<)
134 # Don't try to regenerate Makefile or configure
135 # We don't generate any of them
139 .PHONY
: all clean cscope
distclean html
info install install-doc \
140 pdf txt recurse-all
dist msi FORCE
142 $(call set-vpath
, $(SRC_PATH
))
144 LIBS
+=-lz
$(LIBS_TOOLS
)
146 HELPERS-y
= $(HELPERS
)
148 # Sphinx does not allow building manuals into the same directory as
149 # the source files, so if we're doing an in-tree QEMU build we must
150 # build the manuals into a subdirectory (and then install them from
151 # there for 'make install'). For an out-of-tree build we can just
152 # use the docs/ subdirectory in the build tree as normal.
153 ifeq ($(realpath
$(SRC_PATH
)),$(realpath .
))
154 MANUAL_BUILDDIR
:= docs
/built
156 MANUAL_BUILDDIR
:= docs
160 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu
.1
161 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/qemu-img
.1
162 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/qemu-nbd
.8
163 DOCS
+=$(MANUAL_BUILDDIR
)/interop
/qemu-ga
.8
164 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
165 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/virtiofsd
.1
167 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu-block-drivers
.7
168 DOCS
+=docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7
169 DOCS
+=docs
/interop
/qemu-ga-ref.html docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7
170 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu-cpu-models
.7
171 DOCS
+=$(MANUAL_BUILDDIR
)/index.html
173 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/virtfs-proxy-helper
.1
175 ifdef CONFIG_TRACE_SYSTEMTAP
176 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/qemu-trace-stap
.1
182 SUBDIR_MAKEFLAGS
=$(if
$(V
),,--no-print-directory
--quiet
) BUILD_DIR
=$(BUILD_DIR
)
183 SUBDIR_DEVICES_MAK
=$(patsubst %, %/config-devices.mak
, $(filter %-softmmu
, $(TARGET_DIRS
)))
184 SUBDIR_DEVICES_MAK_DEP
=$(patsubst %, %.d
, $(SUBDIR_DEVICES_MAK
))
186 ifeq ($(SUBDIR_DEVICES_MAK
),)
187 config-all-devices.mak
: config-host.mak
188 $(call quiet-command
,echo
'# no devices' > $@
,"GEN","$@")
190 config-all-devices.mak
: $(SUBDIR_DEVICES_MAK
) config-host.mak
191 $(call quiet-command
, sed
-n \
192 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
193 $(SUBDIR_DEVICES_MAK
) |
sort -u
> $@
, \
197 -include $(SUBDIR_DEVICES_MAK_DEP
)
199 # This has to be kept in sync with Kconfig.host.
201 $(CONFIG_MINIKCONF_MODE
) \
202 $@
$*/config-devices.mak.d
$< $(SRC_PATH
)/Kconfig \
203 CONFIG_TCG
=$(CONFIG_TCG
) \
204 CONFIG_KVM
=$(CONFIG_KVM
) \
205 CONFIG_SPICE
=$(CONFIG_SPICE
) \
206 CONFIG_IVSHMEM
=$(CONFIG_IVSHMEM
) \
207 CONFIG_TPM
=$(CONFIG_TPM
) \
208 CONFIG_XEN
=$(CONFIG_XEN
) \
209 CONFIG_OPENGL
=$(CONFIG_OPENGL
) \
210 CONFIG_X11
=$(CONFIG_X11
) \
211 CONFIG_VHOST_USER
=$(CONFIG_VHOST_USER
) \
212 CONFIG_VHOST_KERNEL
=$(CONFIG_VHOST_KERNEL
) \
213 CONFIG_VIRTFS
=$(CONFIG_VIRTFS
) \
214 CONFIG_LINUX
=$(CONFIG_LINUX
) \
215 CONFIG_PVRDMA
=$(CONFIG_PVRDMA
)
217 MINIKCONF
= $(PYTHON
) $(SRC_PATH
)/scripts
/minikconf.py
219 $(SUBDIR_DEVICES_MAK
): %/config-devices.mak
: default-configs
/%.mak
$(SRC_PATH
)/Kconfig
$(BUILD_DIR
)/config-host.mak
220 $(call quiet-command
, $(MINIKCONF
) $(MINIKCONF_ARGS
) \
221 > $@.tmp
, "GEN", "$@.tmp")
222 $(call quiet-command
, if
test -f
$@
; then \
223 if cmp
-s
$@.old
$@
; then \
227 if
test -f
$@.old
; then \
228 echo
"WARNING: $@ (user modified) out of date.";\
230 echo
"WARNING: $@ out of date.";\
232 echo
"Run \"$(MAKE) defconfig\" to regenerate."; \
241 rm -f config-all-devices.mak
$(SUBDIR_DEVICES_MAK
)
243 ifneq ($(wildcard config-host.mak
),)
244 include $(SRC_PATH
)/Makefile.objs
247 dummy
:= $(call unnest-vars
,, \
252 storage-daemon-obj-y \
253 storage-daemon-obj-m \
260 include $(SRC_PATH
)/tests
/Makefile.
include
262 all: $(DOCS
) $(if
$(BUILD_DOCS
),sphinxdocs
) $(TOOLS
) $(HELPERS-y
) recurse-all modules
264 config-host.h
: config-host.h-timestamp
265 config-host.h-timestamp
: config-host.mak
266 qemu-options.def
: $(SRC_PATH
)/qemu-options.hx
$(SRC_PATH
)/scripts
/hxtool
267 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
269 TARGET_DIRS_RULES
:= $(foreach t
, all fuzz
clean install, $(addsuffix /$(t
), $(TARGET_DIRS
)))
271 SOFTMMU_ALL_RULES
=$(filter %-softmmu
/all, $(TARGET_DIRS_RULES
))
272 $(SOFTMMU_ALL_RULES
): $(authz-obj-y
)
273 $(SOFTMMU_ALL_RULES
): $(block-obj-y
)
274 $(SOFTMMU_ALL_RULES
): $(storage-daemon-obj-y
)
275 $(SOFTMMU_ALL_RULES
): $(chardev-obj-y
)
276 $(SOFTMMU_ALL_RULES
): $(crypto-obj-y
)
277 $(SOFTMMU_ALL_RULES
): $(io-obj-y
)
278 $(SOFTMMU_ALL_RULES
): config-all-devices.mak
279 ifdef DECOMPRESS_EDK2_BLOBS
280 $(SOFTMMU_ALL_RULES
): $(edk2-decompressed
)
283 SOFTMMU_FUZZ_RULES
=$(filter %-softmmu
/fuzz
, $(TARGET_DIRS_RULES
))
284 $(SOFTMMU_FUZZ_RULES
): $(authz-obj-y
)
285 $(SOFTMMU_FUZZ_RULES
): $(block-obj-y
)
286 $(SOFTMMU_FUZZ_RULES
): $(chardev-obj-y
)
287 $(SOFTMMU_FUZZ_RULES
): $(crypto-obj-y
)
288 $(SOFTMMU_FUZZ_RULES
): $(io-obj-y
)
289 $(SOFTMMU_FUZZ_RULES
): config-all-devices.mak
290 $(SOFTMMU_FUZZ_RULES
): $(edk2-decompressed
)
292 .PHONY
: $(TARGET_DIRS_RULES
)
293 # The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
294 # $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
295 $(TARGET_DIRS_RULES
):
296 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" $(notdir $@
),)
298 # LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
299 DTC_MAKE_ARGS
=-I
$(SRC_PATH
)/dtc VPATH
=$(SRC_PATH
)/dtc
-C dtc V
="$(V)" LIBFDT_lib
=""
300 DTC_CFLAGS
=$(CFLAGS
) $(QEMU_CFLAGS
)
301 DTC_CPPFLAGS
=-I
$(SRC_PATH
)/dtc
/libfdt
304 dtc
/all: .git-submodule-status dtc
/libfdt
305 $(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
,)
307 dtc
/%: .git-submodule-status
310 # Overriding CFLAGS causes us to lose defines added in the sub-makefile.
311 # Not overriding CFLAGS leads to mis-matches between compilation modes.
312 # Therefore we replicate some of the logic in the sub-makefile.
313 # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
314 # no need to annoy QEMU developers with such things.
315 CAP_CFLAGS
= $(patsubst -W
%,,$(CFLAGS
) $(QEMU_CFLAGS
))
316 CAP_CFLAGS
+= -DCAPSTONE_USE_SYS_DYN_MEM
317 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM
318 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM64
319 CAP_CFLAGS
+= -DCAPSTONE_HAS_POWERPC
320 CAP_CFLAGS
+= -DCAPSTONE_HAS_X86
323 capstone
/all: .git-submodule-status
324 $(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
))
327 slirp
/all: .git-submodule-status
328 $(call quiet-command
,$(MAKE
) -C
$(SRC_PATH
)/slirp \
329 BUILD_DIR
="$(BUILD_DIR)/slirp" \
330 PKG_CONFIG
="$(PKG_CONFIG)" \
331 CC
="$(CC)" AR
="$(AR)" LD
="$(LD)" RANLIB
="$(RANLIB)" \
332 CFLAGS
="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS
="$(QEMU_LDFLAGS)")
334 $(filter %/all, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
337 $(filter %/fuzz
, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
338 $(qom-obj-y
) $(crypto-user-obj-
$(CONFIG_USER_ONLY
))
340 ROM_DIRS
= $(addprefix pc-bios
/, $(ROMS
))
341 ROM_DIRS_RULES
=$(foreach t
, all clean, $(addsuffix /$(t
), $(ROM_DIRS
)))
342 # Only keep -O and -g cflags
343 .PHONY
: $(ROM_DIRS_RULES
)
345 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" CFLAGS
="$(filter -O% -g%,$(CFLAGS))" $(notdir $@
),)
347 .PHONY
: recurse-all recurse-clean recurse-install
348 recurse-all
: $(addsuffix /all, $(TARGET_DIRS
) $(ROM_DIRS
))
349 recurse-clean
: $(addsuffix /clean, $(TARGET_DIRS
) $(ROM_DIRS
))
350 recurse-install
: $(addsuffix /install, $(TARGET_DIRS
))
351 $(addsuffix /install, $(TARGET_DIRS
)): all
353 $(BUILD_DIR
)/version.o
: $(SRC_PATH
)/version.rc config-host.h
354 $(call quiet-command
,$(WINDRES
) -I
$(BUILD_DIR
) -o
$@
$<,"RC","version.o")
356 Makefile
: $(version-obj-y
)
358 ######################################################################
360 COMMON_LDADDS
= libqemuutil.a
362 qemu-img.o
: qemu-img-cmds.h
364 qemu-img
$(EXESUF
): qemu-img.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
365 qemu-nbd
$(EXESUF
): qemu-nbd.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
366 qemu-io
$(EXESUF
): qemu-io.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
367 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
)
369 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
)
371 scsi
/qemu-pr-helper
$(EXESUF
): LIBS
+= -ludev
-lmultipath
-lmpathpersist
374 qemu-img-cmds.h
: $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/scripts
/hxtool
375 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
377 module_block.h
: $(SRC_PATH
)/scripts
/modules
/module_block.py config-host.mak
378 $(call quiet-command
,$(PYTHON
) $< $@ \
379 $(addprefix $(SRC_PATH
)/,$(patsubst %.mo
,%.c
,$(block-obj-m
))), \
382 clean: recurse-clean ninja-clean clean-ctlist
383 -test -f ninjatool
&& .
/ninjatool
$(if
$(V
),-v
,) -t
clean
384 # avoid old build problems by removing potentially incorrect old files
385 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
386 rm -f qemu-options.def
387 find . \
( -name
'*.so' -o
-name
'*.dll' -o
-name
'*.mo' -o
-name
'*.[oda]' \
) -type f \
388 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-aarch64.a \
389 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-arm.a \
390 ! -path .
/roms
/edk2
/BaseTools
/Source
/Python
/UPT
/Dll
/sqlite3.dll \
392 rm -f
$(edk2-decompressed
)
393 rm -f
$(filter-out %.tlb
,$(TOOLS
)) $(HELPERS-y
) TAGS cscope.
* *.pod
*~
*/*~
394 rm -f fsdev
/*.pod scsi
/*.pod
395 rm -f qemu-img-cmds.h
396 rm -f ui
/shader
/*-vert.h ui
/shader
/*-frag.h
397 rm -f
$(foreach f
,$(generated-files-y
),$(f
) $(f
)-timestamp
)
398 rm -f config-all-devices.mak
399 rm -f
$(SUBDIR_DEVICES_MAK
)
401 VERSION ?
= $(shell cat VERSION
)
403 dist: qemu-
$(VERSION
).
tar.bz2
406 $(SRC_PATH
)/scripts
/make-release
"$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
408 define clean-manual
=
409 rm -rf
$(MANUAL_BUILDDIR
)/$1/_static
410 rm -f
$(MANUAL_BUILDDIR
)/$1/objects.inv
$(MANUAL_BUILDDIR
)/$1/searchindex.js
$(MANUAL_BUILDDIR
)/$1/*.html
413 distclean: clean ninja-distclean
414 -test -f ninjatool
&& .
/ninjatool
$(if
$(V
),-v
,) -t
clean -g
415 rm -f config-host.mak config-host.h
* $(DOCS
)
416 rm -f tests
/tcg
/config-
*.mak
417 rm -f config-all-devices.mak config-all-disas.mak config.status
418 rm -f
$(SUBDIR_DEVICES_MAK
)
419 rm -f po
/*.mo tests
/qemu-iotests
/common.env
420 rm -f roms
/seabios
/config.mak roms
/vgabios
/config.mak
421 rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
422 rm -rf meson-private meson-logs meson-info compile_commands.json
423 rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest
425 rm -f linux-headers
/asm
426 rm -f docs
/version.texi
427 rm -f docs
/interop
/qemu-ga-qapi.texi docs
/interop
/qemu-qmp-qapi.texi
428 rm -f docs
/interop
/qemu-qmp-ref
.7 docs
/interop
/qemu-ga-ref
.7
429 rm -f docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
430 rm -f docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
431 rm -f docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html
433 $(call clean-manual
,devel
)
434 $(call clean-manual
,interop
)
435 $(call clean-manual
,specs
)
436 $(call clean-manual
,system
)
437 $(call clean-manual
,tools
)
438 $(call clean-manual
,user
)
439 for d in
$(TARGET_DIRS
); do \
440 rm -rf
$$d || exit
1 ; \
444 KEYMAPS
=da en-gb et fr fr-ch is lt no pt-br sv \
445 ar de en-us fi fr-be hr it lv nl pl ru th \
446 de-ch es fo fr-ca hu ja mk pt sl tr \
450 BLOBS
=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
451 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
452 vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
453 openbios-sparc32 openbios-sparc64 openbios-ppc QEMU
,tcx.bin QEMU
,cgthree.bin \
454 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
455 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
456 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
457 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
458 efi-e1000e.rom efi-vmxnet3.rom \
460 bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
461 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
462 s390-ccw.img s390-netboot.img \
463 slof.bin skiboot.lid \
465 u-boot.e500 u-boot-sam460-20100605.bin \
469 opensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
470 opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
473 DESCS
=50-edk2-i386-secure.json
50-edk2-x86_64-secure.json \
474 60-edk2-aarch64.json
60-edk2-arm.json
60-edk2-i386.json
60-edk2-x86_64.json
480 # Note that we manually filter-out the non-Sphinx documentation which
481 # is currently built into the docs/interop directory in the build tree,
482 # and also any sphinx-built manpages.
483 define install-manual
=
484 for d in
$$(cd
$(MANUAL_BUILDDIR
) && find
$1 -type d
); do
$(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/$$d"; done
485 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
488 # Note that we deliberately do not install the "devel" manual: it is
489 # for QEMU developers, and not interesting to our users.
490 .PHONY
: install-sphinxdocs
491 install-sphinxdocs
: sphinxdocs
492 $(call install-manual
,interop
)
493 $(call install-manual
,specs
)
494 $(call install-manual
,system
)
495 $(call install-manual
,tools
)
496 $(call install-manual
,user
)
498 install-doc
: $(DOCS
) install-sphinxdocs
499 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)"
500 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/index.html
"$(DESTDIR)$(qemu_docdir)"
501 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/interop"
502 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.html
"$(DESTDIR)$(qemu_docdir)/interop"
503 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.txt
"$(DESTDIR)$(qemu_docdir)/interop"
505 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
506 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu
.1 "$(DESTDIR)$(mandir)/man1"
507 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man7"
508 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref
.7 "$(DESTDIR)$(mandir)/man7"
509 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-block-drivers
.7 "$(DESTDIR)$(mandir)/man7"
510 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-cpu-models
.7 "$(DESTDIR)$(mandir)/man7"
511 ifeq ($(CONFIG_TOOLS
),y
)
512 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-img
.1 "$(DESTDIR)$(mandir)/man1"
513 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man8"
514 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-nbd
.8 "$(DESTDIR)$(mandir)/man8"
516 ifdef CONFIG_TRACE_SYSTEMTAP
517 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-trace-stap
.1 "$(DESTDIR)$(mandir)/man1"
519 ifeq ($(CONFIG_GUEST_AGENT
),y
)
520 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/interop
/qemu-ga
.8 "$(DESTDIR)$(mandir)/man8"
521 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/interop"
522 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.html
"$(DESTDIR)$(qemu_docdir)/interop"
523 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.txt
"$(DESTDIR)$(qemu_docdir)/interop"
524 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref
.7 "$(DESTDIR)$(mandir)/man7"
528 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
529 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/virtfs-proxy-helper
.1 "$(DESTDIR)$(mandir)/man1"
531 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
532 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/virtiofsd
.1 "$(DESTDIR)$(mandir)/man1"
536 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)"
538 install-localstatedir
:
540 ifeq ($(CONFIG_GUEST_AGENT
),y
)
541 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_localstatedir)"/run
545 ICON_SIZES
=16x16
24x24
32x32
48x48
64x64
128x128
256x256
512x512
548 $(INSTALL_DIR
) "$(DESTDIR)$(includedir)"
550 # Needed by "meson install"
552 install: all $(if
$(BUILD_DOCS
),install-doc
) \
553 install-datadir install-localstatedir install-includedir \
554 $(if
$(INSTALL_BLOBS
),$(edk2-decompressed
)) \
557 $(call install-prog
,$(TOOLS
),$(DESTDIR
)$(bindir))
559 ifneq ($(CONFIG_MODULES
),)
560 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_moddir)"
561 for s in
$(modules-m
:.mo
=$(DSOSUF
)); do \
562 t
="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
563 $(INSTALL_LIB
) $$s "$$t"; \
564 test -z
"$(STRIP)" ||
$(STRIP
) "$$t"; \
567 ifneq ($(HELPERS-y
),)
568 $(call install-prog
,$(HELPERS-y
),$(DESTDIR
)$(libexecdir
))
570 ifdef CONFIG_TRACE_SYSTEMTAP
571 $(INSTALL_PROG
) "scripts/qemu-trace-stap" $(DESTDIR
)$(bindir)
574 set
-e
; for x in
$(BLOBS
); do \
575 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/$$x "$(DESTDIR)$(qemu_datadir)"; \
579 set
-e
; for x in
$(edk2-decompressed
); do \
580 $(INSTALL_DATA
) $$x "$(DESTDIR)$(qemu_datadir)"; \
584 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/firmware"
585 set
-e
; tmpf
=$$(mktemp
); trap
'rm -f -- "$$tmpf"' EXIT
; \
586 for x in
$(DESCS
); do \
587 sed
-e
's,@DATADIR@,$(qemu_datadir),' \
588 "$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
589 $(INSTALL_DATA
) "$$tmpf" \
590 "$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
593 for s in
$(ICON_SIZES
); do \
594 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
595 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_
$${s}.png \
596 "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
598 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
599 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_32x32.bmp \
600 "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
601 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
602 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu.svg \
603 "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
604 mkdir
-p
"$(DESTDIR)$(qemu_desktopdir)"
605 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/qemu.desktop \
606 "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
610 ifeq ($(CONFIG_PLUGIN
),y
)
611 $(INSTALL_DATA
) $(SRC_PATH
)/include/qemu
/qemu-plugin.h
"$(DESTDIR)$(includedir)/qemu-plugin.h"
613 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/keymaps"
614 set
-e
; for x in
$(KEYMAPS
); do \
615 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/keymaps
/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
617 for d in
$(TARGET_DIRS
); do \
618 $(MAKE
) $(SUBDIR_MAKEFLAGS
) TARGET_DIR
=$$d/ -C
$$d $@ || exit
1 ; \
621 # opengl shader programs
622 ui
/shader
/%-vert.h
: $(SRC_PATH
)/ui
/shader
/%.vert
$(SRC_PATH
)/scripts
/shaderinclude.pl
624 $(call quiet-command
,\
625 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
628 ui
/shader
/%-frag.h
: $(SRC_PATH
)/ui
/shader
/%.frag
$(SRC_PATH
)/scripts
/shaderinclude.pl
630 $(call quiet-command
,\
631 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
634 ui
/shader.o
: $(SRC_PATH
)/ui
/shader.c \
635 ui
/shader
/texture-blit-vert.h \
636 ui
/shader
/texture-blit-flip-vert.h \
637 ui
/shader
/texture-blit-frag.h
641 MAKEINFOINCLUDES
= -I docs
-I
$(<D
) -I
$(@D
)
642 MAKEINFOFLAGS
=--no-split
--number-sections
$(MAKEINFOINCLUDES
)
643 TEXI2PODFLAGS
=$(MAKEINFOINCLUDES
) -DVERSION
="$(VERSION)" -DCONFDIR
="$(qemu_confdir)"
644 TEXI2PDFFLAGS
=$(if
$(V
),,--quiet
) -I
$(SRC_PATH
) $(MAKEINFOINCLUDES
)
646 docs
/version.texi
: $(SRC_PATH
)/VERSION config-host.mak
647 $(call quiet-command
,(\
648 echo
"@set VERSION $(VERSION)" && \
649 echo
"@set CONFDIR $(qemu_confdir)" \
652 %.html
: %.texi docs
/version.texi
653 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
654 --html
$< -o
$@
,"GEN","$@")
656 %.
info: %.texi docs
/version.texi
657 $(call quiet-command
,$(MAKEINFO
) $(MAKEINFOFLAGS
) $< -o
$@
,"GEN","$@")
659 %.txt
: %.texi docs
/version.texi
660 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
661 --plaintext
$< -o
$@
,"GEN","$@")
663 %.pdf
: %.texi docs
/version.texi
664 $(call quiet-command
,texi2pdf
$(TEXI2PDFFLAGS
) $< -o
$@
,"GEN","$@")
666 # Sphinx builds all its documentation at once in one invocation
667 # and handles "don't rebuild things unless necessary" itself.
668 # The '.doctrees' files are cached information to speed this up.
670 sphinxdocs
: $(MANUAL_BUILDDIR
)/devel
/index.html \
671 $(MANUAL_BUILDDIR
)/interop
/index.html \
672 $(MANUAL_BUILDDIR
)/specs
/index.html \
673 $(MANUAL_BUILDDIR
)/system
/index.html \
674 $(MANUAL_BUILDDIR
)/tools
/index.html \
675 $(MANUAL_BUILDDIR
)/user
/index.html
677 # Canned command to build a single manual
678 # Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
679 # Note the use of different doctree for each (manual, builder) tuple;
680 # this works around Sphinx not handling parallel invocation on
681 # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
682 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")
683 # We assume all RST files in the manual's directory are used in it
684 manual-deps
= $(wildcard $(SRC_PATH
)/docs
/$1/*.rst
$(SRC_PATH
)/docs
/$1/*/*.rst
) \
685 $(SRC_PATH
)/docs
/defs.rst.inc \
686 $(SRC_PATH
)/docs
/$1/conf.py
$(SRC_PATH
)/docs
/conf.py \
687 $(SRC_PATH
)/docs
/sphinx
/*.py
688 # Macro to write out the rule and dependencies for building manpages
689 # Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps])
690 # 'extradeps' is optional, and specifies extra files (eg .hx files) that
691 # the manual page depends on.
692 define define-manpage-rule
693 $(call atomic
,$(foreach manpage
,$2,$(MANUAL_BUILDDIR
)/$1/$(manpage
)),$(call manual-deps
,$1) $3)
694 $(call build-manual
,$1,man
)
697 $(MANUAL_BUILDDIR
)/devel
/index.html
: $(call manual-deps
,devel
)
698 $(call build-manual
,devel
,html
)
700 $(MANUAL_BUILDDIR
)/interop
/index.html
: $(call manual-deps
,interop
)
701 $(call build-manual
,interop
,html
)
703 $(MANUAL_BUILDDIR
)/specs
/index.html
: $(call manual-deps
,specs
)
704 $(call build-manual
,specs
,html
)
706 $(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
707 $(call build-manual
,system
,html
)
709 $(MANUAL_BUILDDIR
)/tools
/index.html
: $(call manual-deps
,tools
) $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/docs
/qemu-option-trace.rst.inc
710 $(call build-manual
,tools
,html
)
712 $(MANUAL_BUILDDIR
)/user
/index.html
: $(call manual-deps
,user
)
713 $(call build-manual
,user
,html
)
715 $(call define-manpage-rule
,interop
,qemu-ga
.8)
717 $(call define-manpage-rule
,system
,qemu
.1 qemu-block-drivers
.7 qemu-cpu-models
.7)
719 $(call define-manpage-rule
,tools
,\
720 qemu-img
.1 qemu-nbd
.8 qemu-trace-stap
.1\
721 virtiofsd
.1 virtfs-proxy-helper
.1,\
722 $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/docs
/qemu-option-trace.rst.inc
)
724 $(MANUAL_BUILDDIR
)/index.html
: $(SRC_PATH
)/docs
/index.html.in qemu-version.h
725 @mkdir
-p
"$(MANUAL_BUILDDIR)"
726 $(call quiet-command
, sed
"s|@@VERSION@@|${VERSION}|g" $< >$@
, \
729 docs
/interop
/qemu-qmp-qapi.texi
: qapi
/qapi-doc.texi
732 docs
/interop
/qemu-ga-qapi.texi
: qga
/qga-qapi-doc.texi
735 html
: docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html sphinxdocs
736 info: docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-ga-ref.
info
737 pdf
: docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
738 txt
: docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
740 docs
/interop
/qemu-ga-ref.
dvi docs
/interop
/qemu-ga-ref.html \
741 docs
/interop
/qemu-ga-ref.
info docs
/interop
/qemu-ga-ref.pdf \
742 docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7: \
743 docs
/interop
/qemu-ga-ref.texi docs
/interop
/qemu-ga-qapi.texi
745 docs
/interop
/qemu-qmp-ref.
dvi docs
/interop
/qemu-qmp-ref.html \
746 docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-qmp-ref.pdf \
747 docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7: \
748 docs
/interop
/qemu-qmp-ref.texi docs
/interop
/qemu-qmp-qapi.texi
750 $(filter %.1 %.7 %.8,$(DOCS
)): scripts
/texi2pod.pl
754 %/coverage-report.html
:
756 $(call quiet-command
,\
757 gcovr
-r
$(SRC_PATH
) \
758 $(foreach t
, $(TARGET_DIRS
), --object-directory
$(BUILD_DIR
)/$(t
)) \
759 --object-directory
$(BUILD_DIR
) \
760 -p
--html
--html-details
-o
$@
, \
761 "GEN", "coverage-report.html")
763 .PHONY
: coverage-report
764 coverage-report
: $(CURDIR
)/reports
/coverage
/coverage-report.html
768 INSTALLER
= qemu-setup-
$(VERSION
)$(EXESUF
)
770 nsisflags
= -V2
-NOCD
772 ifneq ($(wildcard $(SRC_PATH
)/dll
),)
773 ifeq ($(ARCH
),x86_64
)
775 DLL_PATH
= $(SRC_PATH
)/dll
/w64
779 DLL_PATH
= $(SRC_PATH
)/dll
/w32
784 installer
: $(INSTALLER
)
786 INSTDIR
=/tmp
/qemu-nsis
788 $(INSTALLER
): $(SRC_PATH
)/qemu.nsi
789 $(MAKE
) install DESTDIR
=${INSTDIR}
791 (cd
${INSTDIR}/${bindir}; \
797 (cd
${INSTDIR}/${bindir}; \
798 for i in qemu-system-
*.exe
; do \
800 arch
=$${arch
#qemu-system-}; \
801 echo Section
\"$$arch\" Section_
$$arch; \
802 echo SetOutPath
\"\
$$INSTDIR\"; \
803 echo File
\"\
$${BINDIR}\\$$i\"; \
806 ) >${INSTDIR}/${bindir}/system-emulations.nsh
807 makensis
$(nsisflags
) \
808 $(if
$(BUILD_DOCS
),-DCONFIG_DOCUMENTATION
="y") \
809 $(if
$(CONFIG_GTK
),-DCONFIG_GTK
="y") \
810 -DBINDIR
="${INSTDIR}/${bindir}" \
811 $(if
$(DLL_PATH
),-DDLLDIR
="$(DLL_PATH)") \
812 -DSRCDIR
="$(SRC_PATH)" \
813 -DOUTFILE
="$(INSTALLER)" \
814 -DDISPLAYVERSION
="$(VERSION)" \
818 $(SIGNCODE
) $(INSTALLER
)
822 # Add a dependency on the generated files, so that they are always
823 # rebuilt before other object files
824 ifneq ($(wildcard config-host.mak
),)
825 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
826 Makefile
: $(generated-files-y
)
830 # Include automatically generated dependency files
831 # Dependencies in Makefile.objs files come from our recursive subdir rules
832 -include $(wildcard *.d tests
/*.d
)
834 include $(SRC_PATH
)/tests
/docker
/Makefile.
include
835 include $(SRC_PATH
)/tests
/vm
/Makefile.
include
837 print-help-run
= printf
" %-30s - %s\\n" "$1" "$2"
838 print-help
= $(quiet-@
)$(call print-help-run
,$1,$2)
842 @echo
'Generic targets:'
843 $(call print-help
,all,Build
all)
845 $(call print-help
,modules
,Build
all modules
)
847 $(call print-help
,dir/file.o
,Build specified target only
)
848 $(call print-help
,install,Install QEMU
, documentation and tools
)
849 $(call print-help
,ctags
/TAGS
,Generate
tags file for editors
)
850 $(call print-help
,cscope
,Generate cscope index
)
851 $(call print-help
,sparse
,Run sparse on the QEMU source
)
853 @
$(if
$(TARGET_DIRS
), \
854 echo
'Architecture specific targets:'; \
855 $(foreach t
, $(TARGET_DIRS
), \
856 $(call print-help-run
,$(t
)/all,Build for
$(t
)); \
857 $(if
$(CONFIG_FUZZ
), \
858 $(if
$(findstring softmmu
,$(t
)), \
859 $(call print-help-run
,$(t
)/fuzz
,Build fuzzer for
$(t
)); \
862 @
$(if
$(HELPERS-y
), \
863 echo
'Helper targets:'; \
864 $(foreach t
, $(HELPERS-y
), \
865 $(call print-help-run
,$(t
),Build
$(shell basename $(t
)));) \
868 echo
'Tools targets:'; \
869 $(foreach t
, $(TOOLS
), \
870 $(call print-help-run
,$(t
),Build
$(shell basename $(t
)) tool
);) \
872 @echo
'Cleaning targets:'
873 $(call print-help
,clean,Remove most generated files but keep the config
)
874 $(call print-help
,distclean,Remove
all generated files
)
875 $(call print-help
,dist,Build a distributable tarball
)
877 @echo
'Test targets:'
878 $(call print-help
,check,Run
all tests
(check-help for details
))
879 $(call print-help
,docker
,Help about targets running tests inside containers
)
880 $(call print-help
,vm-help
,Help about targets running tests inside VM
)
882 @echo
'Documentation targets:'
883 $(call print-help
,html
info pdf txt
,Build documentation in specified format
)
886 @echo
'Windows targets:'
887 $(call print-help
,installer
,Build NSIS-based installer for QEMU
)
888 ifdef QEMU_GA_MSI_ENABLED
889 $(call print-help
,msi
,Build MSI-based installer for qemu-ga
)
893 $(call print-help
,$(MAKE
) [targets
],(quiet build
, default
))
894 $(call print-help
,$(MAKE
) V
=1 [targets
],(verbose build
))