xref: /openbmc/qemu/Makefile (revision eabfeb0c)
1# Makefile for QEMU.
2
3ifneq ($(words $(subst :, ,$(CURDIR))), 1)
4  $(error main directory cannot contain spaces nor colons)
5endif
6
7# Always point to the root of the build tree (needs GNU make).
8BUILD_DIR=$(CURDIR)
9
10# Before including a proper config-host.mak, assume we are in the source tree
11SRC_PATH=.
12
13UNCHECKED_GOALS := %clean TAGS cscope ctags dist \
14    html info pdf txt \
15    help check-help print-% \
16    docker docker-% vm-help vm-test vm-build-%
17
18# All following code might depend on configuration variables
19ifneq ($(wildcard config-host.mak),)
20# Put the all: rule here so that config-host.mak can contain dependencies.
21all:
22include config-host.mak
23
24git-submodule-update:
25
26.PHONY: git-submodule-update
27
28git_module_status := $(shell \
29  cd '$(SRC_PATH)' && \
30  GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
31  echo $$?; \
32)
33
34ifeq (1,$(git_module_status))
35ifeq (no,$(GIT_UPDATE))
36git-submodule-update:
37	$(call quiet-command, \
38            echo && \
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)" && \
42            echo && \
43            exit 1)
44else
45git-submodule-update:
46	$(call quiet-command, \
47          (cd $(SRC_PATH) && GIT="$(GIT)" ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \
48          "GIT","$(GIT_SUBMODULES)")
49endif
50endif
51
52.git-submodule-status: git-submodule-update config-host.mak
53
54# Check that we're not trying to do an out-of-tree build from
55# a tree that's been used for an in-tree build.
56ifneq ($(realpath $(SRC_PATH)),$(realpath .))
57ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
58$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
59seems to have been used for an in-tree build. You can fix this by running \
60"$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
61endif
62endif
63
64CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
65CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
66CONFIG_XEN := $(CONFIG_XEN_BACKEND)
67CONFIG_ALL=y
68-include config-all-devices.mak
69-include config-all-disas.mak
70
71config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
72	@echo $@ is out-of-date, running configure
73	@./config.status
74
75# Force configure to re-run if the API symbols are updated
76ifeq ($(CONFIG_PLUGIN),y)
77config-host.mak: $(SRC_PATH)/plugins/qemu-plugins.symbols
78endif
79
80else
81config-host.mak:
82ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
83	@echo "Please call configure before running make!"
84	@exit 1
85endif
86endif
87
88include $(SRC_PATH)/rules.mak
89
90# lor is defined in rules.mak
91CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
92
93# Create QEMU_PKGVERSION and FULL_VERSION strings
94# If PKGVERSION is set, use that; otherwise get version and -dirty status from git
95QEMU_PKGVERSION := $(if $(PKGVERSION),$(PKGVERSION),$(shell \
96  cd $(SRC_PATH); \
97  if test -e .git; then \
98    git describe --match 'v*' 2>/dev/null | tr -d '\n'; \
99    if ! git diff-index --quiet HEAD &>/dev/null; then \
100      echo "-dirty"; \
101    fi; \
102  fi))
103
104# Either "version (pkgversion)", or just "version" if pkgversion not set
105FULL_VERSION := $(if $(QEMU_PKGVERSION),$(VERSION) ($(QEMU_PKGVERSION)),$(VERSION))
106
107generated-files-y = qemu-version.h config-host.h qemu-options.def
108
109GENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c
110GENERATED_QAPI_FILES += qapi/qapi-types.h qapi/qapi-types.c
111GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.h)
112GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.c)
113GENERATED_QAPI_FILES += qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c
114GENERATED_QAPI_FILES += qapi/qapi-visit.h qapi/qapi-visit.c
115GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.h)
116GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.c)
117GENERATED_QAPI_FILES += qapi/qapi-init-commands.h qapi/qapi-init-commands.c
118GENERATED_QAPI_FILES += qapi/qapi-commands.h qapi/qapi-commands.c
119GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.h)
120GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.c)
121GENERATED_QAPI_FILES += qapi/qapi-emit-events.h qapi/qapi-emit-events.c
122GENERATED_QAPI_FILES += qapi/qapi-events.h qapi/qapi-events.c
123GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.h)
124GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.c)
125GENERATED_QAPI_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h
126GENERATED_QAPI_FILES += qapi/qapi-doc.texi
127
128# The following list considers only the storage daemon main module. All other
129# modules are currently shared with the main schema, so we don't actually
130# generate additional files.
131
132GENERATED_STORAGE_DAEMON_QAPI_FILES = storage-daemon/qapi/qapi-commands.h
133GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-commands.c
134GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-emit-events.h
135GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-emit-events.c
136GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-events.h
137GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-events.c
138GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-init-commands.h
139GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-init-commands.c
140GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-introspect.h
141GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-introspect.c
142GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-types.h
143GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-types.c
144GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-visit.h
145GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-visit.c
146GENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-doc.texi
147
148generated-files-y += $(GENERATED_QAPI_FILES)
149generated-files-y += $(GENERATED_STORAGE_DAEMON_QAPI_FILES)
150
151generated-files-y += trace/generated-tcg-tracers.h
152
153generated-files-y += trace/generated-helpers-wrappers.h
154generated-files-y += trace/generated-helpers.h
155generated-files-y += trace/generated-helpers.c
156
157generated-files-$(CONFIG_TRACE_UST) += trace-ust-all.h
158generated-files-$(CONFIG_TRACE_UST) += trace-ust-all.c
159
160generated-files-y += module_block.h
161
162TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h)
163TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c)
164TRACE_DTRACE =
165ifdef CONFIG_TRACE_DTRACE
166TRACE_HEADERS += trace-dtrace-root.h $(trace-events-subdirs:%=%/trace-dtrace.h)
167TRACE_DTRACE += trace-dtrace-root.dtrace $(trace-events-subdirs:%=%/trace-dtrace.dtrace)
168endif
169ifdef CONFIG_TRACE_UST
170TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h)
171endif
172
173generated-files-y += $(TRACE_HEADERS)
174generated-files-y += $(TRACE_SOURCES)
175generated-files-y += $(BUILD_DIR)/trace-events-all
176generated-files-y += .git-submodule-status
177
178trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
179
180tracetool-y = $(SRC_PATH)/scripts/tracetool.py
181tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
182
183%/trace.h: %/trace.h-timestamp
184	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
185%/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
186	$(call quiet-command,$(TRACETOOL) \
187		--group=$(call trace-group-name,$@) \
188		--format=h \
189		--backends=$(TRACE_BACKENDS) \
190		$< > $@,"GEN","$(@:%-timestamp=%)")
191
192%/trace.c: %/trace.c-timestamp
193	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
194%/trace.c-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
195	$(call quiet-command,$(TRACETOOL) \
196		--group=$(call trace-group-name,$@) \
197		--format=c \
198		--backends=$(TRACE_BACKENDS) \
199		$< > $@,"GEN","$(@:%-timestamp=%)")
200
201%/trace-ust.h: %/trace-ust.h-timestamp
202	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
203%/trace-ust.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
204	$(call quiet-command,$(TRACETOOL) \
205		--group=$(call trace-group-name,$@) \
206		--format=ust-events-h \
207		--backends=$(TRACE_BACKENDS) \
208		$< > $@,"GEN","$(@:%-timestamp=%)")
209
210%/trace-dtrace.dtrace: %/trace-dtrace.dtrace-timestamp
211	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
212%/trace-dtrace.dtrace-timestamp: $(SRC_PATH)/%/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
213	$(call quiet-command,$(TRACETOOL) \
214		--group=$(call trace-group-name,$@) \
215		--format=d \
216		--backends=$(TRACE_BACKENDS) \
217		$< > $@,"GEN","$(@:%-timestamp=%)")
218
219%/trace-dtrace.h: %/trace-dtrace.dtrace $(tracetool-y)
220	$(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@")
221
222%/trace-dtrace.o: %/trace-dtrace.dtrace $(tracetool-y)
223
224
225trace-root.h: trace-root.h-timestamp
226	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
227trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
228	$(call quiet-command,$(TRACETOOL) \
229		--group=root \
230		--format=h \
231		--backends=$(TRACE_BACKENDS) \
232		$< > $@,"GEN","$(@:%-timestamp=%)")
233
234trace-root.c: trace-root.c-timestamp
235	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
236trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
237	$(call quiet-command,$(TRACETOOL) \
238		--group=root \
239		--format=c \
240		--backends=$(TRACE_BACKENDS) \
241		$< > $@,"GEN","$(@:%-timestamp=%)")
242
243trace-ust-root.h: trace-ust-root.h-timestamp
244	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
245trace-ust-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
246	$(call quiet-command,$(TRACETOOL) \
247		--group=root \
248		--format=ust-events-h \
249		--backends=$(TRACE_BACKENDS) \
250		$< > $@,"GEN","$(@:%-timestamp=%)")
251
252trace-ust-all.h: trace-ust-all.h-timestamp
253	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
254trace-ust-all.h-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak
255	$(call quiet-command,$(TRACETOOL) \
256		--group=all \
257		--format=ust-events-h \
258		--backends=$(TRACE_BACKENDS) \
259		$(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)")
260
261trace-ust-all.c: trace-ust-all.c-timestamp
262	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
263trace-ust-all.c-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak
264	$(call quiet-command,$(TRACETOOL) \
265		--group=all \
266		--format=ust-events-c \
267		--backends=$(TRACE_BACKENDS) \
268		$(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)")
269
270trace-dtrace-root.dtrace: trace-dtrace-root.dtrace-timestamp
271	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
272trace-dtrace-root.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
273	$(call quiet-command,$(TRACETOOL) \
274		--group=root \
275		--format=d \
276		--backends=$(TRACE_BACKENDS) \
277		$< > $@,"GEN","$(@:%-timestamp=%)")
278
279trace-dtrace-root.h: trace-dtrace-root.dtrace
280	$(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@")
281
282trace-dtrace-root.o: trace-dtrace-root.dtrace
283
284KEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen
285KEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv
286
287KEYCODEMAP_FILES = \
288		 ui/input-keymap-atset1-to-qcode.c \
289		 ui/input-keymap-linux-to-qcode.c \
290		 ui/input-keymap-qcode-to-atset1.c \
291		 ui/input-keymap-qcode-to-atset2.c \
292		 ui/input-keymap-qcode-to-atset3.c \
293		 ui/input-keymap-qcode-to-linux.c \
294		 ui/input-keymap-qcode-to-qnum.c \
295		 ui/input-keymap-qcode-to-sun.c \
296		 ui/input-keymap-qnum-to-qcode.c \
297		 ui/input-keymap-usb-to-qcode.c \
298		 ui/input-keymap-win32-to-qcode.c \
299		 ui/input-keymap-x11-to-qcode.c \
300		 ui/input-keymap-xorgevdev-to-qcode.c \
301		 ui/input-keymap-xorgkbd-to-qcode.c \
302		 ui/input-keymap-xorgxquartz-to-qcode.c \
303		 ui/input-keymap-xorgxwin-to-qcode.c \
304		 ui/input-keymap-osx-to-qcode.c \
305		 $(NULL)
306
307generated-files-$(CONFIG_SOFTMMU) += $(KEYCODEMAP_FILES)
308
309ui/input-keymap-%.c: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile.objs
310	$(call quiet-command,\
311	    stem=$* && src=$${stem%-to-*} dst=$${stem#*-to-} && \
312	    test -e $(KEYCODEMAP_GEN) && \
313	    $(PYTHON) $(KEYCODEMAP_GEN) \
314	          --lang glib2 \
315	          --varname qemu_input_map_$${src}_to_$${dst} \
316	          code-map $(KEYCODEMAP_CSV) $${src} $${dst} \
317	        > $@ || rm -f $@, "GEN", "$@")
318
319$(KEYCODEMAP_GEN): .git-submodule-status
320$(KEYCODEMAP_CSV): .git-submodule-status
321
322edk2-decompressed = $(basename $(wildcard pc-bios/edk2-*.fd.bz2))
323pc-bios/edk2-%.fd: pc-bios/edk2-%.fd.bz2
324	$(call quiet-command,bzip2 -d -c $< > $@,"BUNZIP2",$<)
325
326# Don't try to regenerate Makefile or configure
327# We don't generate any of them
328Makefile: ;
329configure: ;
330
331.PHONY: all clean cscope distclean html info install install-doc \
332	pdf txt recurse-all dist msi FORCE
333
334$(call set-vpath, $(SRC_PATH))
335
336LIBS+=-lz $(LIBS_TOOLS)
337
338vhost-user-json-y =
339HELPERS-y = $(HELPERS)
340
341HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) += qemu-bridge-helper$(EXESUF)
342
343ifeq ($(CONFIG_LINUX)$(CONFIG_VIRGL)$(CONFIG_GBM)$(CONFIG_TOOLS),yyyy)
344HELPERS-y += vhost-user-gpu$(EXESUF)
345vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json
346endif
347
348ifeq ($(CONFIG_SOFTMMU)$(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyyy)
349HELPERS-y += virtiofsd$(EXESUF)
350vhost-user-json-y += tools/virtiofsd/50-qemu-virtiofsd.json
351endif
352
353# Sphinx does not allow building manuals into the same directory as
354# the source files, so if we're doing an in-tree QEMU build we must
355# build the manuals into a subdirectory (and then install them from
356# there for 'make install'). For an out-of-tree build we can just
357# use the docs/ subdirectory in the build tree as normal.
358ifeq ($(realpath $(SRC_PATH)),$(realpath .))
359MANUAL_BUILDDIR := docs/built
360else
361MANUAL_BUILDDIR := docs
362endif
363
364ifdef BUILD_DOCS
365DOCS+=$(MANUAL_BUILDDIR)/system/qemu.1
366DOCS+=$(MANUAL_BUILDDIR)/tools/qemu-img.1
367DOCS+=$(MANUAL_BUILDDIR)/tools/qemu-nbd.8
368DOCS+=$(MANUAL_BUILDDIR)/interop/qemu-ga.8
369ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
370DOCS+=$(MANUAL_BUILDDIR)/tools/virtiofsd.1
371endif
372DOCS+=$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7
373DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
374DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
375DOCS+=$(MANUAL_BUILDDIR)/system/qemu-cpu-models.7
376DOCS+=$(MANUAL_BUILDDIR)/index.html
377ifdef CONFIG_VIRTFS
378DOCS+=$(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1
379endif
380ifdef CONFIG_TRACE_SYSTEMTAP
381DOCS+=$(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1
382endif
383else
384DOCS=
385endif
386
387SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
388SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(filter %-softmmu, $(TARGET_DIRS)))
389SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK))
390
391ifeq ($(SUBDIR_DEVICES_MAK),)
392config-all-devices.mak: config-host.mak
393	$(call quiet-command,echo '# no devices' > $@,"GEN","$@")
394else
395config-all-devices.mak: $(SUBDIR_DEVICES_MAK) config-host.mak
396	$(call quiet-command, sed -n \
397             's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
398             $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
399             "GEN","$@")
400endif
401
402-include $(SUBDIR_DEVICES_MAK_DEP)
403
404# This has to be kept in sync with Kconfig.host.
405MINIKCONF_ARGS = \
406    $(CONFIG_MINIKCONF_MODE) \
407    $@ $*/config-devices.mak.d $< $(SRC_PATH)/Kconfig \
408    CONFIG_TCG=$(CONFIG_TCG) \
409    CONFIG_KVM=$(CONFIG_KVM) \
410    CONFIG_SPICE=$(CONFIG_SPICE) \
411    CONFIG_IVSHMEM=$(CONFIG_IVSHMEM) \
412    CONFIG_TPM=$(CONFIG_TPM) \
413    CONFIG_XEN=$(CONFIG_XEN) \
414    CONFIG_OPENGL=$(CONFIG_OPENGL) \
415    CONFIG_X11=$(CONFIG_X11) \
416    CONFIG_VHOST_USER=$(CONFIG_VHOST_USER) \
417    CONFIG_VHOST_KERNEL=$(CONFIG_VHOST_KERNEL) \
418    CONFIG_VIRTFS=$(CONFIG_VIRTFS) \
419    CONFIG_LINUX=$(CONFIG_LINUX) \
420    CONFIG_PVRDMA=$(CONFIG_PVRDMA)
421
422MINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py
423
424$(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak $(SRC_PATH)/Kconfig $(BUILD_DIR)/config-host.mak
425	$(call quiet-command, $(MINIKCONF) $(MINIKCONF_ARGS) \
426		> $@.tmp, "GEN", "$@.tmp")
427	$(call quiet-command, if test -f $@; then \
428	  if cmp -s $@.old $@; then \
429	    mv $@.tmp $@; \
430	    cp -p $@ $@.old; \
431	  else \
432	    if test -f $@.old; then \
433	      echo "WARNING: $@ (user modified) out of date.";\
434	    else \
435	      echo "WARNING: $@ out of date.";\
436	    fi; \
437	    echo "Run \"$(MAKE) defconfig\" to regenerate."; \
438	    rm $@.tmp; \
439	  fi; \
440	 else \
441	  mv $@.tmp $@; \
442	  cp -p $@ $@.old; \
443	 fi,"GEN","$@");
444
445defconfig:
446	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
447
448ifneq ($(wildcard config-host.mak),)
449include $(SRC_PATH)/Makefile.objs
450endif
451
452dummy := $(call unnest-vars,, \
453                stub-obj-y \
454                authz-obj-y \
455                chardev-obj-y \
456                util-obj-y \
457                qga-obj-y \
458                elf2dmp-obj-y \
459                ivshmem-client-obj-y \
460                ivshmem-server-obj-y \
461                virtiofsd-obj-y \
462                rdmacm-mux-obj-y \
463                libvhost-user-obj-y \
464                vhost-user-scsi-obj-y \
465                vhost-user-blk-obj-y \
466                vhost-user-input-obj-y \
467                vhost-user-gpu-obj-y \
468                qga-vss-dll-obj-y \
469                block-obj-y \
470                block-obj-m \
471                storage-daemon-obj-y \
472                storage-daemon-obj-m \
473                crypto-obj-y \
474                qom-obj-y \
475                io-obj-y \
476                common-obj-y \
477                common-obj-m \
478                trace-obj-y)
479
480include $(SRC_PATH)/tests/Makefile.include
481
482all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all modules $(vhost-user-json-y)
483
484qemu-version.h: FORCE
485	$(call quiet-command, \
486                (printf '#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \
487		printf '#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \
488		) > $@.tmp)
489	$(call quiet-command, if ! cmp -s $@ $@.tmp; then \
490	  mv $@.tmp $@; \
491	 else \
492	  rm $@.tmp; \
493	 fi)
494
495config-host.h: config-host.h-timestamp
496config-host.h-timestamp: config-host.mak
497qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
498	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
499
500TARGET_DIRS_RULES := $(foreach t, all fuzz clean install, $(addsuffix /$(t), $(TARGET_DIRS)))
501
502SOFTMMU_ALL_RULES=$(filter %-softmmu/all, $(TARGET_DIRS_RULES))
503$(SOFTMMU_ALL_RULES): $(authz-obj-y)
504$(SOFTMMU_ALL_RULES): $(block-obj-y)
505$(SOFTMMU_ALL_RULES): $(storage-daemon-obj-y)
506$(SOFTMMU_ALL_RULES): $(chardev-obj-y)
507$(SOFTMMU_ALL_RULES): $(crypto-obj-y)
508$(SOFTMMU_ALL_RULES): $(io-obj-y)
509$(SOFTMMU_ALL_RULES): config-all-devices.mak
510ifdef DECOMPRESS_EDK2_BLOBS
511$(SOFTMMU_ALL_RULES): $(edk2-decompressed)
512endif
513
514SOFTMMU_FUZZ_RULES=$(filter %-softmmu/fuzz, $(TARGET_DIRS_RULES))
515$(SOFTMMU_FUZZ_RULES): $(authz-obj-y)
516$(SOFTMMU_FUZZ_RULES): $(block-obj-y)
517$(SOFTMMU_FUZZ_RULES): $(chardev-obj-y)
518$(SOFTMMU_FUZZ_RULES): $(crypto-obj-y)
519$(SOFTMMU_FUZZ_RULES): $(io-obj-y)
520$(SOFTMMU_FUZZ_RULES): config-all-devices.mak
521$(SOFTMMU_FUZZ_RULES): $(edk2-decompressed)
522
523.PHONY: $(TARGET_DIRS_RULES)
524# The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
525# $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
526$(TARGET_DIRS_RULES):
527	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
528
529# LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
530DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_lib=""
531DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
532DTC_CPPFLAGS=-I$(SRC_PATH)/dtc/libfdt
533
534.PHONY: dtc/all
535dtc/all: .git-submodule-status dtc/libfdt
536	$(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,)
537
538dtc/%: .git-submodule-status
539	@mkdir -p $@
540
541# Overriding CFLAGS causes us to lose defines added in the sub-makefile.
542# Not overriding CFLAGS leads to mis-matches between compilation modes.
543# Therefore we replicate some of the logic in the sub-makefile.
544# Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
545# no need to annoy QEMU developers with such things.
546CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS))
547CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
548CAP_CFLAGS += -DCAPSTONE_HAS_ARM
549CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
550CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
551CAP_CFLAGS += -DCAPSTONE_HAS_X86
552
553.PHONY: capstone/all
554capstone/all: .git-submodule-status
555	$(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))
556
557.PHONY: slirp/all
558slirp/all: .git-submodule-status
559	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp		\
560		BUILD_DIR="$(BUILD_DIR)/slirp" 			\
561		PKG_CONFIG="$(PKG_CONFIG)" 				\
562		CC="$(CC)" AR="$(AR)" 	LD="$(LD)" RANLIB="$(RANLIB)"	\
563		CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)")
564
565$(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
566	$(qom-obj-y)
567
568$(filter %/fuzz, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
569	$(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY))
570
571ROM_DIRS = $(addprefix pc-bios/, $(ROMS))
572ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
573# Only keep -O and -g cflags
574.PHONY: $(ROM_DIRS_RULES)
575$(ROM_DIRS_RULES):
576	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))" $(notdir $@),)
577
578.PHONY: recurse-all recurse-clean recurse-install
579recurse-all: $(addsuffix /all, $(TARGET_DIRS) $(ROM_DIRS))
580recurse-clean: $(addsuffix /clean, $(TARGET_DIRS) $(ROM_DIRS))
581recurse-install: $(addsuffix /install, $(TARGET_DIRS))
582$(addsuffix /install, $(TARGET_DIRS)): all
583
584$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
585	$(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
586
587Makefile: $(version-obj-y)
588
589######################################################################
590# Build libraries
591
592libqemuutil.a: $(util-obj-y) $(trace-obj-y) $(stub-obj-y)
593libvhost-user.a: $(libvhost-user-obj-y) $(util-obj-y) $(stub-obj-y)
594
595######################################################################
596
597COMMON_LDADDS = libqemuutil.a
598
599qemu-img.o: qemu-img-cmds.h
600
601qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
602qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
603qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
604qemu-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)
605
606qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
607
608qemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS)
609
610qemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS)
611
612fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
613
614scsi/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)
615ifdef CONFIG_MPATH
616scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
617endif
618
619qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
620	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
621
622qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
623qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
624
625qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
626qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
627
628qapi-py = $(SRC_PATH)/scripts/qapi/__init__.py \
629$(SRC_PATH)/scripts/qapi/commands.py \
630$(SRC_PATH)/scripts/qapi/common.py \
631$(SRC_PATH)/scripts/qapi/doc.py \
632$(SRC_PATH)/scripts/qapi/error.py \
633$(SRC_PATH)/scripts/qapi/events.py \
634$(SRC_PATH)/scripts/qapi/expr.py \
635$(SRC_PATH)/scripts/qapi/gen.py \
636$(SRC_PATH)/scripts/qapi/introspect.py \
637$(SRC_PATH)/scripts/qapi/parser.py \
638$(SRC_PATH)/scripts/qapi/schema.py \
639$(SRC_PATH)/scripts/qapi/source.py \
640$(SRC_PATH)/scripts/qapi/types.py \
641$(SRC_PATH)/scripts/qapi/visit.py \
642$(SRC_PATH)/scripts/qapi-gen.py
643
644qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
645qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h \
646qga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \
647qga/qapi-generated/qga-qapi-init-commands.h qga/qapi-generated/qga-qapi-init-commands.c \
648qga/qapi-generated/qga-qapi-doc.texi: \
649qga/qapi-generated/qapi-gen-timestamp ;
650qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
651	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
652		-o qga/qapi-generated -p "qga-" $<, \
653		"GEN","$(@:%-timestamp=%)")
654	@>$@
655
656qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json \
657               $(QAPI_MODULES:%=$(SRC_PATH)/qapi/%.json)
658
659$(GENERATED_QAPI_FILES): qapi-gen-timestamp ;
660qapi-gen-timestamp: $(qapi-modules) $(qapi-py)
661	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
662		-o "qapi" -b $<, \
663		"GEN","$(@:%-timestamp=%)")
664	@>$@
665
666qapi-modules-storage-daemon = \
667	$(SRC_PATH)/storage-daemon/qapi/qapi-schema.json \
668    $(QAPI_MODULES_STORAGE_DAEMON:%=$(SRC_PATH)/qapi/%.json)
669
670$(GENERATED_STORAGE_DAEMON_QAPI_FILES): storage-daemon/qapi/qapi-gen-timestamp ;
671storage-daemon/qapi/qapi-gen-timestamp: $(qapi-modules-storage-daemon) $(qapi-py)
672	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
673		-o "storage-daemon/qapi" $<, \
674		"GEN","$(@:%-timestamp=%)")
675	@>$@
676
677QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h qga-qapi-init-commands.h)
678$(qga-obj-y): $(QGALIB_GEN)
679
680qemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
681	$(call LINK, $^)
682
683ifdef QEMU_GA_MSI_ENABLED
684QEMU_GA_MSI=qemu-ga-$(ARCH).msi
685
686msi: $(QEMU_GA_MSI)
687
688$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
689
690$(QEMU_GA_MSI): config-host.mak
691
692$(QEMU_GA_MSI):  $(SRC_PATH)/qga/installer/qemu-ga.wxs
693	$(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)" \
694	wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<,"WIXL","$@")
695else
696msi:
697	@echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
698endif
699
700ifneq ($(EXESUF),)
701.PHONY: qemu-ga
702qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
703endif
704
705elf2dmp$(EXESUF): $(elf2dmp-obj-y)
706	$(call LINK, $^)
707
708ifdef CONFIG_IVSHMEM
709ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS)
710	$(call LINK, $^)
711ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
712	$(call LINK, $^)
713endif
714vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a
715	$(call LINK, $^)
716vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a
717	$(call LINK, $^)
718
719rdmacm-mux$(EXESUF): LIBS += "-libumad"
720rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
721	$(call LINK, $^)
722
723# relies on Linux-specific syscalls
724ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
725virtiofsd$(EXESUF): $(virtiofsd-obj-y) libvhost-user.a $(COMMON_LDADDS)
726	$(call LINK, $^)
727endif
728
729vhost-user-gpu$(EXESUF): $(vhost-user-gpu-obj-y) $(libvhost-user-obj-y) libqemuutil.a libqemustub.a
730	$(call LINK, $^)
731
732ifdef CONFIG_VHOST_USER_INPUT
733ifdef CONFIG_LINUX
734vhost-user-input$(EXESUF): $(vhost-user-input-obj-y) libvhost-user.a libqemuutil.a
735	$(call LINK, $^)
736
737# build by default, do not install
738all: vhost-user-input$(EXESUF)
739endif
740endif
741
742module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
743	$(call quiet-command,$(PYTHON) $< $@ \
744	$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
745	"GEN","$@")
746
747ifdef CONFIG_GCOV
748.PHONY: clean-coverage
749clean-coverage:
750	$(call quiet-command, \
751		find . \( -name '*.gcda' -o -name '*.gcov' \) -type f -exec rm {} +, \
752		"CLEAN", "coverage files")
753endif
754
755clean: recurse-clean
756# avoid old build problems by removing potentially incorrect old files
757	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
758	rm -f qemu-options.def
759	rm -f *.msi
760	find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \
761		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
762		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
763		! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
764		-exec rm {} +
765	rm -f $(edk2-decompressed)
766	rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) TAGS cscope.* *.pod *~ */*~
767	rm -f fsdev/*.pod scsi/*.pod
768	rm -f qemu-img-cmds.h
769	rm -f ui/shader/*-vert.h ui/shader/*-frag.h
770	@# May not be present in generated-files-y
771	rm -f trace/generated-tracers-dtrace.dtrace*
772	rm -f trace/generated-tracers-dtrace.h*
773	rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
774	rm -f qapi-gen-timestamp
775	rm -f storage-daemon/qapi/qapi-gen-timestamp
776	rm -rf qga/qapi-generated
777	rm -f config-all-devices.mak
778	rm -f $(SUBDIR_DEVICES_MAK)
779
780VERSION ?= $(shell cat VERSION)
781
782dist: qemu-$(VERSION).tar.bz2
783
784qemu-%.tar.bz2:
785	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
786
787define clean-manual =
788rm -rf $(MANUAL_BUILDDIR)/$1/_static
789rm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(MANUAL_BUILDDIR)/$1/*.html
790endef
791
792distclean: clean
793	rm -f config-host.mak config-host.h* $(DOCS)
794	rm -f tests/tcg/config-*.mak
795	rm -f config-all-devices.mak config-all-disas.mak config.status
796	rm -f $(SUBDIR_DEVICES_MAK)
797	rm -f po/*.mo tests/qemu-iotests/common.env
798	rm -f roms/seabios/config.mak roms/vgabios/config.mak
799	rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
800	rm -f config.log
801	rm -f linux-headers/asm
802	rm -f docs/version.texi
803	rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi
804	rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7
805	rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
806	rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
807	rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
808	rm -rf .doctrees
809	$(call clean-manual,devel)
810	$(call clean-manual,interop)
811	$(call clean-manual,specs)
812	$(call clean-manual,system)
813	$(call clean-manual,tools)
814	$(call clean-manual,user)
815	for d in $(TARGET_DIRS); do \
816	rm -rf $$d || exit 1 ; \
817        done
818	rm -Rf .sdk
819
820KEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  no  pt-br  sv \
821ar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
822de-ch  es     fo  fr-ca  hu     ja  mk  pt  sl     tr \
823bepo    cz
824
825ifdef INSTALL_BLOBS
826BLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
827vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
828vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
829openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
830pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
831pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
832efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
833efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
834efi-e1000e.rom efi-vmxnet3.rom \
835qemu-nsis.bmp \
836bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
837multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
838s390-ccw.img s390-netboot.img \
839slof.bin skiboot.lid \
840palcode-clipper \
841u-boot.e500 u-boot-sam460-20100605.bin \
842qemu_vga.ndrv \
843edk2-licenses.txt \
844hppa-firmware.img \
845opensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
846opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
847
848
849DESCS=50-edk2-i386-secure.json 50-edk2-x86_64-secure.json \
85060-edk2-aarch64.json 60-edk2-arm.json 60-edk2-i386.json 60-edk2-x86_64.json
851else
852BLOBS=
853DESCS=
854endif
855
856# Note that we manually filter-out the non-Sphinx documentation which
857# is currently built into the docs/interop directory in the build tree,
858# and also any sphinx-built manpages.
859define install-manual =
860for d in $$(cd $(MANUAL_BUILDDIR) && find $1 -type d); do $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/$$d"; done
861for 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
862endef
863
864# Note that we deliberately do not install the "devel" manual: it is
865# for QEMU developers, and not interesting to our users.
866.PHONY: install-sphinxdocs
867install-sphinxdocs: sphinxdocs
868	$(call install-manual,interop)
869	$(call install-manual,specs)
870	$(call install-manual,system)
871	$(call install-manual,tools)
872	$(call install-manual,user)
873
874install-doc: $(DOCS) install-sphinxdocs
875	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
876	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/index.html "$(DESTDIR)$(qemu_docdir)"
877	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop"
878	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)/interop"
879	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)/interop"
880ifdef CONFIG_POSIX
881	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
882	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu.1 "$(DESTDIR)$(mandir)/man1"
883	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
884	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
885	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
886	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
887ifeq ($(CONFIG_TOOLS),y)
888	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-img.1 "$(DESTDIR)$(mandir)/man1"
889	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
890	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
891endif
892ifdef CONFIG_TRACE_SYSTEMTAP
893	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
894endif
895ifneq (,$(findstring qemu-ga,$(TOOLS)))
896	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
897	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop"
898	$(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)/interop"
899	$(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)/interop"
900	$(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
901endif
902endif
903ifdef CONFIG_VIRTFS
904	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
905	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
906endif
907ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
908	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtiofsd.1 "$(DESTDIR)$(mandir)/man1"
909endif
910
911install-datadir:
912	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
913
914install-localstatedir:
915ifdef CONFIG_POSIX
916ifneq (,$(findstring qemu-ga,$(TOOLS)))
917	$(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
918endif
919endif
920
921ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
922
923install-includedir:
924	$(INSTALL_DIR) "$(DESTDIR)$(includedir)"
925
926install: all $(if $(BUILD_DOCS),install-doc) \
927	install-datadir install-localstatedir install-includedir \
928	$(if $(INSTALL_BLOBS),$(edk2-decompressed)) \
929	recurse-install
930ifneq ($(TOOLS),)
931	$(call install-prog,$(TOOLS),$(DESTDIR)$(bindir))
932endif
933ifneq ($(CONFIG_MODULES),)
934	$(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
935	for s in $(modules-m:.mo=$(DSOSUF)); do \
936		t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
937		$(INSTALL_LIB) $$s "$$t"; \
938		test -z "$(STRIP)" || $(STRIP) "$$t"; \
939	done
940endif
941ifneq ($(HELPERS-y),)
942	$(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
943endif
944ifneq ($(vhost-user-json-y),)
945	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/vhost-user/"
946	for x in $(vhost-user-json-y); do \
947		$(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)/vhost-user/"; \
948	done
949endif
950ifdef CONFIG_TRACE_SYSTEMTAP
951	$(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
952endif
953ifneq ($(BLOBS),)
954	set -e; for x in $(BLOBS); do \
955		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
956	done
957endif
958ifdef INSTALL_BLOBS
959	set -e; for x in $(edk2-decompressed); do \
960		$(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)"; \
961	done
962endif
963ifneq ($(DESCS),)
964	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/firmware"
965	set -e; tmpf=$$(mktemp); trap 'rm -f -- "$$tmpf"' EXIT; \
966	for x in $(DESCS); do \
967		sed -e 's,@DATADIR@,$(qemu_datadir),' \
968			"$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
969		$(INSTALL_DATA) "$$tmpf" \
970			"$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
971	done
972endif
973	for s in $(ICON_SIZES); do \
974		mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
975		$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \
976			"$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
977	done; \
978	mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
979	$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \
980		"$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
981	mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
982	$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \
983		"$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
984	mkdir -p "$(DESTDIR)$(qemu_desktopdir)"
985	$(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
986		"$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
987ifdef CONFIG_GTK
988	$(MAKE) -C po $@
989endif
990ifeq ($(CONFIG_PLUGIN),y)
991	$(INSTALL_DATA) $(SRC_PATH)/include/qemu/qemu-plugin.h "$(DESTDIR)$(includedir)/qemu-plugin.h"
992endif
993	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
994	set -e; for x in $(KEYMAPS); do \
995		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
996	done
997	$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
998
999.PHONY: ctags
1000ctags:
1001	rm -f tags
1002	find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
1003
1004.PHONY: TAGS
1005TAGS:
1006	rm -f TAGS
1007	find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
1008
1009cscope:
1010	rm -f "$(SRC_PATH)"/cscope.*
1011	find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
1012	cscope -b -i"$(SRC_PATH)/cscope.files"
1013
1014# opengl shader programs
1015ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
1016	@mkdir -p $(dir $@)
1017	$(call quiet-command,\
1018		perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
1019		"VERT","$@")
1020
1021ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
1022	@mkdir -p $(dir $@)
1023	$(call quiet-command,\
1024		perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
1025		"FRAG","$@")
1026
1027ui/shader.o: $(SRC_PATH)/ui/shader.c \
1028	ui/shader/texture-blit-vert.h \
1029	ui/shader/texture-blit-flip-vert.h \
1030	ui/shader/texture-blit-frag.h
1031
1032# documentation
1033MAKEINFO=makeinfo
1034MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
1035MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
1036TEXI2PODFLAGS=$(MAKEINFOINCLUDES) -DVERSION="$(VERSION)" -DCONFDIR="$(qemu_confdir)"
1037TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
1038
1039docs/version.texi: $(SRC_PATH)/VERSION config-host.mak
1040	$(call quiet-command,(\
1041		echo "@set VERSION $(VERSION)" && \
1042		echo "@set CONFDIR $(qemu_confdir)" \
1043	)> $@,"GEN","$@")
1044
1045%.html: %.texi docs/version.texi
1046	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
1047	--html $< -o $@,"GEN","$@")
1048
1049%.info: %.texi docs/version.texi
1050	$(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
1051
1052%.txt: %.texi docs/version.texi
1053	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
1054	--plaintext $< -o $@,"GEN","$@")
1055
1056%.pdf: %.texi docs/version.texi
1057	$(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@")
1058
1059# Sphinx builds all its documentation at once in one invocation
1060# and handles "don't rebuild things unless necessary" itself.
1061# The '.doctrees' files are cached information to speed this up.
1062.PHONY: sphinxdocs
1063sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \
1064            $(MANUAL_BUILDDIR)/interop/index.html \
1065            $(MANUAL_BUILDDIR)/specs/index.html \
1066            $(MANUAL_BUILDDIR)/system/index.html \
1067            $(MANUAL_BUILDDIR)/tools/index.html \
1068            $(MANUAL_BUILDDIR)/user/index.html
1069
1070# Canned command to build a single manual
1071# Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
1072# Note the use of different doctree for each (manual, builder) tuple;
1073# this works around Sphinx not handling parallel invocation on
1074# a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
1075build-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")
1076# We assume all RST files in the manual's directory are used in it
1077manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \
1078              $(SRC_PATH)/docs/defs.rst.inc \
1079              $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py \
1080              $(SRC_PATH)/docs/sphinx/*.py
1081# Macro to write out the rule and dependencies for building manpages
1082# Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps])
1083# 'extradeps' is optional, and specifies extra files (eg .hx files) that
1084# the manual page depends on.
1085define define-manpage-rule
1086$(call atomic,$(foreach manpage,$2,$(MANUAL_BUILDDIR)/$1/$(manpage)),$(call manual-deps,$1) $3)
1087	$(call build-manual,$1,man)
1088endef
1089
1090$(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel)
1091	$(call build-manual,devel,html)
1092
1093$(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop)
1094	$(call build-manual,interop,html)
1095
1096$(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
1097	$(call build-manual,specs,html)
1098
1099$(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
1100	$(call build-manual,system,html)
1101
1102$(MANUAL_BUILDDIR)/tools/index.html: $(call manual-deps,tools) $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc
1103	$(call build-manual,tools,html)
1104
1105$(MANUAL_BUILDDIR)/user/index.html: $(call manual-deps,user)
1106	$(call build-manual,user,html)
1107
1108$(call define-manpage-rule,interop,qemu-ga.8)
1109
1110$(call define-manpage-rule,system,qemu.1 qemu-block-drivers.7 qemu-cpu-models.7)
1111
1112$(call define-manpage-rule,tools,\
1113       qemu-img.1 qemu-nbd.8 qemu-trace-stap.1\
1114       virtiofsd.1 virtfs-proxy-helper.1,\
1115       $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc)
1116
1117$(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version.h
1118	@mkdir -p "$(MANUAL_BUILDDIR)"
1119	$(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \
1120             "GEN","$@")
1121
1122docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
1123	@cp -p $< $@
1124
1125docs/interop/qemu-ga-qapi.texi: qga/qapi-generated/qga-qapi-doc.texi
1126	@cp -p $< $@
1127
1128html: docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs
1129info: docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
1130pdf: docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
1131txt: docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
1132
1133docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
1134    docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
1135    docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \
1136	docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi
1137
1138docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
1139    docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \
1140    docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
1141	docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
1142
1143$(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl
1144
1145# Reports/Analysis
1146
1147%/coverage-report.html:
1148	@mkdir -p $*
1149	$(call quiet-command,\
1150		gcovr -r $(SRC_PATH) \
1151		$(foreach t, $(TARGET_DIRS), --object-directory $(BUILD_DIR)/$(t)) \
1152		 --object-directory $(BUILD_DIR) \
1153		-p --html --html-details -o $@, \
1154		"GEN", "coverage-report.html")
1155
1156.PHONY: coverage-report
1157coverage-report: $(CURDIR)/reports/coverage/coverage-report.html
1158
1159ifdef CONFIG_WIN32
1160
1161INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
1162
1163nsisflags = -V2 -NOCD
1164
1165ifneq ($(wildcard $(SRC_PATH)/dll),)
1166ifeq ($(ARCH),x86_64)
1167# 64 bit executables
1168DLL_PATH = $(SRC_PATH)/dll/w64
1169nsisflags += -DW64
1170else
1171# 32 bit executables
1172DLL_PATH = $(SRC_PATH)/dll/w32
1173endif
1174endif
1175
1176.PHONY: installer
1177installer: $(INSTALLER)
1178
1179INSTDIR=/tmp/qemu-nsis
1180
1181$(INSTALLER): install-doc $(SRC_PATH)/qemu.nsi
1182	$(MAKE) install prefix=${INSTDIR}
1183ifdef SIGNCODE
1184	(cd ${INSTDIR}; \
1185         for i in *.exe; do \
1186           $(SIGNCODE) $${i}; \
1187         done \
1188        )
1189endif # SIGNCODE
1190	(cd ${INSTDIR}; \
1191         for i in qemu-system-*.exe; do \
1192           arch=$${i%.exe}; \
1193           arch=$${arch#qemu-system-}; \
1194           echo Section \"$$arch\" Section_$$arch; \
1195           echo SetOutPath \"\$$INSTDIR\"; \
1196           echo File \"\$${BINDIR}\\$$i\"; \
1197           echo SectionEnd; \
1198         done \
1199        ) >${INSTDIR}/system-emulations.nsh
1200	makensis $(nsisflags) \
1201                $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
1202                $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
1203                -DBINDIR="${INSTDIR}" \
1204                $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
1205                -DSRCDIR="$(SRC_PATH)" \
1206                -DOUTFILE="$(INSTALLER)" \
1207                -DDISPLAYVERSION="$(VERSION)" \
1208                $(SRC_PATH)/qemu.nsi
1209	rm -r ${INSTDIR}
1210ifdef SIGNCODE
1211	$(SIGNCODE) $(INSTALLER)
1212endif # SIGNCODE
1213endif # CONFIG_WIN
1214
1215# Add a dependency on the generated files, so that they are always
1216# rebuilt before other object files
1217ifneq ($(wildcard config-host.mak),)
1218ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
1219Makefile: $(generated-files-y)
1220endif
1221endif
1222
1223.SECONDARY: $(TRACE_HEADERS) $(TRACE_HEADERS:%=%-timestamp) \
1224	$(TRACE_SOURCES) $(TRACE_SOURCES:%=%-timestamp) \
1225	$(TRACE_DTRACE) $(TRACE_DTRACE:%=%-timestamp)
1226
1227# Include automatically generated dependency files
1228# Dependencies in Makefile.objs files come from our recursive subdir rules
1229-include $(wildcard *.d tests/*.d)
1230
1231include $(SRC_PATH)/tests/docker/Makefile.include
1232include $(SRC_PATH)/tests/vm/Makefile.include
1233
1234print-help-run = printf "  %-30s - %s\\n" "$1" "$2"
1235print-help = $(quiet-@)$(call print-help-run,$1,$2)
1236
1237.PHONY: help
1238help:
1239	@echo  'Generic targets:'
1240	$(call print-help,all,Build all)
1241ifdef CONFIG_MODULES
1242	$(call print-help,modules,Build all modules)
1243endif
1244	$(call print-help,dir/file.o,Build specified target only)
1245	$(call print-help,install,Install QEMU, documentation and tools)
1246	$(call print-help,ctags/TAGS,Generate tags file for editors)
1247	$(call print-help,cscope,Generate cscope index)
1248	@echo  ''
1249	@$(if $(TARGET_DIRS), \
1250		echo 'Architecture specific targets:'; \
1251		$(foreach t, $(TARGET_DIRS), \
1252		$(call print-help-run,$(t)/all,Build for $(t)); \
1253		$(if $(CONFIG_FUZZ), \
1254			$(if $(findstring softmmu,$(t)), \
1255				$(call print-help-run,$(t)/fuzz,Build fuzzer for $(t)); \
1256		))) \
1257		echo '')
1258	@$(if $(HELPERS-y), \
1259		echo 'Helper targets:'; \
1260		$(foreach t, $(HELPERS-y), \
1261		$(call print-help-run,$(t),Build $(shell basename $(t)));) \
1262		echo '')
1263	@$(if $(TOOLS), \
1264		echo 'Tools targets:'; \
1265		$(foreach t, $(TOOLS), \
1266		$(call print-help-run,$(t),Build $(shell basename $(t)) tool);) \
1267		echo '')
1268	@echo  'Cleaning targets:'
1269	$(call print-help,clean,Remove most generated files but keep the config)
1270ifdef CONFIG_GCOV
1271	$(call print-help,clean-coverage,Remove coverage files)
1272endif
1273	$(call print-help,distclean,Remove all generated files)
1274	$(call print-help,dist,Build a distributable tarball)
1275	@echo  ''
1276	@echo  'Test targets:'
1277	$(call print-help,check,Run all tests (check-help for details))
1278	$(call print-help,docker,Help about targets running tests inside containers)
1279	$(call print-help,vm-help,Help about targets running tests inside VM)
1280	@echo  ''
1281	@echo  'Documentation targets:'
1282	$(call print-help,html info pdf txt,Build documentation in specified format)
1283ifdef CONFIG_GCOV
1284	$(call print-help,coverage-report,Create code coverage report)
1285endif
1286	@echo  ''
1287ifdef CONFIG_WIN32
1288	@echo  'Windows targets:'
1289	$(call print-help,installer,Build NSIS-based installer for QEMU)
1290ifdef QEMU_GA_MSI_ENABLED
1291	$(call print-help,msi,Build MSI-based installer for qemu-ga)
1292endif
1293	@echo  ''
1294endif
1295	$(call print-help,$(MAKE) [targets],(quiet build, default))
1296	$(call print-help,$(MAKE) V=1 [targets],(verbose build))
1297