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 vhost-user-scsi-obj-y \
322 vhost-user-blk-obj-y \
323 vhost-user-input-obj-y \
324 vhost-user-gpu-obj-y \
328 storage-daemon-obj-y \
329 storage-daemon-obj-m \
336 include $(SRC_PATH
)/tests
/Makefile.
include
338 all: $(DOCS
) $(if
$(BUILD_DOCS
),sphinxdocs
) $(TOOLS
) $(HELPERS-y
) recurse-all modules
$(vhost-user-json-y
)
340 qemu-version.h
: FORCE
341 $(call quiet-command
, \
342 (printf
'#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \
343 printf
'#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \
345 $(call quiet-command
, if
! cmp
-s
$@
$@.tmp
; then \
351 config-host.h
: config-host.h-timestamp
352 config-host.h-timestamp
: config-host.mak
353 qemu-options.def
: $(SRC_PATH
)/qemu-options.hx
$(SRC_PATH
)/scripts
/hxtool
354 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
356 TARGET_DIRS_RULES
:= $(foreach t
, all fuzz
clean install, $(addsuffix /$(t
), $(TARGET_DIRS
)))
358 SOFTMMU_ALL_RULES
=$(filter %-softmmu
/all, $(TARGET_DIRS_RULES
))
359 $(SOFTMMU_ALL_RULES
): $(authz-obj-y
)
360 $(SOFTMMU_ALL_RULES
): $(block-obj-y
)
361 $(SOFTMMU_ALL_RULES
): $(storage-daemon-obj-y
)
362 $(SOFTMMU_ALL_RULES
): $(chardev-obj-y
)
363 $(SOFTMMU_ALL_RULES
): $(crypto-obj-y
)
364 $(SOFTMMU_ALL_RULES
): $(io-obj-y
)
365 $(SOFTMMU_ALL_RULES
): config-all-devices.mak
366 ifdef DECOMPRESS_EDK2_BLOBS
367 $(SOFTMMU_ALL_RULES
): $(edk2-decompressed
)
370 SOFTMMU_FUZZ_RULES
=$(filter %-softmmu
/fuzz
, $(TARGET_DIRS_RULES
))
371 $(SOFTMMU_FUZZ_RULES
): $(authz-obj-y
)
372 $(SOFTMMU_FUZZ_RULES
): $(block-obj-y
)
373 $(SOFTMMU_FUZZ_RULES
): $(chardev-obj-y
)
374 $(SOFTMMU_FUZZ_RULES
): $(crypto-obj-y
)
375 $(SOFTMMU_FUZZ_RULES
): $(io-obj-y
)
376 $(SOFTMMU_FUZZ_RULES
): config-all-devices.mak
377 $(SOFTMMU_FUZZ_RULES
): $(edk2-decompressed
)
379 .PHONY
: $(TARGET_DIRS_RULES
)
380 # The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
381 # $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
382 $(TARGET_DIRS_RULES
):
383 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" $(notdir $@
),)
385 # LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
386 DTC_MAKE_ARGS
=-I
$(SRC_PATH
)/dtc VPATH
=$(SRC_PATH
)/dtc
-C dtc V
="$(V)" LIBFDT_lib
=""
387 DTC_CFLAGS
=$(CFLAGS
) $(QEMU_CFLAGS
)
388 DTC_CPPFLAGS
=-I
$(SRC_PATH
)/dtc
/libfdt
391 dtc
/all: .git-submodule-status dtc
/libfdt
392 $(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
,)
394 dtc
/%: .git-submodule-status
397 # Overriding CFLAGS causes us to lose defines added in the sub-makefile.
398 # Not overriding CFLAGS leads to mis-matches between compilation modes.
399 # Therefore we replicate some of the logic in the sub-makefile.
400 # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
401 # no need to annoy QEMU developers with such things.
402 CAP_CFLAGS
= $(patsubst -W
%,,$(CFLAGS
) $(QEMU_CFLAGS
))
403 CAP_CFLAGS
+= -DCAPSTONE_USE_SYS_DYN_MEM
404 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM
405 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM64
406 CAP_CFLAGS
+= -DCAPSTONE_HAS_POWERPC
407 CAP_CFLAGS
+= -DCAPSTONE_HAS_X86
410 capstone
/all: .git-submodule-status
411 $(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
))
414 slirp
/all: .git-submodule-status
415 $(call quiet-command
,$(MAKE
) -C
$(SRC_PATH
)/slirp \
416 BUILD_DIR
="$(BUILD_DIR)/slirp" \
417 PKG_CONFIG
="$(PKG_CONFIG)" \
418 CC
="$(CC)" AR
="$(AR)" LD
="$(LD)" RANLIB
="$(RANLIB)" \
419 CFLAGS
="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS
="$(QEMU_LDFLAGS)")
421 $(filter %/all, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
424 $(filter %/fuzz
, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
425 $(qom-obj-y
) $(crypto-user-obj-
$(CONFIG_USER_ONLY
))
427 ROM_DIRS
= $(addprefix pc-bios
/, $(ROMS
))
428 ROM_DIRS_RULES
=$(foreach t
, all clean, $(addsuffix /$(t
), $(ROM_DIRS
)))
429 # Only keep -O and -g cflags
430 .PHONY
: $(ROM_DIRS_RULES
)
432 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" CFLAGS
="$(filter -O% -g%,$(CFLAGS))" $(notdir $@
),)
434 .PHONY
: recurse-all recurse-clean recurse-install
435 recurse-all
: $(addsuffix /all, $(TARGET_DIRS
) $(ROM_DIRS
))
436 recurse-clean
: $(addsuffix /clean, $(TARGET_DIRS
) $(ROM_DIRS
))
437 recurse-install
: $(addsuffix /install, $(TARGET_DIRS
))
438 $(addsuffix /install, $(TARGET_DIRS
)): all
440 $(BUILD_DIR
)/version.o
: $(SRC_PATH
)/version.rc config-host.h
441 $(call quiet-command
,$(WINDRES
) -I
$(BUILD_DIR
) -o
$@
$<,"RC","version.o")
443 Makefile
: $(version-obj-y
)
445 ######################################################################
447 COMMON_LDADDS
= libqemuutil.a
449 qemu-img.o
: qemu-img-cmds.h
451 qemu-img
$(EXESUF
): qemu-img.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
452 qemu-nbd
$(EXESUF
): qemu-nbd.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
453 qemu-io
$(EXESUF
): qemu-io.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
454 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
)
456 qemu-bridge-helper
$(EXESUF
): qemu-bridge-helper.o
$(COMMON_LDADDS
)
458 qemu-keymap
$(EXESUF
): qemu-keymap.o ui
/input-keymap.o
$(COMMON_LDADDS
)
460 qemu-edid
$(EXESUF
): qemu-edid.o hw
/display
/edid-generate.o
$(COMMON_LDADDS
)
462 fsdev
/virtfs-proxy-helper
$(EXESUF
): fsdev
/virtfs-proxy-helper.o fsdev
/9p-marshal.o fsdev
/9p-iov-marshal.o
$(COMMON_LDADDS
)
464 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
)
466 scsi
/qemu-pr-helper
$(EXESUF
): LIBS
+= -ludev
-lmultipath
-lmpathpersist
469 qemu-img-cmds.h
: $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/scripts
/hxtool
470 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
472 qemu-ga
$(EXESUF
): LIBS
= $(LIBS_QGA
)
473 qemu-ga
$(EXESUF
): QEMU_CFLAGS
+= -I qga
/qapi-generated
475 qemu-keymap
$(EXESUF
): LIBS
+= $(XKBCOMMON_LIBS
)
476 qemu-keymap
$(EXESUF
): QEMU_CFLAGS
+= $(XKBCOMMON_CFLAGS
)
478 qapi-py
= $(SRC_PATH
)/scripts
/qapi
/__init__.py \
479 $(SRC_PATH
)/scripts
/qapi
/commands.py \
480 $(SRC_PATH
)/scripts
/qapi
/common.py \
481 $(SRC_PATH
)/scripts
/qapi
/doc.py \
482 $(SRC_PATH
)/scripts
/qapi
/error.py \
483 $(SRC_PATH
)/scripts
/qapi
/events.py \
484 $(SRC_PATH
)/scripts
/qapi
/expr.py \
485 $(SRC_PATH
)/scripts
/qapi
/gen.py \
486 $(SRC_PATH
)/scripts
/qapi
/introspect.py \
487 $(SRC_PATH
)/scripts
/qapi
/parser.py \
488 $(SRC_PATH
)/scripts
/qapi
/schema.py \
489 $(SRC_PATH
)/scripts
/qapi
/source.py \
490 $(SRC_PATH
)/scripts
/qapi
/types.py \
491 $(SRC_PATH
)/scripts
/qapi
/visit.py \
492 $(SRC_PATH
)/scripts
/qapi-gen.py
494 qga
/qapi-generated
/qga-qapi-types.c qga
/qapi-generated
/qga-qapi-types.h \
495 qga
/qapi-generated
/qga-qapi-visit.c qga
/qapi-generated
/qga-qapi-visit.h \
496 qga
/qapi-generated
/qga-qapi-commands.h qga
/qapi-generated
/qga-qapi-commands.c \
497 qga
/qapi-generated
/qga-qapi-init-commands.h qga
/qapi-generated
/qga-qapi-init-commands.c \
498 qga
/qapi-generated
/qga-qapi-doc.texi
: \
499 qga
/qapi-generated
/qapi-gen-timestamp
;
500 qga
/qapi-generated
/qapi-gen-timestamp
: $(SRC_PATH
)/qga
/qapi-schema.json
$(qapi-py
)
501 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-gen.py \
502 -o qga
/qapi-generated
-p
"qga-" $<, \
503 "GEN","$(@:%-timestamp=%)")
506 QGALIB_GEN
=$(addprefix qga
/qapi-generated
/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h qga-qapi-init-commands.h
)
507 $(qga-obj-y
): $(QGALIB_GEN
)
509 qemu-ga
$(EXESUF
): $(qga-obj-y
) $(COMMON_LDADDS
)
512 ifdef QEMU_GA_MSI_ENABLED
513 QEMU_GA_MSI
=qemu-ga-
$(ARCH
).msi
517 $(QEMU_GA_MSI
): qemu-ga.exe
$(QGA_VSS_PROVIDER
)
519 $(QEMU_GA_MSI
): config-host.mak
521 $(QEMU_GA_MSI
): $(SRC_PATH
)/qga
/installer
/qemu-ga.wxs
522 $(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)" \
523 wixl
-o
$@
$(QEMU_GA_MSI_ARCH
) $(QEMU_GA_MSI_WITH_VSS
) $(QEMU_GA_MSI_MINGW_DLL_PATH
) $<,"WIXL","$@")
526 @echo
"MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
531 qemu-ga
: qemu-ga
$(EXESUF
) $(QGA_VSS_PROVIDER
) $(QEMU_GA_MSI
)
534 elf2dmp
$(EXESUF
): $(elf2dmp-obj-y
)
538 ivshmem-client
$(EXESUF
): $(ivshmem-client-obj-y
) $(COMMON_LDADDS
)
540 ivshmem-server
$(EXESUF
): $(ivshmem-server-obj-y
) $(COMMON_LDADDS
)
543 vhost-user-scsi
$(EXESUF
): $(vhost-user-scsi-obj-y
) contrib
/libvhost-user
/libvhost-user.a
$(COMMON_LDADDS
)
545 vhost-user-blk
$(EXESUF
): $(vhost-user-blk-obj-y
) contrib
/libvhost-user
/libvhost-user.a
$(COMMON_LDADDS
)
548 rdmacm-mux
$(EXESUF
): LIBS
+= "-libumad"
549 rdmacm-mux
$(EXESUF
): $(rdmacm-mux-obj-y
) $(COMMON_LDADDS
)
552 # relies on Linux-specific syscalls
553 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
554 virtiofsd
$(EXESUF
): $(virtiofsd-obj-y
) contrib
/libvhost-user
/libvhost-user.a
$(COMMON_LDADDS
)
558 vhost-user-gpu
$(EXESUF
): $(vhost-user-gpu-obj-y
) contrib
/libvhost-user
/libvhost-user.a
$(COMMON_LDADDS
)
561 ifdef CONFIG_VHOST_USER_INPUT
563 vhost-user-input
$(EXESUF
): $(vhost-user-input-obj-y
) contrib
/libvhost-user
/libvhost-user.a
$(COMMON_LDADDS
)
566 # build by default, do not install
567 all: vhost-user-input
$(EXESUF
)
571 module_block.h
: $(SRC_PATH
)/scripts
/modules
/module_block.py config-host.mak
572 $(call quiet-command
,$(PYTHON
) $< $@ \
573 $(addprefix $(SRC_PATH
)/,$(patsubst %.mo
,%.c
,$(block-obj-m
))), \
576 clean: recurse-clean ninja-clean clean-ctlist
577 -test -f ninjatool
&& .
/ninjatool
$(if
$(V
),-v
,) -t
clean
578 # avoid old build problems by removing potentially incorrect old files
579 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
580 rm -f qemu-options.def
582 find . \
( -name
'*.so' -o
-name
'*.dll' -o
-name
'*.mo' -o
-name
'*.[oda]' \
) -type f \
583 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-aarch64.a \
584 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-arm.a \
585 ! -path .
/roms
/edk2
/BaseTools
/Source
/Python
/UPT
/Dll
/sqlite3.dll \
587 rm -f
$(edk2-decompressed
)
588 rm -f
$(filter-out %.tlb
,$(TOOLS
)) $(HELPERS-y
) TAGS cscope.
* *.pod
*~
*/*~
589 rm -f fsdev
/*.pod scsi
/*.pod
590 rm -f qemu-img-cmds.h
591 rm -f ui
/shader
/*-vert.h ui
/shader
/*-frag.h
592 rm -f
$(foreach f
,$(generated-files-y
),$(f
) $(f
)-timestamp
)
593 rm -f qapi-gen-timestamp
594 rm -f storage-daemon
/qapi
/qapi-gen-timestamp
595 rm -rf qga
/qapi-generated
596 rm -f config-all-devices.mak
597 rm -f
$(SUBDIR_DEVICES_MAK
)
599 VERSION ?
= $(shell cat VERSION
)
601 dist: qemu-
$(VERSION
).
tar.bz2
604 $(SRC_PATH
)/scripts
/make-release
"$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
606 define clean-manual
=
607 rm -rf
$(MANUAL_BUILDDIR
)/$1/_static
608 rm -f
$(MANUAL_BUILDDIR
)/$1/objects.inv
$(MANUAL_BUILDDIR
)/$1/searchindex.js
$(MANUAL_BUILDDIR
)/$1/*.html
611 distclean: clean ninja-distclean
612 -test -f ninjatool
&& .
/ninjatool
$(if
$(V
),-v
,) -t
clean -g
613 rm -f config-host.mak config-host.h
* $(DOCS
)
614 rm -f tests
/tcg
/config-
*.mak
615 rm -f config-all-devices.mak config-all-disas.mak config.status
616 rm -f
$(SUBDIR_DEVICES_MAK
)
617 rm -f po
/*.mo tests
/qemu-iotests
/common.env
618 rm -f roms
/seabios
/config.mak roms
/vgabios
/config.mak
619 rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
620 rm -rf meson-private meson-logs meson-info compile_commands.json
621 rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest
623 rm -f linux-headers
/asm
624 rm -f docs
/version.texi
625 rm -f docs
/interop
/qemu-ga-qapi.texi docs
/interop
/qemu-qmp-qapi.texi
626 rm -f docs
/interop
/qemu-qmp-ref
.7 docs
/interop
/qemu-ga-ref
.7
627 rm -f docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
628 rm -f docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
629 rm -f docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html
631 $(call clean-manual
,devel
)
632 $(call clean-manual
,interop
)
633 $(call clean-manual
,specs
)
634 $(call clean-manual
,system
)
635 $(call clean-manual
,tools
)
636 $(call clean-manual
,user
)
637 for d in
$(TARGET_DIRS
); do \
638 rm -rf
$$d || exit
1 ; \
642 KEYMAPS
=da en-gb et fr fr-ch is lt no pt-br sv \
643 ar de en-us fi fr-be hr it lv nl pl ru th \
644 de-ch es fo fr-ca hu ja mk pt sl tr \
648 BLOBS
=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
649 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
650 vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
651 openbios-sparc32 openbios-sparc64 openbios-ppc QEMU
,tcx.bin QEMU
,cgthree.bin \
652 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
653 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
654 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
655 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
656 efi-e1000e.rom efi-vmxnet3.rom \
658 bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
659 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
660 s390-ccw.img s390-netboot.img \
661 slof.bin skiboot.lid \
663 u-boot.e500 u-boot-sam460-20100605.bin \
667 opensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
668 opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
671 DESCS
=50-edk2-i386-secure.json
50-edk2-x86_64-secure.json \
672 60-edk2-aarch64.json
60-edk2-arm.json
60-edk2-i386.json
60-edk2-x86_64.json
678 # Note that we manually filter-out the non-Sphinx documentation which
679 # is currently built into the docs/interop directory in the build tree,
680 # and also any sphinx-built manpages.
681 define install-manual
=
682 for d in
$$(cd
$(MANUAL_BUILDDIR
) && find
$1 -type d
); do
$(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/$$d"; done
683 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
686 # Note that we deliberately do not install the "devel" manual: it is
687 # for QEMU developers, and not interesting to our users.
688 .PHONY
: install-sphinxdocs
689 install-sphinxdocs
: sphinxdocs
690 $(call install-manual
,interop
)
691 $(call install-manual
,specs
)
692 $(call install-manual
,system
)
693 $(call install-manual
,tools
)
694 $(call install-manual
,user
)
696 install-doc
: $(DOCS
) install-sphinxdocs
697 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)"
698 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/index.html
"$(DESTDIR)$(qemu_docdir)"
699 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/interop"
700 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.html
"$(DESTDIR)$(qemu_docdir)/interop"
701 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.txt
"$(DESTDIR)$(qemu_docdir)/interop"
703 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
704 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu
.1 "$(DESTDIR)$(mandir)/man1"
705 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man7"
706 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref
.7 "$(DESTDIR)$(mandir)/man7"
707 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-block-drivers
.7 "$(DESTDIR)$(mandir)/man7"
708 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-cpu-models
.7 "$(DESTDIR)$(mandir)/man7"
709 ifeq ($(CONFIG_TOOLS
),y
)
710 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-img
.1 "$(DESTDIR)$(mandir)/man1"
711 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man8"
712 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-nbd
.8 "$(DESTDIR)$(mandir)/man8"
714 ifdef CONFIG_TRACE_SYSTEMTAP
715 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-trace-stap
.1 "$(DESTDIR)$(mandir)/man1"
717 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
718 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/interop
/qemu-ga
.8 "$(DESTDIR)$(mandir)/man8"
719 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/interop"
720 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.html
"$(DESTDIR)$(qemu_docdir)/interop"
721 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.txt
"$(DESTDIR)$(qemu_docdir)/interop"
722 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref
.7 "$(DESTDIR)$(mandir)/man7"
726 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
727 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/virtfs-proxy-helper
.1 "$(DESTDIR)$(mandir)/man1"
729 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
730 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/virtiofsd
.1 "$(DESTDIR)$(mandir)/man1"
734 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)"
736 install-localstatedir
:
738 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
739 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_localstatedir)"/run
743 ICON_SIZES
=16x16
24x24
32x32
48x48
64x64
128x128
256x256
512x512
746 $(INSTALL_DIR
) "$(DESTDIR)$(includedir)"
748 # Needed by "meson install"
750 install: all $(if
$(BUILD_DOCS
),install-doc
) \
751 install-datadir install-localstatedir install-includedir \
752 $(if
$(INSTALL_BLOBS
),$(edk2-decompressed
)) \
755 $(call install-prog
,$(TOOLS
),$(DESTDIR
)$(bindir))
757 ifneq ($(CONFIG_MODULES
),)
758 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_moddir)"
759 for s in
$(modules-m
:.mo
=$(DSOSUF
)); do \
760 t
="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
761 $(INSTALL_LIB
) $$s "$$t"; \
762 test -z
"$(STRIP)" ||
$(STRIP
) "$$t"; \
765 ifneq ($(HELPERS-y
),)
766 $(call install-prog
,$(HELPERS-y
),$(DESTDIR
)$(libexecdir
))
768 ifneq ($(vhost-user-json-y
),)
769 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/vhost-user/"
770 for x in
$(vhost-user-json-y
); do \
771 $(INSTALL_DATA
) $$x "$(DESTDIR)$(qemu_datadir)/vhost-user/"; \
774 ifdef CONFIG_TRACE_SYSTEMTAP
775 $(INSTALL_PROG
) "scripts/qemu-trace-stap" $(DESTDIR
)$(bindir)
778 set
-e
; for x in
$(BLOBS
); do \
779 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/$$x "$(DESTDIR)$(qemu_datadir)"; \
783 set
-e
; for x in
$(edk2-decompressed
); do \
784 $(INSTALL_DATA
) $$x "$(DESTDIR)$(qemu_datadir)"; \
788 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/firmware"
789 set
-e
; tmpf
=$$(mktemp
); trap
'rm -f -- "$$tmpf"' EXIT
; \
790 for x in
$(DESCS
); do \
791 sed
-e
's,@DATADIR@,$(qemu_datadir),' \
792 "$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
793 $(INSTALL_DATA
) "$$tmpf" \
794 "$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
797 for s in
$(ICON_SIZES
); do \
798 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
799 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_
$${s}.png \
800 "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
802 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
803 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_32x32.bmp \
804 "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
805 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
806 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu.svg \
807 "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
808 mkdir
-p
"$(DESTDIR)$(qemu_desktopdir)"
809 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/qemu.desktop \
810 "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
814 ifeq ($(CONFIG_PLUGIN
),y
)
815 $(INSTALL_DATA
) $(SRC_PATH
)/include/qemu
/qemu-plugin.h
"$(DESTDIR)$(includedir)/qemu-plugin.h"
817 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/keymaps"
818 set
-e
; for x in
$(KEYMAPS
); do \
819 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/keymaps
/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
821 for d in
$(TARGET_DIRS
); do \
822 $(MAKE
) $(SUBDIR_MAKEFLAGS
) TARGET_DIR
=$$d/ -C
$$d $@ || exit
1 ; \
825 # opengl shader programs
826 ui
/shader
/%-vert.h
: $(SRC_PATH
)/ui
/shader
/%.vert
$(SRC_PATH
)/scripts
/shaderinclude.pl
828 $(call quiet-command
,\
829 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
832 ui
/shader
/%-frag.h
: $(SRC_PATH
)/ui
/shader
/%.frag
$(SRC_PATH
)/scripts
/shaderinclude.pl
834 $(call quiet-command
,\
835 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
838 ui
/shader.o
: $(SRC_PATH
)/ui
/shader.c \
839 ui
/shader
/texture-blit-vert.h \
840 ui
/shader
/texture-blit-flip-vert.h \
841 ui
/shader
/texture-blit-frag.h
845 MAKEINFOINCLUDES
= -I docs
-I
$(<D
) -I
$(@D
)
846 MAKEINFOFLAGS
=--no-split
--number-sections
$(MAKEINFOINCLUDES
)
847 TEXI2PODFLAGS
=$(MAKEINFOINCLUDES
) -DVERSION
="$(VERSION)" -DCONFDIR
="$(qemu_confdir)"
848 TEXI2PDFFLAGS
=$(if
$(V
),,--quiet
) -I
$(SRC_PATH
) $(MAKEINFOINCLUDES
)
850 docs
/version.texi
: $(SRC_PATH
)/VERSION config-host.mak
851 $(call quiet-command
,(\
852 echo
"@set VERSION $(VERSION)" && \
853 echo
"@set CONFDIR $(qemu_confdir)" \
856 %.html
: %.texi docs
/version.texi
857 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
858 --html
$< -o
$@
,"GEN","$@")
860 %.
info: %.texi docs
/version.texi
861 $(call quiet-command
,$(MAKEINFO
) $(MAKEINFOFLAGS
) $< -o
$@
,"GEN","$@")
863 %.txt
: %.texi docs
/version.texi
864 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
865 --plaintext
$< -o
$@
,"GEN","$@")
867 %.pdf
: %.texi docs
/version.texi
868 $(call quiet-command
,texi2pdf
$(TEXI2PDFFLAGS
) $< -o
$@
,"GEN","$@")
870 # Sphinx builds all its documentation at once in one invocation
871 # and handles "don't rebuild things unless necessary" itself.
872 # The '.doctrees' files are cached information to speed this up.
874 sphinxdocs
: $(MANUAL_BUILDDIR
)/devel
/index.html \
875 $(MANUAL_BUILDDIR
)/interop
/index.html \
876 $(MANUAL_BUILDDIR
)/specs
/index.html \
877 $(MANUAL_BUILDDIR
)/system
/index.html \
878 $(MANUAL_BUILDDIR
)/tools
/index.html \
879 $(MANUAL_BUILDDIR
)/user
/index.html
881 # Canned command to build a single manual
882 # Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
883 # Note the use of different doctree for each (manual, builder) tuple;
884 # this works around Sphinx not handling parallel invocation on
885 # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
886 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")
887 # We assume all RST files in the manual's directory are used in it
888 manual-deps
= $(wildcard $(SRC_PATH
)/docs
/$1/*.rst
$(SRC_PATH
)/docs
/$1/*/*.rst
) \
889 $(SRC_PATH
)/docs
/defs.rst.inc \
890 $(SRC_PATH
)/docs
/$1/conf.py
$(SRC_PATH
)/docs
/conf.py \
891 $(SRC_PATH
)/docs
/sphinx
/*.py
892 # Macro to write out the rule and dependencies for building manpages
893 # Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps])
894 # 'extradeps' is optional, and specifies extra files (eg .hx files) that
895 # the manual page depends on.
896 define define-manpage-rule
897 $(call atomic
,$(foreach manpage
,$2,$(MANUAL_BUILDDIR
)/$1/$(manpage
)),$(call manual-deps
,$1) $3)
898 $(call build-manual
,$1,man
)
901 $(MANUAL_BUILDDIR
)/devel
/index.html
: $(call manual-deps
,devel
)
902 $(call build-manual
,devel
,html
)
904 $(MANUAL_BUILDDIR
)/interop
/index.html
: $(call manual-deps
,interop
)
905 $(call build-manual
,interop
,html
)
907 $(MANUAL_BUILDDIR
)/specs
/index.html
: $(call manual-deps
,specs
)
908 $(call build-manual
,specs
,html
)
910 $(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
911 $(call build-manual
,system
,html
)
913 $(MANUAL_BUILDDIR
)/tools
/index.html
: $(call manual-deps
,tools
) $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/docs
/qemu-option-trace.rst.inc
914 $(call build-manual
,tools
,html
)
916 $(MANUAL_BUILDDIR
)/user
/index.html
: $(call manual-deps
,user
)
917 $(call build-manual
,user
,html
)
919 $(call define-manpage-rule
,interop
,qemu-ga
.8)
921 $(call define-manpage-rule
,system
,qemu
.1 qemu-block-drivers
.7 qemu-cpu-models
.7)
923 $(call define-manpage-rule
,tools
,\
924 qemu-img
.1 qemu-nbd
.8 qemu-trace-stap
.1\
925 virtiofsd
.1 virtfs-proxy-helper
.1,\
926 $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/docs
/qemu-option-trace.rst.inc
)
928 $(MANUAL_BUILDDIR
)/index.html
: $(SRC_PATH
)/docs
/index.html.in qemu-version.h
929 @mkdir
-p
"$(MANUAL_BUILDDIR)"
930 $(call quiet-command
, sed
"s|@@VERSION@@|${VERSION}|g" $< >$@
, \
933 docs
/interop
/qemu-qmp-qapi.texi
: qapi
/qapi-doc.texi
936 docs
/interop
/qemu-ga-qapi.texi
: qga
/qapi-generated
/qga-qapi-doc.texi
939 html
: docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html sphinxdocs
940 info: docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-ga-ref.
info
941 pdf
: docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
942 txt
: docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
944 docs
/interop
/qemu-ga-ref.
dvi docs
/interop
/qemu-ga-ref.html \
945 docs
/interop
/qemu-ga-ref.
info docs
/interop
/qemu-ga-ref.pdf \
946 docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7: \
947 docs
/interop
/qemu-ga-ref.texi docs
/interop
/qemu-ga-qapi.texi
949 docs
/interop
/qemu-qmp-ref.
dvi docs
/interop
/qemu-qmp-ref.html \
950 docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-qmp-ref.pdf \
951 docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7: \
952 docs
/interop
/qemu-qmp-ref.texi docs
/interop
/qemu-qmp-qapi.texi
954 $(filter %.1 %.7 %.8,$(DOCS
)): scripts
/texi2pod.pl
958 %/coverage-report.html
:
960 $(call quiet-command
,\
961 gcovr
-r
$(SRC_PATH
) \
962 $(foreach t
, $(TARGET_DIRS
), --object-directory
$(BUILD_DIR
)/$(t
)) \
963 --object-directory
$(BUILD_DIR
) \
964 -p
--html
--html-details
-o
$@
, \
965 "GEN", "coverage-report.html")
967 .PHONY
: coverage-report
968 coverage-report
: $(CURDIR
)/reports
/coverage
/coverage-report.html
972 INSTALLER
= qemu-setup-
$(VERSION
)$(EXESUF
)
974 nsisflags
= -V2
-NOCD
976 ifneq ($(wildcard $(SRC_PATH
)/dll
),)
977 ifeq ($(ARCH
),x86_64
)
979 DLL_PATH
= $(SRC_PATH
)/dll
/w64
983 DLL_PATH
= $(SRC_PATH
)/dll
/w32
988 installer
: $(INSTALLER
)
990 INSTDIR
=/tmp
/qemu-nsis
992 $(INSTALLER
): $(SRC_PATH
)/qemu.nsi
993 $(MAKE
) install DESTDIR
=${INSTDIR}
995 (cd
${INSTDIR}/${bindir}; \
1001 (cd
${INSTDIR}/${bindir}; \
1002 for i in qemu-system-
*.exe
; do \
1004 arch
=$${arch
#qemu-system-}; \
1005 echo Section
\"$$arch\" Section_
$$arch; \
1006 echo SetOutPath
\"\
$$INSTDIR\"; \
1007 echo File
\"\
$${BINDIR}\\$$i\"; \
1010 ) >${INSTDIR}/${bindir}/system-emulations.nsh
1011 makensis
$(nsisflags
) \
1012 $(if
$(BUILD_DOCS
),-DCONFIG_DOCUMENTATION
="y") \
1013 $(if
$(CONFIG_GTK
),-DCONFIG_GTK
="y") \
1014 -DBINDIR
="${INSTDIR}/${bindir}" \
1015 $(if
$(DLL_PATH
),-DDLLDIR
="$(DLL_PATH)") \
1016 -DSRCDIR
="$(SRC_PATH)" \
1017 -DOUTFILE
="$(INSTALLER)" \
1018 -DDISPLAYVERSION
="$(VERSION)" \
1019 $(SRC_PATH
)/qemu.nsi
1022 $(SIGNCODE
) $(INSTALLER
)
1026 # Add a dependency on the generated files, so that they are always
1027 # rebuilt before other object files
1028 ifneq ($(wildcard config-host.mak
),)
1029 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
1030 Makefile
: $(generated-files-y
)
1034 # Include automatically generated dependency files
1035 # Dependencies in Makefile.objs files come from our recursive subdir rules
1036 -include $(wildcard *.d tests
/*.d
)
1038 include $(SRC_PATH
)/tests
/docker
/Makefile.
include
1039 include $(SRC_PATH
)/tests
/vm
/Makefile.
include
1041 print-help-run
= printf
" %-30s - %s\\n" "$1" "$2"
1042 print-help
= $(quiet-@
)$(call print-help-run
,$1,$2)
1046 @echo
'Generic targets:'
1047 $(call print-help
,all,Build
all)
1048 ifdef CONFIG_MODULES
1049 $(call print-help
,modules
,Build
all modules
)
1051 $(call print-help
,dir/file.o
,Build specified target only
)
1052 $(call print-help
,install,Install QEMU
, documentation and tools
)
1053 $(call print-help
,ctags
/TAGS
,Generate
tags file for editors
)
1054 $(call print-help
,cscope
,Generate cscope index
)
1055 $(call print-help
,sparse
,Run sparse on the QEMU source
)
1057 @
$(if
$(TARGET_DIRS
), \
1058 echo
'Architecture specific targets:'; \
1059 $(foreach t
, $(TARGET_DIRS
), \
1060 $(call print-help-run
,$(t
)/all,Build for
$(t
)); \
1061 $(if
$(CONFIG_FUZZ
), \
1062 $(if
$(findstring softmmu
,$(t
)), \
1063 $(call print-help-run
,$(t
)/fuzz
,Build fuzzer for
$(t
)); \
1066 @
$(if
$(HELPERS-y
), \
1067 echo
'Helper targets:'; \
1068 $(foreach t
, $(HELPERS-y
), \
1069 $(call print-help-run
,$(t
),Build
$(shell basename $(t
)));) \
1072 echo
'Tools targets:'; \
1073 $(foreach t
, $(TOOLS
), \
1074 $(call print-help-run
,$(t
),Build
$(shell basename $(t
)) tool
);) \
1076 @echo
'Cleaning targets:'
1077 $(call print-help
,clean,Remove most generated files but keep the config
)
1078 $(call print-help
,distclean,Remove
all generated files
)
1079 $(call print-help
,dist,Build a distributable tarball
)
1081 @echo
'Test targets:'
1082 $(call print-help
,check,Run
all tests
(check-help for details
))
1083 $(call print-help
,docker
,Help about targets running tests inside containers
)
1084 $(call print-help
,vm-help
,Help about targets running tests inside VM
)
1086 @echo
'Documentation targets:'
1087 $(call print-help
,html
info pdf txt
,Build documentation in specified format
)
1090 @echo
'Windows targets:'
1091 $(call print-help
,installer
,Build NSIS-based installer for QEMU
)
1092 ifdef QEMU_GA_MSI_ENABLED
1093 $(call print-help
,msi
,Build MSI-based installer for qemu-ga
)
1097 $(call print-help
,$(MAKE
) [targets
],(quiet build
, default
))
1098 $(call print-help
,$(MAKE
) V
=1 [targets
],(verbose build
))