i.mx7d: Add no-op/unimplemented APBH DMA module
[qemu/ar7.git] / Makefile
blobcfb18f152544c9aefd1b081f127cc115cd162f4f
1 # Makefile for QEMU.
3 # Always point to the root of the build tree (needs GNU make).
4 BUILD_DIR=$(CURDIR)
6 # Before including a proper config-host.mak, assume we are in the source tree
7 SRC_PATH=.
9 UNCHECKED_GOALS := %clean TAGS cscope ctags dist \
10 html info pdf txt \
11 help check-help print-% \
12 docker docker-% vm-test vm-build-%
14 print-%:
15 @echo '$*=$($*)'
17 # All following code might depend on configuration variables
18 ifneq ($(wildcard config-host.mak),)
19 # Put the all: rule here so that config-host.mak can contain dependencies.
20 all:
21 include config-host.mak
23 git-submodule-update:
25 .PHONY: git-submodule-update
27 git_module_status := $(shell \
28 cd '$(SRC_PATH)' && \
29 GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
30 echo $$?; \
33 ifeq (1,$(git_module_status))
34 ifeq (no,$(GIT_UPDATE))
35 git-submodule-update:
36 $(call quiet-command, \
37 echo && \
38 echo "GIT submodule checkout is out of date. Please run" && \
39 echo " scripts/git-submodule.sh update $(GIT_SUBMODULES)" && \
40 echo "from the source directory checkout $(SRC_PATH)" && \
41 echo && \
42 exit 1)
43 else
44 git-submodule-update:
45 $(call quiet-command, \
46 (cd $(SRC_PATH) && GIT="$(GIT)" ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \
47 "GIT","$(GIT_SUBMODULES)")
48 endif
49 endif
51 .git-submodule-status: git-submodule-update config-host.mak
53 # Check that we're not trying to do an out-of-tree build from
54 # a tree that's been used for an in-tree build.
55 ifneq ($(realpath $(SRC_PATH)),$(realpath .))
56 ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
57 $(error This is an out of tree build but your source tree ($(SRC_PATH)) \
58 seems to have been used for an in-tree build. You can fix this by running \
59 "$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
60 endif
61 endif
63 CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
64 CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
65 CONFIG_XEN := $(CONFIG_XEN_BACKEND)
66 CONFIG_ALL=y
67 -include config-all-devices.mak
68 -include config-all-disas.mak
70 config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
71 @echo $@ is out-of-date, running configure
72 @# TODO: The next lines include code which supports a smooth
73 @# transition from old configurations without config.status.
74 @# This code can be removed after QEMU 1.7.
75 @if test -x config.status; then \
76 ./config.status; \
77 else \
78 sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh; \
80 else
81 config-host.mak:
82 ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
83 @echo "Please call configure before running make!"
84 @exit 1
85 endif
86 endif
88 include $(SRC_PATH)/rules.mak
90 # notempy and lor are defined in rules.mak
91 CONFIG_TOOLS := $(call notempty,$(TOOLS))
92 CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
94 # Create QEMU_PKGVERSION and FULL_VERSION strings
95 # If PKGVERSION is set, use that; otherwise get version and -dirty status from git
96 QEMU_PKGVERSION := $(if $(PKGVERSION),$(PKGVERSION),$(shell \
97 cd $(SRC_PATH); \
98 if test -e .git; then \
99 git describe --match 'v*' 2>/dev/null | tr -d '\n'; \
100 if ! git diff-index --quiet HEAD &>/dev/null; then \
101 echo "-dirty"; \
102 fi; \
103 fi))
105 # Either "version (pkgversion)", or just "version" if pkgversion not set
106 FULL_VERSION := $(if $(QEMU_PKGVERSION),$(VERSION) ($(QEMU_PKGVERSION)),$(VERSION))
108 generated-files-y = qemu-version.h config-host.h qemu-options.def
110 GENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c
111 GENERATED_QAPI_FILES += qapi/qapi-types.h qapi/qapi-types.c
112 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.h)
113 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.c)
114 GENERATED_QAPI_FILES += qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c
115 GENERATED_QAPI_FILES += qapi/qapi-visit.h qapi/qapi-visit.c
116 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.h)
117 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.c)
118 GENERATED_QAPI_FILES += qapi/qapi-commands.h qapi/qapi-commands.c
119 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.h)
120 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.c)
121 GENERATED_QAPI_FILES += qapi/qapi-emit-events.h qapi/qapi-emit-events.c
122 GENERATED_QAPI_FILES += qapi/qapi-events.h qapi/qapi-events.c
123 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.h)
124 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.c)
125 GENERATED_QAPI_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h
126 GENERATED_QAPI_FILES += qapi/qapi-doc.texi
128 generated-files-y += $(GENERATED_QAPI_FILES)
130 generated-files-y += trace/generated-tcg-tracers.h
132 generated-files-y += trace/generated-helpers-wrappers.h
133 generated-files-y += trace/generated-helpers.h
134 generated-files-y += trace/generated-helpers.c
136 generated-files-$(CONFIG_TRACE_UST) += trace-ust-all.h
137 generated-files-$(CONFIG_TRACE_UST) += trace-ust-all.c
139 generated-files-y += module_block.h
141 TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h)
142 TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c)
143 TRACE_DTRACE =
144 ifdef CONFIG_TRACE_DTRACE
145 TRACE_HEADERS += trace-dtrace-root.h $(trace-events-subdirs:%=%/trace-dtrace.h)
146 TRACE_DTRACE += trace-dtrace-root.dtrace $(trace-events-subdirs:%=%/trace-dtrace.dtrace)
147 endif
148 ifdef CONFIG_TRACE_UST
149 TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h)
150 endif
152 generated-files-y += $(TRACE_HEADERS)
153 generated-files-y += $(TRACE_SOURCES)
154 generated-files-y += $(BUILD_DIR)/trace-events-all
155 generated-files-y += .git-submodule-status
157 trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
159 tracetool-y = $(SRC_PATH)/scripts/tracetool.py
160 tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
162 %/trace.h: %/trace.h-timestamp
163 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
164 %/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
165 $(call quiet-command,$(TRACETOOL) \
166 --group=$(call trace-group-name,$@) \
167 --format=h \
168 --backends=$(TRACE_BACKENDS) \
169 $< > $@,"GEN","$(@:%-timestamp=%)")
171 %/trace.c: %/trace.c-timestamp
172 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
173 %/trace.c-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
174 $(call quiet-command,$(TRACETOOL) \
175 --group=$(call trace-group-name,$@) \
176 --format=c \
177 --backends=$(TRACE_BACKENDS) \
178 $< > $@,"GEN","$(@:%-timestamp=%)")
180 %/trace-ust.h: %/trace-ust.h-timestamp
181 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
182 %/trace-ust.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
183 $(call quiet-command,$(TRACETOOL) \
184 --group=$(call trace-group-name,$@) \
185 --format=ust-events-h \
186 --backends=$(TRACE_BACKENDS) \
187 $< > $@,"GEN","$(@:%-timestamp=%)")
189 %/trace-dtrace.dtrace: %/trace-dtrace.dtrace-timestamp
190 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
191 %/trace-dtrace.dtrace-timestamp: $(SRC_PATH)/%/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
192 $(call quiet-command,$(TRACETOOL) \
193 --group=$(call trace-group-name,$@) \
194 --format=d \
195 --backends=$(TRACE_BACKENDS) \
196 $< > $@,"GEN","$(@:%-timestamp=%)")
198 %/trace-dtrace.h: %/trace-dtrace.dtrace $(tracetool-y)
199 $(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@")
201 %/trace-dtrace.o: %/trace-dtrace.dtrace $(tracetool-y)
204 trace-root.h: trace-root.h-timestamp
205 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
206 trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
207 $(call quiet-command,$(TRACETOOL) \
208 --group=root \
209 --format=h \
210 --backends=$(TRACE_BACKENDS) \
211 $< > $@,"GEN","$(@:%-timestamp=%)")
213 trace-root.c: trace-root.c-timestamp
214 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
215 trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
216 $(call quiet-command,$(TRACETOOL) \
217 --group=root \
218 --format=c \
219 --backends=$(TRACE_BACKENDS) \
220 $< > $@,"GEN","$(@:%-timestamp=%)")
222 trace-ust-root.h: trace-ust-root.h-timestamp
223 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
224 trace-ust-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
225 $(call quiet-command,$(TRACETOOL) \
226 --group=root \
227 --format=ust-events-h \
228 --backends=$(TRACE_BACKENDS) \
229 $< > $@,"GEN","$(@:%-timestamp=%)")
231 trace-ust-all.h: trace-ust-all.h-timestamp
232 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
233 trace-ust-all.h-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak
234 $(call quiet-command,$(TRACETOOL) \
235 --group=all \
236 --format=ust-events-h \
237 --backends=$(TRACE_BACKENDS) \
238 $(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)")
240 trace-ust-all.c: trace-ust-all.c-timestamp
241 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
242 trace-ust-all.c-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak
243 $(call quiet-command,$(TRACETOOL) \
244 --group=all \
245 --format=ust-events-c \
246 --backends=$(TRACE_BACKENDS) \
247 $(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)")
249 trace-dtrace-root.dtrace: trace-dtrace-root.dtrace-timestamp
250 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
251 trace-dtrace-root.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
252 $(call quiet-command,$(TRACETOOL) \
253 --group=root \
254 --format=d \
255 --backends=$(TRACE_BACKENDS) \
256 $< > $@,"GEN","$(@:%-timestamp=%)")
258 trace-dtrace-root.h: trace-dtrace-root.dtrace
259 $(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@")
261 trace-dtrace-root.o: trace-dtrace-root.dtrace
263 KEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen
264 KEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv
266 KEYCODEMAP_FILES = \
267 ui/input-keymap-atset1-to-qcode.c \
268 ui/input-keymap-linux-to-qcode.c \
269 ui/input-keymap-qcode-to-atset1.c \
270 ui/input-keymap-qcode-to-atset2.c \
271 ui/input-keymap-qcode-to-atset3.c \
272 ui/input-keymap-qcode-to-linux.c \
273 ui/input-keymap-qcode-to-qnum.c \
274 ui/input-keymap-qcode-to-sun.c \
275 ui/input-keymap-qnum-to-qcode.c \
276 ui/input-keymap-usb-to-qcode.c \
277 ui/input-keymap-win32-to-qcode.c \
278 ui/input-keymap-x11-to-qcode.c \
279 ui/input-keymap-xorgevdev-to-qcode.c \
280 ui/input-keymap-xorgkbd-to-qcode.c \
281 ui/input-keymap-xorgxquartz-to-qcode.c \
282 ui/input-keymap-xorgxwin-to-qcode.c \
283 ui/input-keymap-osx-to-qcode.c \
284 $(NULL)
286 generated-files-$(CONFIG_SOFTMMU) += $(KEYCODEMAP_FILES)
288 ui/input-keymap-%.c: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile.objs
289 $(call quiet-command,\
290 stem=$* && src=$${stem%-to-*} dst=$${stem#*-to-} && \
291 test -e $(KEYCODEMAP_GEN) && \
292 $(PYTHON) $(KEYCODEMAP_GEN) \
293 --lang glib2 \
294 --varname qemu_input_map_$${src}_to_$${dst} \
295 code-map $(KEYCODEMAP_CSV) $${src} $${dst} \
296 > $@ || rm -f $@, "GEN", "$@")
298 $(KEYCODEMAP_GEN): .git-submodule-status
299 $(KEYCODEMAP_CSV): .git-submodule-status
301 edk2-decompressed = $(basename $(wildcard pc-bios/edk2-*.fd.bz2))
302 pc-bios/edk2-%.fd: pc-bios/edk2-%.fd.bz2
303 $(call quiet-command,bzip2 -d -c $< > $@,"BUNZIP2",$<)
305 # Don't try to regenerate Makefile or configure
306 # We don't generate any of them
307 Makefile: ;
308 configure: ;
310 .PHONY: all clean cscope distclean html info install install-doc \
311 pdf txt recurse-all dist msi FORCE
313 $(call set-vpath, $(SRC_PATH))
315 LIBS+=-lz $(LIBS_TOOLS)
317 vhost-user-json-y =
318 HELPERS-y =
320 HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = qemu-bridge-helper$(EXESUF)
322 ifdef CONFIG_LINUX
323 ifdef CONFIG_VIRGL
324 ifdef CONFIG_GBM
325 HELPERS-y += vhost-user-gpu$(EXESUF)
326 vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json
327 endif
328 endif
329 endif
331 ifdef BUILD_DOCS
332 DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8
333 DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
334 DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
335 DOCS+=docs/qemu-block-drivers.7
336 DOCS+=docs/qemu-cpu-models.7
337 ifdef CONFIG_VIRTFS
338 DOCS+=fsdev/virtfs-proxy-helper.1
339 endif
340 ifdef CONFIG_TRACE_SYSTEMTAP
341 DOCS+=scripts/qemu-trace-stap.1
342 endif
343 else
344 DOCS=
345 endif
347 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
348 SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(filter %-softmmu, $(TARGET_DIRS)))
349 SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK))
351 ifeq ($(SUBDIR_DEVICES_MAK),)
352 config-all-devices.mak: config-host.mak
353 $(call quiet-command,echo '# no devices' > $@,"GEN","$@")
354 else
355 config-all-devices.mak: $(SUBDIR_DEVICES_MAK) config-host.mak
356 $(call quiet-command, sed -n \
357 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
358 $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
359 "GEN","$@")
360 endif
362 -include $(SUBDIR_DEVICES_MAK_DEP)
364 # This has to be kept in sync with Kconfig.host.
365 MINIKCONF_ARGS = \
366 $(CONFIG_MINIKCONF_MODE) \
367 $@ $*/config-devices.mak.d $< $(MINIKCONF_INPUTS) \
368 CONFIG_KVM=$(CONFIG_KVM) \
369 CONFIG_SPICE=$(CONFIG_SPICE) \
370 CONFIG_IVSHMEM=$(CONFIG_IVSHMEM) \
371 CONFIG_TPM=$(CONFIG_TPM) \
372 CONFIG_XEN=$(CONFIG_XEN) \
373 CONFIG_OPENGL=$(CONFIG_OPENGL) \
374 CONFIG_X11=$(CONFIG_X11) \
375 CONFIG_VHOST_USER=$(CONFIG_VHOST_USER) \
376 CONFIG_VIRTFS=$(CONFIG_VIRTFS) \
377 CONFIG_LINUX=$(CONFIG_LINUX) \
378 CONFIG_PVRDMA=$(CONFIG_PVRDMA)
380 MINIKCONF_INPUTS = $(SRC_PATH)/Kconfig.host $(SRC_PATH)/hw/Kconfig
381 MINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py \
383 $(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak $(MINIKCONF_INPUTS) $(BUILD_DIR)/config-host.mak
384 $(call quiet-command, $(MINIKCONF) $(MINIKCONF_ARGS) > $@.tmp, "GEN", "$@.tmp")
385 $(call quiet-command, if test -f $@; then \
386 if cmp -s $@.old $@; then \
387 mv $@.tmp $@; \
388 cp -p $@ $@.old; \
389 else \
390 if test -f $@.old; then \
391 echo "WARNING: $@ (user modified) out of date.";\
392 else \
393 echo "WARNING: $@ out of date.";\
394 fi; \
395 echo "Run \"$(MAKE) defconfig\" to regenerate."; \
396 rm $@.tmp; \
397 fi; \
398 else \
399 mv $@.tmp $@; \
400 cp -p $@ $@.old; \
401 fi,"GEN","$@");
403 defconfig:
404 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
406 ifneq ($(wildcard config-host.mak),)
407 include $(SRC_PATH)/Makefile.objs
408 endif
410 dummy := $(call unnest-vars,, \
411 stub-obj-y \
412 authz-obj-y \
413 chardev-obj-y \
414 util-obj-y \
415 qga-obj-y \
416 elf2dmp-obj-y \
417 ivshmem-client-obj-y \
418 ivshmem-server-obj-y \
419 rdmacm-mux-obj-y \
420 libvhost-user-obj-y \
421 vhost-user-scsi-obj-y \
422 vhost-user-blk-obj-y \
423 vhost-user-input-obj-y \
424 vhost-user-gpu-obj-y \
425 qga-vss-dll-obj-y \
426 block-obj-y \
427 block-obj-m \
428 crypto-obj-y \
429 crypto-user-obj-y \
430 qom-obj-y \
431 io-obj-y \
432 common-obj-y \
433 common-obj-m \
434 ui-obj-y \
435 ui-obj-m \
436 audio-obj-y \
437 audio-obj-m \
438 trace-obj-y)
440 include $(SRC_PATH)/tests/Makefile.include
442 all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all modules $(vhost-user-json-y)
444 qemu-version.h: FORCE
445 $(call quiet-command, \
446 (printf '#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \
447 printf '#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \
448 ) > $@.tmp)
449 $(call quiet-command, if ! cmp -s $@ $@.tmp; then \
450 mv $@.tmp $@; \
451 else \
452 rm $@.tmp; \
455 config-host.h: config-host.h-timestamp
456 config-host.h-timestamp: config-host.mak
457 qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
458 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
460 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
461 SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
463 $(SOFTMMU_SUBDIR_RULES): $(authz-obj-y)
464 $(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
465 $(SOFTMMU_SUBDIR_RULES): $(chardev-obj-y)
466 $(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
467 $(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
468 $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
469 $(SOFTMMU_SUBDIR_RULES): $(edk2-decompressed)
471 subdir-%:
472 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
474 DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
475 DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
476 DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
478 subdir-dtc: .git-submodule-status dtc/libfdt dtc/tests
479 $(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,)
481 dtc/%: .git-submodule-status
482 @mkdir -p $@
484 # Overriding CFLAGS causes us to lose defines added in the sub-makefile.
485 # Not overriding CFLAGS leads to mis-matches between compilation modes.
486 # Therefore we replicate some of the logic in the sub-makefile.
487 # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
488 # no need to annoy QEMU developers with such things.
489 CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS))
490 CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
491 CAP_CFLAGS += -DCAPSTONE_HAS_ARM
492 CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
493 CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
494 CAP_CFLAGS += -DCAPSTONE_HAS_X86
496 subdir-capstone: .git-submodule-status
497 $(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))
499 subdir-slirp: .git-submodule-status
500 $(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp BUILD_DIR="$(BUILD_DIR)/slirp" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)")
502 $(SUBDIR_RULES): libqemuutil.a $(common-obj-y) \
503 $(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY))
505 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
506 # Only keep -O and -g cflags
507 romsubdir-%:
508 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
510 ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
512 recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
514 $(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
515 $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
517 Makefile: $(version-obj-y)
519 ######################################################################
520 # Build libraries
522 libqemuutil.a: $(util-obj-y) $(trace-obj-y) $(stub-obj-y)
523 libvhost-user.a: $(libvhost-user-obj-y) $(util-obj-y) $(stub-obj-y)
525 ######################################################################
527 COMMON_LDADDS = libqemuutil.a
529 qemu-img.o: qemu-img-cmds.h
531 qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
532 qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
533 qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
535 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
537 qemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS)
539 qemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS)
541 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
542 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
544 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)
545 ifdef CONFIG_MPATH
546 scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
547 endif
549 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
550 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
552 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
553 qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
555 qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
556 qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
558 qapi-py = $(SRC_PATH)/scripts/qapi/commands.py \
559 $(SRC_PATH)/scripts/qapi/events.py \
560 $(SRC_PATH)/scripts/qapi/introspect.py \
561 $(SRC_PATH)/scripts/qapi/types.py \
562 $(SRC_PATH)/scripts/qapi/visit.py \
563 $(SRC_PATH)/scripts/qapi/common.py \
564 $(SRC_PATH)/scripts/qapi/doc.py \
565 $(SRC_PATH)/scripts/qapi-gen.py
567 qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
568 qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h \
569 qga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \
570 qga/qapi-generated/qga-qapi-doc.texi: \
571 qga/qapi-generated/qapi-gen-timestamp ;
572 qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
573 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
574 -o qga/qapi-generated -p "qga-" $<, \
575 "GEN","$(@:%-timestamp=%)")
576 @>$@
578 qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json \
579 $(QAPI_MODULES:%=$(SRC_PATH)/qapi/%.json)
581 $(GENERATED_QAPI_FILES): qapi-gen-timestamp ;
582 qapi-gen-timestamp: $(qapi-modules) $(qapi-py)
583 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
584 -o "qapi" -b $<, \
585 "GEN","$(@:%-timestamp=%)")
586 @>$@
588 QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h)
589 $(qga-obj-y): $(QGALIB_GEN)
591 qemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
592 $(call LINK, $^)
594 ifdef QEMU_GA_MSI_ENABLED
595 QEMU_GA_MSI=qemu-ga-$(ARCH).msi
597 msi: $(QEMU_GA_MSI)
599 $(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
601 $(QEMU_GA_MSI): config-host.mak
603 $(QEMU_GA_MSI): $(SRC_PATH)/qga/installer/qemu-ga.wxs
604 $(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)" \
605 wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<,"WIXL","$@")
606 else
607 msi:
608 @echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
609 endif
611 ifneq ($(EXESUF),)
612 .PHONY: qemu-ga
613 qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
614 endif
616 elf2dmp$(EXESUF): LIBS += $(CURL_LIBS)
617 elf2dmp$(EXESUF): $(elf2dmp-obj-y)
618 $(call LINK, $^)
620 ifdef CONFIG_IVSHMEM
621 ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS)
622 $(call LINK, $^)
623 ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
624 $(call LINK, $^)
625 endif
626 vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a
627 $(call LINK, $^)
628 vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a
629 $(call LINK, $^)
631 rdmacm-mux$(EXESUF): LIBS += "-libumad"
632 rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
633 $(call LINK, $^)
635 vhost-user-gpu$(EXESUF): $(vhost-user-gpu-obj-y) $(libvhost-user-obj-y) libqemuutil.a libqemustub.a
636 $(call LINK, $^)
638 ifdef CONFIG_VHOST_USER_INPUT
639 ifdef CONFIG_LINUX
640 vhost-user-input$(EXESUF): $(vhost-user-input-obj-y) libvhost-user.a libqemuutil.a
641 $(call LINK, $^)
643 # build by default, do not install
644 all: vhost-user-input$(EXESUF)
645 endif
646 endif
648 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
649 $(call quiet-command,$(PYTHON) $< $@ \
650 $(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
651 "GEN","$@")
653 ifdef CONFIG_GCOV
654 .PHONY: clean-coverage
655 clean-coverage:
656 $(call quiet-command, \
657 find . \( -name '*.gcda' -o -name '*.gcov' \) -type f -exec rm {} +, \
658 "CLEAN", "coverage files")
659 endif
661 clean:
662 # avoid old build problems by removing potentially incorrect old files
663 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
664 rm -f qemu-options.def
665 rm -f *.msi
666 find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \
667 ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
668 ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
669 ! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
670 -exec rm {} +
671 rm -f $(edk2-decompressed)
672 rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga$(EXESUF) TAGS cscope.* *.pod *~ */*~
673 rm -f fsdev/*.pod scsi/*.pod
674 rm -f qemu-img-cmds.h
675 rm -f ui/shader/*-vert.h ui/shader/*-frag.h
676 @# May not be present in generated-files-y
677 rm -f trace/generated-tracers-dtrace.dtrace*
678 rm -f trace/generated-tracers-dtrace.h*
679 rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
680 rm -f qapi-gen-timestamp
681 rm -rf qga/qapi-generated
682 for d in $(ALL_SUBDIRS); do \
683 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
684 rm -f $$d/qemu-options.def; \
685 done
686 rm -f config-all-devices.mak
688 VERSION ?= $(shell cat VERSION)
690 dist: qemu-$(VERSION).tar.bz2
692 qemu-%.tar.bz2:
693 $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
695 # Sphinx does not allow building manuals into the same directory as
696 # the source files, so if we're doing an in-tree QEMU build we must
697 # build the manuals into a subdirectory (and then install them from
698 # there for 'make install'). For an out-of-tree build we can just
699 # use the docs/ subdirectory in the build tree as normal.
700 ifeq ($(realpath $(SRC_PATH)),$(realpath .))
701 MANUAL_BUILDDIR := docs/built
702 else
703 MANUAL_BUILDDIR := docs
704 endif
706 define clean-manual =
707 rm -rf $(MANUAL_BUILDDIR)/$1/_static
708 rm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(MANUAL_BUILDDIR)/$1/*.html
709 endef
711 distclean: clean
712 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
713 rm -f config-all-devices.mak config-all-disas.mak config.status
714 rm -f $(SUBDIR_DEVICES_MAK)
715 rm -f po/*.mo tests/qemu-iotests/common.env
716 rm -f roms/seabios/config.mak roms/vgabios/config.mak
717 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps
718 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
719 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
720 rm -f qemu-doc.vr qemu-doc.txt
721 rm -f config.log
722 rm -f linux-headers/asm
723 rm -f docs/version.texi
724 rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi
725 rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7
726 rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
727 rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
728 rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
729 rm -f docs/qemu-block-drivers.7
730 rm -f docs/qemu-cpu-models.7
731 rm -rf .doctrees
732 $(call clean-manual,devel)
733 $(call clean-manual,interop)
734 $(call clean-manual,specs)
735 for d in $(TARGET_DIRS); do \
736 rm -rf $$d || exit 1 ; \
737 done
738 rm -Rf .sdk
739 if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
741 KEYMAPS=da en-gb et fr fr-ch is lt no pt-br sv \
742 ar de en-us fi fr-be hr it lv nl pl ru th \
743 de-ch es fo fr-ca hu ja mk pt sl tr \
744 bepo cz
746 ifdef INSTALL_BLOBS
747 BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
748 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
749 vgabios-ramfb.bin vgabios-bochs-display.bin \
750 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
751 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
752 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
753 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
754 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
755 efi-e1000e.rom efi-vmxnet3.rom \
756 bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
757 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
758 s390-ccw.img s390-netboot.img \
759 spapr-rtas.bin slof.bin skiboot.lid \
760 palcode-clipper \
761 u-boot.e500 u-boot-sam460-20100605.bin \
762 qemu_vga.ndrv \
763 edk2-licenses.txt \
764 hppa-firmware.img
766 DESCS=50-edk2-i386-secure.json 50-edk2-x86_64-secure.json \
767 60-edk2-aarch64.json 60-edk2-arm.json 60-edk2-i386.json 60-edk2-x86_64.json
768 else
769 BLOBS=
770 DESCS=
771 endif
773 # Note that we manually filter-out the non-Sphinx documentation which
774 # is currently built into the docs/interop directory in the build tree.
775 define install-manual =
776 for d in $$(cd $(MANUAL_BUILDDIR) && find $1 -type d); do $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/$$d"; done
777 for f in $$(cd $(MANUAL_BUILDDIR) && find $1 -type f -a '!' '(' -name 'qemu-*-qapi.*' -o -name 'qemu-*-ref.*' ')' ); do $(INSTALL_DATA) "$(MANUAL_BUILDDIR)/$$f" "$(DESTDIR)$(qemu_docdir)/$$f"; done
778 endef
780 # Note that we deliberately do not install the "devel" manual: it is
781 # for QEMU developers, and not interesting to our users.
782 .PHONY: install-sphinxdocs
783 install-sphinxdocs: sphinxdocs
784 $(call install-manual,interop)
785 $(call install-manual,specs)
787 install-doc: $(DOCS) install-sphinxdocs
788 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
789 $(INSTALL_DATA) qemu-doc.html "$(DESTDIR)$(qemu_docdir)"
790 $(INSTALL_DATA) qemu-doc.txt "$(DESTDIR)$(qemu_docdir)"
791 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)"
792 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)"
793 ifdef CONFIG_POSIX
794 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
795 $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
796 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
797 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
798 $(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
799 $(INSTALL_DATA) docs/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
800 ifneq ($(TOOLS),)
801 $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
802 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
803 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
804 endif
805 ifdef CONFIG_TRACE_SYSTEMTAP
806 $(INSTALL_DATA) scripts/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
807 endif
808 ifneq (,$(findstring qemu-ga,$(TOOLS)))
809 $(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
810 $(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)"
811 $(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)"
812 $(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
813 endif
814 endif
815 ifdef CONFIG_VIRTFS
816 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
817 $(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
818 endif
820 install-datadir:
821 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
823 install-localstatedir:
824 ifdef CONFIG_POSIX
825 ifneq (,$(findstring qemu-ga,$(TOOLS)))
826 $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
827 endif
828 endif
830 ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
832 install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir \
833 $(if $(INSTALL_BLOBS),$(edk2-decompressed))
834 ifneq ($(TOOLS),)
835 $(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
836 endif
837 ifneq ($(CONFIG_MODULES),)
838 $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
839 for s in $(modules-m:.mo=$(DSOSUF)); do \
840 t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
841 $(INSTALL_LIB) $$s "$$t"; \
842 test -z "$(STRIP)" || $(STRIP) "$$t"; \
843 done
844 endif
845 ifneq ($(HELPERS-y),)
846 $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
847 endif
848 ifneq ($(vhost-user-json-y),)
849 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/vhost-user/"
850 for x in $(vhost-user-json-y); do \
851 $(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)/vhost-user/"; \
852 done
853 endif
854 ifdef CONFIG_TRACE_SYSTEMTAP
855 $(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
856 endif
857 ifneq ($(BLOBS),)
858 set -e; for x in $(BLOBS); do \
859 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
860 done
861 endif
862 ifdef INSTALL_BLOBS
863 set -e; for x in $(edk2-decompressed); do \
864 $(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)"; \
865 done
866 endif
867 ifneq ($(DESCS),)
868 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/firmware"
869 set -e; tmpf=$$(mktemp); trap 'rm -f -- "$$tmpf"' EXIT; \
870 for x in $(DESCS); do \
871 sed -e 's,@DATADIR@,$(DESTDIR)$(qemu_datadir),' \
872 "$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
873 $(INSTALL_DATA) "$$tmpf" \
874 "$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
875 done
876 endif
877 for s in $(ICON_SIZES); do \
878 mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/$${s}/apps"; \
879 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \
880 "$(DESTDIR)/$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
881 done; \
882 mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/32x32/apps"; \
883 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \
884 "$(DESTDIR)/$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
885 mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/scalable/apps"; \
886 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \
887 "$(DESTDIR)/$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
888 mkdir -p "$(DESTDIR)/$(qemu_desktopdir)"
889 $(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
890 "$(DESTDIR)/$(qemu_desktopdir)/qemu.desktop"
891 ifdef CONFIG_GTK
892 $(MAKE) -C po $@
893 endif
894 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
895 set -e; for x in $(KEYMAPS); do \
896 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
897 done
898 $(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
899 for d in $(TARGET_DIRS); do \
900 $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
901 done
903 .PHONY: ctags
904 ctags:
905 rm -f tags
906 find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
908 .PHONY: TAGS
909 TAGS:
910 rm -f TAGS
911 find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
913 cscope:
914 rm -f "$(SRC_PATH)"/cscope.*
915 find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
916 cscope -b -i"$(SRC_PATH)/cscope.files"
918 # opengl shader programs
919 ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
920 @mkdir -p $(dir $@)
921 $(call quiet-command,\
922 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
923 "VERT","$@")
925 ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
926 @mkdir -p $(dir $@)
927 $(call quiet-command,\
928 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
929 "FRAG","$@")
931 ui/shader.o: $(SRC_PATH)/ui/shader.c \
932 ui/shader/texture-blit-vert.h \
933 ui/shader/texture-blit-flip-vert.h \
934 ui/shader/texture-blit-frag.h
936 # documentation
937 MAKEINFO=makeinfo
938 MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
939 MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
940 TEXI2PODFLAGS=$(MAKEINFOINCLUDES) -DVERSION="$(VERSION)" -DCONFDIR="$(qemu_confdir)"
941 TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
943 docs/version.texi: $(SRC_PATH)/VERSION config-host.mak
944 $(call quiet-command,(\
945 echo "@set VERSION $(VERSION)" && \
946 echo "@set CONFDIR $(qemu_confdir)" \
947 )> $@,"GEN","$@")
949 %.html: %.texi docs/version.texi
950 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
951 --html $< -o $@,"GEN","$@")
953 %.info: %.texi docs/version.texi
954 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
956 %.txt: %.texi docs/version.texi
957 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
958 --plaintext $< -o $@,"GEN","$@")
960 %.pdf: %.texi docs/version.texi
961 $(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@")
963 # Sphinx builds all its documentation at once in one invocation
964 # and handles "don't rebuild things unless necessary" itself.
965 # The '.doctrees' files are cached information to speed this up.
966 .PHONY: sphinxdocs
967 sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MANUAL_BUILDDIR)/interop/index.html $(MANUAL_BUILDDIR)/specs/index.html
969 # Canned command to build a single manual
970 build-manual = $(call quiet-command,sphinx-build $(if $(V),,-q) -W -n -b html -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
971 # We assume all RST files in the manual's directory are used in it
972 manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst) $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py
974 $(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel)
975 $(call build-manual,devel)
977 $(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop)
978 $(call build-manual,interop)
980 $(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
981 $(call build-manual,specs)
983 qemu-options.texi: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
984 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
986 qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
987 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
989 qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
990 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
992 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
993 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
995 docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
996 @cp -p $< $@
998 docs/interop/qemu-ga-qapi.texi: qga/qapi-generated/qga-qapi-doc.texi
999 @cp -p $< $@
1001 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
1002 qemu.1: qemu-option-trace.texi
1003 qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
1004 fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
1005 qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
1006 qemu-ga.8: qemu-ga.texi
1007 docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
1008 docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
1009 scripts/qemu-trace-stap.1: scripts/qemu-trace-stap.texi
1011 html: qemu-doc.html docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs
1012 info: qemu-doc.info docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
1013 pdf: qemu-doc.pdf docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
1014 txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
1016 qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
1017 qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \
1018 qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
1019 qemu-monitor-info.texi docs/qemu-block-drivers.texi \
1020 docs/qemu-cpu-models.texi docs/security.texi
1022 docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
1023 docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
1024 docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \
1025 docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi
1027 docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
1028 docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \
1029 docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
1030 docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
1032 $(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl
1034 # Reports/Analysis
1036 %/coverage-report.html:
1037 @mkdir -p $*
1038 $(call quiet-command,\
1039 gcovr -r $(SRC_PATH) \
1040 $(foreach t, $(TARGET_DIRS), --object-directory $(BUILD_DIR)/$(t)) \
1041 --object-directory $(BUILD_DIR) \
1042 -p --html --html-details -o $@, \
1043 "GEN", "coverage-report.html")
1045 .PHONY: coverage-report
1046 coverage-report: $(CURDIR)/reports/coverage/coverage-report.html
1048 ifdef CONFIG_WIN32
1050 INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
1052 nsisflags = -V2 -NOCD
1054 ifneq ($(wildcard $(SRC_PATH)/dll),)
1055 ifeq ($(ARCH),x86_64)
1056 # 64 bit executables
1057 DLL_PATH = $(SRC_PATH)/dll/w64
1058 nsisflags += -DW64
1059 else
1060 # 32 bit executables
1061 DLL_PATH = $(SRC_PATH)/dll/w32
1062 endif
1063 endif
1065 .PHONY: installer
1066 installer: $(INSTALLER)
1068 INSTDIR=/tmp/qemu-nsis
1070 $(INSTALLER): $(SRC_PATH)/qemu.nsi
1071 $(MAKE) install prefix=${INSTDIR}
1072 ifdef SIGNCODE
1073 (cd ${INSTDIR}; \
1074 for i in *.exe; do \
1075 $(SIGNCODE) $${i}; \
1076 done \
1078 endif # SIGNCODE
1079 (cd ${INSTDIR}; \
1080 for i in qemu-system-*.exe; do \
1081 arch=$${i%.exe}; \
1082 arch=$${arch#qemu-system-}; \
1083 echo Section \"$$arch\" Section_$$arch; \
1084 echo SetOutPath \"\$$INSTDIR\"; \
1085 echo File \"\$${BINDIR}\\$$i\"; \
1086 echo SectionEnd; \
1087 done \
1088 ) >${INSTDIR}/system-emulations.nsh
1089 makensis $(nsisflags) \
1090 $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
1091 $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
1092 -DBINDIR="${INSTDIR}" \
1093 $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
1094 -DSRCDIR="$(SRC_PATH)" \
1095 -DOUTFILE="$(INSTALLER)" \
1096 -DDISPLAYVERSION="$(VERSION)" \
1097 $(SRC_PATH)/qemu.nsi
1098 rm -r ${INSTDIR}
1099 ifdef SIGNCODE
1100 $(SIGNCODE) $(INSTALLER)
1101 endif # SIGNCODE
1102 endif # CONFIG_WIN
1104 # Add a dependency on the generated files, so that they are always
1105 # rebuilt before other object files
1106 ifneq ($(wildcard config-host.mak),)
1107 ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
1108 Makefile: $(generated-files-y)
1109 endif
1110 endif
1112 .SECONDARY: $(TRACE_HEADERS) $(TRACE_HEADERS:%=%-timestamp) \
1113 $(TRACE_SOURCES) $(TRACE_SOURCES:%=%-timestamp) \
1114 $(TRACE_DTRACE) $(TRACE_DTRACE:%=%-timestamp)
1116 # Include automatically generated dependency files
1117 # Dependencies in Makefile.objs files come from our recursive subdir rules
1118 -include $(wildcard *.d tests/*.d)
1120 include $(SRC_PATH)/tests/docker/Makefile.include
1121 include $(SRC_PATH)/tests/vm/Makefile.include
1123 .PHONY: help
1124 help:
1125 @echo 'Generic targets:'
1126 @echo ' all - Build all'
1127 ifdef CONFIG_MODULES
1128 @echo ' modules - Build all modules'
1129 endif
1130 @echo ' dir/file.o - Build specified target only'
1131 @echo ' install - Install QEMU, documentation and tools'
1132 @echo ' ctags/TAGS - Generate tags file for editors'
1133 @echo ' cscope - Generate cscope index'
1134 @echo ''
1135 @$(if $(TARGET_DIRS), \
1136 echo 'Architecture specific targets:'; \
1137 $(foreach t, $(TARGET_DIRS), \
1138 printf " %-30s - Build for %s\\n" $(patsubst %,subdir-%,$(t)) $(t);) \
1139 echo '')
1140 @echo 'Cleaning targets:'
1141 @echo ' clean - Remove most generated files but keep the config'
1142 ifdef CONFIG_GCOV
1143 @echo ' clean-coverage - Remove coverage files'
1144 endif
1145 @echo ' distclean - Remove all generated files'
1146 @echo ' dist - Build a distributable tarball'
1147 @echo ''
1148 @echo 'Test targets:'
1149 @echo ' check - Run all tests (check-help for details)'
1150 @echo ' docker - Help about targets running tests inside Docker containers'
1151 @echo ' vm-test - Help about targets running tests inside VM'
1152 @echo ''
1153 @echo 'Documentation targets:'
1154 @echo ' html info pdf txt'
1155 @echo ' - Build documentation in specified format'
1156 ifdef CONFIG_GCOV
1157 @echo ' coverage-report - Create code coverage report'
1158 endif
1159 @echo ''
1160 ifdef CONFIG_WIN32
1161 @echo 'Windows targets:'
1162 @echo ' installer - Build NSIS-based installer for QEMU'
1163 ifdef QEMU_GA_MSI_ENABLED
1164 @echo ' msi - Build MSI-based installer for qemu-ga'
1165 endif
1166 @echo ''
1167 endif
1168 @echo ' $(MAKE) [targets] (quiet build, default)'
1169 @echo ' $(MAKE) V=1 [targets] (verbose build)'