meson: add qemu-keymap
[qemu.git] / Makefile
1 # Makefile for QEMU.
2
3 ifneq ($(words $(subst :, ,$(CURDIR))), 1)
4 $(error main directory cannot contain spaces nor colons)
5 endif
6
7 # Always point to the root of the build tree (needs GNU make).
8 BUILD_DIR=$(CURDIR)
9
10 # Before including a proper config-host.mak, assume we are in the source tree
11 SRC_PATH=.
12
13 UNCHECKED_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
19 ifneq ($(wildcard config-host.mak),)
20 # Put the all: rule here so that config-host.mak can contain dependencies.
21 all:
22 include config-host.mak
23
24 git-submodule-update:
25
26 .PHONY: git-submodule-update
27
28 git_module_status := $(shell \
29 cd '$(SRC_PATH)' && \
30 GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
31 echo $$?; \
32 )
33
34 ifeq (1,$(git_module_status))
35 ifeq (no,$(GIT_UPDATE))
36 git-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)
44 else
45 git-submodule-update:
46 $(call quiet-command, \
47 (cd $(SRC_PATH) && GIT="$(GIT)" ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \
48 "GIT","$(GIT_SUBMODULES)")
49 endif
50 endif
51
52 export NINJA=./ninjatool
53
54 # Running meson regenerates both build.ninja and ninjatool, and that is
55 # enough to prime the rest of the build.
56 ninjatool: build.ninja
57
58 # Only needed in case Makefile.ninja does not exist.
59 .PHONY: ninja-clean ninja-distclean clean-ctlist
60 clean-ctlist:
61 ninja-clean::
62 ninja-distclean::
63 build.ninja: config-host.mak
64
65 Makefile.ninja: build.ninja ninjatool
66 ./ninjatool -t ninja2make --omit clean dist uninstall < $< > $@
67 -include Makefile.ninja
68
69 ${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
70
71 # If MESON is empty, the rule will be re-evaluated after Makefiles are
72 # reread (and MESON won't be empty anymore).
73 ifneq ($(MESON),)
74 Makefile.mtest: build.ninja scripts/mtest2make.py
75 $(MESON) introspect --tests | $(PYTHON) scripts/mtest2make.py > $@
76 -include Makefile.mtest
77 endif
78
79 .git-submodule-status: git-submodule-update config-host.mak
80
81 # Check that we're not trying to do an out-of-tree build from
82 # a tree that's been used for an in-tree build.
83 ifneq ($(realpath $(SRC_PATH)),$(realpath .))
84 ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
85 $(error This is an out of tree build but your source tree ($(SRC_PATH)) \
86 seems to have been used for an in-tree build. You can fix this by running \
87 "$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
88 endif
89 endif
90
91 CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
92 CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
93 CONFIG_XEN := $(CONFIG_XEN_BACKEND)
94 CONFIG_ALL=y
95 -include config-all-devices.mak
96 -include config-all-disas.mak
97
98 config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
99 @echo $@ is out-of-date, running configure
100 @if test -f meson-private/coredata.dat; then \
101 ./config.status --skip-meson; \
102 else \
103 ./config.status; \
104 fi
105
106 # Force configure to re-run if the API symbols are updated
107 ifeq ($(CONFIG_PLUGIN),y)
108 config-host.mak: $(SRC_PATH)/plugins/qemu-plugins.symbols
109 endif
110
111 else
112 config-host.mak:
113 ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
114 @echo "Please call configure before running make!"
115 @exit 1
116 endif
117 endif
118
119 include $(SRC_PATH)/rules.mak
120
121 # lor is defined in rules.mak
122 CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
123
124 # Create QEMU_PKGVERSION and FULL_VERSION strings
125 # If PKGVERSION is set, use that; otherwise get version and -dirty status from git
126 QEMU_PKGVERSION := $(if $(PKGVERSION),$(PKGVERSION),$(shell \
127 cd $(SRC_PATH); \
128 if test -e .git; then \
129 git describe --match 'v*' 2>/dev/null | tr -d '\n'; \
130 if ! git diff-index --quiet HEAD &>/dev/null; then \
131 echo "-dirty"; \
132 fi; \
133 fi))
134
135 # Either "version (pkgversion)", or just "version" if pkgversion not set
136 FULL_VERSION := $(if $(QEMU_PKGVERSION),$(VERSION) ($(QEMU_PKGVERSION)),$(VERSION))
137
138 generated-files-y = qemu-version.h config-host.h qemu-options.def
139
140 generated-files-y += module_block.h
141
142 generated-files-y += .git-submodule-status
143
144 KEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen
145 KEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv
146
147 KEYCODEMAP_FILES = \
148 ui/input-keymap-atset1-to-qcode.c.inc \
149 ui/input-keymap-linux-to-qcode.c.inc \
150 ui/input-keymap-qcode-to-atset1.c.inc \
151 ui/input-keymap-qcode-to-atset2.c.inc \
152 ui/input-keymap-qcode-to-atset3.c.inc \
153 ui/input-keymap-qcode-to-linux.c.inc \
154 ui/input-keymap-qcode-to-qnum.c.inc \
155 ui/input-keymap-qcode-to-sun.c.inc \
156 ui/input-keymap-qnum-to-qcode.c.inc \
157 ui/input-keymap-usb-to-qcode.c.inc \
158 ui/input-keymap-win32-to-qcode.c.inc \
159 ui/input-keymap-x11-to-qcode.c.inc \
160 ui/input-keymap-xorgevdev-to-qcode.c.inc \
161 ui/input-keymap-xorgkbd-to-qcode.c.inc \
162 ui/input-keymap-xorgxquartz-to-qcode.c.inc \
163 ui/input-keymap-xorgxwin-to-qcode.c.inc \
164 ui/input-keymap-osx-to-qcode.c.inc \
165 $(NULL)
166
167 generated-files-$(CONFIG_SOFTMMU) += $(KEYCODEMAP_FILES)
168
169 ui/input-keymap-%.c.inc: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile.objs
170 $(call quiet-command,\
171 stem=$* && src=$${stem%-to-*} dst=$${stem#*-to-} && \
172 test -e $(KEYCODEMAP_GEN) && \
173 $(PYTHON) $(KEYCODEMAP_GEN) \
174 --lang glib2 \
175 --varname qemu_input_map_$${src}_to_$${dst} \
176 code-map $(KEYCODEMAP_CSV) $${src} $${dst} \
177 > $@ || rm -f $@, "GEN", "$@")
178
179 $(KEYCODEMAP_GEN): .git-submodule-status
180 $(KEYCODEMAP_CSV): .git-submodule-status
181
182 edk2-decompressed = $(basename $(wildcard pc-bios/edk2-*.fd.bz2))
183 pc-bios/edk2-%.fd: pc-bios/edk2-%.fd.bz2
184 $(call quiet-command,bzip2 -d -c $< > $@,"BUNZIP2",$<)
185
186 # Don't try to regenerate Makefile or configure
187 # We don't generate any of them
188 Makefile: ;
189 configure: ;
190
191 .PHONY: all clean cscope distclean html info install install-doc \
192 pdf txt recurse-all dist msi FORCE
193
194 $(call set-vpath, $(SRC_PATH))
195
196 LIBS+=-lz $(LIBS_TOOLS)
197
198 HELPERS-y = $(HELPERS)
199
200 # Sphinx does not allow building manuals into the same directory as
201 # the source files, so if we're doing an in-tree QEMU build we must
202 # build the manuals into a subdirectory (and then install them from
203 # there for 'make install'). For an out-of-tree build we can just
204 # use the docs/ subdirectory in the build tree as normal.
205 ifeq ($(realpath $(SRC_PATH)),$(realpath .))
206 MANUAL_BUILDDIR := docs/built
207 else
208 MANUAL_BUILDDIR := docs
209 endif
210
211 ifdef BUILD_DOCS
212 DOCS+=$(MANUAL_BUILDDIR)/system/qemu.1
213 DOCS+=$(MANUAL_BUILDDIR)/tools/qemu-img.1
214 DOCS+=$(MANUAL_BUILDDIR)/tools/qemu-nbd.8
215 DOCS+=$(MANUAL_BUILDDIR)/interop/qemu-ga.8
216 ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
217 DOCS+=$(MANUAL_BUILDDIR)/tools/virtiofsd.1
218 endif
219 DOCS+=$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7
220 DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
221 DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
222 DOCS+=$(MANUAL_BUILDDIR)/system/qemu-cpu-models.7
223 DOCS+=$(MANUAL_BUILDDIR)/index.html
224 ifdef CONFIG_VIRTFS
225 DOCS+=$(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1
226 endif
227 ifdef CONFIG_TRACE_SYSTEMTAP
228 DOCS+=$(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1
229 endif
230 else
231 DOCS=
232 endif
233
234 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
235 SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(filter %-softmmu, $(TARGET_DIRS)))
236 SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK))
237
238 ifeq ($(SUBDIR_DEVICES_MAK),)
239 config-all-devices.mak: config-host.mak
240 $(call quiet-command,echo '# no devices' > $@,"GEN","$@")
241 else
242 config-all-devices.mak: $(SUBDIR_DEVICES_MAK) config-host.mak
243 $(call quiet-command, sed -n \
244 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
245 $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
246 "GEN","$@")
247 endif
248
249 -include $(SUBDIR_DEVICES_MAK_DEP)
250
251 # This has to be kept in sync with Kconfig.host.
252 MINIKCONF_ARGS = \
253 $(CONFIG_MINIKCONF_MODE) \
254 $@ $*/config-devices.mak.d $< $(SRC_PATH)/Kconfig \
255 CONFIG_TCG=$(CONFIG_TCG) \
256 CONFIG_KVM=$(CONFIG_KVM) \
257 CONFIG_SPICE=$(CONFIG_SPICE) \
258 CONFIG_IVSHMEM=$(CONFIG_IVSHMEM) \
259 CONFIG_TPM=$(CONFIG_TPM) \
260 CONFIG_XEN=$(CONFIG_XEN) \
261 CONFIG_OPENGL=$(CONFIG_OPENGL) \
262 CONFIG_X11=$(CONFIG_X11) \
263 CONFIG_VHOST_USER=$(CONFIG_VHOST_USER) \
264 CONFIG_VHOST_KERNEL=$(CONFIG_VHOST_KERNEL) \
265 CONFIG_VIRTFS=$(CONFIG_VIRTFS) \
266 CONFIG_LINUX=$(CONFIG_LINUX) \
267 CONFIG_PVRDMA=$(CONFIG_PVRDMA)
268
269 MINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py
270
271 $(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak $(SRC_PATH)/Kconfig $(BUILD_DIR)/config-host.mak
272 $(call quiet-command, $(MINIKCONF) $(MINIKCONF_ARGS) \
273 > $@.tmp, "GEN", "$@.tmp")
274 $(call quiet-command, if test -f $@; then \
275 if cmp -s $@.old $@; then \
276 mv $@.tmp $@; \
277 cp -p $@ $@.old; \
278 else \
279 if test -f $@.old; then \
280 echo "WARNING: $@ (user modified) out of date.";\
281 else \
282 echo "WARNING: $@ out of date.";\
283 fi; \
284 echo "Run \"$(MAKE) defconfig\" to regenerate."; \
285 rm $@.tmp; \
286 fi; \
287 else \
288 mv $@.tmp $@; \
289 cp -p $@ $@.old; \
290 fi,"GEN","$@");
291
292 defconfig:
293 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
294
295 ifneq ($(wildcard config-host.mak),)
296 include $(SRC_PATH)/Makefile.objs
297 endif
298
299 dummy := $(call unnest-vars,, \
300 authz-obj-y \
301 chardev-obj-y \
302 block-obj-y \
303 block-obj-m \
304 storage-daemon-obj-y \
305 storage-daemon-obj-m \
306 crypto-obj-y \
307 qom-obj-y \
308 io-obj-y \
309 common-obj-y \
310 common-obj-m)
311
312 include $(SRC_PATH)/tests/Makefile.include
313
314 all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all modules
315
316 qemu-version.h: FORCE
317 $(call quiet-command, \
318 (printf '#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \
319 printf '#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \
320 ) > $@.tmp)
321 $(call quiet-command, if ! cmp -s $@ $@.tmp; then \
322 mv $@.tmp $@; \
323 else \
324 rm $@.tmp; \
325 fi)
326
327 config-host.h: config-host.h-timestamp
328 config-host.h-timestamp: config-host.mak
329 qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
330 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
331
332 TARGET_DIRS_RULES := $(foreach t, all fuzz clean install, $(addsuffix /$(t), $(TARGET_DIRS)))
333
334 SOFTMMU_ALL_RULES=$(filter %-softmmu/all, $(TARGET_DIRS_RULES))
335 $(SOFTMMU_ALL_RULES): $(authz-obj-y)
336 $(SOFTMMU_ALL_RULES): $(block-obj-y)
337 $(SOFTMMU_ALL_RULES): $(storage-daemon-obj-y)
338 $(SOFTMMU_ALL_RULES): $(chardev-obj-y)
339 $(SOFTMMU_ALL_RULES): $(crypto-obj-y)
340 $(SOFTMMU_ALL_RULES): $(io-obj-y)
341 $(SOFTMMU_ALL_RULES): config-all-devices.mak
342 ifdef DECOMPRESS_EDK2_BLOBS
343 $(SOFTMMU_ALL_RULES): $(edk2-decompressed)
344 endif
345
346 SOFTMMU_FUZZ_RULES=$(filter %-softmmu/fuzz, $(TARGET_DIRS_RULES))
347 $(SOFTMMU_FUZZ_RULES): $(authz-obj-y)
348 $(SOFTMMU_FUZZ_RULES): $(block-obj-y)
349 $(SOFTMMU_FUZZ_RULES): $(chardev-obj-y)
350 $(SOFTMMU_FUZZ_RULES): $(crypto-obj-y)
351 $(SOFTMMU_FUZZ_RULES): $(io-obj-y)
352 $(SOFTMMU_FUZZ_RULES): config-all-devices.mak
353 $(SOFTMMU_FUZZ_RULES): $(edk2-decompressed)
354
355 .PHONY: $(TARGET_DIRS_RULES)
356 # The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
357 # $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
358 $(TARGET_DIRS_RULES):
359 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
360
361 # LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
362 DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_lib=""
363 DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
364 DTC_CPPFLAGS=-I$(SRC_PATH)/dtc/libfdt
365
366 .PHONY: dtc/all
367 dtc/all: .git-submodule-status dtc/libfdt
368 $(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,)
369
370 dtc/%: .git-submodule-status
371 @mkdir -p $@
372
373 # Overriding CFLAGS causes us to lose defines added in the sub-makefile.
374 # Not overriding CFLAGS leads to mis-matches between compilation modes.
375 # Therefore we replicate some of the logic in the sub-makefile.
376 # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
377 # no need to annoy QEMU developers with such things.
378 CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS))
379 CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
380 CAP_CFLAGS += -DCAPSTONE_HAS_ARM
381 CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
382 CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
383 CAP_CFLAGS += -DCAPSTONE_HAS_X86
384
385 .PHONY: capstone/all
386 capstone/all: .git-submodule-status
387 $(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))
388
389 .PHONY: slirp/all
390 slirp/all: .git-submodule-status
391 $(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp \
392 BUILD_DIR="$(BUILD_DIR)/slirp" \
393 PKG_CONFIG="$(PKG_CONFIG)" \
394 CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" \
395 CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)")
396
397 $(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
398 $(qom-obj-y)
399
400 $(filter %/fuzz, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
401 $(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY))
402
403 ROM_DIRS = $(addprefix pc-bios/, $(ROMS))
404 ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
405 # Only keep -O and -g cflags
406 .PHONY: $(ROM_DIRS_RULES)
407 $(ROM_DIRS_RULES):
408 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))" $(notdir $@),)
409
410 .PHONY: recurse-all recurse-clean recurse-install
411 recurse-all: $(addsuffix /all, $(TARGET_DIRS) $(ROM_DIRS))
412 recurse-clean: $(addsuffix /clean, $(TARGET_DIRS) $(ROM_DIRS))
413 recurse-install: $(addsuffix /install, $(TARGET_DIRS))
414 $(addsuffix /install, $(TARGET_DIRS)): all
415
416 $(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
417 $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
418
419 Makefile: $(version-obj-y)
420
421 ######################################################################
422
423 COMMON_LDADDS = libqemuutil.a
424
425 qemu-img.o: qemu-img-cmds.h
426
427 qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
428 qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
429 qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
430 qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) $(storage-daemon-obj-y) $(COMMON_LDADDS)
431
432 qemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS)
433
434 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
435
436 scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o $(authz-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
437 ifdef CONFIG_MPATH
438 scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
439 endif
440
441 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
442 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
443
444 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
445 $(call quiet-command,$(PYTHON) $< $@ \
446 $(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
447 "GEN","$@")
448
449 clean: recurse-clean ninja-clean clean-ctlist
450 -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
451 # avoid old build problems by removing potentially incorrect old files
452 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
453 rm -f qemu-options.def
454 find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \
455 ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
456 ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
457 ! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
458 -exec rm {} +
459 rm -f $(edk2-decompressed)
460 rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) TAGS cscope.* *.pod *~ */*~
461 rm -f fsdev/*.pod scsi/*.pod
462 rm -f qemu-img-cmds.h
463 rm -f ui/shader/*-vert.h ui/shader/*-frag.h
464 rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
465 rm -f config-all-devices.mak
466 rm -f $(SUBDIR_DEVICES_MAK)
467
468 VERSION ?= $(shell cat VERSION)
469
470 dist: qemu-$(VERSION).tar.bz2
471
472 qemu-%.tar.bz2:
473 $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
474
475 define clean-manual =
476 rm -rf $(MANUAL_BUILDDIR)/$1/_static
477 rm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(MANUAL_BUILDDIR)/$1/*.html
478 endef
479
480 distclean: clean ninja-distclean
481 -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean -g
482 rm -f config-host.mak config-host.h* $(DOCS)
483 rm -f tests/tcg/config-*.mak
484 rm -f config-all-devices.mak config-all-disas.mak config.status
485 rm -f $(SUBDIR_DEVICES_MAK)
486 rm -f po/*.mo tests/qemu-iotests/common.env
487 rm -f roms/seabios/config.mak roms/vgabios/config.mak
488 rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
489 rm -rf meson-private meson-logs meson-info compile_commands.json
490 rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest
491 rm -f config.log
492 rm -f linux-headers/asm
493 rm -f docs/version.texi
494 rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi
495 rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7
496 rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
497 rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
498 rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
499 rm -rf .doctrees
500 $(call clean-manual,devel)
501 $(call clean-manual,interop)
502 $(call clean-manual,specs)
503 $(call clean-manual,system)
504 $(call clean-manual,tools)
505 $(call clean-manual,user)
506 for d in $(TARGET_DIRS); do \
507 rm -rf $$d || exit 1 ; \
508 done
509 rm -Rf .sdk
510
511 KEYMAPS=da en-gb et fr fr-ch is lt no pt-br sv \
512 ar de en-us fi fr-be hr it lv nl pl ru th \
513 de-ch es fo fr-ca hu ja mk pt sl tr \
514 bepo cz
515
516 ifdef INSTALL_BLOBS
517 BLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
518 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
519 vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
520 openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
521 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
522 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
523 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
524 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
525 efi-e1000e.rom efi-vmxnet3.rom \
526 qemu-nsis.bmp \
527 bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
528 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
529 s390-ccw.img s390-netboot.img \
530 slof.bin skiboot.lid \
531 palcode-clipper \
532 u-boot.e500 u-boot-sam460-20100605.bin \
533 qemu_vga.ndrv \
534 edk2-licenses.txt \
535 hppa-firmware.img \
536 opensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
537 opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
538
539
540 DESCS=50-edk2-i386-secure.json 50-edk2-x86_64-secure.json \
541 60-edk2-aarch64.json 60-edk2-arm.json 60-edk2-i386.json 60-edk2-x86_64.json
542 else
543 BLOBS=
544 DESCS=
545 endif
546
547 # Note that we manually filter-out the non-Sphinx documentation which
548 # is currently built into the docs/interop directory in the build tree,
549 # and also any sphinx-built manpages.
550 define install-manual =
551 for d in $$(cd $(MANUAL_BUILDDIR) && find $1 -type d); do $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/$$d"; done
552 for f in $$(cd $(MANUAL_BUILDDIR) && find $1 -type f -a '!' '(' -name '*.[0-9]' -o -name 'qemu-*-qapi.*' -o -name 'qemu-*-ref.*' ')' ); do $(INSTALL_DATA) "$(MANUAL_BUILDDIR)/$$f" "$(DESTDIR)$(qemu_docdir)/$$f"; done
553 endef
554
555 # Note that we deliberately do not install the "devel" manual: it is
556 # for QEMU developers, and not interesting to our users.
557 .PHONY: install-sphinxdocs
558 install-sphinxdocs: sphinxdocs
559 $(call install-manual,interop)
560 $(call install-manual,specs)
561 $(call install-manual,system)
562 $(call install-manual,tools)
563 $(call install-manual,user)
564
565 install-doc: $(DOCS) install-sphinxdocs
566 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
567 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/index.html "$(DESTDIR)$(qemu_docdir)"
568 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop"
569 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)/interop"
570 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)/interop"
571 ifdef CONFIG_POSIX
572 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
573 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu.1 "$(DESTDIR)$(mandir)/man1"
574 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
575 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
576 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
577 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
578 ifeq ($(CONFIG_TOOLS),y)
579 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-img.1 "$(DESTDIR)$(mandir)/man1"
580 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
581 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
582 endif
583 ifdef CONFIG_TRACE_SYSTEMTAP
584 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
585 endif
586 ifeq ($(CONFIG_GUEST_AGENT),y)
587 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
588 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop"
589 $(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)/interop"
590 $(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)/interop"
591 $(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
592 endif
593 endif
594 ifdef CONFIG_VIRTFS
595 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
596 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
597 endif
598 ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
599 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtiofsd.1 "$(DESTDIR)$(mandir)/man1"
600 endif
601
602 install-datadir:
603 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
604
605 install-localstatedir:
606 ifdef CONFIG_POSIX
607 ifeq ($(CONFIG_GUEST_AGENT),y)
608 $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
609 endif
610 endif
611
612 ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
613
614 install-includedir:
615 $(INSTALL_DIR) "$(DESTDIR)$(includedir)"
616
617 # Needed by "meson install"
618 export DESTDIR
619 install: all $(if $(BUILD_DOCS),install-doc) \
620 install-datadir install-localstatedir install-includedir \
621 $(if $(INSTALL_BLOBS),$(edk2-decompressed)) \
622 recurse-install
623 ifneq ($(TOOLS),)
624 $(call install-prog,$(TOOLS),$(DESTDIR)$(bindir))
625 endif
626 ifneq ($(CONFIG_MODULES),)
627 $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
628 for s in $(modules-m:.mo=$(DSOSUF)); do \
629 t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
630 $(INSTALL_LIB) $$s "$$t"; \
631 test -z "$(STRIP)" || $(STRIP) "$$t"; \
632 done
633 endif
634 ifneq ($(HELPERS-y),)
635 $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
636 endif
637 ifdef CONFIG_TRACE_SYSTEMTAP
638 $(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
639 endif
640 ifneq ($(BLOBS),)
641 set -e; for x in $(BLOBS); do \
642 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
643 done
644 endif
645 ifdef INSTALL_BLOBS
646 set -e; for x in $(edk2-decompressed); do \
647 $(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)"; \
648 done
649 endif
650 ifneq ($(DESCS),)
651 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/firmware"
652 set -e; tmpf=$$(mktemp); trap 'rm -f -- "$$tmpf"' EXIT; \
653 for x in $(DESCS); do \
654 sed -e 's,@DATADIR@,$(qemu_datadir),' \
655 "$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
656 $(INSTALL_DATA) "$$tmpf" \
657 "$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
658 done
659 endif
660 for s in $(ICON_SIZES); do \
661 mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
662 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \
663 "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
664 done; \
665 mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
666 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \
667 "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
668 mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
669 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \
670 "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
671 mkdir -p "$(DESTDIR)$(qemu_desktopdir)"
672 $(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
673 "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
674 ifdef CONFIG_GTK
675 $(MAKE) -C po $@
676 endif
677 ifeq ($(CONFIG_PLUGIN),y)
678 $(INSTALL_DATA) $(SRC_PATH)/include/qemu/qemu-plugin.h "$(DESTDIR)$(includedir)/qemu-plugin.h"
679 endif
680 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
681 set -e; for x in $(KEYMAPS); do \
682 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
683 done
684 for d in $(TARGET_DIRS); do \
685 $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
686 done
687
688 # opengl shader programs
689 ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
690 @mkdir -p $(dir $@)
691 $(call quiet-command,\
692 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
693 "VERT","$@")
694
695 ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
696 @mkdir -p $(dir $@)
697 $(call quiet-command,\
698 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
699 "FRAG","$@")
700
701 ui/shader.o: $(SRC_PATH)/ui/shader.c \
702 ui/shader/texture-blit-vert.h \
703 ui/shader/texture-blit-flip-vert.h \
704 ui/shader/texture-blit-frag.h
705
706 # documentation
707 MAKEINFO=makeinfo
708 MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
709 MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
710 TEXI2PODFLAGS=$(MAKEINFOINCLUDES) -DVERSION="$(VERSION)" -DCONFDIR="$(qemu_confdir)"
711 TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
712
713 docs/version.texi: $(SRC_PATH)/VERSION config-host.mak
714 $(call quiet-command,(\
715 echo "@set VERSION $(VERSION)" && \
716 echo "@set CONFDIR $(qemu_confdir)" \
717 )> $@,"GEN","$@")
718
719 %.html: %.texi docs/version.texi
720 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
721 --html $< -o $@,"GEN","$@")
722
723 %.info: %.texi docs/version.texi
724 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
725
726 %.txt: %.texi docs/version.texi
727 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
728 --plaintext $< -o $@,"GEN","$@")
729
730 %.pdf: %.texi docs/version.texi
731 $(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@")
732
733 # Sphinx builds all its documentation at once in one invocation
734 # and handles "don't rebuild things unless necessary" itself.
735 # The '.doctrees' files are cached information to speed this up.
736 .PHONY: sphinxdocs
737 sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \
738 $(MANUAL_BUILDDIR)/interop/index.html \
739 $(MANUAL_BUILDDIR)/specs/index.html \
740 $(MANUAL_BUILDDIR)/system/index.html \
741 $(MANUAL_BUILDDIR)/tools/index.html \
742 $(MANUAL_BUILDDIR)/user/index.html
743
744 # Canned command to build a single manual
745 # Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
746 # Note the use of different doctree for each (manual, builder) tuple;
747 # this works around Sphinx not handling parallel invocation on
748 # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
749 build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) $(SPHINX_WERROR) -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
750 # We assume all RST files in the manual's directory are used in it
751 manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \
752 $(SRC_PATH)/docs/defs.rst.inc \
753 $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py \
754 $(SRC_PATH)/docs/sphinx/*.py
755 # Macro to write out the rule and dependencies for building manpages
756 # Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps])
757 # 'extradeps' is optional, and specifies extra files (eg .hx files) that
758 # the manual page depends on.
759 define define-manpage-rule
760 $(call atomic,$(foreach manpage,$2,$(MANUAL_BUILDDIR)/$1/$(manpage)),$(call manual-deps,$1) $3)
761 $(call build-manual,$1,man)
762 endef
763
764 $(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel)
765 $(call build-manual,devel,html)
766
767 $(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop)
768 $(call build-manual,interop,html)
769
770 $(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
771 $(call build-manual,specs,html)
772
773 $(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
774 $(call build-manual,system,html)
775
776 $(MANUAL_BUILDDIR)/tools/index.html: $(call manual-deps,tools) $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc
777 $(call build-manual,tools,html)
778
779 $(MANUAL_BUILDDIR)/user/index.html: $(call manual-deps,user)
780 $(call build-manual,user,html)
781
782 $(call define-manpage-rule,interop,qemu-ga.8)
783
784 $(call define-manpage-rule,system,qemu.1 qemu-block-drivers.7 qemu-cpu-models.7)
785
786 $(call define-manpage-rule,tools,\
787 qemu-img.1 qemu-nbd.8 qemu-trace-stap.1\
788 virtiofsd.1 virtfs-proxy-helper.1,\
789 $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc)
790
791 $(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version.h
792 @mkdir -p "$(MANUAL_BUILDDIR)"
793 $(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \
794 "GEN","$@")
795
796 docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
797 @cp -p $< $@
798
799 docs/interop/qemu-ga-qapi.texi: qga/qga-qapi-doc.texi
800 @cp -p $< $@
801
802 html: docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs
803 info: docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
804 pdf: docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
805 txt: docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
806
807 docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
808 docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
809 docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \
810 docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi
811
812 docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
813 docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \
814 docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
815 docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
816
817 $(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl
818
819 # Reports/Analysis
820
821 %/coverage-report.html:
822 @mkdir -p $*
823 $(call quiet-command,\
824 gcovr -r $(SRC_PATH) \
825 $(foreach t, $(TARGET_DIRS), --object-directory $(BUILD_DIR)/$(t)) \
826 --object-directory $(BUILD_DIR) \
827 -p --html --html-details -o $@, \
828 "GEN", "coverage-report.html")
829
830 .PHONY: coverage-report
831 coverage-report: $(CURDIR)/reports/coverage/coverage-report.html
832
833 ifdef CONFIG_WIN32
834
835 INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
836
837 nsisflags = -V2 -NOCD
838
839 ifneq ($(wildcard $(SRC_PATH)/dll),)
840 ifeq ($(ARCH),x86_64)
841 # 64 bit executables
842 DLL_PATH = $(SRC_PATH)/dll/w64
843 nsisflags += -DW64
844 else
845 # 32 bit executables
846 DLL_PATH = $(SRC_PATH)/dll/w32
847 endif
848 endif
849
850 .PHONY: installer
851 installer: $(INSTALLER)
852
853 INSTDIR=/tmp/qemu-nsis
854
855 $(INSTALLER): $(SRC_PATH)/qemu.nsi
856 $(MAKE) install DESTDIR=${INSTDIR}
857 ifdef SIGNCODE
858 (cd ${INSTDIR}/${bindir}; \
859 for i in *.exe; do \
860 $(SIGNCODE) $${i}; \
861 done \
862 )
863 endif # SIGNCODE
864 (cd ${INSTDIR}/${bindir}; \
865 for i in qemu-system-*.exe; do \
866 arch=$${i%.exe}; \
867 arch=$${arch#qemu-system-}; \
868 echo Section \"$$arch\" Section_$$arch; \
869 echo SetOutPath \"\$$INSTDIR\"; \
870 echo File \"\$${BINDIR}\\$$i\"; \
871 echo SectionEnd; \
872 done \
873 ) >${INSTDIR}/${bindir}/system-emulations.nsh
874 makensis $(nsisflags) \
875 $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
876 $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
877 -DBINDIR="${INSTDIR}/${bindir}" \
878 $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
879 -DSRCDIR="$(SRC_PATH)" \
880 -DOUTFILE="$(INSTALLER)" \
881 -DDISPLAYVERSION="$(VERSION)" \
882 $(SRC_PATH)/qemu.nsi
883 rm -r ${INSTDIR}
884 ifdef SIGNCODE
885 $(SIGNCODE) $(INSTALLER)
886 endif # SIGNCODE
887 endif # CONFIG_WIN
888
889 # Add a dependency on the generated files, so that they are always
890 # rebuilt before other object files
891 ifneq ($(wildcard config-host.mak),)
892 ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
893 Makefile: $(generated-files-y)
894 endif
895 endif
896
897 # Include automatically generated dependency files
898 # Dependencies in Makefile.objs files come from our recursive subdir rules
899 -include $(wildcard *.d tests/*.d)
900
901 include $(SRC_PATH)/tests/docker/Makefile.include
902 include $(SRC_PATH)/tests/vm/Makefile.include
903
904 print-help-run = printf " %-30s - %s\\n" "$1" "$2"
905 print-help = $(quiet-@)$(call print-help-run,$1,$2)
906
907 .PHONY: help
908 help:
909 @echo 'Generic targets:'
910 $(call print-help,all,Build all)
911 ifdef CONFIG_MODULES
912 $(call print-help,modules,Build all modules)
913 endif
914 $(call print-help,dir/file.o,Build specified target only)
915 $(call print-help,install,Install QEMU, documentation and tools)
916 $(call print-help,ctags/TAGS,Generate tags file for editors)
917 $(call print-help,cscope,Generate cscope index)
918 $(call print-help,sparse,Run sparse on the QEMU source)
919 @echo ''
920 @$(if $(TARGET_DIRS), \
921 echo 'Architecture specific targets:'; \
922 $(foreach t, $(TARGET_DIRS), \
923 $(call print-help-run,$(t)/all,Build for $(t)); \
924 $(if $(CONFIG_FUZZ), \
925 $(if $(findstring softmmu,$(t)), \
926 $(call print-help-run,$(t)/fuzz,Build fuzzer for $(t)); \
927 ))) \
928 echo '')
929 @$(if $(HELPERS-y), \
930 echo 'Helper targets:'; \
931 $(foreach t, $(HELPERS-y), \
932 $(call print-help-run,$(t),Build $(shell basename $(t)));) \
933 echo '')
934 @$(if $(TOOLS), \
935 echo 'Tools targets:'; \
936 $(foreach t, $(TOOLS), \
937 $(call print-help-run,$(t),Build $(shell basename $(t)) tool);) \
938 echo '')
939 @echo 'Cleaning targets:'
940 $(call print-help,clean,Remove most generated files but keep the config)
941 $(call print-help,distclean,Remove all generated files)
942 $(call print-help,dist,Build a distributable tarball)
943 @echo ''
944 @echo 'Test targets:'
945 $(call print-help,check,Run all tests (check-help for details))
946 $(call print-help,docker,Help about targets running tests inside containers)
947 $(call print-help,vm-help,Help about targets running tests inside VM)
948 @echo ''
949 @echo 'Documentation targets:'
950 $(call print-help,html info pdf txt,Build documentation in specified format)
951 @echo ''
952 ifdef CONFIG_WIN32
953 @echo 'Windows targets:'
954 $(call print-help,installer,Build NSIS-based installer for QEMU)
955 ifdef QEMU_GA_MSI_ENABLED
956 $(call print-help,msi,Build MSI-based installer for qemu-ga)
957 endif
958 @echo ''
959 endif
960 $(call print-help,$(MAKE) [targets],(quiet build, default))
961 $(call print-help,$(MAKE) V=1 [targets],(verbose build))