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 # Create QEMU_PKGVERSION and FULL_VERSION strings
125 # If PKGVERSION is set, use that; otherwise get version and -dirty status from git
126 QEMU_PKGVERSION
:= $(if
$(PKGVERSION
),$(PKGVERSION
),$(shell \
128 if
test -e .git
; then \
129 git describe
--match
'v*' 2>/dev
/null | tr
-d
'\n'; \
130 if
! git diff-index
--quiet HEAD
&>/dev
/null
; then \
135 # Either "version (pkgversion)", or just "version" if pkgversion not set
136 FULL_VERSION
:= $(if
$(QEMU_PKGVERSION
),$(VERSION
) ($(QEMU_PKGVERSION
)),$(VERSION
))
138 generated-files-y
= qemu-version.h config-host.h qemu-options.def
140 generated-files-y
+= module_block.h
142 generated-files-y
+= .git-submodule-status
144 KEYCODEMAP_GEN
= $(SRC_PATH
)/ui
/keycodemapdb
/tools
/keymap-gen
145 KEYCODEMAP_CSV
= $(SRC_PATH
)/ui
/keycodemapdb
/data
/keymaps.csv
148 ui
/input-keymap-atset1-to-qcode.c.inc \
149 ui
/input-keymap-linux-to-qcode.c.inc \
150 ui
/input-keymap-qcode-to-atset1.c.inc \
151 ui
/input-keymap-qcode-to-atset2.c.inc \
152 ui
/input-keymap-qcode-to-atset3.c.inc \
153 ui
/input-keymap-qcode-to-linux.c.inc \
154 ui
/input-keymap-qcode-to-qnum.c.inc \
155 ui
/input-keymap-qcode-to-sun.c.inc \
156 ui
/input-keymap-qnum-to-qcode.c.inc \
157 ui
/input-keymap-usb-to-qcode.c.inc \
158 ui
/input-keymap-win32-to-qcode.c.inc \
159 ui
/input-keymap-x11-to-qcode.c.inc \
160 ui
/input-keymap-xorgevdev-to-qcode.c.inc \
161 ui
/input-keymap-xorgkbd-to-qcode.c.inc \
162 ui
/input-keymap-xorgxquartz-to-qcode.c.inc \
163 ui
/input-keymap-xorgxwin-to-qcode.c.inc \
164 ui
/input-keymap-osx-to-qcode.c.inc \
167 generated-files-
$(CONFIG_SOFTMMU
) += $(KEYCODEMAP_FILES
)
169 ui
/input-keymap-
%.c.inc
: $(KEYCODEMAP_GEN
) $(KEYCODEMAP_CSV
) $(SRC_PATH
)/ui
/Makefile.objs
170 $(call quiet-command
,\
171 stem
=$* && src
=$${stem
%-to-
*} dst
=$${stem
#*-to-} && \
172 test -e
$(KEYCODEMAP_GEN
) && \
173 $(PYTHON
) $(KEYCODEMAP_GEN
) \
175 --varname qemu_input_map_
$${src}_to_
$${dst} \
176 code-map
$(KEYCODEMAP_CSV
) $${src} $${dst} \
177 > $@ ||
rm -f
$@
, "GEN", "$@")
179 $(KEYCODEMAP_GEN
): .git-submodule-status
180 $(KEYCODEMAP_CSV
): .git-submodule-status
182 edk2-decompressed
= $(basename $(wildcard pc-bios
/edk2-
*.fd.bz2
))
183 pc-bios
/edk2-
%.fd
: pc-bios
/edk2-
%.fd.bz2
184 $(call quiet-command
,bzip2
-d
-c
$< > $@
,"BUNZIP2",$<)
186 # Don't try to regenerate Makefile or configure
187 # We don't generate any of them
191 .PHONY
: all clean cscope
distclean html
info install install-doc \
192 pdf txt recurse-all
dist msi FORCE
194 $(call set-vpath
, $(SRC_PATH
))
196 LIBS
+=-lz
$(LIBS_TOOLS
)
199 HELPERS-y
= $(HELPERS
)
201 HELPERS-
$(call land
,$(CONFIG_SOFTMMU
),$(CONFIG_LINUX
)) += qemu-bridge-helper
$(EXESUF
)
203 ifeq ($(CONFIG_LINUX
)$(CONFIG_VIRGL
)$(CONFIG_GBM
)$(CONFIG_TOOLS
),yyyy
)
204 HELPERS-y
+= vhost-user-gpu
$(EXESUF
)
205 vhost-user-json-y
+= contrib
/vhost-user-gpu
/50-qemu-gpu.json
208 ifeq ($(CONFIG_SOFTMMU
)$(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyyy
)
209 HELPERS-y
+= virtiofsd
$(EXESUF
)
210 vhost-user-json-y
+= tools
/virtiofsd
/50-qemu-virtiofsd.json
213 # Sphinx does not allow building manuals into the same directory as
214 # the source files, so if we're doing an in-tree QEMU build we must
215 # build the manuals into a subdirectory (and then install them from
216 # there for 'make install'). For an out-of-tree build we can just
217 # use the docs/ subdirectory in the build tree as normal.
218 ifeq ($(realpath
$(SRC_PATH
)),$(realpath .
))
219 MANUAL_BUILDDIR
:= docs
/built
221 MANUAL_BUILDDIR
:= docs
225 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu
.1
226 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/qemu-img
.1
227 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/qemu-nbd
.8
228 DOCS
+=$(MANUAL_BUILDDIR
)/interop
/qemu-ga
.8
229 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
230 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/virtiofsd
.1
232 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu-block-drivers
.7
233 DOCS
+=docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7
234 DOCS
+=docs
/interop
/qemu-ga-ref.html docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7
235 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu-cpu-models
.7
236 DOCS
+=$(MANUAL_BUILDDIR
)/index.html
238 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/virtfs-proxy-helper
.1
240 ifdef CONFIG_TRACE_SYSTEMTAP
241 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/qemu-trace-stap
.1
247 SUBDIR_MAKEFLAGS
=$(if
$(V
),,--no-print-directory
--quiet
) BUILD_DIR
=$(BUILD_DIR
)
248 SUBDIR_DEVICES_MAK
=$(patsubst %, %/config-devices.mak
, $(filter %-softmmu
, $(TARGET_DIRS
)))
249 SUBDIR_DEVICES_MAK_DEP
=$(patsubst %, %.d
, $(SUBDIR_DEVICES_MAK
))
251 ifeq ($(SUBDIR_DEVICES_MAK
),)
252 config-all-devices.mak
: config-host.mak
253 $(call quiet-command
,echo
'# no devices' > $@
,"GEN","$@")
255 config-all-devices.mak
: $(SUBDIR_DEVICES_MAK
) config-host.mak
256 $(call quiet-command
, sed
-n \
257 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
258 $(SUBDIR_DEVICES_MAK
) |
sort -u
> $@
, \
262 -include $(SUBDIR_DEVICES_MAK_DEP
)
264 # This has to be kept in sync with Kconfig.host.
266 $(CONFIG_MINIKCONF_MODE
) \
267 $@
$*/config-devices.mak.d
$< $(SRC_PATH
)/Kconfig \
268 CONFIG_TCG
=$(CONFIG_TCG
) \
269 CONFIG_KVM
=$(CONFIG_KVM
) \
270 CONFIG_SPICE
=$(CONFIG_SPICE
) \
271 CONFIG_IVSHMEM
=$(CONFIG_IVSHMEM
) \
272 CONFIG_TPM
=$(CONFIG_TPM
) \
273 CONFIG_XEN
=$(CONFIG_XEN
) \
274 CONFIG_OPENGL
=$(CONFIG_OPENGL
) \
275 CONFIG_X11
=$(CONFIG_X11
) \
276 CONFIG_VHOST_USER
=$(CONFIG_VHOST_USER
) \
277 CONFIG_VHOST_KERNEL
=$(CONFIG_VHOST_KERNEL
) \
278 CONFIG_VIRTFS
=$(CONFIG_VIRTFS
) \
279 CONFIG_LINUX
=$(CONFIG_LINUX
) \
280 CONFIG_PVRDMA
=$(CONFIG_PVRDMA
)
282 MINIKCONF
= $(PYTHON
) $(SRC_PATH
)/scripts
/minikconf.py
284 $(SUBDIR_DEVICES_MAK
): %/config-devices.mak
: default-configs
/%.mak
$(SRC_PATH
)/Kconfig
$(BUILD_DIR
)/config-host.mak
285 $(call quiet-command
, $(MINIKCONF
) $(MINIKCONF_ARGS
) \
286 > $@.tmp
, "GEN", "$@.tmp")
287 $(call quiet-command
, if
test -f
$@
; then \
288 if cmp
-s
$@.old
$@
; then \
292 if
test -f
$@.old
; then \
293 echo
"WARNING: $@ (user modified) out of date.";\
295 echo
"WARNING: $@ out of date.";\
297 echo
"Run \"$(MAKE) defconfig\" to regenerate."; \
306 rm -f config-all-devices.mak
$(SUBDIR_DEVICES_MAK
)
308 ifneq ($(wildcard config-host.mak
),)
309 include $(SRC_PATH
)/Makefile.objs
312 dummy
:= $(call unnest-vars
,, \
317 ivshmem-client-obj-y \
318 ivshmem-server-obj-y \
321 libvhost-user-obj-y \
322 vhost-user-scsi-obj-y \
323 vhost-user-blk-obj-y \
324 vhost-user-input-obj-y \
325 vhost-user-gpu-obj-y \
329 storage-daemon-obj-y \
330 storage-daemon-obj-m \
337 include $(SRC_PATH
)/tests
/Makefile.
include
339 all: $(DOCS
) $(if
$(BUILD_DOCS
),sphinxdocs
) $(TOOLS
) $(HELPERS-y
) recurse-all modules
$(vhost-user-json-y
)
341 qemu-version.h
: FORCE
342 $(call quiet-command
, \
343 (printf
'#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \
344 printf
'#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \
346 $(call quiet-command
, if
! cmp
-s
$@
$@.tmp
; then \
352 config-host.h
: config-host.h-timestamp
353 config-host.h-timestamp
: config-host.mak
354 qemu-options.def
: $(SRC_PATH
)/qemu-options.hx
$(SRC_PATH
)/scripts
/hxtool
355 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
357 TARGET_DIRS_RULES
:= $(foreach t
, all fuzz
clean install, $(addsuffix /$(t
), $(TARGET_DIRS
)))
359 SOFTMMU_ALL_RULES
=$(filter %-softmmu
/all, $(TARGET_DIRS_RULES
))
360 $(SOFTMMU_ALL_RULES
): $(authz-obj-y
)
361 $(SOFTMMU_ALL_RULES
): $(block-obj-y
)
362 $(SOFTMMU_ALL_RULES
): $(storage-daemon-obj-y
)
363 $(SOFTMMU_ALL_RULES
): $(chardev-obj-y
)
364 $(SOFTMMU_ALL_RULES
): $(crypto-obj-y
)
365 $(SOFTMMU_ALL_RULES
): $(io-obj-y
)
366 $(SOFTMMU_ALL_RULES
): config-all-devices.mak
367 ifdef DECOMPRESS_EDK2_BLOBS
368 $(SOFTMMU_ALL_RULES
): $(edk2-decompressed
)
371 SOFTMMU_FUZZ_RULES
=$(filter %-softmmu
/fuzz
, $(TARGET_DIRS_RULES
))
372 $(SOFTMMU_FUZZ_RULES
): $(authz-obj-y
)
373 $(SOFTMMU_FUZZ_RULES
): $(block-obj-y
)
374 $(SOFTMMU_FUZZ_RULES
): $(chardev-obj-y
)
375 $(SOFTMMU_FUZZ_RULES
): $(crypto-obj-y
)
376 $(SOFTMMU_FUZZ_RULES
): $(io-obj-y
)
377 $(SOFTMMU_FUZZ_RULES
): config-all-devices.mak
378 $(SOFTMMU_FUZZ_RULES
): $(edk2-decompressed
)
380 .PHONY
: $(TARGET_DIRS_RULES
)
381 # The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
382 # $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
383 $(TARGET_DIRS_RULES
):
384 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" $(notdir $@
),)
386 # LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
387 DTC_MAKE_ARGS
=-I
$(SRC_PATH
)/dtc VPATH
=$(SRC_PATH
)/dtc
-C dtc V
="$(V)" LIBFDT_lib
=""
388 DTC_CFLAGS
=$(CFLAGS
) $(QEMU_CFLAGS
)
389 DTC_CPPFLAGS
=-I
$(SRC_PATH
)/dtc
/libfdt
392 dtc
/all: .git-submodule-status dtc
/libfdt
393 $(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
,)
395 dtc
/%: .git-submodule-status
398 # Overriding CFLAGS causes us to lose defines added in the sub-makefile.
399 # Not overriding CFLAGS leads to mis-matches between compilation modes.
400 # Therefore we replicate some of the logic in the sub-makefile.
401 # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
402 # no need to annoy QEMU developers with such things.
403 CAP_CFLAGS
= $(patsubst -W
%,,$(CFLAGS
) $(QEMU_CFLAGS
))
404 CAP_CFLAGS
+= -DCAPSTONE_USE_SYS_DYN_MEM
405 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM
406 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM64
407 CAP_CFLAGS
+= -DCAPSTONE_HAS_POWERPC
408 CAP_CFLAGS
+= -DCAPSTONE_HAS_X86
411 capstone
/all: .git-submodule-status
412 $(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
))
415 slirp
/all: .git-submodule-status
416 $(call quiet-command
,$(MAKE
) -C
$(SRC_PATH
)/slirp \
417 BUILD_DIR
="$(BUILD_DIR)/slirp" \
418 PKG_CONFIG
="$(PKG_CONFIG)" \
419 CC
="$(CC)" AR
="$(AR)" LD
="$(LD)" RANLIB
="$(RANLIB)" \
420 CFLAGS
="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS
="$(QEMU_LDFLAGS)")
422 $(filter %/all, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
425 $(filter %/fuzz
, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
426 $(qom-obj-y
) $(crypto-user-obj-
$(CONFIG_USER_ONLY
))
428 ROM_DIRS
= $(addprefix pc-bios
/, $(ROMS
))
429 ROM_DIRS_RULES
=$(foreach t
, all clean, $(addsuffix /$(t
), $(ROM_DIRS
)))
430 # Only keep -O and -g cflags
431 .PHONY
: $(ROM_DIRS_RULES
)
433 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" CFLAGS
="$(filter -O% -g%,$(CFLAGS))" $(notdir $@
),)
435 .PHONY
: recurse-all recurse-clean recurse-install
436 recurse-all
: $(addsuffix /all, $(TARGET_DIRS
) $(ROM_DIRS
))
437 recurse-clean
: $(addsuffix /clean, $(TARGET_DIRS
) $(ROM_DIRS
))
438 recurse-install
: $(addsuffix /install, $(TARGET_DIRS
))
439 $(addsuffix /install, $(TARGET_DIRS
)): all
441 $(BUILD_DIR
)/version.o
: $(SRC_PATH
)/version.rc config-host.h
442 $(call quiet-command
,$(WINDRES
) -I
$(BUILD_DIR
) -o
$@
$<,"RC","version.o")
444 Makefile
: $(version-obj-y
)
446 ######################################################################
449 libvhost-user.a
: $(libvhost-user-obj-y
)
451 ######################################################################
453 COMMON_LDADDS
= libqemuutil.a
455 qemu-img.o
: qemu-img-cmds.h
457 qemu-img
$(EXESUF
): qemu-img.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
458 qemu-nbd
$(EXESUF
): qemu-nbd.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
459 qemu-io
$(EXESUF
): qemu-io.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
460 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
)
462 qemu-bridge-helper
$(EXESUF
): qemu-bridge-helper.o
$(COMMON_LDADDS
)
464 qemu-keymap
$(EXESUF
): qemu-keymap.o ui
/input-keymap.o
$(COMMON_LDADDS
)
466 qemu-edid
$(EXESUF
): qemu-edid.o hw
/display
/edid-generate.o
$(COMMON_LDADDS
)
468 fsdev
/virtfs-proxy-helper
$(EXESUF
): fsdev
/virtfs-proxy-helper.o fsdev
/9p-marshal.o fsdev
/9p-iov-marshal.o
$(COMMON_LDADDS
)
470 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
)
472 scsi
/qemu-pr-helper
$(EXESUF
): LIBS
+= -ludev
-lmultipath
-lmpathpersist
475 qemu-img-cmds.h
: $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/scripts
/hxtool
476 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
478 qemu-ga
$(EXESUF
): LIBS
= $(LIBS_QGA
)
479 qemu-ga
$(EXESUF
): QEMU_CFLAGS
+= -I qga
/qapi-generated
481 qemu-keymap
$(EXESUF
): LIBS
+= $(XKBCOMMON_LIBS
)
482 qemu-keymap
$(EXESUF
): QEMU_CFLAGS
+= $(XKBCOMMON_CFLAGS
)
484 qapi-py
= $(SRC_PATH
)/scripts
/qapi
/__init__.py \
485 $(SRC_PATH
)/scripts
/qapi
/commands.py \
486 $(SRC_PATH
)/scripts
/qapi
/common.py \
487 $(SRC_PATH
)/scripts
/qapi
/doc.py \
488 $(SRC_PATH
)/scripts
/qapi
/error.py \
489 $(SRC_PATH
)/scripts
/qapi
/events.py \
490 $(SRC_PATH
)/scripts
/qapi
/expr.py \
491 $(SRC_PATH
)/scripts
/qapi
/gen.py \
492 $(SRC_PATH
)/scripts
/qapi
/introspect.py \
493 $(SRC_PATH
)/scripts
/qapi
/parser.py \
494 $(SRC_PATH
)/scripts
/qapi
/schema.py \
495 $(SRC_PATH
)/scripts
/qapi
/source.py \
496 $(SRC_PATH
)/scripts
/qapi
/types.py \
497 $(SRC_PATH
)/scripts
/qapi
/visit.py \
498 $(SRC_PATH
)/scripts
/qapi-gen.py
500 qga
/qapi-generated
/qga-qapi-types.c qga
/qapi-generated
/qga-qapi-types.h \
501 qga
/qapi-generated
/qga-qapi-visit.c qga
/qapi-generated
/qga-qapi-visit.h \
502 qga
/qapi-generated
/qga-qapi-commands.h qga
/qapi-generated
/qga-qapi-commands.c \
503 qga
/qapi-generated
/qga-qapi-init-commands.h qga
/qapi-generated
/qga-qapi-init-commands.c \
504 qga
/qapi-generated
/qga-qapi-doc.texi
: \
505 qga
/qapi-generated
/qapi-gen-timestamp
;
506 qga
/qapi-generated
/qapi-gen-timestamp
: $(SRC_PATH
)/qga
/qapi-schema.json
$(qapi-py
)
507 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-gen.py \
508 -o qga
/qapi-generated
-p
"qga-" $<, \
509 "GEN","$(@:%-timestamp=%)")
512 QGALIB_GEN
=$(addprefix qga
/qapi-generated
/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h qga-qapi-init-commands.h
)
513 $(qga-obj-y
): $(QGALIB_GEN
)
515 qemu-ga
$(EXESUF
): $(qga-obj-y
) $(COMMON_LDADDS
)
518 ifdef QEMU_GA_MSI_ENABLED
519 QEMU_GA_MSI
=qemu-ga-
$(ARCH
).msi
523 $(QEMU_GA_MSI
): qemu-ga.exe
$(QGA_VSS_PROVIDER
)
525 $(QEMU_GA_MSI
): config-host.mak
527 $(QEMU_GA_MSI
): $(SRC_PATH
)/qga
/installer
/qemu-ga.wxs
528 $(call quiet-command
,QEMU_GA_VERSION
="$(QEMU_GA_VERSION)" QEMU_GA_MANUFACTURER
="$(QEMU_GA_MANUFACTURER)" QEMU_GA_DISTRO
="$(QEMU_GA_DISTRO)" BUILD_DIR
="$(BUILD_DIR)" \
529 wixl
-o
$@
$(QEMU_GA_MSI_ARCH
) $(QEMU_GA_MSI_WITH_VSS
) $(QEMU_GA_MSI_MINGW_DLL_PATH
) $<,"WIXL","$@")
532 @echo
"MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
537 qemu-ga
: qemu-ga
$(EXESUF
) $(QGA_VSS_PROVIDER
) $(QEMU_GA_MSI
)
540 elf2dmp
$(EXESUF
): $(elf2dmp-obj-y
)
544 ivshmem-client
$(EXESUF
): $(ivshmem-client-obj-y
) $(COMMON_LDADDS
)
546 ivshmem-server
$(EXESUF
): $(ivshmem-server-obj-y
) $(COMMON_LDADDS
)
549 vhost-user-scsi
$(EXESUF
): $(vhost-user-scsi-obj-y
) libvhost-user.a
$(COMMON_LDADDS
)
551 vhost-user-blk
$(EXESUF
): $(vhost-user-blk-obj-y
) libvhost-user.a
$(COMMON_LDADDS
)
554 rdmacm-mux
$(EXESUF
): LIBS
+= "-libumad"
555 rdmacm-mux
$(EXESUF
): $(rdmacm-mux-obj-y
) $(COMMON_LDADDS
)
558 # relies on Linux-specific syscalls
559 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
560 virtiofsd
$(EXESUF
): $(virtiofsd-obj-y
) libvhost-user.a
$(COMMON_LDADDS
)
564 vhost-user-gpu
$(EXESUF
): $(vhost-user-gpu-obj-y
) libvhost-user.a
$(COMMON_LDADDS
)
567 ifdef CONFIG_VHOST_USER_INPUT
569 vhost-user-input
$(EXESUF
): $(vhost-user-input-obj-y
) libvhost-user.a
$(COMMON_LDADDS
)
572 # build by default, do not install
573 all: vhost-user-input
$(EXESUF
)
577 module_block.h
: $(SRC_PATH
)/scripts
/modules
/module_block.py config-host.mak
578 $(call quiet-command
,$(PYTHON
) $< $@ \
579 $(addprefix $(SRC_PATH
)/,$(patsubst %.mo
,%.c
,$(block-obj-m
))), \
582 clean: recurse-clean ninja-clean clean-ctlist
583 -test -f ninjatool
&& .
/ninjatool
$(if
$(V
),-v
,) -t
clean
584 # avoid old build problems by removing potentially incorrect old files
585 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
586 rm -f qemu-options.def
588 find . \
( -name
'*.so' -o
-name
'*.dll' -o
-name
'*.mo' -o
-name
'*.[oda]' \
) -type f \
589 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-aarch64.a \
590 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-arm.a \
591 ! -path .
/roms
/edk2
/BaseTools
/Source
/Python
/UPT
/Dll
/sqlite3.dll \
593 rm -f
$(edk2-decompressed
)
594 rm -f
$(filter-out %.tlb
,$(TOOLS
)) $(HELPERS-y
) TAGS cscope.
* *.pod
*~
*/*~
595 rm -f fsdev
/*.pod scsi
/*.pod
596 rm -f qemu-img-cmds.h
597 rm -f ui
/shader
/*-vert.h ui
/shader
/*-frag.h
598 rm -f
$(foreach f
,$(generated-files-y
),$(f
) $(f
)-timestamp
)
599 rm -f qapi-gen-timestamp
600 rm -f storage-daemon
/qapi
/qapi-gen-timestamp
601 rm -rf qga
/qapi-generated
602 rm -f config-all-devices.mak
603 rm -f
$(SUBDIR_DEVICES_MAK
)
605 VERSION ?
= $(shell cat VERSION
)
607 dist: qemu-
$(VERSION
).
tar.bz2
610 $(SRC_PATH
)/scripts
/make-release
"$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
612 define clean-manual
=
613 rm -rf
$(MANUAL_BUILDDIR
)/$1/_static
614 rm -f
$(MANUAL_BUILDDIR
)/$1/objects.inv
$(MANUAL_BUILDDIR
)/$1/searchindex.js
$(MANUAL_BUILDDIR
)/$1/*.html
617 distclean: clean ninja-distclean
618 -test -f ninjatool
&& .
/ninjatool
$(if
$(V
),-v
,) -t
clean -g
619 rm -f config-host.mak config-host.h
* $(DOCS
)
620 rm -f tests
/tcg
/config-
*.mak
621 rm -f config-all-devices.mak config-all-disas.mak config.status
622 rm -f
$(SUBDIR_DEVICES_MAK
)
623 rm -f po
/*.mo tests
/qemu-iotests
/common.env
624 rm -f roms
/seabios
/config.mak roms
/vgabios
/config.mak
625 rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
626 rm -rf meson-private meson-logs meson-info compile_commands.json
627 rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest
629 rm -f linux-headers
/asm
630 rm -f docs
/version.texi
631 rm -f docs
/interop
/qemu-ga-qapi.texi docs
/interop
/qemu-qmp-qapi.texi
632 rm -f docs
/interop
/qemu-qmp-ref
.7 docs
/interop
/qemu-ga-ref
.7
633 rm -f docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
634 rm -f docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
635 rm -f docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html
637 $(call clean-manual
,devel
)
638 $(call clean-manual
,interop
)
639 $(call clean-manual
,specs
)
640 $(call clean-manual
,system
)
641 $(call clean-manual
,tools
)
642 $(call clean-manual
,user
)
643 for d in
$(TARGET_DIRS
); do \
644 rm -rf
$$d || exit
1 ; \
648 KEYMAPS
=da en-gb et fr fr-ch is lt no pt-br sv \
649 ar de en-us fi fr-be hr it lv nl pl ru th \
650 de-ch es fo fr-ca hu ja mk pt sl tr \
654 BLOBS
=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
655 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
656 vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
657 openbios-sparc32 openbios-sparc64 openbios-ppc QEMU
,tcx.bin QEMU
,cgthree.bin \
658 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
659 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
660 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
661 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
662 efi-e1000e.rom efi-vmxnet3.rom \
664 bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
665 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
666 s390-ccw.img s390-netboot.img \
667 slof.bin skiboot.lid \
669 u-boot.e500 u-boot-sam460-20100605.bin \
673 opensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
674 opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
677 DESCS
=50-edk2-i386-secure.json
50-edk2-x86_64-secure.json \
678 60-edk2-aarch64.json
60-edk2-arm.json
60-edk2-i386.json
60-edk2-x86_64.json
684 # Note that we manually filter-out the non-Sphinx documentation which
685 # is currently built into the docs/interop directory in the build tree,
686 # and also any sphinx-built manpages.
687 define install-manual
=
688 for d in
$$(cd
$(MANUAL_BUILDDIR
) && find
$1 -type d
); do
$(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/$$d"; done
689 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
692 # Note that we deliberately do not install the "devel" manual: it is
693 # for QEMU developers, and not interesting to our users.
694 .PHONY
: install-sphinxdocs
695 install-sphinxdocs
: sphinxdocs
696 $(call install-manual
,interop
)
697 $(call install-manual
,specs
)
698 $(call install-manual
,system
)
699 $(call install-manual
,tools
)
700 $(call install-manual
,user
)
702 install-doc
: $(DOCS
) install-sphinxdocs
703 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)"
704 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/index.html
"$(DESTDIR)$(qemu_docdir)"
705 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/interop"
706 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.html
"$(DESTDIR)$(qemu_docdir)/interop"
707 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.txt
"$(DESTDIR)$(qemu_docdir)/interop"
709 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
710 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu
.1 "$(DESTDIR)$(mandir)/man1"
711 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man7"
712 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref
.7 "$(DESTDIR)$(mandir)/man7"
713 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-block-drivers
.7 "$(DESTDIR)$(mandir)/man7"
714 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-cpu-models
.7 "$(DESTDIR)$(mandir)/man7"
715 ifeq ($(CONFIG_TOOLS
),y
)
716 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-img
.1 "$(DESTDIR)$(mandir)/man1"
717 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man8"
718 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-nbd
.8 "$(DESTDIR)$(mandir)/man8"
720 ifdef CONFIG_TRACE_SYSTEMTAP
721 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-trace-stap
.1 "$(DESTDIR)$(mandir)/man1"
723 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
724 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/interop
/qemu-ga
.8 "$(DESTDIR)$(mandir)/man8"
725 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/interop"
726 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.html
"$(DESTDIR)$(qemu_docdir)/interop"
727 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.txt
"$(DESTDIR)$(qemu_docdir)/interop"
728 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref
.7 "$(DESTDIR)$(mandir)/man7"
732 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
733 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/virtfs-proxy-helper
.1 "$(DESTDIR)$(mandir)/man1"
735 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
736 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/virtiofsd
.1 "$(DESTDIR)$(mandir)/man1"
740 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)"
742 install-localstatedir
:
744 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
745 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_localstatedir)"/run
749 ICON_SIZES
=16x16
24x24
32x32
48x48
64x64
128x128
256x256
512x512
752 $(INSTALL_DIR
) "$(DESTDIR)$(includedir)"
754 # Needed by "meson install"
756 install: all $(if
$(BUILD_DOCS
),install-doc
) \
757 install-datadir install-localstatedir install-includedir \
758 $(if
$(INSTALL_BLOBS
),$(edk2-decompressed
)) \
761 $(call install-prog
,$(TOOLS
),$(DESTDIR
)$(bindir))
763 ifneq ($(CONFIG_MODULES
),)
764 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_moddir)"
765 for s in
$(modules-m
:.mo
=$(DSOSUF
)); do \
766 t
="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
767 $(INSTALL_LIB
) $$s "$$t"; \
768 test -z
"$(STRIP)" ||
$(STRIP
) "$$t"; \
771 ifneq ($(HELPERS-y
),)
772 $(call install-prog
,$(HELPERS-y
),$(DESTDIR
)$(libexecdir
))
774 ifneq ($(vhost-user-json-y
),)
775 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/vhost-user/"
776 for x in
$(vhost-user-json-y
); do \
777 $(INSTALL_DATA
) $$x "$(DESTDIR)$(qemu_datadir)/vhost-user/"; \
780 ifdef CONFIG_TRACE_SYSTEMTAP
781 $(INSTALL_PROG
) "scripts/qemu-trace-stap" $(DESTDIR
)$(bindir)
784 set
-e
; for x in
$(BLOBS
); do \
785 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/$$x "$(DESTDIR)$(qemu_datadir)"; \
789 set
-e
; for x in
$(edk2-decompressed
); do \
790 $(INSTALL_DATA
) $$x "$(DESTDIR)$(qemu_datadir)"; \
794 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/firmware"
795 set
-e
; tmpf
=$$(mktemp
); trap
'rm -f -- "$$tmpf"' EXIT
; \
796 for x in
$(DESCS
); do \
797 sed
-e
's,@DATADIR@,$(qemu_datadir),' \
798 "$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
799 $(INSTALL_DATA
) "$$tmpf" \
800 "$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
803 for s in
$(ICON_SIZES
); do \
804 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
805 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_
$${s}.png \
806 "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
808 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
809 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_32x32.bmp \
810 "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
811 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
812 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu.svg \
813 "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
814 mkdir
-p
"$(DESTDIR)$(qemu_desktopdir)"
815 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/qemu.desktop \
816 "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
820 ifeq ($(CONFIG_PLUGIN
),y
)
821 $(INSTALL_DATA
) $(SRC_PATH
)/include/qemu
/qemu-plugin.h
"$(DESTDIR)$(includedir)/qemu-plugin.h"
823 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/keymaps"
824 set
-e
; for x in
$(KEYMAPS
); do \
825 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/keymaps
/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
827 for d in
$(TARGET_DIRS
); do \
828 $(MAKE
) $(SUBDIR_MAKEFLAGS
) TARGET_DIR
=$$d/ -C
$$d $@ || exit
1 ; \
831 # opengl shader programs
832 ui
/shader
/%-vert.h
: $(SRC_PATH
)/ui
/shader
/%.vert
$(SRC_PATH
)/scripts
/shaderinclude.pl
834 $(call quiet-command
,\
835 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
838 ui
/shader
/%-frag.h
: $(SRC_PATH
)/ui
/shader
/%.frag
$(SRC_PATH
)/scripts
/shaderinclude.pl
840 $(call quiet-command
,\
841 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
844 ui
/shader.o
: $(SRC_PATH
)/ui
/shader.c \
845 ui
/shader
/texture-blit-vert.h \
846 ui
/shader
/texture-blit-flip-vert.h \
847 ui
/shader
/texture-blit-frag.h
851 MAKEINFOINCLUDES
= -I docs
-I
$(<D
) -I
$(@D
)
852 MAKEINFOFLAGS
=--no-split
--number-sections
$(MAKEINFOINCLUDES
)
853 TEXI2PODFLAGS
=$(MAKEINFOINCLUDES
) -DVERSION
="$(VERSION)" -DCONFDIR
="$(qemu_confdir)"
854 TEXI2PDFFLAGS
=$(if
$(V
),,--quiet
) -I
$(SRC_PATH
) $(MAKEINFOINCLUDES
)
856 docs
/version.texi
: $(SRC_PATH
)/VERSION config-host.mak
857 $(call quiet-command
,(\
858 echo
"@set VERSION $(VERSION)" && \
859 echo
"@set CONFDIR $(qemu_confdir)" \
862 %.html
: %.texi docs
/version.texi
863 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
864 --html
$< -o
$@
,"GEN","$@")
866 %.
info: %.texi docs
/version.texi
867 $(call quiet-command
,$(MAKEINFO
) $(MAKEINFOFLAGS
) $< -o
$@
,"GEN","$@")
869 %.txt
: %.texi docs
/version.texi
870 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
871 --plaintext
$< -o
$@
,"GEN","$@")
873 %.pdf
: %.texi docs
/version.texi
874 $(call quiet-command
,texi2pdf
$(TEXI2PDFFLAGS
) $< -o
$@
,"GEN","$@")
876 # Sphinx builds all its documentation at once in one invocation
877 # and handles "don't rebuild things unless necessary" itself.
878 # The '.doctrees' files are cached information to speed this up.
880 sphinxdocs
: $(MANUAL_BUILDDIR
)/devel
/index.html \
881 $(MANUAL_BUILDDIR
)/interop
/index.html \
882 $(MANUAL_BUILDDIR
)/specs
/index.html \
883 $(MANUAL_BUILDDIR
)/system
/index.html \
884 $(MANUAL_BUILDDIR
)/tools
/index.html \
885 $(MANUAL_BUILDDIR
)/user
/index.html
887 # Canned command to build a single manual
888 # Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
889 # Note the use of different doctree for each (manual, builder) tuple;
890 # this works around Sphinx not handling parallel invocation on
891 # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
892 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")
893 # We assume all RST files in the manual's directory are used in it
894 manual-deps
= $(wildcard $(SRC_PATH
)/docs
/$1/*.rst
$(SRC_PATH
)/docs
/$1/*/*.rst
) \
895 $(SRC_PATH
)/docs
/defs.rst.inc \
896 $(SRC_PATH
)/docs
/$1/conf.py
$(SRC_PATH
)/docs
/conf.py \
897 $(SRC_PATH
)/docs
/sphinx
/*.py
898 # Macro to write out the rule and dependencies for building manpages
899 # Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps])
900 # 'extradeps' is optional, and specifies extra files (eg .hx files) that
901 # the manual page depends on.
902 define define-manpage-rule
903 $(call atomic
,$(foreach manpage
,$2,$(MANUAL_BUILDDIR
)/$1/$(manpage
)),$(call manual-deps
,$1) $3)
904 $(call build-manual
,$1,man
)
907 $(MANUAL_BUILDDIR
)/devel
/index.html
: $(call manual-deps
,devel
)
908 $(call build-manual
,devel
,html
)
910 $(MANUAL_BUILDDIR
)/interop
/index.html
: $(call manual-deps
,interop
)
911 $(call build-manual
,interop
,html
)
913 $(MANUAL_BUILDDIR
)/specs
/index.html
: $(call manual-deps
,specs
)
914 $(call build-manual
,specs
,html
)
916 $(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
917 $(call build-manual
,system
,html
)
919 $(MANUAL_BUILDDIR
)/tools
/index.html
: $(call manual-deps
,tools
) $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/docs
/qemu-option-trace.rst.inc
920 $(call build-manual
,tools
,html
)
922 $(MANUAL_BUILDDIR
)/user
/index.html
: $(call manual-deps
,user
)
923 $(call build-manual
,user
,html
)
925 $(call define-manpage-rule
,interop
,qemu-ga
.8)
927 $(call define-manpage-rule
,system
,qemu
.1 qemu-block-drivers
.7 qemu-cpu-models
.7)
929 $(call define-manpage-rule
,tools
,\
930 qemu-img
.1 qemu-nbd
.8 qemu-trace-stap
.1\
931 virtiofsd
.1 virtfs-proxy-helper
.1,\
932 $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/docs
/qemu-option-trace.rst.inc
)
934 $(MANUAL_BUILDDIR
)/index.html
: $(SRC_PATH
)/docs
/index.html.in qemu-version.h
935 @mkdir
-p
"$(MANUAL_BUILDDIR)"
936 $(call quiet-command
, sed
"s|@@VERSION@@|${VERSION}|g" $< >$@
, \
939 docs
/interop
/qemu-qmp-qapi.texi
: qapi
/qapi-doc.texi
942 docs
/interop
/qemu-ga-qapi.texi
: qga
/qapi-generated
/qga-qapi-doc.texi
945 html
: docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html sphinxdocs
946 info: docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-ga-ref.
info
947 pdf
: docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
948 txt
: docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
950 docs
/interop
/qemu-ga-ref.
dvi docs
/interop
/qemu-ga-ref.html \
951 docs
/interop
/qemu-ga-ref.
info docs
/interop
/qemu-ga-ref.pdf \
952 docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7: \
953 docs
/interop
/qemu-ga-ref.texi docs
/interop
/qemu-ga-qapi.texi
955 docs
/interop
/qemu-qmp-ref.
dvi docs
/interop
/qemu-qmp-ref.html \
956 docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-qmp-ref.pdf \
957 docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7: \
958 docs
/interop
/qemu-qmp-ref.texi docs
/interop
/qemu-qmp-qapi.texi
960 $(filter %.1 %.7 %.8,$(DOCS
)): scripts
/texi2pod.pl
964 %/coverage-report.html
:
966 $(call quiet-command
,\
967 gcovr
-r
$(SRC_PATH
) \
968 $(foreach t
, $(TARGET_DIRS
), --object-directory
$(BUILD_DIR
)/$(t
)) \
969 --object-directory
$(BUILD_DIR
) \
970 -p
--html
--html-details
-o
$@
, \
971 "GEN", "coverage-report.html")
973 .PHONY
: coverage-report
974 coverage-report
: $(CURDIR
)/reports
/coverage
/coverage-report.html
978 INSTALLER
= qemu-setup-
$(VERSION
)$(EXESUF
)
980 nsisflags
= -V2
-NOCD
982 ifneq ($(wildcard $(SRC_PATH
)/dll
),)
983 ifeq ($(ARCH
),x86_64
)
985 DLL_PATH
= $(SRC_PATH
)/dll
/w64
989 DLL_PATH
= $(SRC_PATH
)/dll
/w32
994 installer
: $(INSTALLER
)
996 INSTDIR
=/tmp
/qemu-nsis
998 $(INSTALLER
): $(SRC_PATH
)/qemu.nsi
999 $(MAKE
) install DESTDIR
=${INSTDIR}
1001 (cd
${INSTDIR}/${bindir}; \
1002 for i in
*.exe
; do \
1003 $(SIGNCODE
) $${i}; \
1007 (cd
${INSTDIR}/${bindir}; \
1008 for i in qemu-system-
*.exe
; do \
1010 arch
=$${arch
#qemu-system-}; \
1011 echo Section
\"$$arch\" Section_
$$arch; \
1012 echo SetOutPath
\"\
$$INSTDIR\"; \
1013 echo File
\"\
$${BINDIR}\\$$i\"; \
1016 ) >${INSTDIR}/${bindir}/system-emulations.nsh
1017 makensis
$(nsisflags
) \
1018 $(if
$(BUILD_DOCS
),-DCONFIG_DOCUMENTATION
="y") \
1019 $(if
$(CONFIG_GTK
),-DCONFIG_GTK
="y") \
1020 -DBINDIR
="${INSTDIR}/${bindir}" \
1021 $(if
$(DLL_PATH
),-DDLLDIR
="$(DLL_PATH)") \
1022 -DSRCDIR
="$(SRC_PATH)" \
1023 -DOUTFILE
="$(INSTALLER)" \
1024 -DDISPLAYVERSION
="$(VERSION)" \
1025 $(SRC_PATH
)/qemu.nsi
1028 $(SIGNCODE
) $(INSTALLER
)
1032 # Add a dependency on the generated files, so that they are always
1033 # rebuilt before other object files
1034 ifneq ($(wildcard config-host.mak
),)
1035 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
1036 Makefile
: $(generated-files-y
)
1040 # Include automatically generated dependency files
1041 # Dependencies in Makefile.objs files come from our recursive subdir rules
1042 -include $(wildcard *.d tests
/*.d
)
1044 include $(SRC_PATH
)/tests
/docker
/Makefile.
include
1045 include $(SRC_PATH
)/tests
/vm
/Makefile.
include
1047 print-help-run
= printf
" %-30s - %s\\n" "$1" "$2"
1048 print-help
= $(quiet-@
)$(call print-help-run
,$1,$2)
1052 @echo
'Generic targets:'
1053 $(call print-help
,all,Build
all)
1054 ifdef CONFIG_MODULES
1055 $(call print-help
,modules
,Build
all modules
)
1057 $(call print-help
,dir/file.o
,Build specified target only
)
1058 $(call print-help
,install,Install QEMU
, documentation and tools
)
1059 $(call print-help
,ctags
/TAGS
,Generate
tags file for editors
)
1060 $(call print-help
,cscope
,Generate cscope index
)
1061 $(call print-help
,sparse
,Run sparse on the QEMU source
)
1063 @
$(if
$(TARGET_DIRS
), \
1064 echo
'Architecture specific targets:'; \
1065 $(foreach t
, $(TARGET_DIRS
), \
1066 $(call print-help-run
,$(t
)/all,Build for
$(t
)); \
1067 $(if
$(CONFIG_FUZZ
), \
1068 $(if
$(findstring softmmu
,$(t
)), \
1069 $(call print-help-run
,$(t
)/fuzz
,Build fuzzer for
$(t
)); \
1072 @
$(if
$(HELPERS-y
), \
1073 echo
'Helper targets:'; \
1074 $(foreach t
, $(HELPERS-y
), \
1075 $(call print-help-run
,$(t
),Build
$(shell basename $(t
)));) \
1078 echo
'Tools targets:'; \
1079 $(foreach t
, $(TOOLS
), \
1080 $(call print-help-run
,$(t
),Build
$(shell basename $(t
)) tool
);) \
1082 @echo
'Cleaning targets:'
1083 $(call print-help
,clean,Remove most generated files but keep the config
)
1084 $(call print-help
,distclean,Remove
all generated files
)
1085 $(call print-help
,dist,Build a distributable tarball
)
1087 @echo
'Test targets:'
1088 $(call print-help
,check,Run
all tests
(check-help for details
))
1089 $(call print-help
,docker
,Help about targets running tests inside containers
)
1090 $(call print-help
,vm-help
,Help about targets running tests inside VM
)
1092 @echo
'Documentation targets:'
1093 $(call print-help
,html
info pdf txt
,Build documentation in specified format
)
1096 @echo
'Windows targets:'
1097 $(call print-help
,installer
,Build NSIS-based installer for QEMU
)
1098 ifdef QEMU_GA_MSI_ENABLED
1099 $(call print-help
,msi
,Build MSI-based installer for qemu-ga
)
1103 $(call print-help
,$(MAKE
) [targets
],(quiet build
, default
))
1104 $(call print-help
,$(MAKE
) V
=1 [targets
],(verbose build
))