Makefile, configure: Support building rST documentation
[qemu/ar7.git] / Makefile
blobadd22cf294735e66e7289321cda6327f6c8a3404
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 GENERATED_FILES = qemu-version.h config-host.h qemu-options.def
92 GENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c
93 GENERATED_QAPI_FILES += qapi/qapi-types.h qapi/qapi-types.c
94 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.h)
95 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.c)
96 GENERATED_QAPI_FILES += qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c
97 GENERATED_QAPI_FILES += qapi/qapi-visit.h qapi/qapi-visit.c
98 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.h)
99 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.c)
100 GENERATED_QAPI_FILES += qapi/qapi-commands.h qapi/qapi-commands.c
101 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.h)
102 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.c)
103 GENERATED_QAPI_FILES += qapi/qapi-emit-events.h qapi/qapi-emit-events.c
104 GENERATED_QAPI_FILES += qapi/qapi-events.h qapi/qapi-events.c
105 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.h)
106 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.c)
107 GENERATED_QAPI_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h
108 GENERATED_QAPI_FILES += qapi/qapi-doc.texi
110 GENERATED_FILES += $(GENERATED_QAPI_FILES)
112 GENERATED_FILES += trace/generated-tcg-tracers.h
114 GENERATED_FILES += trace/generated-helpers-wrappers.h
115 GENERATED_FILES += trace/generated-helpers.h
116 GENERATED_FILES += trace/generated-helpers.c
118 ifdef CONFIG_TRACE_UST
119 GENERATED_FILES += trace-ust-all.h
120 GENERATED_FILES += trace-ust-all.c
121 endif
123 GENERATED_FILES += module_block.h
125 TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h)
126 TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c)
127 TRACE_DTRACE =
128 ifdef CONFIG_TRACE_DTRACE
129 TRACE_HEADERS += trace-dtrace-root.h $(trace-events-subdirs:%=%/trace-dtrace.h)
130 TRACE_DTRACE += trace-dtrace-root.dtrace $(trace-events-subdirs:%=%/trace-dtrace.dtrace)
131 endif
132 ifdef CONFIG_TRACE_UST
133 TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h)
134 endif
136 GENERATED_FILES += $(TRACE_HEADERS)
137 GENERATED_FILES += $(TRACE_SOURCES)
138 GENERATED_FILES += $(BUILD_DIR)/trace-events-all
139 GENERATED_FILES += .git-submodule-status
141 trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
143 tracetool-y = $(SRC_PATH)/scripts/tracetool.py
144 tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
146 %/trace.h: %/trace.h-timestamp
147 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
148 %/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
149 $(call quiet-command,$(TRACETOOL) \
150 --group=$(call trace-group-name,$@) \
151 --format=h \
152 --backends=$(TRACE_BACKENDS) \
153 $< > $@,"GEN","$(@:%-timestamp=%)")
155 %/trace.c: %/trace.c-timestamp
156 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
157 %/trace.c-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
158 $(call quiet-command,$(TRACETOOL) \
159 --group=$(call trace-group-name,$@) \
160 --format=c \
161 --backends=$(TRACE_BACKENDS) \
162 $< > $@,"GEN","$(@:%-timestamp=%)")
164 %/trace-ust.h: %/trace-ust.h-timestamp
165 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
166 %/trace-ust.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
167 $(call quiet-command,$(TRACETOOL) \
168 --group=$(call trace-group-name,$@) \
169 --format=ust-events-h \
170 --backends=$(TRACE_BACKENDS) \
171 $< > $@,"GEN","$(@:%-timestamp=%)")
173 %/trace-dtrace.dtrace: %/trace-dtrace.dtrace-timestamp
174 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
175 %/trace-dtrace.dtrace-timestamp: $(SRC_PATH)/%/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
176 $(call quiet-command,$(TRACETOOL) \
177 --group=$(call trace-group-name,$@) \
178 --format=d \
179 --backends=$(TRACE_BACKENDS) \
180 $< > $@,"GEN","$(@:%-timestamp=%)")
182 %/trace-dtrace.h: %/trace-dtrace.dtrace $(tracetool-y)
183 $(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@")
185 %/trace-dtrace.o: %/trace-dtrace.dtrace $(tracetool-y)
188 trace-root.h: trace-root.h-timestamp
189 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
190 trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
191 $(call quiet-command,$(TRACETOOL) \
192 --group=root \
193 --format=h \
194 --backends=$(TRACE_BACKENDS) \
195 $< > $@,"GEN","$(@:%-timestamp=%)")
197 trace-root.c: trace-root.c-timestamp
198 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
199 trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
200 $(call quiet-command,$(TRACETOOL) \
201 --group=root \
202 --format=c \
203 --backends=$(TRACE_BACKENDS) \
204 $< > $@,"GEN","$(@:%-timestamp=%)")
206 trace-ust-root.h: trace-ust-root.h-timestamp
207 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
208 trace-ust-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
209 $(call quiet-command,$(TRACETOOL) \
210 --group=root \
211 --format=ust-events-h \
212 --backends=$(TRACE_BACKENDS) \
213 $< > $@,"GEN","$(@:%-timestamp=%)")
215 trace-ust-all.h: trace-ust-all.h-timestamp
216 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
217 trace-ust-all.h-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak
218 $(call quiet-command,$(TRACETOOL) \
219 --group=all \
220 --format=ust-events-h \
221 --backends=$(TRACE_BACKENDS) \
222 $(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)")
224 trace-ust-all.c: trace-ust-all.c-timestamp
225 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
226 trace-ust-all.c-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak
227 $(call quiet-command,$(TRACETOOL) \
228 --group=all \
229 --format=ust-events-c \
230 --backends=$(TRACE_BACKENDS) \
231 $(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)")
233 trace-dtrace-root.dtrace: trace-dtrace-root.dtrace-timestamp
234 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
235 trace-dtrace-root.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
236 $(call quiet-command,$(TRACETOOL) \
237 --group=root \
238 --format=d \
239 --backends=$(TRACE_BACKENDS) \
240 $< > $@,"GEN","$(@:%-timestamp=%)")
242 trace-dtrace-root.h: trace-dtrace-root.dtrace
243 $(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@")
245 trace-dtrace-root.o: trace-dtrace-root.dtrace
247 KEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen
248 KEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv
250 KEYCODEMAP_FILES = \
251 ui/input-keymap-atset1-to-qcode.c \
252 ui/input-keymap-linux-to-qcode.c \
253 ui/input-keymap-qcode-to-atset1.c \
254 ui/input-keymap-qcode-to-atset2.c \
255 ui/input-keymap-qcode-to-atset3.c \
256 ui/input-keymap-qcode-to-linux.c \
257 ui/input-keymap-qcode-to-qnum.c \
258 ui/input-keymap-qcode-to-sun.c \
259 ui/input-keymap-qnum-to-qcode.c \
260 ui/input-keymap-usb-to-qcode.c \
261 ui/input-keymap-win32-to-qcode.c \
262 ui/input-keymap-x11-to-qcode.c \
263 ui/input-keymap-xorgevdev-to-qcode.c \
264 ui/input-keymap-xorgkbd-to-qcode.c \
265 ui/input-keymap-xorgxquartz-to-qcode.c \
266 ui/input-keymap-xorgxwin-to-qcode.c \
267 ui/input-keymap-osx-to-qcode.c \
268 $(NULL)
270 GENERATED_FILES += $(KEYCODEMAP_FILES)
272 ui/input-keymap-%.c: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile.objs
273 $(call quiet-command,\
274 stem=$* && src=$${stem%-to-*} dst=$${stem#*-to-} && \
275 test -e $(KEYCODEMAP_GEN) && \
276 $(PYTHON) $(KEYCODEMAP_GEN) \
277 --lang glib2 \
278 --varname qemu_input_map_$${src}_to_$${dst} \
279 code-map $(KEYCODEMAP_CSV) $${src} $${dst} \
280 > $@ || rm -f $@, "GEN", "$@")
282 $(KEYCODEMAP_GEN): .git-submodule-status
283 $(KEYCODEMAP_CSV): .git-submodule-status
285 # Don't try to regenerate Makefile or configure
286 # We don't generate any of them
287 Makefile: ;
288 configure: ;
290 .PHONY: all clean cscope distclean html info install install-doc \
291 pdf txt recurse-all dist msi FORCE
293 $(call set-vpath, $(SRC_PATH))
295 LIBS+=-lz $(LIBS_TOOLS)
297 HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = qemu-bridge-helper$(EXESUF)
299 ifdef BUILD_DOCS
300 DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8
301 DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
302 DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
303 DOCS+=docs/qemu-block-drivers.7
304 DOCS+=docs/qemu-cpu-models.7
305 ifdef CONFIG_VIRTFS
306 DOCS+=fsdev/virtfs-proxy-helper.1
307 endif
308 ifdef CONFIG_TRACE_SYSTEMTAP
309 DOCS+=scripts/qemu-trace-stap.1
310 endif
311 else
312 DOCS=
313 endif
315 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
316 SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
317 SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
319 ifeq ($(SUBDIR_DEVICES_MAK),)
320 config-all-devices.mak:
321 $(call quiet-command,echo '# no devices' > $@,"GEN","$@")
322 else
323 config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
324 $(call quiet-command, sed -n \
325 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
326 $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
327 "GEN","$@")
328 endif
330 -include $(SUBDIR_DEVICES_MAK_DEP)
332 %/config-devices.mak: default-configs/%.mak $(SRC_PATH)/scripts/make_device_config.sh
333 $(call quiet-command, \
334 $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > $@.tmp,"GEN","$@.tmp")
335 $(call quiet-command, if test -f $@; then \
336 if cmp -s $@.old $@; then \
337 mv $@.tmp $@; \
338 cp -p $@ $@.old; \
339 else \
340 if test -f $@.old; then \
341 echo "WARNING: $@ (user modified) out of date.";\
342 else \
343 echo "WARNING: $@ out of date.";\
344 fi; \
345 echo "Run \"$(MAKE) defconfig\" to regenerate."; \
346 rm $@.tmp; \
347 fi; \
348 else \
349 mv $@.tmp $@; \
350 cp -p $@ $@.old; \
351 fi,"GEN","$@");
353 defconfig:
354 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
356 ifneq ($(wildcard config-host.mak),)
357 include $(SRC_PATH)/Makefile.objs
358 endif
360 dummy := $(call unnest-vars,, \
361 stub-obj-y \
362 authz-obj-y \
363 chardev-obj-y \
364 util-obj-y \
365 qga-obj-y \
366 elf2dmp-obj-y \
367 ivshmem-client-obj-y \
368 ivshmem-server-obj-y \
369 rdmacm-mux-obj-y \
370 libvhost-user-obj-y \
371 vhost-user-scsi-obj-y \
372 vhost-user-blk-obj-y \
373 qga-vss-dll-obj-y \
374 block-obj-y \
375 block-obj-m \
376 crypto-obj-y \
377 crypto-aes-obj-y \
378 qom-obj-y \
379 io-obj-y \
380 common-obj-y \
381 common-obj-m \
382 ui-obj-y \
383 ui-obj-m \
384 audio-obj-y \
385 audio-obj-m \
386 trace-obj-y \
387 slirp-obj-y)
389 include $(SRC_PATH)/tests/Makefile.include
391 all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all modules
393 qemu-version.h: FORCE
394 $(call quiet-command, \
395 (cd $(SRC_PATH); \
396 if test -n "$(PKGVERSION)"; then \
397 pkgvers="$(PKGVERSION)"; \
398 else \
399 if test -d .git; then \
400 pkgvers=$$(git describe --match 'v*' 2>/dev/null | tr -d '\n');\
401 if ! git diff-index --quiet HEAD &>/dev/null; then \
402 pkgvers="$${pkgvers}-dirty"; \
403 fi; \
404 fi; \
405 fi; \
406 printf "#define QEMU_PKGVERSION \"$${pkgvers}\"\n"; \
407 if test -n "$${pkgvers}"; then \
408 printf '#define QEMU_FULL_VERSION QEMU_VERSION " (" QEMU_PKGVERSION ")"\n'; \
409 else \
410 printf '#define QEMU_FULL_VERSION QEMU_VERSION\n'; \
411 fi; \
412 ) > $@.tmp)
413 $(call quiet-command, if ! cmp -s $@ $@.tmp; then \
414 mv $@.tmp $@; \
415 else \
416 rm $@.tmp; \
419 config-host.h: config-host.h-timestamp
420 config-host.h-timestamp: config-host.mak
421 qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
422 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
424 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
425 SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
427 $(SOFTMMU_SUBDIR_RULES): $(authz-obj-y)
428 $(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
429 $(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
430 $(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
431 $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
433 subdir-%:
434 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
436 DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
437 DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
438 DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
440 subdir-dtc: .git-submodule-status dtc/libfdt dtc/tests
441 $(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,)
443 dtc/%: .git-submodule-status
444 @mkdir -p $@
446 # Overriding CFLAGS causes us to lose defines added in the sub-makefile.
447 # Not overriding CFLAGS leads to mis-matches between compilation modes.
448 # Therefore we replicate some of the logic in the sub-makefile.
449 # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
450 # no need to annoy QEMU developers with such things.
451 CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS))
452 CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
453 CAP_CFLAGS += -DCAPSTONE_HAS_ARM
454 CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
455 CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
456 CAP_CFLAGS += -DCAPSTONE_HAS_X86
458 subdir-capstone: .git-submodule-status
459 $(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))
461 $(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) $(slirp-obj-y) \
462 $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
464 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
465 # Only keep -O and -g cflags
466 romsubdir-%:
467 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
469 ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
471 recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
473 $(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
474 $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
476 Makefile: $(version-obj-y)
478 ######################################################################
479 # Build libraries
481 libqemuutil.a: $(util-obj-y) $(trace-obj-y) $(stub-obj-y)
482 libvhost-user.a: $(libvhost-user-obj-y)
484 ######################################################################
486 COMMON_LDADDS = libqemuutil.a
488 qemu-img.o: qemu-img-cmds.h
490 qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
491 qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
492 qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
494 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
496 qemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS)
498 qemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS)
500 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
501 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
503 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)
504 ifdef CONFIG_MPATH
505 scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
506 endif
508 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
509 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
511 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
512 qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
514 qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
515 qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
517 qapi-py = $(SRC_PATH)/scripts/qapi/commands.py \
518 $(SRC_PATH)/scripts/qapi/events.py \
519 $(SRC_PATH)/scripts/qapi/introspect.py \
520 $(SRC_PATH)/scripts/qapi/types.py \
521 $(SRC_PATH)/scripts/qapi/visit.py \
522 $(SRC_PATH)/scripts/qapi/common.py \
523 $(SRC_PATH)/scripts/qapi/doc.py \
524 $(SRC_PATH)/scripts/qapi-gen.py
526 qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
527 qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h \
528 qga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \
529 qga/qapi-generated/qga-qapi-doc.texi: \
530 qga/qapi-generated/qapi-gen-timestamp ;
531 qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
532 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
533 -o qga/qapi-generated -p "qga-" $<, \
534 "GEN","$(@:%-timestamp=%)")
535 @>$@
537 qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json \
538 $(QAPI_MODULES:%=$(SRC_PATH)/qapi/%.json)
540 $(GENERATED_QAPI_FILES): qapi-gen-timestamp ;
541 qapi-gen-timestamp: $(qapi-modules) $(qapi-py)
542 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
543 -o "qapi" -b $<, \
544 "GEN","$(@:%-timestamp=%)")
545 @>$@
547 QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h)
548 $(qga-obj-y): $(QGALIB_GEN)
550 qemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
551 $(call LINK, $^)
553 ifdef QEMU_GA_MSI_ENABLED
554 QEMU_GA_MSI=qemu-ga-$(ARCH).msi
556 msi: $(QEMU_GA_MSI)
558 $(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
560 $(QEMU_GA_MSI): config-host.mak
562 $(QEMU_GA_MSI): $(SRC_PATH)/qga/installer/qemu-ga.wxs
563 $(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)" \
564 wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<,"WIXL","$@")
565 else
566 msi:
567 @echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
568 endif
570 ifneq ($(EXESUF),)
571 .PHONY: qemu-ga
572 qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
573 endif
575 elf2dmp$(EXESUF): LIBS += $(CURL_LIBS)
576 elf2dmp$(EXESUF): $(elf2dmp-obj-y)
577 $(call LINK, $^)
579 ifdef CONFIG_IVSHMEM
580 ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS)
581 $(call LINK, $^)
582 ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
583 $(call LINK, $^)
584 endif
585 vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a
586 $(call LINK, $^)
587 vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a
588 $(call LINK, $^)
590 rdmacm-mux$(EXESUF): LIBS += "-libumad"
591 rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
592 $(call LINK, $^)
594 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
595 $(call quiet-command,$(PYTHON) $< $@ \
596 $(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
597 "GEN","$@")
599 ifdef CONFIG_GCOV
600 .PHONY: clean-coverage
601 clean-coverage:
602 $(call quiet-command, \
603 find . \( -name '*.gcda' -o -name '*.gcov' \) -type f -exec rm {} +, \
604 "CLEAN", "coverage files")
605 endif
607 clean:
608 # avoid old build problems by removing potentially incorrect old files
609 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
610 rm -f qemu-options.def
611 rm -f *.msi
612 find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \
613 ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
614 ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
615 ! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
616 -exec rm {} +
617 rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
618 rm -f fsdev/*.pod scsi/*.pod
619 rm -f qemu-img-cmds.h
620 rm -f ui/shader/*-vert.h ui/shader/*-frag.h
621 @# May not be present in GENERATED_FILES
622 rm -f trace/generated-tracers-dtrace.dtrace*
623 rm -f trace/generated-tracers-dtrace.h*
624 rm -f $(foreach f,$(GENERATED_FILES),$(f) $(f)-timestamp)
625 rm -f qapi-gen-timestamp
626 rm -rf qga/qapi-generated
627 for d in $(ALL_SUBDIRS); do \
628 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
629 rm -f $$d/qemu-options.def; \
630 done
631 rm -f config-all-devices.mak
633 VERSION ?= $(shell cat VERSION)
635 dist: qemu-$(VERSION).tar.bz2
637 qemu-%.tar.bz2:
638 $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
640 # Note that these commands assume that there are no HTML files in
641 # the docs subdir in the source tree! If there are then this will
642 # blow them away for an in-source-tree 'make clean'.
643 define clean-manual =
644 rm -rf docs/$1/_static
645 rm -f docs/$1/objects.inv docs/$1/searchindex.js docs/$1/*.html
646 endef
648 distclean: clean
649 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
650 rm -f config-all-devices.mak config-all-disas.mak config.status
651 rm -f $(SUBDIR_DEVICES_MAK)
652 rm -f po/*.mo tests/qemu-iotests/common.env
653 rm -f roms/seabios/config.mak roms/vgabios/config.mak
654 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps
655 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
656 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
657 rm -f qemu-doc.vr qemu-doc.txt
658 rm -f config.log
659 rm -f linux-headers/asm
660 rm -f docs/version.texi
661 rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi
662 rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7
663 rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
664 rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
665 rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
666 rm -f docs/qemu-block-drivers.7
667 rm -f docs/qemu-cpu-models.7
668 rm -f .doctrees
669 $(call clean-manual,devel)
670 $(call clean-manual,interop)
671 for d in $(TARGET_DIRS); do \
672 rm -rf $$d || exit 1 ; \
673 done
674 rm -Rf .sdk
675 if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
677 KEYMAPS=da en-gb et fr fr-ch is lt no pt-br sv \
678 ar de en-us fi fr-be hr it lv nl pl ru th \
679 de-ch es fo fr-ca hu ja mk pt sl tr \
680 bepo cz
682 ifdef INSTALL_BLOBS
683 BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
684 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
685 vgabios-ramfb.bin vgabios-bochs-display.bin \
686 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
687 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
688 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
689 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
690 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
691 efi-e1000e.rom efi-vmxnet3.rom \
692 bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
693 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
694 s390-ccw.img s390-netboot.img \
695 spapr-rtas.bin slof.bin skiboot.lid \
696 palcode-clipper \
697 u-boot.e500 u-boot-sam460-20100605.bin \
698 qemu_vga.ndrv \
699 hppa-firmware.img
700 else
701 BLOBS=
702 endif
704 define install-manual =
705 for d in $$(cd docs && find $1 -type d); do $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/$$d"; done
706 for f in $$(cd docs && find $1 -type f); do $(INSTALL_DATA) "docs/$$f" "$(DESTDIR)$(qemu_docdir)/$$f"; done
707 endef
709 # Note that we deliberately do not install the "devel" manual: it is
710 # for QEMU developers, and not interesting to our users.
711 .PHONY: install-sphinxdocs
712 install-sphinxdocs: sphinxdocs
713 $(call install-manual,interop)
715 install-doc: $(DOCS) install-sphinxdocs
716 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
717 $(INSTALL_DATA) qemu-doc.html "$(DESTDIR)$(qemu_docdir)"
718 $(INSTALL_DATA) qemu-doc.txt "$(DESTDIR)$(qemu_docdir)"
719 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)"
720 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)"
721 ifdef CONFIG_POSIX
722 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
723 $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
724 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
725 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
726 $(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
727 $(INSTALL_DATA) docs/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
728 ifneq ($(TOOLS),)
729 $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
730 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
731 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
732 endif
733 ifdef CONFIG_TRACE_SYSTEMTAP
734 $(INSTALL_DATA) scripts/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
735 endif
736 ifneq (,$(findstring qemu-ga,$(TOOLS)))
737 $(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
738 $(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)"
739 $(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)"
740 $(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
741 endif
742 endif
743 ifdef CONFIG_VIRTFS
744 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
745 $(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
746 endif
748 install-datadir:
749 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
751 install-localstatedir:
752 ifdef CONFIG_POSIX
753 ifneq (,$(findstring qemu-ga,$(TOOLS)))
754 $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
755 endif
756 endif
758 ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
760 install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir
761 ifneq ($(TOOLS),)
762 $(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
763 endif
764 ifneq ($(CONFIG_MODULES),)
765 $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
766 for s in $(modules-m:.mo=$(DSOSUF)); do \
767 t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
768 $(INSTALL_LIB) $$s "$$t"; \
769 test -z "$(STRIP)" || $(STRIP) "$$t"; \
770 done
771 endif
772 ifneq ($(HELPERS-y),)
773 $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
774 endif
775 ifdef CONFIG_TRACE_SYSTEMTAP
776 $(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
777 endif
778 ifneq ($(BLOBS),)
779 set -e; for x in $(BLOBS); do \
780 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
781 done
782 endif
783 for s in $(ICON_SIZES); do \
784 mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/$${s}/apps"; \
785 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \
786 "$(DESTDIR)/$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
787 done; \
788 mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/32x32/apps"; \
789 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \
790 "$(DESTDIR)/$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
791 mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/scalable/apps"; \
792 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \
793 "$(DESTDIR)/$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
794 mkdir -p "$(DESTDIR)/$(qemu_desktopdir)"
795 $(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
796 "$(DESTDIR)/$(qemu_desktopdir)/qemu.desktop"
797 ifdef CONFIG_GTK
798 $(MAKE) -C po $@
799 endif
800 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
801 set -e; for x in $(KEYMAPS); do \
802 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
803 done
804 $(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
805 for d in $(TARGET_DIRS); do \
806 $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
807 done
809 .PHONY: ctags
810 ctags:
811 rm -f tags
812 find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
814 .PHONY: TAGS
815 TAGS:
816 rm -f TAGS
817 find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
819 cscope:
820 rm -f "$(SRC_PATH)"/cscope.*
821 find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
822 cscope -b -i"$(SRC_PATH)/cscope.files"
824 # opengl shader programs
825 ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
826 @mkdir -p $(dir $@)
827 $(call quiet-command,\
828 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
829 "VERT","$@")
831 ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
832 @mkdir -p $(dir $@)
833 $(call quiet-command,\
834 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
835 "FRAG","$@")
837 ui/shader.o: $(SRC_PATH)/ui/shader.c \
838 ui/shader/texture-blit-vert.h \
839 ui/shader/texture-blit-flip-vert.h \
840 ui/shader/texture-blit-frag.h
842 # documentation
843 MAKEINFO=makeinfo
844 MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
845 MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
846 TEXI2PODFLAGS=$(MAKEINFOINCLUDES) "-DVERSION=$(VERSION)"
847 TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
849 docs/version.texi: $(SRC_PATH)/VERSION
850 $(call quiet-command,echo "@set VERSION $(VERSION)" > $@,"GEN","$@")
852 %.html: %.texi docs/version.texi
853 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
854 --html $< -o $@,"GEN","$@")
856 %.info: %.texi docs/version.texi
857 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
859 %.txt: %.texi docs/version.texi
860 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
861 --plaintext $< -o $@,"GEN","$@")
863 %.pdf: %.texi docs/version.texi
864 $(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@")
866 # Sphinx builds all its documentation at once in one invocation
867 # and handles "don't rebuild things unless necessary" itself.
868 # The '.doctrees' files are cached information to speed this up.
869 .PHONY: sphinxdocs
870 sphinxdocs: docs/devel/index.html docs/interop/index.html
872 # Canned command to build a single manual
873 build-manual = $(call quiet-command,sphinx-build $(if $(V),,-q) -b html -d .doctrees/$1 $(SRC_PATH)/docs/$1 docs/$1 ,"SPHINX","docs/$1")
874 # We assume all RST files in the manual's directory are used in it
875 manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst) $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py
877 docs/devel/index.html: $(call manual-deps,devel)
878 $(call build-manual,devel)
880 docs/interop/index.html: $(call manual-deps,interop)
881 $(call build-manual,interop)
883 qemu-options.texi: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
884 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
886 qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
887 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
889 qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
890 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
892 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
893 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
895 docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
896 @cp -p $< $@
898 docs/interop/qemu-ga-qapi.texi: qga/qapi-generated/qga-qapi-doc.texi
899 @cp -p $< $@
901 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
902 qemu.1: qemu-option-trace.texi
903 qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
904 fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
905 qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
906 qemu-ga.8: qemu-ga.texi
907 docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
908 docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
909 scripts/qemu-trace-stap.1: scripts/qemu-trace-stap.texi
911 html: qemu-doc.html docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs
912 info: qemu-doc.info docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
913 pdf: qemu-doc.pdf docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
914 txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
916 qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
917 qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \
918 qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
919 qemu-monitor-info.texi docs/qemu-block-drivers.texi \
920 docs/qemu-cpu-models.texi
922 docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
923 docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
924 docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \
925 docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi
927 docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
928 docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \
929 docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
930 docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
932 $(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl
934 # Reports/Analysis
936 %/coverage-report.html:
937 @mkdir -p $*
938 $(call quiet-command,\
939 gcovr -p --html --html-details -o $@, \
940 "GEN", "coverage-report.html")
942 .PHONY: coverage-report
943 coverage-report: $(CURDIR)/reports/coverage/coverage-report.html
945 ifdef CONFIG_WIN32
947 INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
949 nsisflags = -V2 -NOCD
951 ifneq ($(wildcard $(SRC_PATH)/dll),)
952 ifeq ($(ARCH),x86_64)
953 # 64 bit executables
954 DLL_PATH = $(SRC_PATH)/dll/w64
955 nsisflags += -DW64
956 else
957 # 32 bit executables
958 DLL_PATH = $(SRC_PATH)/dll/w32
959 endif
960 endif
962 .PHONY: installer
963 installer: $(INSTALLER)
965 INSTDIR=/tmp/qemu-nsis
967 $(INSTALLER): $(SRC_PATH)/qemu.nsi
968 $(MAKE) install prefix=${INSTDIR}
969 ifdef SIGNCODE
970 (cd ${INSTDIR}; \
971 for i in *.exe; do \
972 $(SIGNCODE) $${i}; \
973 done \
975 endif # SIGNCODE
976 (cd ${INSTDIR}; \
977 for i in qemu-system-*.exe; do \
978 arch=$${i%.exe}; \
979 arch=$${arch#qemu-system-}; \
980 echo Section \"$$arch\" Section_$$arch; \
981 echo SetOutPath \"\$$INSTDIR\"; \
982 echo File \"\$${BINDIR}\\$$i\"; \
983 echo SectionEnd; \
984 done \
985 ) >${INSTDIR}/system-emulations.nsh
986 makensis $(nsisflags) \
987 $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
988 $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
989 -DBINDIR="${INSTDIR}" \
990 $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
991 -DSRCDIR="$(SRC_PATH)" \
992 -DOUTFILE="$(INSTALLER)" \
993 -DDISPLAYVERSION="$(VERSION)" \
994 $(SRC_PATH)/qemu.nsi
995 rm -r ${INSTDIR}
996 ifdef SIGNCODE
997 $(SIGNCODE) $(INSTALLER)
998 endif # SIGNCODE
999 endif # CONFIG_WIN
1001 # Add a dependency on the generated files, so that they are always
1002 # rebuilt before other object files
1003 ifneq ($(wildcard config-host.mak),)
1004 ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
1005 Makefile: $(GENERATED_FILES)
1006 endif
1007 endif
1009 .SECONDARY: $(TRACE_HEADERS) $(TRACE_HEADERS:%=%-timestamp) \
1010 $(TRACE_SOURCES) $(TRACE_SOURCES:%=%-timestamp) \
1011 $(TRACE_DTRACE) $(TRACE_DTRACE:%=%-timestamp)
1013 # Include automatically generated dependency files
1014 # Dependencies in Makefile.objs files come from our recursive subdir rules
1015 -include $(wildcard *.d tests/*.d)
1017 include $(SRC_PATH)/tests/docker/Makefile.include
1018 include $(SRC_PATH)/tests/vm/Makefile.include
1020 .PHONY: help
1021 help:
1022 @echo 'Generic targets:'
1023 @echo ' all - Build all'
1024 ifdef CONFIG_MODULES
1025 @echo ' modules - Build all modules'
1026 endif
1027 @echo ' dir/file.o - Build specified target only'
1028 @echo ' install - Install QEMU, documentation and tools'
1029 @echo ' ctags/TAGS - Generate tags file for editors'
1030 @echo ' cscope - Generate cscope index'
1031 @echo ''
1032 @$(if $(TARGET_DIRS), \
1033 echo 'Architecture specific targets:'; \
1034 $(foreach t, $(TARGET_DIRS), \
1035 printf " %-30s - Build for %s\\n" $(patsubst %,subdir-%,$(t)) $(t);) \
1036 echo '')
1037 @echo 'Cleaning targets:'
1038 @echo ' clean - Remove most generated files but keep the config'
1039 ifdef CONFIG_GCOV
1040 @echo ' clean-coverage - Remove coverage files'
1041 endif
1042 @echo ' distclean - Remove all generated files'
1043 @echo ' dist - Build a distributable tarball'
1044 @echo ''
1045 @echo 'Test targets:'
1046 @echo ' check - Run all tests (check-help for details)'
1047 @echo ' docker - Help about targets running tests inside Docker containers'
1048 @echo ' vm-test - Help about targets running tests inside VM'
1049 @echo ''
1050 @echo 'Documentation targets:'
1051 @echo ' html info pdf txt'
1052 @echo ' - Build documentation in specified format'
1053 ifdef CONFIG_GCOV
1054 @echo ' coverage-report - Create code coverage report'
1055 endif
1056 @echo ''
1057 ifdef CONFIG_WIN32
1058 @echo 'Windows targets:'
1059 @echo ' installer - Build NSIS-based installer for QEMU'
1060 ifdef QEMU_GA_MSI_ENABLED
1061 @echo ' msi - Build MSI-based installer for qemu-ga'
1062 endif
1063 @echo ''
1064 endif
1065 @echo ' $(MAKE) [targets] (quiet build, default)'
1066 @echo ' $(MAKE) V=1 [targets] (verbose build)'