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
+= module_block.h
125 generated-files-y
+= target
/s390x
/gen-features.h
126 target
/s390x
/gen-features.h
: Makefile.ninja
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
)
180 ifneq ($(wildcard config-host.mak
),)
181 include $(SRC_PATH
)/Makefile.objs
184 dummy
:= $(call unnest-vars
,, \
188 storage-daemon-obj-y \
189 storage-daemon-obj-m \
193 include $(SRC_PATH
)/tests
/Makefile.
include
195 all: $(DOCS
) $(if
$(BUILD_DOCS
),sphinxdocs
) $(TOOLS
) $(HELPERS-y
) recurse-all modules
197 config-host.h
: config-host.h-timestamp
198 config-host.h-timestamp
: config-host.mak
200 TARGET_DIRS_RULES
:= $(foreach t
, all fuzz
clean install, $(addsuffix /$(t
), $(TARGET_DIRS
)))
202 SOFTMMU_ALL_RULES
=$(filter %-softmmu
/all, $(TARGET_DIRS_RULES
))
203 $(SOFTMMU_ALL_RULES
): $(authz-obj-y
)
204 $(SOFTMMU_ALL_RULES
): $(block-obj-y
)
205 $(SOFTMMU_ALL_RULES
): $(storage-daemon-obj-y
)
206 $(SOFTMMU_ALL_RULES
): $(chardev-obj-y
)
207 $(SOFTMMU_ALL_RULES
): $(crypto-obj-y
)
208 $(SOFTMMU_ALL_RULES
): $(io-obj-y
)
209 $(SOFTMMU_ALL_RULES
): $(qom-obj-y
)
210 $(SOFTMMU_ALL_RULES
): config-all-devices.mak
212 SOFTMMU_FUZZ_RULES
=$(filter %-softmmu
/fuzz
, $(TARGET_DIRS_RULES
))
213 $(SOFTMMU_FUZZ_RULES
): $(authz-obj-y
)
214 $(SOFTMMU_FUZZ_RULES
): $(block-obj-y
)
215 $(SOFTMMU_FUZZ_RULES
): $(chardev-obj-y
)
216 $(SOFTMMU_FUZZ_RULES
): $(crypto-obj-y
)
217 $(SOFTMMU_FUZZ_RULES
): $(io-obj-y
)
218 $(SOFTMMU_FUZZ_RULES
): config-all-devices.mak
219 $(SOFTMMU_FUZZ_RULES
): $(edk2-decompressed
)
221 # meson: this is sub-optimal but going away after conversion
222 TARGET_DEPS
= $(patsubst %,%-config-target.h
, $(TARGET_DIRS
))
223 TARGET_DEPS
+= $(patsubst %,%-config-devices.h
, $(filter %-softmmu
,$(TARGET_DIRS
)))
224 TARGET_DEPS
+= $(patsubst %,libqemu-
%.fa
, $(TARGET_DIRS
))
226 .PHONY
: $(TARGET_DIRS_RULES
)
227 # The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
228 # $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
229 $(TARGET_DIRS_RULES
): $(TARGET_DEPS
)
230 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" $(notdir $@
),)
232 # LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
233 DTC_MAKE_ARGS
=-I
$(SRC_PATH
)/dtc VPATH
=$(SRC_PATH
)/dtc
-C dtc V
="$(V)" LIBFDT_lib
=""
234 DTC_CFLAGS
=$(CFLAGS
) $(QEMU_CFLAGS
)
235 DTC_CPPFLAGS
=-I
$(SRC_PATH
)/dtc
/libfdt
238 dtc
/all: .git-submodule-status dtc
/libfdt
239 $(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
,)
241 dtc
/%: .git-submodule-status
244 # Overriding CFLAGS causes us to lose defines added in the sub-makefile.
245 # Not overriding CFLAGS leads to mis-matches between compilation modes.
246 # Therefore we replicate some of the logic in the sub-makefile.
247 # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
248 # no need to annoy QEMU developers with such things.
249 CAP_CFLAGS
= $(patsubst -W
%,,$(CFLAGS
) $(QEMU_CFLAGS
))
250 CAP_CFLAGS
+= -DCAPSTONE_USE_SYS_DYN_MEM
251 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM
252 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM64
253 CAP_CFLAGS
+= -DCAPSTONE_HAS_POWERPC
254 CAP_CFLAGS
+= -DCAPSTONE_HAS_X86
257 capstone
/all: .git-submodule-status
258 $(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
))
261 slirp
/all: .git-submodule-status
262 $(call quiet-command
,$(MAKE
) -C
$(SRC_PATH
)/slirp \
263 BUILD_DIR
="$(BUILD_DIR)/slirp" \
264 PKG_CONFIG
="$(PKG_CONFIG)" \
265 CC
="$(CC)" AR
="$(AR)" LD
="$(LD)" RANLIB
="$(RANLIB)" \
266 CFLAGS
="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS
="$(QEMU_LDFLAGS)")
268 $(filter %/all, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
269 $(qom-obj-y
) block.syms qemu.syms
271 $(filter %/fuzz
, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
272 $(qom-obj-y
) $(crypto-user-obj-
$(CONFIG_USER_ONLY
))
274 ROM_DIRS
= $(addprefix pc-bios
/, $(ROMS
))
275 ROM_DIRS_RULES
=$(foreach t
, all clean, $(addsuffix /$(t
), $(ROM_DIRS
)))
276 # Only keep -O and -g cflags
277 .PHONY
: $(ROM_DIRS_RULES
)
279 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" CFLAGS
="$(filter -O% -g%,$(CFLAGS))" $(notdir $@
),)
281 .PHONY
: recurse-all recurse-clean recurse-install
282 recurse-all
: $(addsuffix /all, $(TARGET_DIRS
) $(ROM_DIRS
))
283 recurse-clean
: $(addsuffix /clean, $(TARGET_DIRS
) $(ROM_DIRS
))
284 recurse-install
: $(addsuffix /install, $(TARGET_DIRS
))
285 $(addsuffix /install, $(TARGET_DIRS
)): all
287 $(BUILD_DIR
)/version.o
: $(SRC_PATH
)/version.rc config-host.h
288 $(call quiet-command
,$(WINDRES
) -I
$(BUILD_DIR
) -o
$@
$<,"RC","version.o")
290 Makefile
: $(version-obj-y
)
292 ######################################################################
294 COMMON_LDADDS
= libqemuutil.a
296 qemu-img.o
: qemu-img-cmds.h
298 qemu-img
$(EXESUF
): qemu-img.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
299 qemu-nbd
$(EXESUF
): qemu-nbd.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
300 qemu-io
$(EXESUF
): qemu-io.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
301 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
)
303 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
)
305 scsi
/qemu-pr-helper
$(EXESUF
): LIBS
+= -ludev
-lmultipath
-lmpathpersist
308 module_block.h
: $(SRC_PATH
)/scripts
/modules
/module_block.py config-host.mak
309 $(call quiet-command
,$(PYTHON
) $< $@ \
310 $(addprefix $(SRC_PATH
)/,$(patsubst %.mo
,%.c
,$(block-obj-m
))), \
313 clean: recurse-clean ninja-clean clean-ctlist
314 -test -f ninjatool
&& .
/ninjatool
$(if
$(V
),-v
,) -t
clean
315 # avoid old build problems by removing potentially incorrect old files
316 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
317 find . \
( -name
'*.so' -o
-name
'*.dll' -o
-name
'*.mo' -o
-name
'*.[oda]' \
) -type f \
318 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-aarch64.a \
319 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-arm.a \
320 ! -path .
/roms
/edk2
/BaseTools
/Source
/Python
/UPT
/Dll
/sqlite3.dll \
322 rm -f
$(filter-out %.tlb
,$(TOOLS
)) $(HELPERS-y
) TAGS cscope.
* *.pod
*~
*/*~
323 rm -f fsdev
/*.pod scsi
/*.pod
324 rm -f
$(foreach f
,$(generated-files-y
),$(f
) $(f
)-timestamp
)
326 VERSION ?
= $(shell cat VERSION
)
328 dist: qemu-
$(VERSION
).
tar.bz2
331 $(SRC_PATH
)/scripts
/make-release
"$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
333 define clean-manual
=
334 rm -rf
$(MANUAL_BUILDDIR
)/$1/_static
335 rm -f
$(MANUAL_BUILDDIR
)/$1/objects.inv
$(MANUAL_BUILDDIR
)/$1/searchindex.js
$(MANUAL_BUILDDIR
)/$1/*.html
338 distclean: clean ninja-distclean
339 -test -f ninjatool
&& .
/ninjatool
$(if
$(V
),-v
,) -t
clean -g
340 rm -f config-host.mak config-host.h
* $(DOCS
)
341 rm -f tests
/tcg
/config-
*.mak
342 rm -f config-all-disas.mak config.status
343 rm -f po
/*.mo tests
/qemu-iotests
/common.env
344 rm -f roms
/seabios
/config.mak roms
/vgabios
/config.mak
345 rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
346 rm -rf meson-private meson-logs meson-info compile_commands.json
347 rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest
349 rm -f linux-headers
/asm
350 rm -f docs
/version.texi
351 rm -f docs
/interop
/qemu-ga-qapi.texi docs
/interop
/qemu-qmp-qapi.texi
352 rm -f docs
/interop
/qemu-qmp-ref
.7 docs
/interop
/qemu-ga-ref
.7
353 rm -f docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
354 rm -f docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
355 rm -f docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html
357 $(call clean-manual
,devel
)
358 $(call clean-manual
,interop
)
359 $(call clean-manual
,specs
)
360 $(call clean-manual
,system
)
361 $(call clean-manual
,tools
)
362 $(call clean-manual
,user
)
363 for d in
$(TARGET_DIRS
); do \
364 rm -rf
$$d || exit
1 ; \
368 KEYMAPS
=da en-gb et fr fr-ch is lt no pt-br sv \
369 ar de en-us fi fr-be hr it lv nl pl ru th \
370 de-ch es fo fr-ca hu ja mk pt sl tr \
374 BLOBS
=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
375 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
376 vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
377 openbios-sparc32 openbios-sparc64 openbios-ppc QEMU
,tcx.bin QEMU
,cgthree.bin \
378 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
379 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
380 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
381 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
382 efi-e1000e.rom efi-vmxnet3.rom \
384 bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
385 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
386 s390-ccw.img s390-netboot.img \
387 slof.bin skiboot.lid \
389 u-boot.e500 u-boot-sam460-20100605.bin \
393 opensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
394 opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
399 # Note that we manually filter-out the non-Sphinx documentation which
400 # is currently built into the docs/interop directory in the build tree,
401 # and also any sphinx-built manpages.
402 define install-manual
=
403 for d in
$$(cd
$(MANUAL_BUILDDIR
) && find
$1 -type d
); do
$(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/$$d"; done
404 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
407 # Note that we deliberately do not install the "devel" manual: it is
408 # for QEMU developers, and not interesting to our users.
409 .PHONY
: install-sphinxdocs
410 install-sphinxdocs
: sphinxdocs
411 $(call install-manual
,interop
)
412 $(call install-manual
,specs
)
413 $(call install-manual
,system
)
414 $(call install-manual
,tools
)
415 $(call install-manual
,user
)
417 install-doc
: $(DOCS
) install-sphinxdocs
418 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)"
419 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/index.html
"$(DESTDIR)$(qemu_docdir)"
420 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/interop"
421 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.html
"$(DESTDIR)$(qemu_docdir)/interop"
422 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.txt
"$(DESTDIR)$(qemu_docdir)/interop"
424 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
425 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu
.1 "$(DESTDIR)$(mandir)/man1"
426 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man7"
427 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref
.7 "$(DESTDIR)$(mandir)/man7"
428 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-block-drivers
.7 "$(DESTDIR)$(mandir)/man7"
429 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-cpu-models
.7 "$(DESTDIR)$(mandir)/man7"
430 ifeq ($(CONFIG_TOOLS
),y
)
431 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-img
.1 "$(DESTDIR)$(mandir)/man1"
432 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man8"
433 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-nbd
.8 "$(DESTDIR)$(mandir)/man8"
435 ifdef CONFIG_TRACE_SYSTEMTAP
436 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-trace-stap
.1 "$(DESTDIR)$(mandir)/man1"
438 ifeq ($(CONFIG_GUEST_AGENT
),y
)
439 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/interop
/qemu-ga
.8 "$(DESTDIR)$(mandir)/man8"
440 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/interop"
441 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.html
"$(DESTDIR)$(qemu_docdir)/interop"
442 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.txt
"$(DESTDIR)$(qemu_docdir)/interop"
443 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref
.7 "$(DESTDIR)$(mandir)/man7"
447 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
448 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/virtfs-proxy-helper
.1 "$(DESTDIR)$(mandir)/man1"
450 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
451 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/virtiofsd
.1 "$(DESTDIR)$(mandir)/man1"
455 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)"
457 install-localstatedir
:
459 ifeq ($(CONFIG_GUEST_AGENT
),y
)
460 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_localstatedir)"/run
464 ICON_SIZES
=16x16
24x24
32x32
48x48
64x64
128x128
256x256
512x512
467 $(INSTALL_DIR
) "$(DESTDIR)$(includedir)"
469 # Needed by "meson install"
471 install: all $(if
$(BUILD_DOCS
),install-doc
) \
472 install-datadir install-localstatedir install-includedir \
475 $(call install-prog
,$(TOOLS
),$(DESTDIR
)$(bindir))
477 ifneq ($(HELPERS-y
),)
478 $(call install-prog
,$(HELPERS-y
),$(DESTDIR
)$(libexecdir
))
480 ifdef CONFIG_TRACE_SYSTEMTAP
481 $(INSTALL_PROG
) "scripts/qemu-trace-stap" $(DESTDIR
)$(bindir)
484 set
-e
; for x in
$(BLOBS
); do \
485 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/$$x "$(DESTDIR)$(qemu_datadir)"; \
488 for s in
$(ICON_SIZES
); do \
489 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
490 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_
$${s}.png \
491 "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
493 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
494 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_32x32.bmp \
495 "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
496 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
497 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu.svg \
498 "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
499 mkdir
-p
"$(DESTDIR)$(qemu_desktopdir)"
500 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/qemu.desktop \
501 "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
505 ifeq ($(CONFIG_PLUGIN
),y
)
506 $(INSTALL_DATA
) $(SRC_PATH
)/include/qemu
/qemu-plugin.h
"$(DESTDIR)$(includedir)/qemu-plugin.h"
508 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/keymaps"
509 set
-e
; for x in
$(KEYMAPS
); do \
510 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/keymaps
/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
512 for d in
$(TARGET_DIRS
); do \
513 $(MAKE
) $(SUBDIR_MAKEFLAGS
) TARGET_DIR
=$$d/ -C
$$d $@ || exit
1 ; \
518 MAKEINFOINCLUDES
= -I docs
-I
$(<D
) -I
$(@D
)
519 MAKEINFOFLAGS
=--no-split
--number-sections
$(MAKEINFOINCLUDES
)
520 TEXI2PODFLAGS
=$(MAKEINFOINCLUDES
) -DVERSION
="$(VERSION)" -DCONFDIR
="$(qemu_confdir)"
521 TEXI2PDFFLAGS
=$(if
$(V
),,--quiet
) -I
$(SRC_PATH
) $(MAKEINFOINCLUDES
)
523 docs
/version.texi
: $(SRC_PATH
)/VERSION config-host.mak
524 $(call quiet-command
,(\
525 echo
"@set VERSION $(VERSION)" && \
526 echo
"@set CONFDIR $(qemu_confdir)" \
529 %.html
: %.texi docs
/version.texi
530 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
531 --html
$< -o
$@
,"GEN","$@")
533 %.
info: %.texi docs
/version.texi
534 $(call quiet-command
,$(MAKEINFO
) $(MAKEINFOFLAGS
) $< -o
$@
,"GEN","$@")
536 %.txt
: %.texi docs
/version.texi
537 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
538 --plaintext
$< -o
$@
,"GEN","$@")
540 %.pdf
: %.texi docs
/version.texi
541 $(call quiet-command
,texi2pdf
$(TEXI2PDFFLAGS
) $< -o
$@
,"GEN","$@")
543 # Sphinx builds all its documentation at once in one invocation
544 # and handles "don't rebuild things unless necessary" itself.
545 # The '.doctrees' files are cached information to speed this up.
547 sphinxdocs
: $(MANUAL_BUILDDIR
)/devel
/index.html \
548 $(MANUAL_BUILDDIR
)/interop
/index.html \
549 $(MANUAL_BUILDDIR
)/specs
/index.html \
550 $(MANUAL_BUILDDIR
)/system
/index.html \
551 $(MANUAL_BUILDDIR
)/tools
/index.html \
552 $(MANUAL_BUILDDIR
)/user
/index.html
554 # Canned command to build a single manual
555 # Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
556 # Note the use of different doctree for each (manual, builder) tuple;
557 # this works around Sphinx not handling parallel invocation on
558 # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
559 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")
560 # We assume all RST files in the manual's directory are used in it
561 manual-deps
= $(wildcard $(SRC_PATH
)/docs
/$1/*.rst
$(SRC_PATH
)/docs
/$1/*/*.rst
) \
562 $(SRC_PATH
)/docs
/defs.rst.inc \
563 $(SRC_PATH
)/docs
/$1/conf.py
$(SRC_PATH
)/docs
/conf.py \
564 $(SRC_PATH
)/docs
/sphinx
/*.py
565 # Macro to write out the rule and dependencies for building manpages
566 # Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps])
567 # 'extradeps' is optional, and specifies extra files (eg .hx files) that
568 # the manual page depends on.
569 define define-manpage-rule
570 $(call atomic
,$(foreach manpage
,$2,$(MANUAL_BUILDDIR
)/$1/$(manpage
)),$(call manual-deps
,$1) $3)
571 $(call build-manual
,$1,man
)
574 $(MANUAL_BUILDDIR
)/devel
/index.html
: $(call manual-deps
,devel
)
575 $(call build-manual
,devel
,html
)
577 $(MANUAL_BUILDDIR
)/interop
/index.html
: $(call manual-deps
,interop
)
578 $(call build-manual
,interop
,html
)
580 $(MANUAL_BUILDDIR
)/specs
/index.html
: $(call manual-deps
,specs
)
581 $(call build-manual
,specs
,html
)
583 $(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
584 $(call build-manual
,system
,html
)
586 $(MANUAL_BUILDDIR
)/tools
/index.html
: $(call manual-deps
,tools
) $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/docs
/qemu-option-trace.rst.inc
587 $(call build-manual
,tools
,html
)
589 $(MANUAL_BUILDDIR
)/user
/index.html
: $(call manual-deps
,user
)
590 $(call build-manual
,user
,html
)
592 $(call define-manpage-rule
,interop
,qemu-ga
.8)
594 $(call define-manpage-rule
,system
,qemu
.1 qemu-block-drivers
.7 qemu-cpu-models
.7)
596 $(call define-manpage-rule
,tools
,\
597 qemu-img
.1 qemu-nbd
.8 qemu-trace-stap
.1\
598 virtiofsd
.1 virtfs-proxy-helper
.1,\
599 $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/docs
/qemu-option-trace.rst.inc
)
601 $(MANUAL_BUILDDIR
)/index.html
: $(SRC_PATH
)/docs
/index.html.in qemu-version.h
602 @mkdir
-p
"$(MANUAL_BUILDDIR)"
603 $(call quiet-command
, sed
"s|@@VERSION@@|${VERSION}|g" $< >$@
, \
606 docs
/interop
/qemu-qmp-qapi.texi
: qapi
/qapi-doc.texi
609 docs
/interop
/qemu-ga-qapi.texi
: qga
/qga-qapi-doc.texi
612 html
: docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html sphinxdocs
613 info: docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-ga-ref.
info
614 pdf
: docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
615 txt
: docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
617 docs
/interop
/qemu-ga-ref.
dvi docs
/interop
/qemu-ga-ref.html \
618 docs
/interop
/qemu-ga-ref.
info docs
/interop
/qemu-ga-ref.pdf \
619 docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7: \
620 docs
/interop
/qemu-ga-ref.texi docs
/interop
/qemu-ga-qapi.texi
622 docs
/interop
/qemu-qmp-ref.
dvi docs
/interop
/qemu-qmp-ref.html \
623 docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-qmp-ref.pdf \
624 docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7: \
625 docs
/interop
/qemu-qmp-ref.texi docs
/interop
/qemu-qmp-qapi.texi
627 $(filter %.1 %.7 %.8,$(DOCS
)): scripts
/texi2pod.pl
631 %/coverage-report.html
:
633 $(call quiet-command
,\
634 gcovr
-r
$(SRC_PATH
) \
635 $(foreach t
, $(TARGET_DIRS
), --object-directory
$(BUILD_DIR
)/$(t
)) \
636 --object-directory
$(BUILD_DIR
) \
637 -p
--html
--html-details
-o
$@
, \
638 "GEN", "coverage-report.html")
640 .PHONY
: coverage-report
641 coverage-report
: $(CURDIR
)/reports
/coverage
/coverage-report.html
645 INSTALLER
= qemu-setup-
$(VERSION
)$(EXESUF
)
647 nsisflags
= -V2
-NOCD
649 ifneq ($(wildcard $(SRC_PATH
)/dll
),)
650 ifeq ($(ARCH
),x86_64
)
652 DLL_PATH
= $(SRC_PATH
)/dll
/w64
656 DLL_PATH
= $(SRC_PATH
)/dll
/w32
661 installer
: $(INSTALLER
)
663 INSTDIR
=/tmp
/qemu-nsis
665 $(INSTALLER
): $(SRC_PATH
)/qemu.nsi
666 $(MAKE
) install DESTDIR
=${INSTDIR}
668 (cd
${INSTDIR}/${bindir}; \
674 (cd
${INSTDIR}/${bindir}; \
675 for i in qemu-system-
*.exe
; do \
677 arch
=$${arch
#qemu-system-}; \
678 echo Section
\"$$arch\" Section_
$$arch; \
679 echo SetOutPath
\"\
$$INSTDIR\"; \
680 echo File
\"\
$${BINDIR}\\$$i\"; \
683 ) >${INSTDIR}/${bindir}/system-emulations.nsh
684 makensis
$(nsisflags
) \
685 $(if
$(BUILD_DOCS
),-DCONFIG_DOCUMENTATION
="y") \
686 $(if
$(CONFIG_GTK
),-DCONFIG_GTK
="y") \
687 -DBINDIR
="${INSTDIR}/${bindir}" \
688 $(if
$(DLL_PATH
),-DDLLDIR
="$(DLL_PATH)") \
689 -DSRCDIR
="$(SRC_PATH)" \
690 -DOUTFILE
="$(INSTALLER)" \
691 -DDISPLAYVERSION
="$(VERSION)" \
695 $(SIGNCODE
) $(INSTALLER
)
699 # Add a dependency on the generated files, so that they are always
700 # rebuilt before other object files
701 ifneq ($(wildcard config-host.mak
),)
702 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
703 Makefile
: $(generated-files-y
)
707 # Include automatically generated dependency files
708 # Dependencies in Makefile.objs files come from our recursive subdir rules
709 -include $(wildcard *.d tests
/*.d
)
711 include $(SRC_PATH
)/tests
/docker
/Makefile.
include
712 include $(SRC_PATH
)/tests
/vm
/Makefile.
include
714 print-help-run
= printf
" %-30s - %s\\n" "$1" "$2"
715 print-help
= $(quiet-@
)$(call print-help-run
,$1,$2)
719 @echo
'Generic targets:'
720 $(call print-help
,all,Build
all)
722 $(call print-help
,modules
,Build
all modules
)
724 $(call print-help
,dir/file.o
,Build specified target only
)
725 $(call print-help
,install,Install QEMU
, documentation and tools
)
726 $(call print-help
,ctags
/TAGS
,Generate
tags file for editors
)
727 $(call print-help
,cscope
,Generate cscope index
)
728 $(call print-help
,sparse
,Run sparse on the QEMU source
)
730 @
$(if
$(TARGET_DIRS
), \
731 echo
'Architecture specific targets:'; \
732 $(foreach t
, $(TARGET_DIRS
), \
733 $(call print-help-run
,$(t
)/all,Build for
$(t
)); \
734 $(if
$(CONFIG_FUZZ
), \
735 $(if
$(findstring softmmu
,$(t
)), \
736 $(call print-help-run
,$(t
)/fuzz
,Build fuzzer for
$(t
)); \
739 @
$(if
$(HELPERS-y
), \
740 echo
'Helper targets:'; \
741 $(foreach t
, $(HELPERS-y
), \
742 $(call print-help-run
,$(t
),Build
$(shell basename $(t
)));) \
745 echo
'Tools targets:'; \
746 $(foreach t
, $(TOOLS
), \
747 $(call print-help-run
,$(t
),Build
$(shell basename $(t
)) tool
);) \
749 @echo
'Cleaning targets:'
750 $(call print-help
,clean,Remove most generated files but keep the config
)
751 $(call print-help
,distclean,Remove
all generated files
)
752 $(call print-help
,dist,Build a distributable tarball
)
754 @echo
'Test targets:'
755 $(call print-help
,check,Run
all tests
(check-help for details
))
756 $(call print-help
,docker
,Help about targets running tests inside containers
)
757 $(call print-help
,vm-help
,Help about targets running tests inside VM
)
759 @echo
'Documentation targets:'
760 $(call print-help
,html
info pdf txt
,Build documentation in specified format
)
763 @echo
'Windows targets:'
764 $(call print-help
,installer
,Build NSIS-based installer for QEMU
)
765 ifdef QEMU_GA_MSI_ENABLED
766 $(call print-help
,msi
,Build MSI-based installer for qemu-ga
)
770 $(call print-help
,$(MAKE
) [targets
],(quiet build
, default
))
771 $(call print-help
,$(MAKE
) V
=1 [targets
],(verbose build
))