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 # Sphinx does not allow building manuals into the same directory as
209 # the source files, so if we're doing an in-tree QEMU build we must
210 # build the manuals into a subdirectory (and then install them from
211 # there for 'make install'). For an out-of-tree build we can just
212 # use the docs/ subdirectory in the build tree as normal.
213 ifeq ($(realpath
$(SRC_PATH
)),$(realpath .
))
214 MANUAL_BUILDDIR
:= docs
/built
216 MANUAL_BUILDDIR
:= docs
220 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu
.1
221 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/qemu-img
.1
222 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/qemu-nbd
.8
223 DOCS
+=$(MANUAL_BUILDDIR
)/interop
/qemu-ga
.8
224 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
225 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/virtiofsd
.1
227 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu-block-drivers
.7
228 DOCS
+=docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7
229 DOCS
+=docs
/interop
/qemu-ga-ref.html docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7
230 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu-cpu-models
.7
231 DOCS
+=$(MANUAL_BUILDDIR
)/index.html
233 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/virtfs-proxy-helper
.1
235 ifdef CONFIG_TRACE_SYSTEMTAP
236 DOCS
+=$(MANUAL_BUILDDIR
)/tools
/qemu-trace-stap
.1
242 SUBDIR_MAKEFLAGS
=$(if
$(V
),,--no-print-directory
--quiet
) BUILD_DIR
=$(BUILD_DIR
)
243 SUBDIR_DEVICES_MAK
=$(patsubst %, %/config-devices.mak
, $(filter %-softmmu
, $(TARGET_DIRS
)))
244 SUBDIR_DEVICES_MAK_DEP
=$(patsubst %, %.d
, $(SUBDIR_DEVICES_MAK
))
246 ifeq ($(SUBDIR_DEVICES_MAK
),)
247 config-all-devices.mak
: config-host.mak
248 $(call quiet-command
,echo
'# no devices' > $@
,"GEN","$@")
250 config-all-devices.mak
: $(SUBDIR_DEVICES_MAK
) config-host.mak
251 $(call quiet-command
, sed
-n \
252 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
253 $(SUBDIR_DEVICES_MAK
) |
sort -u
> $@
, \
257 -include $(SUBDIR_DEVICES_MAK_DEP
)
259 # This has to be kept in sync with Kconfig.host.
261 $(CONFIG_MINIKCONF_MODE
) \
262 $@
$*/config-devices.mak.d
$< $(SRC_PATH
)/Kconfig \
263 CONFIG_TCG
=$(CONFIG_TCG
) \
264 CONFIG_KVM
=$(CONFIG_KVM
) \
265 CONFIG_SPICE
=$(CONFIG_SPICE
) \
266 CONFIG_IVSHMEM
=$(CONFIG_IVSHMEM
) \
267 CONFIG_TPM
=$(CONFIG_TPM
) \
268 CONFIG_XEN
=$(CONFIG_XEN
) \
269 CONFIG_OPENGL
=$(CONFIG_OPENGL
) \
270 CONFIG_X11
=$(CONFIG_X11
) \
271 CONFIG_VHOST_USER
=$(CONFIG_VHOST_USER
) \
272 CONFIG_VHOST_KERNEL
=$(CONFIG_VHOST_KERNEL
) \
273 CONFIG_VIRTFS
=$(CONFIG_VIRTFS
) \
274 CONFIG_LINUX
=$(CONFIG_LINUX
) \
275 CONFIG_PVRDMA
=$(CONFIG_PVRDMA
)
277 MINIKCONF
= $(PYTHON
) $(SRC_PATH
)/scripts
/minikconf.py
279 $(SUBDIR_DEVICES_MAK
): %/config-devices.mak
: default-configs
/%.mak
$(SRC_PATH
)/Kconfig
$(BUILD_DIR
)/config-host.mak
280 $(call quiet-command
, $(MINIKCONF
) $(MINIKCONF_ARGS
) \
281 > $@.tmp
, "GEN", "$@.tmp")
282 $(call quiet-command
, if
test -f
$@
; then \
283 if cmp
-s
$@.old
$@
; then \
287 if
test -f
$@.old
; then \
288 echo
"WARNING: $@ (user modified) out of date.";\
290 echo
"WARNING: $@ out of date.";\
292 echo
"Run \"$(MAKE) defconfig\" to regenerate."; \
301 rm -f config-all-devices.mak
$(SUBDIR_DEVICES_MAK
)
303 ifneq ($(wildcard config-host.mak
),)
304 include $(SRC_PATH
)/Makefile.objs
307 dummy
:= $(call unnest-vars
,, \
312 ivshmem-client-obj-y \
313 ivshmem-server-obj-y \
315 vhost-user-scsi-obj-y \
316 vhost-user-input-obj-y \
317 vhost-user-gpu-obj-y \
321 storage-daemon-obj-y \
322 storage-daemon-obj-m \
329 include $(SRC_PATH
)/tests
/Makefile.
include
331 all: $(DOCS
) $(if
$(BUILD_DOCS
),sphinxdocs
) $(TOOLS
) $(HELPERS-y
) recurse-all modules
$(vhost-user-json-y
)
333 qemu-version.h
: FORCE
334 $(call quiet-command
, \
335 (printf
'#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \
336 printf
'#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \
338 $(call quiet-command
, if
! cmp
-s
$@
$@.tmp
; then \
344 config-host.h
: config-host.h-timestamp
345 config-host.h-timestamp
: config-host.mak
346 qemu-options.def
: $(SRC_PATH
)/qemu-options.hx
$(SRC_PATH
)/scripts
/hxtool
347 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
349 TARGET_DIRS_RULES
:= $(foreach t
, all fuzz
clean install, $(addsuffix /$(t
), $(TARGET_DIRS
)))
351 SOFTMMU_ALL_RULES
=$(filter %-softmmu
/all, $(TARGET_DIRS_RULES
))
352 $(SOFTMMU_ALL_RULES
): $(authz-obj-y
)
353 $(SOFTMMU_ALL_RULES
): $(block-obj-y
)
354 $(SOFTMMU_ALL_RULES
): $(storage-daemon-obj-y
)
355 $(SOFTMMU_ALL_RULES
): $(chardev-obj-y
)
356 $(SOFTMMU_ALL_RULES
): $(crypto-obj-y
)
357 $(SOFTMMU_ALL_RULES
): $(io-obj-y
)
358 $(SOFTMMU_ALL_RULES
): config-all-devices.mak
359 ifdef DECOMPRESS_EDK2_BLOBS
360 $(SOFTMMU_ALL_RULES
): $(edk2-decompressed
)
363 SOFTMMU_FUZZ_RULES
=$(filter %-softmmu
/fuzz
, $(TARGET_DIRS_RULES
))
364 $(SOFTMMU_FUZZ_RULES
): $(authz-obj-y
)
365 $(SOFTMMU_FUZZ_RULES
): $(block-obj-y
)
366 $(SOFTMMU_FUZZ_RULES
): $(chardev-obj-y
)
367 $(SOFTMMU_FUZZ_RULES
): $(crypto-obj-y
)
368 $(SOFTMMU_FUZZ_RULES
): $(io-obj-y
)
369 $(SOFTMMU_FUZZ_RULES
): config-all-devices.mak
370 $(SOFTMMU_FUZZ_RULES
): $(edk2-decompressed
)
372 .PHONY
: $(TARGET_DIRS_RULES
)
373 # The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
374 # $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
375 $(TARGET_DIRS_RULES
):
376 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" $(notdir $@
),)
378 # LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
379 DTC_MAKE_ARGS
=-I
$(SRC_PATH
)/dtc VPATH
=$(SRC_PATH
)/dtc
-C dtc V
="$(V)" LIBFDT_lib
=""
380 DTC_CFLAGS
=$(CFLAGS
) $(QEMU_CFLAGS
)
381 DTC_CPPFLAGS
=-I
$(SRC_PATH
)/dtc
/libfdt
384 dtc
/all: .git-submodule-status dtc
/libfdt
385 $(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
,)
387 dtc
/%: .git-submodule-status
390 # Overriding CFLAGS causes us to lose defines added in the sub-makefile.
391 # Not overriding CFLAGS leads to mis-matches between compilation modes.
392 # Therefore we replicate some of the logic in the sub-makefile.
393 # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
394 # no need to annoy QEMU developers with such things.
395 CAP_CFLAGS
= $(patsubst -W
%,,$(CFLAGS
) $(QEMU_CFLAGS
))
396 CAP_CFLAGS
+= -DCAPSTONE_USE_SYS_DYN_MEM
397 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM
398 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM64
399 CAP_CFLAGS
+= -DCAPSTONE_HAS_POWERPC
400 CAP_CFLAGS
+= -DCAPSTONE_HAS_X86
403 capstone
/all: .git-submodule-status
404 $(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
))
407 slirp
/all: .git-submodule-status
408 $(call quiet-command
,$(MAKE
) -C
$(SRC_PATH
)/slirp \
409 BUILD_DIR
="$(BUILD_DIR)/slirp" \
410 PKG_CONFIG
="$(PKG_CONFIG)" \
411 CC
="$(CC)" AR
="$(AR)" LD
="$(LD)" RANLIB
="$(RANLIB)" \
412 CFLAGS
="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS
="$(QEMU_LDFLAGS)")
414 $(filter %/all, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
417 $(filter %/fuzz
, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
418 $(qom-obj-y
) $(crypto-user-obj-
$(CONFIG_USER_ONLY
))
420 ROM_DIRS
= $(addprefix pc-bios
/, $(ROMS
))
421 ROM_DIRS_RULES
=$(foreach t
, all clean, $(addsuffix /$(t
), $(ROM_DIRS
)))
422 # Only keep -O and -g cflags
423 .PHONY
: $(ROM_DIRS_RULES
)
425 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" CFLAGS
="$(filter -O% -g%,$(CFLAGS))" $(notdir $@
),)
427 .PHONY
: recurse-all recurse-clean recurse-install
428 recurse-all
: $(addsuffix /all, $(TARGET_DIRS
) $(ROM_DIRS
))
429 recurse-clean
: $(addsuffix /clean, $(TARGET_DIRS
) $(ROM_DIRS
))
430 recurse-install
: $(addsuffix /install, $(TARGET_DIRS
))
431 $(addsuffix /install, $(TARGET_DIRS
)): all
433 $(BUILD_DIR
)/version.o
: $(SRC_PATH
)/version.rc config-host.h
434 $(call quiet-command
,$(WINDRES
) -I
$(BUILD_DIR
) -o
$@
$<,"RC","version.o")
436 Makefile
: $(version-obj-y
)
438 ######################################################################
440 COMMON_LDADDS
= libqemuutil.a
442 qemu-img.o
: qemu-img-cmds.h
444 qemu-img
$(EXESUF
): qemu-img.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
445 qemu-nbd
$(EXESUF
): qemu-nbd.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
446 qemu-io
$(EXESUF
): qemu-io.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
447 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
)
449 qemu-bridge-helper
$(EXESUF
): qemu-bridge-helper.o
$(COMMON_LDADDS
)
451 qemu-keymap
$(EXESUF
): qemu-keymap.o ui
/input-keymap.o
$(COMMON_LDADDS
)
453 qemu-edid
$(EXESUF
): qemu-edid.o hw
/display
/edid-generate.o
$(COMMON_LDADDS
)
455 fsdev
/virtfs-proxy-helper
$(EXESUF
): fsdev
/virtfs-proxy-helper.o fsdev
/9p-marshal.o fsdev
/9p-iov-marshal.o
$(COMMON_LDADDS
)
457 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
)
459 scsi
/qemu-pr-helper
$(EXESUF
): LIBS
+= -ludev
-lmultipath
-lmpathpersist
462 qemu-img-cmds.h
: $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/scripts
/hxtool
463 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
465 qemu-ga
$(EXESUF
): LIBS
= $(LIBS_QGA
)
466 qemu-ga
$(EXESUF
): QEMU_CFLAGS
+= -I qga
/qapi-generated
468 qemu-keymap
$(EXESUF
): LIBS
+= $(XKBCOMMON_LIBS
)
469 qemu-keymap
$(EXESUF
): QEMU_CFLAGS
+= $(XKBCOMMON_CFLAGS
)
471 qapi-py
= $(SRC_PATH
)/scripts
/qapi
/__init__.py \
472 $(SRC_PATH
)/scripts
/qapi
/commands.py \
473 $(SRC_PATH
)/scripts
/qapi
/common.py \
474 $(SRC_PATH
)/scripts
/qapi
/doc.py \
475 $(SRC_PATH
)/scripts
/qapi
/error.py \
476 $(SRC_PATH
)/scripts
/qapi
/events.py \
477 $(SRC_PATH
)/scripts
/qapi
/expr.py \
478 $(SRC_PATH
)/scripts
/qapi
/gen.py \
479 $(SRC_PATH
)/scripts
/qapi
/introspect.py \
480 $(SRC_PATH
)/scripts
/qapi
/parser.py \
481 $(SRC_PATH
)/scripts
/qapi
/schema.py \
482 $(SRC_PATH
)/scripts
/qapi
/source.py \
483 $(SRC_PATH
)/scripts
/qapi
/types.py \
484 $(SRC_PATH
)/scripts
/qapi
/visit.py \
485 $(SRC_PATH
)/scripts
/qapi-gen.py
487 qga
/qapi-generated
/qga-qapi-types.c qga
/qapi-generated
/qga-qapi-types.h \
488 qga
/qapi-generated
/qga-qapi-visit.c qga
/qapi-generated
/qga-qapi-visit.h \
489 qga
/qapi-generated
/qga-qapi-commands.h qga
/qapi-generated
/qga-qapi-commands.c \
490 qga
/qapi-generated
/qga-qapi-init-commands.h qga
/qapi-generated
/qga-qapi-init-commands.c \
491 qga
/qapi-generated
/qga-qapi-doc.texi
: \
492 qga
/qapi-generated
/qapi-gen-timestamp
;
493 qga
/qapi-generated
/qapi-gen-timestamp
: $(SRC_PATH
)/qga
/qapi-schema.json
$(qapi-py
)
494 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-gen.py \
495 -o qga
/qapi-generated
-p
"qga-" $<, \
496 "GEN","$(@:%-timestamp=%)")
499 QGALIB_GEN
=$(addprefix qga
/qapi-generated
/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h qga-qapi-init-commands.h
)
500 $(qga-obj-y
): $(QGALIB_GEN
)
502 qemu-ga
$(EXESUF
): $(qga-obj-y
) $(COMMON_LDADDS
)
505 ifdef QEMU_GA_MSI_ENABLED
506 QEMU_GA_MSI
=qemu-ga-
$(ARCH
).msi
510 $(QEMU_GA_MSI
): qemu-ga.exe
$(QGA_VSS_PROVIDER
)
512 $(QEMU_GA_MSI
): config-host.mak
514 $(QEMU_GA_MSI
): $(SRC_PATH
)/qga
/installer
/qemu-ga.wxs
515 $(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)" \
516 wixl
-o
$@
$(QEMU_GA_MSI_ARCH
) $(QEMU_GA_MSI_WITH_VSS
) $(QEMU_GA_MSI_MINGW_DLL_PATH
) $<,"WIXL","$@")
519 @echo
"MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
524 qemu-ga
: qemu-ga
$(EXESUF
) $(QGA_VSS_PROVIDER
) $(QEMU_GA_MSI
)
527 elf2dmp
$(EXESUF
): $(elf2dmp-obj-y
)
531 ivshmem-client
$(EXESUF
): $(ivshmem-client-obj-y
) $(COMMON_LDADDS
)
533 ivshmem-server
$(EXESUF
): $(ivshmem-server-obj-y
) $(COMMON_LDADDS
)
536 vhost-user-scsi
$(EXESUF
): $(vhost-user-scsi-obj-y
) contrib
/libvhost-user
/libvhost-user.a
$(COMMON_LDADDS
)
539 rdmacm-mux
$(EXESUF
): LIBS
+= "-libumad"
540 rdmacm-mux
$(EXESUF
): $(rdmacm-mux-obj-y
) $(COMMON_LDADDS
)
543 vhost-user-gpu
$(EXESUF
): $(vhost-user-gpu-obj-y
) contrib
/libvhost-user
/libvhost-user.a
$(COMMON_LDADDS
)
546 ifdef CONFIG_VHOST_USER_INPUT
548 vhost-user-input
$(EXESUF
): $(vhost-user-input-obj-y
) contrib
/libvhost-user
/libvhost-user.a
$(COMMON_LDADDS
)
551 # build by default, do not install
552 all: vhost-user-input
$(EXESUF
)
556 module_block.h
: $(SRC_PATH
)/scripts
/modules
/module_block.py config-host.mak
557 $(call quiet-command
,$(PYTHON
) $< $@ \
558 $(addprefix $(SRC_PATH
)/,$(patsubst %.mo
,%.c
,$(block-obj-m
))), \
561 clean: recurse-clean ninja-clean clean-ctlist
562 -test -f ninjatool
&& .
/ninjatool
$(if
$(V
),-v
,) -t
clean
563 # avoid old build problems by removing potentially incorrect old files
564 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
565 rm -f qemu-options.def
567 find . \
( -name
'*.so' -o
-name
'*.dll' -o
-name
'*.mo' -o
-name
'*.[oda]' \
) -type f \
568 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-aarch64.a \
569 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-arm.a \
570 ! -path .
/roms
/edk2
/BaseTools
/Source
/Python
/UPT
/Dll
/sqlite3.dll \
572 rm -f
$(edk2-decompressed
)
573 rm -f
$(filter-out %.tlb
,$(TOOLS
)) $(HELPERS-y
) TAGS cscope.
* *.pod
*~
*/*~
574 rm -f fsdev
/*.pod scsi
/*.pod
575 rm -f qemu-img-cmds.h
576 rm -f ui
/shader
/*-vert.h ui
/shader
/*-frag.h
577 rm -f
$(foreach f
,$(generated-files-y
),$(f
) $(f
)-timestamp
)
578 rm -f qapi-gen-timestamp
579 rm -f storage-daemon
/qapi
/qapi-gen-timestamp
580 rm -rf qga
/qapi-generated
581 rm -f config-all-devices.mak
582 rm -f
$(SUBDIR_DEVICES_MAK
)
584 VERSION ?
= $(shell cat VERSION
)
586 dist: qemu-
$(VERSION
).
tar.bz2
589 $(SRC_PATH
)/scripts
/make-release
"$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
591 define clean-manual
=
592 rm -rf
$(MANUAL_BUILDDIR
)/$1/_static
593 rm -f
$(MANUAL_BUILDDIR
)/$1/objects.inv
$(MANUAL_BUILDDIR
)/$1/searchindex.js
$(MANUAL_BUILDDIR
)/$1/*.html
596 distclean: clean ninja-distclean
597 -test -f ninjatool
&& .
/ninjatool
$(if
$(V
),-v
,) -t
clean -g
598 rm -f config-host.mak config-host.h
* $(DOCS
)
599 rm -f tests
/tcg
/config-
*.mak
600 rm -f config-all-devices.mak config-all-disas.mak config.status
601 rm -f
$(SUBDIR_DEVICES_MAK
)
602 rm -f po
/*.mo tests
/qemu-iotests
/common.env
603 rm -f roms
/seabios
/config.mak roms
/vgabios
/config.mak
604 rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
605 rm -rf meson-private meson-logs meson-info compile_commands.json
606 rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest
608 rm -f linux-headers
/asm
609 rm -f docs
/version.texi
610 rm -f docs
/interop
/qemu-ga-qapi.texi docs
/interop
/qemu-qmp-qapi.texi
611 rm -f docs
/interop
/qemu-qmp-ref
.7 docs
/interop
/qemu-ga-ref
.7
612 rm -f docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
613 rm -f docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
614 rm -f docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html
616 $(call clean-manual
,devel
)
617 $(call clean-manual
,interop
)
618 $(call clean-manual
,specs
)
619 $(call clean-manual
,system
)
620 $(call clean-manual
,tools
)
621 $(call clean-manual
,user
)
622 for d in
$(TARGET_DIRS
); do \
623 rm -rf
$$d || exit
1 ; \
627 KEYMAPS
=da en-gb et fr fr-ch is lt no pt-br sv \
628 ar de en-us fi fr-be hr it lv nl pl ru th \
629 de-ch es fo fr-ca hu ja mk pt sl tr \
633 BLOBS
=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
634 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
635 vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
636 openbios-sparc32 openbios-sparc64 openbios-ppc QEMU
,tcx.bin QEMU
,cgthree.bin \
637 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
638 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
639 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
640 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
641 efi-e1000e.rom efi-vmxnet3.rom \
643 bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
644 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
645 s390-ccw.img s390-netboot.img \
646 slof.bin skiboot.lid \
648 u-boot.e500 u-boot-sam460-20100605.bin \
652 opensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
653 opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
656 DESCS
=50-edk2-i386-secure.json
50-edk2-x86_64-secure.json \
657 60-edk2-aarch64.json
60-edk2-arm.json
60-edk2-i386.json
60-edk2-x86_64.json
663 # Note that we manually filter-out the non-Sphinx documentation which
664 # is currently built into the docs/interop directory in the build tree,
665 # and also any sphinx-built manpages.
666 define install-manual
=
667 for d in
$$(cd
$(MANUAL_BUILDDIR
) && find
$1 -type d
); do
$(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/$$d"; done
668 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
671 # Note that we deliberately do not install the "devel" manual: it is
672 # for QEMU developers, and not interesting to our users.
673 .PHONY
: install-sphinxdocs
674 install-sphinxdocs
: sphinxdocs
675 $(call install-manual
,interop
)
676 $(call install-manual
,specs
)
677 $(call install-manual
,system
)
678 $(call install-manual
,tools
)
679 $(call install-manual
,user
)
681 install-doc
: $(DOCS
) install-sphinxdocs
682 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)"
683 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/index.html
"$(DESTDIR)$(qemu_docdir)"
684 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/interop"
685 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.html
"$(DESTDIR)$(qemu_docdir)/interop"
686 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.txt
"$(DESTDIR)$(qemu_docdir)/interop"
688 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
689 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu
.1 "$(DESTDIR)$(mandir)/man1"
690 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man7"
691 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref
.7 "$(DESTDIR)$(mandir)/man7"
692 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-block-drivers
.7 "$(DESTDIR)$(mandir)/man7"
693 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-cpu-models
.7 "$(DESTDIR)$(mandir)/man7"
694 ifeq ($(CONFIG_TOOLS
),y
)
695 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-img
.1 "$(DESTDIR)$(mandir)/man1"
696 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man8"
697 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-nbd
.8 "$(DESTDIR)$(mandir)/man8"
699 ifdef CONFIG_TRACE_SYSTEMTAP
700 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/qemu-trace-stap
.1 "$(DESTDIR)$(mandir)/man1"
702 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
703 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/interop
/qemu-ga
.8 "$(DESTDIR)$(mandir)/man8"
704 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/interop"
705 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.html
"$(DESTDIR)$(qemu_docdir)/interop"
706 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.txt
"$(DESTDIR)$(qemu_docdir)/interop"
707 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref
.7 "$(DESTDIR)$(mandir)/man7"
711 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
712 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/virtfs-proxy-helper
.1 "$(DESTDIR)$(mandir)/man1"
714 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
715 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/tools
/virtiofsd
.1 "$(DESTDIR)$(mandir)/man1"
719 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)"
721 install-localstatedir
:
723 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
724 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_localstatedir)"/run
728 ICON_SIZES
=16x16
24x24
32x32
48x48
64x64
128x128
256x256
512x512
731 $(INSTALL_DIR
) "$(DESTDIR)$(includedir)"
733 # Needed by "meson install"
735 install: all $(if
$(BUILD_DOCS
),install-doc
) \
736 install-datadir install-localstatedir install-includedir \
737 $(if
$(INSTALL_BLOBS
),$(edk2-decompressed
)) \
740 $(call install-prog
,$(TOOLS
),$(DESTDIR
)$(bindir))
742 ifneq ($(CONFIG_MODULES
),)
743 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_moddir)"
744 for s in
$(modules-m
:.mo
=$(DSOSUF
)); do \
745 t
="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
746 $(INSTALL_LIB
) $$s "$$t"; \
747 test -z
"$(STRIP)" ||
$(STRIP
) "$$t"; \
750 ifneq ($(HELPERS-y
),)
751 $(call install-prog
,$(HELPERS-y
),$(DESTDIR
)$(libexecdir
))
753 ifneq ($(vhost-user-json-y
),)
754 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/vhost-user/"
755 for x in
$(vhost-user-json-y
); do \
756 $(INSTALL_DATA
) $$x "$(DESTDIR)$(qemu_datadir)/vhost-user/"; \
759 ifdef CONFIG_TRACE_SYSTEMTAP
760 $(INSTALL_PROG
) "scripts/qemu-trace-stap" $(DESTDIR
)$(bindir)
763 set
-e
; for x in
$(BLOBS
); do \
764 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/$$x "$(DESTDIR)$(qemu_datadir)"; \
768 set
-e
; for x in
$(edk2-decompressed
); do \
769 $(INSTALL_DATA
) $$x "$(DESTDIR)$(qemu_datadir)"; \
773 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/firmware"
774 set
-e
; tmpf
=$$(mktemp
); trap
'rm -f -- "$$tmpf"' EXIT
; \
775 for x in
$(DESCS
); do \
776 sed
-e
's,@DATADIR@,$(qemu_datadir),' \
777 "$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
778 $(INSTALL_DATA
) "$$tmpf" \
779 "$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
782 for s in
$(ICON_SIZES
); do \
783 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
784 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_
$${s}.png \
785 "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
787 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
788 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_32x32.bmp \
789 "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
790 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
791 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu.svg \
792 "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
793 mkdir
-p
"$(DESTDIR)$(qemu_desktopdir)"
794 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/qemu.desktop \
795 "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
799 ifeq ($(CONFIG_PLUGIN
),y
)
800 $(INSTALL_DATA
) $(SRC_PATH
)/include/qemu
/qemu-plugin.h
"$(DESTDIR)$(includedir)/qemu-plugin.h"
802 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/keymaps"
803 set
-e
; for x in
$(KEYMAPS
); do \
804 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/keymaps
/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
806 for d in
$(TARGET_DIRS
); do \
807 $(MAKE
) $(SUBDIR_MAKEFLAGS
) TARGET_DIR
=$$d/ -C
$$d $@ || exit
1 ; \
810 # opengl shader programs
811 ui
/shader
/%-vert.h
: $(SRC_PATH
)/ui
/shader
/%.vert
$(SRC_PATH
)/scripts
/shaderinclude.pl
813 $(call quiet-command
,\
814 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
817 ui
/shader
/%-frag.h
: $(SRC_PATH
)/ui
/shader
/%.frag
$(SRC_PATH
)/scripts
/shaderinclude.pl
819 $(call quiet-command
,\
820 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
823 ui
/shader.o
: $(SRC_PATH
)/ui
/shader.c \
824 ui
/shader
/texture-blit-vert.h \
825 ui
/shader
/texture-blit-flip-vert.h \
826 ui
/shader
/texture-blit-frag.h
830 MAKEINFOINCLUDES
= -I docs
-I
$(<D
) -I
$(@D
)
831 MAKEINFOFLAGS
=--no-split
--number-sections
$(MAKEINFOINCLUDES
)
832 TEXI2PODFLAGS
=$(MAKEINFOINCLUDES
) -DVERSION
="$(VERSION)" -DCONFDIR
="$(qemu_confdir)"
833 TEXI2PDFFLAGS
=$(if
$(V
),,--quiet
) -I
$(SRC_PATH
) $(MAKEINFOINCLUDES
)
835 docs
/version.texi
: $(SRC_PATH
)/VERSION config-host.mak
836 $(call quiet-command
,(\
837 echo
"@set VERSION $(VERSION)" && \
838 echo
"@set CONFDIR $(qemu_confdir)" \
841 %.html
: %.texi docs
/version.texi
842 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
843 --html
$< -o
$@
,"GEN","$@")
845 %.
info: %.texi docs
/version.texi
846 $(call quiet-command
,$(MAKEINFO
) $(MAKEINFOFLAGS
) $< -o
$@
,"GEN","$@")
848 %.txt
: %.texi docs
/version.texi
849 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
850 --plaintext
$< -o
$@
,"GEN","$@")
852 %.pdf
: %.texi docs
/version.texi
853 $(call quiet-command
,texi2pdf
$(TEXI2PDFFLAGS
) $< -o
$@
,"GEN","$@")
855 # Sphinx builds all its documentation at once in one invocation
856 # and handles "don't rebuild things unless necessary" itself.
857 # The '.doctrees' files are cached information to speed this up.
859 sphinxdocs
: $(MANUAL_BUILDDIR
)/devel
/index.html \
860 $(MANUAL_BUILDDIR
)/interop
/index.html \
861 $(MANUAL_BUILDDIR
)/specs
/index.html \
862 $(MANUAL_BUILDDIR
)/system
/index.html \
863 $(MANUAL_BUILDDIR
)/tools
/index.html \
864 $(MANUAL_BUILDDIR
)/user
/index.html
866 # Canned command to build a single manual
867 # Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
868 # Note the use of different doctree for each (manual, builder) tuple;
869 # this works around Sphinx not handling parallel invocation on
870 # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
871 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")
872 # We assume all RST files in the manual's directory are used in it
873 manual-deps
= $(wildcard $(SRC_PATH
)/docs
/$1/*.rst
$(SRC_PATH
)/docs
/$1/*/*.rst
) \
874 $(SRC_PATH
)/docs
/defs.rst.inc \
875 $(SRC_PATH
)/docs
/$1/conf.py
$(SRC_PATH
)/docs
/conf.py \
876 $(SRC_PATH
)/docs
/sphinx
/*.py
877 # Macro to write out the rule and dependencies for building manpages
878 # Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps])
879 # 'extradeps' is optional, and specifies extra files (eg .hx files) that
880 # the manual page depends on.
881 define define-manpage-rule
882 $(call atomic
,$(foreach manpage
,$2,$(MANUAL_BUILDDIR
)/$1/$(manpage
)),$(call manual-deps
,$1) $3)
883 $(call build-manual
,$1,man
)
886 $(MANUAL_BUILDDIR
)/devel
/index.html
: $(call manual-deps
,devel
)
887 $(call build-manual
,devel
,html
)
889 $(MANUAL_BUILDDIR
)/interop
/index.html
: $(call manual-deps
,interop
)
890 $(call build-manual
,interop
,html
)
892 $(MANUAL_BUILDDIR
)/specs
/index.html
: $(call manual-deps
,specs
)
893 $(call build-manual
,specs
,html
)
895 $(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
896 $(call build-manual
,system
,html
)
898 $(MANUAL_BUILDDIR
)/tools
/index.html
: $(call manual-deps
,tools
) $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/docs
/qemu-option-trace.rst.inc
899 $(call build-manual
,tools
,html
)
901 $(MANUAL_BUILDDIR
)/user
/index.html
: $(call manual-deps
,user
)
902 $(call build-manual
,user
,html
)
904 $(call define-manpage-rule
,interop
,qemu-ga
.8)
906 $(call define-manpage-rule
,system
,qemu
.1 qemu-block-drivers
.7 qemu-cpu-models
.7)
908 $(call define-manpage-rule
,tools
,\
909 qemu-img
.1 qemu-nbd
.8 qemu-trace-stap
.1\
910 virtiofsd
.1 virtfs-proxy-helper
.1,\
911 $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/docs
/qemu-option-trace.rst.inc
)
913 $(MANUAL_BUILDDIR
)/index.html
: $(SRC_PATH
)/docs
/index.html.in qemu-version.h
914 @mkdir
-p
"$(MANUAL_BUILDDIR)"
915 $(call quiet-command
, sed
"s|@@VERSION@@|${VERSION}|g" $< >$@
, \
918 docs
/interop
/qemu-qmp-qapi.texi
: qapi
/qapi-doc.texi
921 docs
/interop
/qemu-ga-qapi.texi
: qga
/qapi-generated
/qga-qapi-doc.texi
924 html
: docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html sphinxdocs
925 info: docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-ga-ref.
info
926 pdf
: docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
927 txt
: docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
929 docs
/interop
/qemu-ga-ref.
dvi docs
/interop
/qemu-ga-ref.html \
930 docs
/interop
/qemu-ga-ref.
info docs
/interop
/qemu-ga-ref.pdf \
931 docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7: \
932 docs
/interop
/qemu-ga-ref.texi docs
/interop
/qemu-ga-qapi.texi
934 docs
/interop
/qemu-qmp-ref.
dvi docs
/interop
/qemu-qmp-ref.html \
935 docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-qmp-ref.pdf \
936 docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7: \
937 docs
/interop
/qemu-qmp-ref.texi docs
/interop
/qemu-qmp-qapi.texi
939 $(filter %.1 %.7 %.8,$(DOCS
)): scripts
/texi2pod.pl
943 %/coverage-report.html
:
945 $(call quiet-command
,\
946 gcovr
-r
$(SRC_PATH
) \
947 $(foreach t
, $(TARGET_DIRS
), --object-directory
$(BUILD_DIR
)/$(t
)) \
948 --object-directory
$(BUILD_DIR
) \
949 -p
--html
--html-details
-o
$@
, \
950 "GEN", "coverage-report.html")
952 .PHONY
: coverage-report
953 coverage-report
: $(CURDIR
)/reports
/coverage
/coverage-report.html
957 INSTALLER
= qemu-setup-
$(VERSION
)$(EXESUF
)
959 nsisflags
= -V2
-NOCD
961 ifneq ($(wildcard $(SRC_PATH
)/dll
),)
962 ifeq ($(ARCH
),x86_64
)
964 DLL_PATH
= $(SRC_PATH
)/dll
/w64
968 DLL_PATH
= $(SRC_PATH
)/dll
/w32
973 installer
: $(INSTALLER
)
975 INSTDIR
=/tmp
/qemu-nsis
977 $(INSTALLER
): $(SRC_PATH
)/qemu.nsi
978 $(MAKE
) install DESTDIR
=${INSTDIR}
980 (cd
${INSTDIR}/${bindir}; \
986 (cd
${INSTDIR}/${bindir}; \
987 for i in qemu-system-
*.exe
; do \
989 arch
=$${arch
#qemu-system-}; \
990 echo Section
\"$$arch\" Section_
$$arch; \
991 echo SetOutPath
\"\
$$INSTDIR\"; \
992 echo File
\"\
$${BINDIR}\\$$i\"; \
995 ) >${INSTDIR}/${bindir}/system-emulations.nsh
996 makensis
$(nsisflags
) \
997 $(if
$(BUILD_DOCS
),-DCONFIG_DOCUMENTATION
="y") \
998 $(if
$(CONFIG_GTK
),-DCONFIG_GTK
="y") \
999 -DBINDIR
="${INSTDIR}/${bindir}" \
1000 $(if
$(DLL_PATH
),-DDLLDIR
="$(DLL_PATH)") \
1001 -DSRCDIR
="$(SRC_PATH)" \
1002 -DOUTFILE
="$(INSTALLER)" \
1003 -DDISPLAYVERSION
="$(VERSION)" \
1004 $(SRC_PATH
)/qemu.nsi
1007 $(SIGNCODE
) $(INSTALLER
)
1011 # Add a dependency on the generated files, so that they are always
1012 # rebuilt before other object files
1013 ifneq ($(wildcard config-host.mak
),)
1014 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
1015 Makefile
: $(generated-files-y
)
1019 # Include automatically generated dependency files
1020 # Dependencies in Makefile.objs files come from our recursive subdir rules
1021 -include $(wildcard *.d tests
/*.d
)
1023 include $(SRC_PATH
)/tests
/docker
/Makefile.
include
1024 include $(SRC_PATH
)/tests
/vm
/Makefile.
include
1026 print-help-run
= printf
" %-30s - %s\\n" "$1" "$2"
1027 print-help
= $(quiet-@
)$(call print-help-run
,$1,$2)
1031 @echo
'Generic targets:'
1032 $(call print-help
,all,Build
all)
1033 ifdef CONFIG_MODULES
1034 $(call print-help
,modules
,Build
all modules
)
1036 $(call print-help
,dir/file.o
,Build specified target only
)
1037 $(call print-help
,install,Install QEMU
, documentation and tools
)
1038 $(call print-help
,ctags
/TAGS
,Generate
tags file for editors
)
1039 $(call print-help
,cscope
,Generate cscope index
)
1040 $(call print-help
,sparse
,Run sparse on the QEMU source
)
1042 @
$(if
$(TARGET_DIRS
), \
1043 echo
'Architecture specific targets:'; \
1044 $(foreach t
, $(TARGET_DIRS
), \
1045 $(call print-help-run
,$(t
)/all,Build for
$(t
)); \
1046 $(if
$(CONFIG_FUZZ
), \
1047 $(if
$(findstring softmmu
,$(t
)), \
1048 $(call print-help-run
,$(t
)/fuzz
,Build fuzzer for
$(t
)); \
1051 @
$(if
$(HELPERS-y
), \
1052 echo
'Helper targets:'; \
1053 $(foreach t
, $(HELPERS-y
), \
1054 $(call print-help-run
,$(t
),Build
$(shell basename $(t
)));) \
1057 echo
'Tools targets:'; \
1058 $(foreach t
, $(TOOLS
), \
1059 $(call print-help-run
,$(t
),Build
$(shell basename $(t
)) tool
);) \
1061 @echo
'Cleaning targets:'
1062 $(call print-help
,clean,Remove most generated files but keep the config
)
1063 $(call print-help
,distclean,Remove
all generated files
)
1064 $(call print-help
,dist,Build a distributable tarball
)
1066 @echo
'Test targets:'
1067 $(call print-help
,check,Run
all tests
(check-help for details
))
1068 $(call print-help
,docker
,Help about targets running tests inside containers
)
1069 $(call print-help
,vm-help
,Help about targets running tests inside VM
)
1071 @echo
'Documentation targets:'
1072 $(call print-help
,html
info pdf txt
,Build documentation in specified format
)
1075 @echo
'Windows targets:'
1076 $(call print-help
,installer
,Build NSIS-based installer for QEMU
)
1077 ifdef QEMU_GA_MSI_ENABLED
1078 $(call print-help
,msi
,Build MSI-based installer for qemu-ga
)
1082 $(call print-help
,$(MAKE
) [targets
],(quiet build
, default
))
1083 $(call print-help
,$(MAKE
) V
=1 [targets
],(verbose build
))