]> git.proxmox.com Git - mirror_qemu.git/blame - Makefile
cputlb: Rename helper_ret_ld*_cmmu to cpu_ld*_code
[mirror_qemu.git] / Makefile
CommitLineData
0cb3fb1e
PB
1# Makefile for QEMU.
2
4ace32e2
AO
3ifneq ($(words $(subst :, ,$(CURDIR))), 1)
4 $(error main directory cannot contain spaces nor colons)
5endif
6
519e1693
SW
7# Always point to the root of the build tree (needs GNU make).
8BUILD_DIR=$(CURDIR)
388d4758 9
eaa2ddbb
FZ
10# Before including a proper config-host.mak, assume we are in the source tree
11SRC_PATH=.
12
28fa2927
PMD
13UNCHECKED_GOALS := %clean TAGS cscope ctags dist \
14 html info pdf txt \
de1da442 15 help check-help print-% \
4f2f6276 16 docker docker-% vm-help vm-test vm-build-%
eaa2ddbb 17
de1da442
MAL
18print-%:
19 @echo '$*=$($*)'
20
250b086e 21# All following code might depend on configuration variables
55d7e8f6 22ifneq ($(wildcard config-host.mak),)
1ad2134f 23# Put the all: rule here so that config-host.mak can contain dependencies.
8f67aa82 24all:
ad064840 25include config-host.mak
d1bd2423 26
aef45d51
DB
27git-submodule-update:
28
29.PHONY: git-submodule-update
30
c4b01c7c
DB
31git_module_status := $(shell \
32 cd '$(SRC_PATH)' && \
33 GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
34 echo $$?; \
35)
aef45d51
DB
36
37ifeq (1,$(git_module_status))
f62bbee5
DB
38ifeq (no,$(GIT_UPDATE))
39git-submodule-update:
40 $(call quiet-command, \
41 echo && \
42 echo "GIT submodule checkout is out of date. Please run" && \
43 echo " scripts/git-submodule.sh update $(GIT_SUBMODULES)" && \
44 echo "from the source directory checkout $(SRC_PATH)" && \
45 echo && \
46 exit 1)
47else
aef45d51
DB
48git-submodule-update:
49 $(call quiet-command, \
cc84d63a 50 (cd $(SRC_PATH) && GIT="$(GIT)" ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \
aef45d51
DB
51 "GIT","$(GIT_SUBMODULES)")
52endif
53endif
54
92712822 55.git-submodule-status: git-submodule-update config-host.mak
aef45d51 56
d1bd2423
PM
57# Check that we're not trying to do an out-of-tree build from
58# a tree that's been used for an in-tree build.
59ifneq ($(realpath $(SRC_PATH)),$(realpath .))
60ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
61$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
62seems to have been used for an in-tree build. You can fix this by running \
b98a3bae 63"$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
d1bd2423
PM
64endif
65endif
66
2b1f35b9
AB
67CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
68CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
6b827cca 69CONFIG_XEN := $(CONFIG_XEN_BACKEND)
f3aa844b
PB
70CONFIG_ALL=y
71-include config-all-devices.mak
72-include config-all-disas.mak
73
3a6b016d 74config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
e5efe7f5 75 @echo $@ is out-of-date, running configure
cdb69b08 76 @./config.status
26fffe29
EC
77
78# Force configure to re-run if the API symbols are updated
79ifeq ($(CONFIG_PLUGIN),y)
80config-host.mak: $(SRC_PATH)/plugins/qemu-plugins.symbols
81endif
82
55d7e8f6
AJ
83else
84config-host.mak:
eaa2ddbb 85ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
55d7e8f6
AJ
86 @echo "Please call configure before running make!"
87 @exit 1
88endif
7748b8cb 89endif
766a487a 90
fb57c881
FZ
91include $(SRC_PATH)/rules.mak
92
c932ce31 93# lor is defined in rules.mak
29de2804
LV
94CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
95
57b49737
PM
96# Create QEMU_PKGVERSION and FULL_VERSION strings
97# If PKGVERSION is set, use that; otherwise get version and -dirty status from git
98QEMU_PKGVERSION := $(if $(PKGVERSION),$(PKGVERSION),$(shell \
99 cd $(SRC_PATH); \
100 if test -e .git; then \
101 git describe --match 'v*' 2>/dev/null | tr -d '\n'; \
102 if ! git diff-index --quiet HEAD &>/dev/null; then \
103 echo "-dirty"; \
104 fi; \
105 fi))
106
107# Either "version (pkgversion)", or just "version" if pkgversion not set
108FULL_VERSION := $(if $(QEMU_PKGVERSION),$(VERSION) ($(QEMU_PKGVERSION)),$(VERSION))
109
3dff199c 110generated-files-y = qemu-version.h config-host.h qemu-options.def
bf582c34 111
bf582c34
EB
112GENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c
113GENERATED_QAPI_FILES += qapi/qapi-types.h qapi/qapi-types.c
114GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.h)
115GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.c)
116GENERATED_QAPI_FILES += qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c
117GENERATED_QAPI_FILES += qapi/qapi-visit.h qapi/qapi-visit.c
118GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.h)
119GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.c)
120GENERATED_QAPI_FILES += qapi/qapi-commands.h qapi/qapi-commands.c
121GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.h)
122GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.c)
5d75648b 123GENERATED_QAPI_FILES += qapi/qapi-emit-events.h qapi/qapi-emit-events.c
bf582c34
EB
124GENERATED_QAPI_FILES += qapi/qapi-events.h qapi/qapi-events.c
125GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.h)
126GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.c)
127GENERATED_QAPI_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h
128GENERATED_QAPI_FILES += qapi/qapi-doc.texi
129
3dff199c 130generated-files-y += $(GENERATED_QAPI_FILES)
eac236ea 131
3dff199c 132generated-files-y += trace/generated-tcg-tracers.h
465830fb 133
3dff199c
LV
134generated-files-y += trace/generated-helpers-wrappers.h
135generated-files-y += trace/generated-helpers.h
136generated-files-y += trace/generated-helpers.c
707c8a98 137
3dff199c
LV
138generated-files-$(CONFIG_TRACE_UST) += trace-ust-all.h
139generated-files-$(CONFIG_TRACE_UST) += trace-ust-all.c
e6bf23f8 140
3dff199c 141generated-files-y += module_block.h
0c0c1fd9 142
0ab8ed18
DB
143TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h)
144TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c)
145TRACE_DTRACE =
146ifdef CONFIG_TRACE_DTRACE
147TRACE_HEADERS += trace-dtrace-root.h $(trace-events-subdirs:%=%/trace-dtrace.h)
148TRACE_DTRACE += trace-dtrace-root.dtrace $(trace-events-subdirs:%=%/trace-dtrace.dtrace)
149endif
150ifdef CONFIG_TRACE_UST
151TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h)
152endif
153
3dff199c
LV
154generated-files-y += $(TRACE_HEADERS)
155generated-files-y += $(TRACE_SOURCES)
156generated-files-y += $(BUILD_DIR)/trace-events-all
157generated-files-y += .git-submodule-status
0ab8ed18
DB
158
159trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
160
8755b4af
DB
161tracetool-y = $(SRC_PATH)/scripts/tracetool.py
162tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
163
0ab8ed18
DB
164%/trace.h: %/trace.h-timestamp
165 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
57b7bdf4 166%/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
0ab8ed18
DB
167 $(call quiet-command,$(TRACETOOL) \
168 --group=$(call trace-group-name,$@) \
169 --format=h \
170 --backends=$(TRACE_BACKENDS) \
171 $< > $@,"GEN","$(@:%-timestamp=%)")
172
173%/trace.c: %/trace.c-timestamp
174 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
57b7bdf4 175%/trace.c-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
0ab8ed18
DB
176 $(call quiet-command,$(TRACETOOL) \
177 --group=$(call trace-group-name,$@) \
178 --format=c \
179 --backends=$(TRACE_BACKENDS) \
180 $< > $@,"GEN","$(@:%-timestamp=%)")
181
182%/trace-ust.h: %/trace-ust.h-timestamp
183 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
57b7bdf4 184%/trace-ust.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
0ab8ed18
DB
185 $(call quiet-command,$(TRACETOOL) \
186 --group=$(call trace-group-name,$@) \
187 --format=ust-events-h \
188 --backends=$(TRACE_BACKENDS) \
189 $< > $@,"GEN","$(@:%-timestamp=%)")
190
191%/trace-dtrace.dtrace: %/trace-dtrace.dtrace-timestamp
192 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
193%/trace-dtrace.dtrace-timestamp: $(SRC_PATH)/%/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
194 $(call quiet-command,$(TRACETOOL) \
195 --group=$(call trace-group-name,$@) \
196 --format=d \
197 --backends=$(TRACE_BACKENDS) \
198 $< > $@,"GEN","$(@:%-timestamp=%)")
199
200%/trace-dtrace.h: %/trace-dtrace.dtrace $(tracetool-y)
201 $(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@")
202
203%/trace-dtrace.o: %/trace-dtrace.dtrace $(tracetool-y)
204
205
206trace-root.h: trace-root.h-timestamp
207 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
57b7bdf4 208trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
0ab8ed18
DB
209 $(call quiet-command,$(TRACETOOL) \
210 --group=root \
211 --format=h \
212 --backends=$(TRACE_BACKENDS) \
213 $< > $@,"GEN","$(@:%-timestamp=%)")
214
215trace-root.c: trace-root.c-timestamp
216 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
57b7bdf4 217trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
0ab8ed18
DB
218 $(call quiet-command,$(TRACETOOL) \
219 --group=root \
220 --format=c \
221 --backends=$(TRACE_BACKENDS) \
222 $< > $@,"GEN","$(@:%-timestamp=%)")
223
224trace-ust-root.h: trace-ust-root.h-timestamp
225 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
57b7bdf4 226trace-ust-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
0ab8ed18
DB
227 $(call quiet-command,$(TRACETOOL) \
228 --group=root \
229 --format=ust-events-h \
230 --backends=$(TRACE_BACKENDS) \
231 $< > $@,"GEN","$(@:%-timestamp=%)")
232
233trace-ust-all.h: trace-ust-all.h-timestamp
234 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
57b7bdf4 235trace-ust-all.h-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak
0ab8ed18
DB
236 $(call quiet-command,$(TRACETOOL) \
237 --group=all \
238 --format=ust-events-h \
239 --backends=$(TRACE_BACKENDS) \
240 $(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)")
241
242trace-ust-all.c: trace-ust-all.c-timestamp
243 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
57b7bdf4 244trace-ust-all.c-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak
0ab8ed18
DB
245 $(call quiet-command,$(TRACETOOL) \
246 --group=all \
247 --format=ust-events-c \
248 --backends=$(TRACE_BACKENDS) \
249 $(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)")
250
251trace-dtrace-root.dtrace: trace-dtrace-root.dtrace-timestamp
252 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
253trace-dtrace-root.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
254 $(call quiet-command,$(TRACETOOL) \
255 --group=root \
256 --format=d \
257 --backends=$(TRACE_BACKENDS) \
258 $< > $@,"GEN","$(@:%-timestamp=%)")
259
260trace-dtrace-root.h: trace-dtrace-root.dtrace
261 $(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@")
262
263trace-dtrace-root.o: trace-dtrace-root.dtrace
264
92712822
DB
265KEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen
266KEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv
267
268KEYCODEMAP_FILES = \
2ec78706 269 ui/input-keymap-atset1-to-qcode.c \
bcd5ac9b 270 ui/input-keymap-linux-to-qcode.c \
ab8f9d49
DB
271 ui/input-keymap-qcode-to-atset1.c \
272 ui/input-keymap-qcode-to-atset2.c \
273 ui/input-keymap-qcode-to-atset3.c \
5a15e6b1 274 ui/input-keymap-qcode-to-linux.c \
bcd5ac9b 275 ui/input-keymap-qcode-to-qnum.c \
e709a61a 276 ui/input-keymap-qcode-to-sun.c \
bcd5ac9b 277 ui/input-keymap-qnum-to-qcode.c \
ed7b2624 278 ui/input-keymap-usb-to-qcode.c \
2ec78706
DB
279 ui/input-keymap-win32-to-qcode.c \
280 ui/input-keymap-x11-to-qcode.c \
281 ui/input-keymap-xorgevdev-to-qcode.c \
282 ui/input-keymap-xorgkbd-to-qcode.c \
283 ui/input-keymap-xorgxquartz-to-qcode.c \
284 ui/input-keymap-xorgxwin-to-qcode.c \
656282d2 285 ui/input-keymap-osx-to-qcode.c \
92712822
DB
286 $(NULL)
287
3dff199c 288generated-files-$(CONFIG_SOFTMMU) += $(KEYCODEMAP_FILES)
92712822
DB
289
290ui/input-keymap-%.c: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile.objs
291 $(call quiet-command,\
6809df1d 292 stem=$* && src=$${stem%-to-*} dst=$${stem#*-to-} && \
92712822
DB
293 test -e $(KEYCODEMAP_GEN) && \
294 $(PYTHON) $(KEYCODEMAP_GEN) \
295 --lang glib2 \
296 --varname qemu_input_map_$${src}_to_$${dst} \
297 code-map $(KEYCODEMAP_CSV) $${src} $${dst} \
298 > $@ || rm -f $@, "GEN", "$@")
299
300$(KEYCODEMAP_GEN): .git-submodule-status
301$(KEYCODEMAP_CSV): .git-submodule-status
302
26ce90fd
LE
303edk2-decompressed = $(basename $(wildcard pc-bios/edk2-*.fd.bz2))
304pc-bios/edk2-%.fd: pc-bios/edk2-%.fd.bz2
305 $(call quiet-command,bzip2 -d -c $< > $@,"BUNZIP2",$<)
306
d9ace8b3
JQ
307# Don't try to regenerate Makefile or configure
308# We don't generate any of them
309Makefile: ;
310configure: ;
311
bd3f5706 312.PHONY: all clean cscope distclean html info install install-doc \
7c3d1917 313 pdf txt recurse-all dist msi FORCE
0cb3fb1e 314
fec90ff0 315$(call set-vpath, $(SRC_PATH))
8c462f8f 316
3e2e0e6b 317LIBS+=-lz $(LIBS_TOOLS)
67c0f08d 318
d52c454a
MAL
319vhost-user-json-y =
320HELPERS-y =
321
206d1b9c 322HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = qemu-bridge-helper$(EXESUF)
7b93fadf 323
57589bc4 324ifeq ($(CONFIG_LINUX)$(CONFIG_VIRGL)$(CONFIG_GBM)$(CONFIG_TOOLS),yyyy)
d52c454a
MAL
325HELPERS-y += vhost-user-gpu$(EXESUF)
326vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json
327endif
d52c454a 328
b53c54c6
PM
329# Sphinx does not allow building manuals into the same directory as
330# the source files, so if we're doing an in-tree QEMU build we must
331# build the manuals into a subdirectory (and then install them from
332# there for 'make install'). For an out-of-tree build we can just
333# use the docs/ subdirectory in the build tree as normal.
334ifeq ($(realpath $(SRC_PATH)),$(realpath .))
335MANUAL_BUILDDIR := docs/built
336else
337MANUAL_BUILDDIR := docs
338endif
339
cc8ae6de 340ifdef BUILD_DOCS
b53c54c6 341DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 $(MANUAL_BUILDDIR)/interop/qemu-ga.8
d59157ea
PB
342DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
343DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
78aa8aa0 344DOCS+=docs/qemu-block-drivers.7
2544e9e4 345DOCS+=docs/qemu-cpu-models.7
22108f33 346DOCS+=$(MANUAL_BUILDDIR)/index.html
983eef5a 347ifdef CONFIG_VIRTFS
a2d8f1be 348DOCS+=fsdev/virtfs-proxy-helper.1
983eef5a 349endif
62dd1048
DB
350ifdef CONFIG_TRACE_SYSTEMTAP
351DOCS+=scripts/qemu-trace-stap.1
352endif
cc8ae6de
PB
353else
354DOCS=
355endif
aa05ae6f 356
8cc357b5 357SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
e0e312f3
PB
358SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(filter %-softmmu, $(TARGET_DIRS)))
359SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK))
1f3d3c8f 360
8bdd3d49 361ifeq ($(SUBDIR_DEVICES_MAK),)
b7c11e57 362config-all-devices.mak: config-host.mak
0bdb12c7 363 $(call quiet-command,echo '# no devices' > $@,"GEN","$@")
8bdd3d49 364else
b7c11e57 365config-all-devices.mak: $(SUBDIR_DEVICES_MAK) config-host.mak
bb585a78
PB
366 $(call quiet-command, sed -n \
367 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
368 $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
0bdb12c7 369 "GEN","$@")
8bdd3d49 370endif
1f3d3c8f 371
bd9141bb
PB
372-include $(SUBDIR_DEVICES_MAK_DEP)
373
e0e312f3
PB
374# This has to be kept in sync with Kconfig.host.
375MINIKCONF_ARGS = \
f3494749 376 $(CONFIG_MINIKCONF_MODE) \
bb768f71 377 $@ $*/config-devices.mak.d $< $(MINIKCONF_INPUTS) \
e0e312f3
PB
378 CONFIG_KVM=$(CONFIG_KVM) \
379 CONFIG_SPICE=$(CONFIG_SPICE) \
380 CONFIG_IVSHMEM=$(CONFIG_IVSHMEM) \
381 CONFIG_TPM=$(CONFIG_TPM) \
382 CONFIG_XEN=$(CONFIG_XEN) \
383 CONFIG_OPENGL=$(CONFIG_OPENGL) \
384 CONFIG_X11=$(CONFIG_X11) \
385 CONFIG_VHOST_USER=$(CONFIG_VHOST_USER) \
21c6b0c8 386 CONFIG_VHOST_KERNEL=$(CONFIG_VHOST_KERNEL) \
e0e312f3 387 CONFIG_VIRTFS=$(CONFIG_VIRTFS) \
d6c1bd4a
PB
388 CONFIG_LINUX=$(CONFIG_LINUX) \
389 CONFIG_PVRDMA=$(CONFIG_PVRDMA)
e0e312f3 390
b6011caf
PMD
391MINIKCONF_INPUTS = $(SRC_PATH)/Kconfig.host $(SRC_PATH)/hw/Kconfig \
392 $(wildcard $(SRC_PATH)/hw/*/Kconfig)
e0e312f3
PB
393MINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py \
394
395$(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak $(MINIKCONF_INPUTS) $(BUILD_DIR)/config-host.mak
396 $(call quiet-command, $(MINIKCONF) $(MINIKCONF_ARGS) > $@.tmp, "GEN", "$@.tmp")
12ccfec9 397 $(call quiet-command, if test -f $@; then \
904fe1fb 398 if cmp -s $@.old $@; then \
bd9141bb
PB
399 mv $@.tmp $@; \
400 cp -p $@ $@.old; \
012f0879
SW
401 else \
402 if test -f $@.old; then \
403 echo "WARNING: $@ (user modified) out of date.";\
404 else \
405 echo "WARNING: $@ out of date.";\
406 fi; \
b98a3bae 407 echo "Run \"$(MAKE) defconfig\" to regenerate."; \
012f0879
SW
408 rm $@.tmp; \
409 fi; \
a992fe3d 410 else \
012f0879
SW
411 mv $@.tmp $@; \
412 cp -p $@ $@.old; \
0bdb12c7 413 fi,"GEN","$@");
a992fe3d
PB
414
415defconfig:
416 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
417
992aeb8e
PB
418ifneq ($(wildcard config-host.mak),)
419include $(SRC_PATH)/Makefile.objs
ba1183da
FZ
420endif
421
422dummy := $(call unnest-vars,, \
423 stub-obj-y \
5b76dd13 424 authz-obj-y \
32d955a4 425 chardev-obj-y \
ba1183da
FZ
426 util-obj-y \
427 qga-obj-y \
3fa2d384 428 elf2dmp-obj-y \
a75eb03b
DM
429 ivshmem-client-obj-y \
430 ivshmem-server-obj-y \
a5d2f6f8 431 rdmacm-mux-obj-y \
7b2e5c65 432 libvhost-user-obj-y \
49cc0340 433 vhost-user-scsi-obj-y \
406d2aa2 434 vhost-user-blk-obj-y \
06914c97 435 vhost-user-input-obj-y \
d52c454a 436 vhost-user-gpu-obj-y \
577a6723 437 qga-vss-dll-obj-y \
ba1183da 438 block-obj-y \
cc475698 439 block-obj-m \
fb37726d 440 crypto-obj-y \
0c7012e0 441 qom-obj-y \
666a3af9 442 io-obj-y \
cc475698 443 common-obj-y \
0ab8ed18 444 common-obj-m \
675b9b53 445 trace-obj-y)
ba1183da 446
46e7b706 447include $(SRC_PATH)/tests/Makefile.include
992aeb8e 448
d52c454a 449all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all modules $(vhost-user-json-y)
b9dea4fb 450
67a1de0d
FZ
451qemu-version.h: FORCE
452 $(call quiet-command, \
57b49737
PM
453 (printf '#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \
454 printf '#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \
7e563bfb 455 ) > $@.tmp)
d9e73d32
LM
456 $(call quiet-command, if ! cmp -s $@ $@.tmp; then \
457 mv $@.tmp $@; \
458 else \
459 rm $@.tmp; \
460 fi)
67a1de0d 461
1215c6e7
JQ
462config-host.h: config-host.h-timestamp
463config-host.h-timestamp: config-host.mak
077de81a 464qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
0bdb12c7 465 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
1215c6e7 466
1338a4b7 467TARGET_DIRS_RULES := $(foreach t, all clean install, $(addsuffix /$(t), $(TARGET_DIRS)))
916359f6 468
1338a4b7
MA
469SOFTMMU_ALL_RULES=$(filter %-softmmu/all, $(TARGET_DIRS_RULES))
470$(SOFTMMU_ALL_RULES): $(authz-obj-y)
471$(SOFTMMU_ALL_RULES): $(block-obj-y)
472$(SOFTMMU_ALL_RULES): $(chardev-obj-y)
473$(SOFTMMU_ALL_RULES): $(crypto-obj-y)
474$(SOFTMMU_ALL_RULES): $(io-obj-y)
475$(SOFTMMU_ALL_RULES): config-all-devices.mak
05dfa22b 476ifdef DECOMPRESS_EDK2_BLOBS
1338a4b7 477$(SOFTMMU_ALL_RULES): $(edk2-decompressed)
05dfa22b 478endif
cec7d0b6 479
1338a4b7
MA
480.PHONY: $(TARGET_DIRS_RULES)
481# The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
482# $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
483$(TARGET_DIRS_RULES):
484 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
4aa42531 485
a540f158 486DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
965f486c
PM
487DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
488DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
a540f158 489
3b8593ee
MA
490.PHONY: dtc/all
491dtc/all: .git-submodule-status dtc/libfdt dtc/tests
965f486c 492 $(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,)
a540f158 493
00525864 494dtc/%: .git-submodule-status
814e1110 495 @mkdir -p $@
a540f158 496
e219c499
RH
497# Overriding CFLAGS causes us to lose defines added in the sub-makefile.
498# Not overriding CFLAGS leads to mis-matches between compilation modes.
499# Therefore we replicate some of the logic in the sub-makefile.
500# Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
501# no need to annoy QEMU developers with such things.
502CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS))
503CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
504CAP_CFLAGS += -DCAPSTONE_HAS_ARM
505CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
506CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
507CAP_CFLAGS += -DCAPSTONE_HAS_X86
508
3b8593ee
MA
509.PHONY: capstone/all
510capstone/all: .git-submodule-status
9f81aeb5 511 $(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))
e219c499 512
3b8593ee
MA
513.PHONY: slirp/all
514slirp/all: .git-submodule-status
daa79d9a
AB
515 $(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp \
516 BUILD_DIR="$(BUILD_DIR)/slirp" \
517 PKG_CONFIG="$(PKG_CONFIG)" \
518 CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" \
519 CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)")
675b9b53 520
3b8593ee
MA
521# Compatibility gunk to keep make working across the rename of targets
522# for recursion, to be removed some time after 4.1.
523subdir-dtc: dtc/all
524subdir-capstone: capstone/all
525subdir-slirp: slirp/all
526
1338a4b7 527$(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
b8d89ba8 528 $(qom-obj-y)
add16157 529
3b8593ee 530ROM_DIRS = $(addprefix pc-bios/, $(ROMS))
1338a4b7 531ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
a9c87304 532# Only keep -O and -g cflags
1338a4b7
MA
533.PHONY: $(ROM_DIRS_RULES)
534$(ROM_DIRS_RULES):
535 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))" $(notdir $@),)
c05ac895 536
8d358a5e 537.PHONY: recurse-all recurse-clean recurse-install
1338a4b7
MA
538recurse-all: $(addsuffix /all, $(TARGET_DIRS) $(ROM_DIRS))
539recurse-clean: $(addsuffix /clean, $(TARGET_DIRS) $(ROM_DIRS))
540recurse-install: $(addsuffix /install, $(TARGET_DIRS))
47ae060e 541$(addsuffix /install, $(TARGET_DIRS)): all
83f64091 542
c17a18ef 543$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
0bdb12c7 544 $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
5354e4d2 545
c17a18ef 546Makefile: $(version-obj-y)
3bc2f570
PB
547
548######################################################################
8a090705 549# Build libraries
3bc2f570 550
ebedb37c 551libqemuutil.a: $(util-obj-y) $(trace-obj-y) $(stub-obj-y)
5f9ff1ef 552libvhost-user.a: $(libvhost-user-obj-y) $(util-obj-y) $(stub-obj-y)
3bc2f570 553
44dc0ca3 554######################################################################
4fb240a4 555
ebedb37c 556COMMON_LDADDS = libqemuutil.a
0ab8ed18 557
3c089e15 558qemu-img.o: qemu-img-cmds.h
153859be 559
5b76dd13
DB
560qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
561qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
562qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
0a8e1acd 563
0ab8ed18 564qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
7b93fadf 565
6a021536
GH
566qemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS)
567
72d277a7
GH
568qemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS)
569
0ab8ed18 570fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
17bff52b 571
5b76dd13 572scsi/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)
fe8fc5ae
PB
573ifdef CONFIG_MPATH
574scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
575endif
b855f8d1 576
077de81a 577qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
0bdb12c7 578 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
153859be 579
957f1f99 580qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
54c2e502 581qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
640e5404 582
6a021536
GH
583qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
584qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
585
e6c42b96
MA
586qapi-py = $(SRC_PATH)/scripts/qapi/__init__.py \
587$(SRC_PATH)/scripts/qapi/commands.py \
588$(SRC_PATH)/scripts/qapi/common.py \
589$(SRC_PATH)/scripts/qapi/doc.py \
590$(SRC_PATH)/scripts/qapi/error.py \
fb0bc835 591$(SRC_PATH)/scripts/qapi/events.py \
e6c42b96
MA
592$(SRC_PATH)/scripts/qapi/expr.py \
593$(SRC_PATH)/scripts/qapi/gen.py \
fb0bc835 594$(SRC_PATH)/scripts/qapi/introspect.py \
e6c42b96
MA
595$(SRC_PATH)/scripts/qapi/parser.py \
596$(SRC_PATH)/scripts/qapi/schema.py \
597$(SRC_PATH)/scripts/qapi/source.py \
fb0bc835
MA
598$(SRC_PATH)/scripts/qapi/types.py \
599$(SRC_PATH)/scripts/qapi/visit.py \
fb0bc835
MA
600$(SRC_PATH)/scripts/qapi-gen.py
601
602qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
603qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h \
eb815e24 604qga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \
fb0bc835
MA
605qga/qapi-generated/qga-qapi-doc.texi: \
606qga/qapi-generated/qapi-gen-timestamp ;
607qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
0d6b93de 608 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
fb0bc835
MA
609 -o qga/qapi-generated -p "qga-" $<, \
610 "GEN","$(@:%-timestamp=%)")
611 @>$@
e3d4d252 612
bf582c34
EB
613qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json \
614 $(QAPI_MODULES:%=$(SRC_PATH)/qapi/%.json)
615
616$(GENERATED_QAPI_FILES): qapi-gen-timestamp ;
fb0bc835 617qapi-gen-timestamp: $(qapi-modules) $(qapi-py)
0d6b93de 618 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
eb815e24 619 -o "qapi" -b $<, \
fb0bc835
MA
620 "GEN","$(@:%-timestamp=%)")
621 @>$@
e3193601 622
eb815e24 623QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h)
7a0b7eba 624$(qga-obj-y): $(QGALIB_GEN)
957f1f99 625
0ab8ed18 626qemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
fafcaf1d 627 $(call LINK, $^)
48ff7a62 628
9dacf32d
YH
629ifdef QEMU_GA_MSI_ENABLED
630QEMU_GA_MSI=qemu-ga-$(ARCH).msi
631
0a18750f 632msi: $(QEMU_GA_MSI)
9dacf32d 633
fafcaf1d 634$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
9dacf32d 635
9dacf32d
YH
636$(QEMU_GA_MSI): config-host.mak
637
decdfbd2
LB
638$(QEMU_GA_MSI): $(SRC_PATH)/qga/installer/qemu-ga.wxs
639 $(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)" \
0bdb12c7 640 wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<,"WIXL","$@")
9dacf32d
YH
641else
642msi:
15b19ed8 643 @echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
9dacf32d
YH
644endif
645
fafcaf1d
MR
646ifneq ($(EXESUF),)
647.PHONY: qemu-ga
648qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
649endif
650
1b9d35f3 651elf2dmp$(EXESUF): $(elf2dmp-obj-y)
3fa2d384
VP
652 $(call LINK, $^)
653
b1449edb 654ifdef CONFIG_IVSHMEM
0ab8ed18 655ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS)
a75eb03b 656 $(call LINK, $^)
0ab8ed18 657ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
a75eb03b 658 $(call LINK, $^)
b1449edb 659endif
d59a031c 660vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a
49cc0340 661 $(call LINK, $^)
406d2aa2
CL
662vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a
663 $(call LINK, $^)
0f645ba1
MA
664
665rdmacm-mux$(EXESUF): LIBS += "-libumad"
a5d2f6f8
YS
666rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
667 $(call LINK, $^)
a75eb03b 668
d52c454a
MAL
669vhost-user-gpu$(EXESUF): $(vhost-user-gpu-obj-y) $(libvhost-user-obj-y) libqemuutil.a libqemustub.a
670 $(call LINK, $^)
671
06914c97
MAL
672ifdef CONFIG_VHOST_USER_INPUT
673ifdef CONFIG_LINUX
674vhost-user-input$(EXESUF): $(vhost-user-input-obj-y) libvhost-user.a libqemuutil.a
675 $(call LINK, $^)
676
677# build by default, do not install
678all: vhost-user-input$(EXESUF)
679endif
680endif
681
0c0c1fd9
MM
682module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
683 $(call quiet-command,$(PYTHON) $< $@ \
684 $(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
0bdb12c7 685 "GEN","$@")
0c0c1fd9 686
990e6a27
AB
687ifdef CONFIG_GCOV
688.PHONY: clean-coverage
689clean-coverage:
690 $(call quiet-command, \
691 find . \( -name '*.gcda' -o -name '*.gcov' \) -type f -exec rm {} +, \
692 "CLEAN", "coverage files")
693endif
694
1338a4b7 695clean: recurse-clean
2d80ae89 696# avoid old build problems by removing potentially incorrect old files
25be210f 697 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
df2943ba 698 rm -f qemu-options.def
9dacf32d 699 rm -f *.msi
23858f40
LE
700 find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \
701 ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
702 ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
703 ! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
704 -exec rm {} +
26ce90fd 705 rm -f $(edk2-decompressed)
0814465a 706 rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) TAGS cscope.* *.pod *~ */*~
b855f8d1 707 rm -f fsdev/*.pod scsi/*.pod
07b44ce9 708 rm -f qemu-img-cmds.h
d98bc0b6 709 rm -f ui/shader/*-vert.h ui/shader/*-frag.h
3dff199c 710 @# May not be present in generated-files-y
eac236ea
LV
711 rm -f trace/generated-tracers-dtrace.dtrace*
712 rm -f trace/generated-tracers-dtrace.h*
3dff199c 713 rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
fb0bc835 714 rm -f qapi-gen-timestamp
54c2e502 715 rm -rf qga/qapi-generated
e92af6ec 716 rm -f config-all-devices.mak
31e31b8a 717
34bb443e
AL
718VERSION ?= $(shell cat VERSION)
719
720dist: qemu-$(VERSION).tar.bz2
721
34bb443e
AL
722qemu-%.tar.bz2:
723 $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
724
5f71eac0 725define clean-manual =
1290e671
PM
726rm -rf $(MANUAL_BUILDDIR)/$1/_static
727rm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(MANUAL_BUILDDIR)/$1/*.html
5f71eac0
PM
728endef
729
7d13299d 730distclean: clean
2cd8af2d 731 rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi qemu-monitor-info.texi
2038f8c8 732 rm -f tests/tcg/config-*.mak
ae219359 733 rm -f config-all-devices.mak config-all-disas.mak config.status
e92af6ec 734 rm -f $(SUBDIR_DEVICES_MAK)
ae219359 735 rm -f po/*.mo tests/qemu-iotests/common.env
fc8e320e 736 rm -f roms/seabios/config.mak roms/vgabios/config.mak
bd3f5706 737 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps
7a734b8f
BH
738 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
739 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
d5e85105 740 rm -f qemu-doc.vr qemu-doc.txt
26fffe29 741 rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
793553ac 742 rm -f config.log
67ed96f9 743 rm -f linux-headers/asm
d59157ea
PB
744 rm -f docs/version.texi
745 rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi
746 rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7
747 rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
748 rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
749 rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
78aa8aa0 750 rm -f docs/qemu-block-drivers.7
2544e9e4 751 rm -f docs/qemu-cpu-models.7
81f33401 752 rm -rf .doctrees
5f71eac0
PM
753 $(call clean-manual,devel)
754 $(call clean-manual,interop)
0783a732 755 $(call clean-manual,specs)
2b1f35b9 756 for d in $(TARGET_DIRS); do \
bc1b050d 757 rm -rf $$d || exit 1 ; \
76bc6838 758 done
d9840e25 759 rm -Rf .sdk
fb8597bb 760 if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
7d13299d 761
06e7772f 762KEYMAPS=da en-gb et fr fr-ch is lt no pt-br sv \
fed4a9ad 763ar de en-us fi fr-be hr it lv nl pl ru th \
26b1cbf8 764de-ch es fo fr-ca hu ja mk pt sl tr \
3751e722 765bepo cz
fed4a9ad 766
77755340 767ifdef INSTALL_BLOBS
32eb2da3 768BLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
7a4dfd1e 769vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
0a87fd69 770vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
9eb08a43 771ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
5ee8ad71
AW
772pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
773pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
9fd02979
SE
774efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
775efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
45027808 776efi-e1000e.rom efi-vmxnet3.rom \
b3ce38dc 777qemu-nsis.bmp \
4b387f9e 778bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
2785dc7b 779multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
6c5359e1 780s390-ccw.img s390-netboot.img \
744a928c 781slof.bin skiboot.lid \
0c6ab8c9 782palcode-clipper \
82e65fe0 783u-boot.e500 u-boot-sam460-20100605.bin \
43ad2564 784qemu_vga.ndrv \
26ce90fd 785edk2-licenses.txt \
91f3a2f0
AF
786hppa-firmware.img \
787opensbi-riscv32-virt-fw_jump.bin \
788opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
789
26ce90fd
LE
790
791DESCS=50-edk2-i386-secure.json 50-edk2-x86_64-secure.json \
79260-edk2-aarch64.json 60-edk2-arm.json 60-edk2-i386.json 60-edk2-x86_64.json
77755340
TS
793else
794BLOBS=
26ce90fd 795DESCS=
77755340
TS
796endif
797
336cfef4 798# Note that we manually filter-out the non-Sphinx documentation which
27a296fc
PM
799# is currently built into the docs/interop directory in the build tree,
800# and also any sphinx-built manpages.
5f71eac0 801define install-manual =
1290e671 802for d in $$(cd $(MANUAL_BUILDDIR) && find $1 -type d); do $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/$$d"; done
27a296fc 803for 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
5f71eac0
PM
804endef
805
806# Note that we deliberately do not install the "devel" manual: it is
807# for QEMU developers, and not interesting to our users.
808.PHONY: install-sphinxdocs
809install-sphinxdocs: sphinxdocs
810 $(call install-manual,interop)
0783a732 811 $(call install-manual,specs)
5f71eac0
PM
812
813install-doc: $(DOCS) install-sphinxdocs
d7dd65ba 814 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
22108f33 815 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/index.html "$(DESTDIR)$(qemu_docdir)"
78e87797 816 $(INSTALL_DATA) qemu-doc.html "$(DESTDIR)$(qemu_docdir)"
f8bab10b 817 $(INSTALL_DATA) qemu-doc.txt "$(DESTDIR)$(qemu_docdir)"
d59157ea
PB
818 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)"
819 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)"
96d409eb 820ifdef CONFIG_POSIX
58f8aead 821 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
8a3e8f7f 822 $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
56e8bdd4 823 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
d59157ea 824 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
78aa8aa0 825 $(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
2544e9e4 826 $(INSTALL_DATA) docs/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
c932ce31 827ifeq ($(CONFIG_TOOLS),y)
8a3e8f7f 828 $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
58f8aead
AL
829 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
830 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
38954dca 831endif
62dd1048
DB
832ifdef CONFIG_TRACE_SYSTEMTAP
833 $(INSTALL_DATA) scripts/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
834endif
665b5d0d 835ifneq (,$(findstring qemu-ga,$(TOOLS)))
b53c54c6 836 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
d59157ea
PB
837 $(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)"
838 $(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)"
839 $(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
665b5d0d 840endif
8a3e8f7f 841endif
a2d8f1be
MK
842ifdef CONFIG_VIRTFS
843 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
844 $(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
845endif
e2d87bff
EH
846
847install-datadir:
848 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
849
f2e3978b
LE
850install-localstatedir:
851ifdef CONFIG_POSIX
852ifneq (,$(findstring qemu-ga,$(TOOLS)))
853 $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
854endif
855endif
856
a8260d38 857ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
e2d87bff 858
54cb65d8
EC
859install-includedir:
860 $(INSTALL_DIR) "$(DESTDIR)$(includedir)"
861
862install: all $(if $(BUILD_DOCS),install-doc) \
863 install-datadir install-localstatedir install-includedir \
1338a4b7
MA
864 $(if $(INSTALL_BLOBS),$(edk2-decompressed)) \
865 recurse-install
932a79df 866ifneq ($(TOOLS),)
0814465a 867 $(call install-prog,$(TOOLS),$(DESTDIR)$(bindir))
932a79df 868endif
e3be6f0e
FZ
869ifneq ($(CONFIG_MODULES),)
870 $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
2115182f
MT
871 for s in $(modules-m:.mo=$(DSOSUF)); do \
872 t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
264f8b4f 873 $(INSTALL_LIB) $$s "$$t"; \
2115182f 874 test -z "$(STRIP)" || $(STRIP) "$$t"; \
e3be6f0e
FZ
875 done
876endif
7b93fadf 877ifneq ($(HELPERS-y),)
0d659426 878 $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
7b93fadf 879endif
d52c454a
MAL
880ifneq ($(vhost-user-json-y),)
881 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/vhost-user/"
882 for x in $(vhost-user-json-y); do \
883 $(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)/vhost-user/"; \
884 done
885endif
62dd1048
DB
886ifdef CONFIG_TRACE_SYSTEMTAP
887 $(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
888endif
77755340 889ifneq ($(BLOBS),)
77755340 890 set -e; for x in $(BLOBS); do \
6aae2a2e 891 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
ad064840 892 done
26ce90fd
LE
893endif
894ifdef INSTALL_BLOBS
895 set -e; for x in $(edk2-decompressed); do \
896 $(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)"; \
897 done
898endif
899ifneq ($(DESCS),)
900 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/firmware"
901 set -e; tmpf=$$(mktemp); trap 'rm -f -- "$$tmpf"' EXIT; \
902 for x in $(DESCS); do \
177cd674 903 sed -e 's,@DATADIR@,$(qemu_datadir),' \
26ce90fd
LE
904 "$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
905 $(INSTALL_DATA) "$$tmpf" \
906 "$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
907 done
834574ea 908endif
a8260d38 909 for s in $(ICON_SIZES); do \
6c11dda9 910 mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
a8260d38 911 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \
6c11dda9 912 "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
a8260d38 913 done; \
6c11dda9 914 mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
a8260d38 915 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \
6c11dda9
SH
916 "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
917 mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
a8260d38 918 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \
6c11dda9
SH
919 "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
920 mkdir -p "$(DESTDIR)$(qemu_desktopdir)"
67ea9546 921 $(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
6c11dda9 922 "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
2a6b5372 923ifdef CONFIG_GTK
834574ea 924 $(MAKE) -C po $@
54cb65d8
EC
925endif
926ifeq ($(CONFIG_PLUGIN),y)
927 $(INSTALL_DATA) $(SRC_PATH)/include/qemu/qemu-plugin.h "$(DESTDIR)$(includedir)/qemu-plugin.h"
77755340 928endif
6aae2a2e 929 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
18be8d77 930 set -e; for x in $(KEYMAPS); do \
6aae2a2e 931 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
ad064840 932 done
1412cf58 933 $(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
612384d7 934
ae5fdc81
FZ
935.PHONY: ctags
936ctags:
ac99c624 937 rm -f tags
ae5fdc81
FZ
938 find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
939
21d4e8e3 940.PHONY: TAGS
5fafdf24 941TAGS:
ac99c624 942 rm -f TAGS
b1999e87 943 find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
31e31b8a 944
6688bc6d 945cscope:
eaa2ddbb
FZ
946 rm -f "$(SRC_PATH)"/cscope.*
947 find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
948 cscope -b -i"$(SRC_PATH)/cscope.files"
6688bc6d 949
d98bc0b6
GH
950# opengl shader programs
951ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
952 @mkdir -p $(dir $@)
953 $(call quiet-command,\
954 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
0bdb12c7 955 "VERT","$@")
d98bc0b6
GH
956
957ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
958 @mkdir -p $(dir $@)
959 $(call quiet-command,\
960 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
0bdb12c7 961 "FRAG","$@")
d98bc0b6 962
46e19e14 963ui/shader.o: $(SRC_PATH)/ui/shader.c \
2e1d70b9
GH
964 ui/shader/texture-blit-vert.h \
965 ui/shader/texture-blit-flip-vert.h \
966 ui/shader/texture-blit-frag.h
cd2bc889 967
3ef693a0 968# documentation
e8518c92 969MAKEINFO=makeinfo
d59157ea
PB
970MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
971MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
e8338fdb 972TEXI2PODFLAGS=$(MAKEINFOINCLUDES) -DVERSION="$(VERSION)" -DCONFDIR="$(qemu_confdir)"
d59157ea 973TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
56e8bdd4 974
e8338fdb
MAL
975docs/version.texi: $(SRC_PATH)/VERSION config-host.mak
976 $(call quiet-command,(\
977 echo "@set VERSION $(VERSION)" && \
978 echo "@set CONFDIR $(qemu_confdir)" \
979 )> $@,"GEN","$@")
fea346f5 980
44cb280d 981%.html: %.texi docs/version.texi
e9ee06bd
MAL
982 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
983 --html $< -o $@,"GEN","$@")
3ef693a0 984
44cb280d 985%.info: %.texi docs/version.texi
e9ee06bd 986 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
f3548328 987
44cb280d 988%.txt: %.texi docs/version.texi
f8bab10b
MAL
989 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
990 --plaintext $< -o $@,"GEN","$@")
991
44cb280d 992%.pdf: %.texi docs/version.texi
d59157ea 993 $(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@")
bd7f9747 994
5f71eac0
PM
995# Sphinx builds all its documentation at once in one invocation
996# and handles "don't rebuild things unless necessary" itself.
997# The '.doctrees' files are cached information to speed this up.
998.PHONY: sphinxdocs
0783a732 999sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MANUAL_BUILDDIR)/interop/index.html $(MANUAL_BUILDDIR)/specs/index.html
5f71eac0
PM
1000
1001# Canned command to build a single manual
27a296fc 1002# Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
6bda415c
EH
1003# Note the use of different doctree for each (manual, builder) tuple;
1004# this works around Sphinx not handling parallel invocation on
1005# a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
96ecba67 1006build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" sphinx-build $(if $(V),,-q) -W -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
5f71eac0
PM
1007# We assume all RST files in the manual's directory are used in it
1008manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst) $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py
1009
1290e671 1010$(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel)
27a296fc 1011 $(call build-manual,devel,html)
5f71eac0 1012
1290e671 1013$(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop)
27a296fc 1014 $(call build-manual,interop,html)
5f71eac0 1015
0783a732 1016$(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
27a296fc
PM
1017 $(call build-manual,specs,html)
1018
1019$(MANUAL_BUILDDIR)/interop/qemu-ga.8: $(call manual-deps,interop)
1020 $(call build-manual,interop,man)
0783a732 1021
22108f33
SH
1022$(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version.h
1023 $(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \
1024 "GEN","$@")
1025
077de81a 1026qemu-options.texi: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
0bdb12c7 1027 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
f3548328 1028
077de81a 1029qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
0bdb12c7 1030 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
2313086a 1031
077de81a 1032qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
0bdb12c7 1033 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
2cd8af2d 1034
077de81a 1035qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
0bdb12c7 1036 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
153859be 1037
eb815e24 1038docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
fb0bc835 1039 @cp -p $< $@
4afeeb57 1040
fb0bc835
MA
1041docs/interop/qemu-ga-qapi.texi: qga/qapi-generated/qga-qapi-doc.texi
1042 @cp -p $< $@
56e8bdd4 1043
2cd8af2d 1044qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
eeb2b8f7 1045qemu.1: qemu-option-trace.texi
06a1e0c1 1046qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
a2d8f1be 1047fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
39ca463e 1048qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
78aa8aa0 1049docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
2544e9e4 1050docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
62dd1048 1051scripts/qemu-trace-stap.1: scripts/qemu-trace-stap.texi
665b5d0d 1052
5f71eac0 1053html: qemu-doc.html docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs
d59157ea
PB
1054info: qemu-doc.info docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
1055pdf: qemu-doc.pdf docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
1056txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
0cb3fb1e 1057
d5e85105 1058qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
65183318
MA
1059 qemu-img.texi qemu-nbd.texi qemu-options.texi \
1060 qemu-tech.texi qemu-option-trace.texi \
27a296fc 1061 qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi \
2544e9e4 1062 qemu-monitor-info.texi docs/qemu-block-drivers.texi \
e8412576 1063 docs/qemu-cpu-models.texi docs/security.texi
818220f5 1064
d59157ea
PB
1065docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
1066 docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
1067 docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \
1068 docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi
56e8bdd4 1069
d59157ea
PB
1070docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
1071 docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \
1072 docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
1073 docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
56e8bdd4 1074
ae560cc3
EB
1075$(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl
1076
fe8bf5f6
AB
1077# Reports/Analysis
1078
1079%/coverage-report.html:
1080 @mkdir -p $*
1081 $(call quiet-command,\
5eda6e42
AB
1082 gcovr -r $(SRC_PATH) \
1083 $(foreach t, $(TARGET_DIRS), --object-directory $(BUILD_DIR)/$(t)) \
1084 --object-directory $(BUILD_DIR) \
337f2311 1085 -p --html --html-details -o $@, \
fe8bf5f6
AB
1086 "GEN", "coverage-report.html")
1087
1088.PHONY: coverage-report
1089coverage-report: $(CURDIR)/reports/coverage/coverage-report.html
56e8bdd4 1090
f53ec699
SW
1091ifdef CONFIG_WIN32
1092
1093INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
1094
1095nsisflags = -V2 -NOCD
1096
1097ifneq ($(wildcard $(SRC_PATH)/dll),)
1098ifeq ($(ARCH),x86_64)
1099# 64 bit executables
1100DLL_PATH = $(SRC_PATH)/dll/w64
1101nsisflags += -DW64
1102else
1103# 32 bit executables
1104DLL_PATH = $(SRC_PATH)/dll/w32
1105endif
1106endif
1107
1108.PHONY: installer
1109installer: $(INSTALLER)
1110
1111INSTDIR=/tmp/qemu-nsis
1112
f84f9f75 1113$(INSTALLER): install-doc $(SRC_PATH)/qemu.nsi
fb8597bb 1114 $(MAKE) install prefix=${INSTDIR}
f53ec699
SW
1115ifdef SIGNCODE
1116 (cd ${INSTDIR}; \
1117 for i in *.exe; do \
1118 $(SIGNCODE) $${i}; \
1119 done \
1120 )
1121endif # SIGNCODE
1122 (cd ${INSTDIR}; \
1123 for i in qemu-system-*.exe; do \
1124 arch=$${i%.exe}; \
1125 arch=$${arch#qemu-system-}; \
1126 echo Section \"$$arch\" Section_$$arch; \
1127 echo SetOutPath \"\$$INSTDIR\"; \
1128 echo File \"\$${BINDIR}\\$$i\"; \
1129 echo SectionEnd; \
1130 done \
1131 ) >${INSTDIR}/system-emulations.nsh
1132 makensis $(nsisflags) \
1133 $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
1134 $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
1135 -DBINDIR="${INSTDIR}" \
1136 $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
1137 -DSRCDIR="$(SRC_PATH)" \
1138 -DOUTFILE="$(INSTALLER)" \
805d8a67 1139 -DDISPLAYVERSION="$(VERSION)" \
f53ec699
SW
1140 $(SRC_PATH)/qemu.nsi
1141 rm -r ${INSTDIR}
1142ifdef SIGNCODE
1143 $(SIGNCODE) $(INSTALLER)
1144endif # SIGNCODE
1145endif # CONFIG_WIN
1146
cb5fc67d
AL
1147# Add a dependency on the generated files, so that they are always
1148# rebuilt before other object files
428952cf 1149ifneq ($(wildcard config-host.mak),)
eaa2ddbb 1150ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
3dff199c 1151Makefile: $(generated-files-y)
7748b8cb 1152endif
428952cf 1153endif
cb5fc67d 1154
0ab8ed18
DB
1155.SECONDARY: $(TRACE_HEADERS) $(TRACE_HEADERS:%=%-timestamp) \
1156 $(TRACE_SOURCES) $(TRACE_SOURCES:%=%-timestamp) \
1157 $(TRACE_DTRACE) $(TRACE_DTRACE:%=%-timestamp)
1158
4fb240a4 1159# Include automatically generated dependency files
1435ddb8
PB
1160# Dependencies in Makefile.objs files come from our recursive subdir rules
1161-include $(wildcard *.d tests/*.d)
324027c2
FZ
1162
1163include $(SRC_PATH)/tests/docker/Makefile.include
b1fb9a63 1164include $(SRC_PATH)/tests/vm/Makefile.include
0d8e065f
MAL
1165
1166.PHONY: help
1167help:
1168 @echo 'Generic targets:'
1169 @echo ' all - Build all'
0decdfe2
MAL
1170ifdef CONFIG_MODULES
1171 @echo ' modules - Build all modules'
1172endif
0d8e065f
MAL
1173 @echo ' dir/file.o - Build specified target only'
1174 @echo ' install - Install QEMU, documentation and tools'
1175 @echo ' ctags/TAGS - Generate tags file for editors'
1176 @echo ' cscope - Generate cscope index'
1177 @echo ''
2b1f35b9 1178 @$(if $(TARGET_DIRS), \
0d8e065f 1179 echo 'Architecture specific targets:'; \
2b1f35b9 1180 $(foreach t, $(TARGET_DIRS), \
3b8593ee 1181 printf " %-30s - Build for %s\\n" $(t)/all $(t);) \
0d8e065f
MAL
1182 echo '')
1183 @echo 'Cleaning targets:'
1184 @echo ' clean - Remove most generated files but keep the config'
990e6a27
AB
1185ifdef CONFIG_GCOV
1186 @echo ' clean-coverage - Remove coverage files'
1187endif
0d8e065f
MAL
1188 @echo ' distclean - Remove all generated files'
1189 @echo ' dist - Build a distributable tarball'
1190 @echo ''
1191 @echo 'Test targets:'
1192 @echo ' check - Run all tests (check-help for details)'
05af039d 1193 @echo ' docker - Help about targets running tests inside containers'
4f2f6276 1194 @echo ' vm-help - Help about targets running tests inside VM'
0d8e065f
MAL
1195 @echo ''
1196 @echo 'Documentation targets:'
f8bab10b 1197 @echo ' html info pdf txt'
0d8e065f 1198 @echo ' - Build documentation in specified format'
fe8bf5f6
AB
1199ifdef CONFIG_GCOV
1200 @echo ' coverage-report - Create code coverage report'
1201endif
0d8e065f
MAL
1202 @echo ''
1203ifdef CONFIG_WIN32
1204 @echo 'Windows targets:'
6bd67f89 1205 @echo ' installer - Build NSIS-based installer for QEMU'
0d8e065f
MAL
1206ifdef QEMU_GA_MSI_ENABLED
1207 @echo ' msi - Build MSI-based installer for qemu-ga'
1208endif
1209 @echo ''
1210endif
7b409519
DB
1211 @echo ' $(MAKE) [targets] (quiet build, default)'
1212 @echo ' $(MAKE) V=1 [targets] (verbose build)'