nbd/client: Add meta contexts to nbd_receive_export_list()
[qemu.git] / Makefile
blob2639437cdaf0bda7e9333f1f90bec39a375ac82d
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 #see Makefile.objs for the definition of QAPI_MODULES
93 GENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c
94 GENERATED_QAPI_FILES += qapi/qapi-types.h qapi/qapi-types.c
95 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.h)
96 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.c)
97 GENERATED_QAPI_FILES += qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c
98 GENERATED_QAPI_FILES += qapi/qapi-visit.h qapi/qapi-visit.c
99 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.h)
100 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.c)
101 GENERATED_QAPI_FILES += qapi/qapi-commands.h qapi/qapi-commands.c
102 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.h)
103 GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.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)
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)
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)
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)
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)
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)
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)
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)
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 else
309 DOCS=
310 endif
312 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
313 SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
314 SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
316 ifeq ($(SUBDIR_DEVICES_MAK),)
317 config-all-devices.mak:
318 $(call quiet-command,echo '# no devices' > $@,"GEN","$@")
319 else
320 config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
321 $(call quiet-command, sed -n \
322 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
323 $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
324 "GEN","$@")
325 endif
327 -include $(SUBDIR_DEVICES_MAK_DEP)
329 %/config-devices.mak: default-configs/%.mak $(SRC_PATH)/scripts/make_device_config.sh
330 $(call quiet-command, \
331 $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > $@.tmp,"GEN","$@.tmp")
332 $(call quiet-command, if test -f $@; then \
333 if cmp -s $@.old $@; then \
334 mv $@.tmp $@; \
335 cp -p $@ $@.old; \
336 else \
337 if test -f $@.old; then \
338 echo "WARNING: $@ (user modified) out of date.";\
339 else \
340 echo "WARNING: $@ out of date.";\
341 fi; \
342 echo "Run \"$(MAKE) defconfig\" to regenerate."; \
343 rm $@.tmp; \
344 fi; \
345 else \
346 mv $@.tmp $@; \
347 cp -p $@ $@.old; \
348 fi,"GEN","$@");
350 defconfig:
351 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
353 ifneq ($(wildcard config-host.mak),)
354 include $(SRC_PATH)/Makefile.objs
355 endif
357 dummy := $(call unnest-vars,, \
358 stub-obj-y \
359 chardev-obj-y \
360 util-obj-y \
361 qga-obj-y \
362 elf2dmp-obj-y \
363 ivshmem-client-obj-y \
364 ivshmem-server-obj-y \
365 rdmacm-mux-obj-y \
366 libvhost-user-obj-y \
367 vhost-user-scsi-obj-y \
368 vhost-user-blk-obj-y \
369 qga-vss-dll-obj-y \
370 block-obj-y \
371 block-obj-m \
372 crypto-obj-y \
373 crypto-aes-obj-y \
374 qom-obj-y \
375 io-obj-y \
376 common-obj-y \
377 common-obj-m \
378 ui-obj-y \
379 ui-obj-m \
380 audio-obj-y \
381 audio-obj-m \
382 trace-obj-y \
383 slirp-obj-y)
385 include $(SRC_PATH)/tests/Makefile.include
387 all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules
389 qemu-version.h: FORCE
390 $(call quiet-command, \
391 (cd $(SRC_PATH); \
392 if test -n "$(PKGVERSION)"; then \
393 pkgvers="$(PKGVERSION)"; \
394 else \
395 if test -d .git; then \
396 pkgvers=$$(git describe --match 'v*' 2>/dev/null | tr -d '\n');\
397 if ! git diff-index --quiet HEAD &>/dev/null; then \
398 pkgvers="$${pkgvers}-dirty"; \
399 fi; \
400 fi; \
401 fi; \
402 printf "#define QEMU_PKGVERSION \"$${pkgvers}\"\n"; \
403 if test -n "$${pkgvers}"; then \
404 printf '#define QEMU_FULL_VERSION QEMU_VERSION " (" QEMU_PKGVERSION ")"\n'; \
405 else \
406 printf '#define QEMU_FULL_VERSION QEMU_VERSION\n'; \
407 fi; \
408 ) > $@.tmp)
409 $(call quiet-command, if ! cmp -s $@ $@.tmp; then \
410 mv $@.tmp $@; \
411 else \
412 rm $@.tmp; \
415 config-host.h: config-host.h-timestamp
416 config-host.h-timestamp: config-host.mak
417 qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
418 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
420 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
421 SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
423 $(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
424 $(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
425 $(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
426 $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
428 subdir-%:
429 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
431 DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
432 DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
433 DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
435 subdir-dtc: .git-submodule-status dtc/libfdt dtc/tests
436 $(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,)
438 dtc/%: .git-submodule-status
439 @mkdir -p $@
441 # Overriding CFLAGS causes us to lose defines added in the sub-makefile.
442 # Not overriding CFLAGS leads to mis-matches between compilation modes.
443 # Therefore we replicate some of the logic in the sub-makefile.
444 # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
445 # no need to annoy QEMU developers with such things.
446 CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS))
447 CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
448 CAP_CFLAGS += -DCAPSTONE_HAS_ARM
449 CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
450 CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
451 CAP_CFLAGS += -DCAPSTONE_HAS_X86
453 subdir-capstone: .git-submodule-status
454 $(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))
456 $(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) $(slirp-obj-y) \
457 $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
459 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
460 # Only keep -O and -g cflags
461 romsubdir-%:
462 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
464 ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
466 recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
468 $(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
469 $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
471 Makefile: $(version-obj-y)
473 ######################################################################
474 # Build libraries
476 libqemuutil.a: $(util-obj-y) $(trace-obj-y) $(stub-obj-y)
477 libvhost-user.a: $(libvhost-user-obj-y)
479 ######################################################################
481 COMMON_LDADDS = libqemuutil.a
483 qemu-img.o: qemu-img-cmds.h
485 qemu-img$(EXESUF): qemu-img.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
486 qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
487 qemu-io$(EXESUF): qemu-io.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
489 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
491 qemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS)
493 qemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS)
495 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
496 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
498 scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
499 ifdef CONFIG_MPATH
500 scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
501 endif
503 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
504 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
506 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
507 qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
509 qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
510 qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
512 qapi-py = $(SRC_PATH)/scripts/qapi/commands.py \
513 $(SRC_PATH)/scripts/qapi/events.py \
514 $(SRC_PATH)/scripts/qapi/introspect.py \
515 $(SRC_PATH)/scripts/qapi/types.py \
516 $(SRC_PATH)/scripts/qapi/visit.py \
517 $(SRC_PATH)/scripts/qapi/common.py \
518 $(SRC_PATH)/scripts/qapi/doc.py \
519 $(SRC_PATH)/scripts/qapi-gen.py
521 qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
522 qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h \
523 qga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \
524 qga/qapi-generated/qga-qapi-doc.texi: \
525 qga/qapi-generated/qapi-gen-timestamp ;
526 qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
527 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
528 -o qga/qapi-generated -p "qga-" $<, \
529 "GEN","$(@:%-timestamp=%)")
530 @>$@
532 qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json \
533 $(QAPI_MODULES:%=$(SRC_PATH)/qapi/%.json)
535 $(GENERATED_QAPI_FILES): qapi-gen-timestamp ;
536 qapi-gen-timestamp: $(qapi-modules) $(qapi-py)
537 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
538 -o "qapi" -b $<, \
539 "GEN","$(@:%-timestamp=%)")
540 @>$@
542 QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h)
543 $(qga-obj-y): $(QGALIB_GEN)
545 qemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
546 $(call LINK, $^)
548 ifdef QEMU_GA_MSI_ENABLED
549 QEMU_GA_MSI=qemu-ga-$(ARCH).msi
551 msi: $(QEMU_GA_MSI)
553 $(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
555 $(QEMU_GA_MSI): config-host.mak
557 $(QEMU_GA_MSI): $(SRC_PATH)/qga/installer/qemu-ga.wxs
558 $(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)" \
559 wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<,"WIXL","$@")
560 else
561 msi:
562 @echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
563 endif
565 ifneq ($(EXESUF),)
566 .PHONY: qemu-ga
567 qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
568 endif
570 elf2dmp: LIBS = $(CURL_LIBS)
571 elf2dmp: $(elf2dmp-obj-y)
572 $(call LINK, $^)
574 ifdef CONFIG_IVSHMEM
575 ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS)
576 $(call LINK, $^)
577 ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
578 $(call LINK, $^)
579 endif
580 vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a
581 $(call LINK, $^)
582 vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a
583 $(call LINK, $^)
584 rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
585 $(call LINK, $^)
587 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
588 $(call quiet-command,$(PYTHON) $< $@ \
589 $(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
590 "GEN","$@")
592 ifdef CONFIG_GCOV
593 .PHONY: clean-coverage
594 clean-coverage:
595 $(call quiet-command, \
596 find . \( -name '*.gcda' -o -name '*.gcov' \) -type f -exec rm {} +, \
597 "CLEAN", "coverage files")
598 endif
600 clean:
601 # avoid old build problems by removing potentially incorrect old files
602 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
603 rm -f qemu-options.def
604 rm -f *.msi
605 find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} +
606 rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
607 rm -f fsdev/*.pod scsi/*.pod
608 rm -f qemu-img-cmds.h
609 rm -f ui/shader/*-vert.h ui/shader/*-frag.h
610 @# May not be present in GENERATED_FILES
611 rm -f trace/generated-tracers-dtrace.dtrace*
612 rm -f trace/generated-tracers-dtrace.h*
613 rm -f $(foreach f,$(GENERATED_FILES),$(f) $(f)-timestamp)
614 rm -f qapi-gen-timestamp
615 rm -rf qga/qapi-generated
616 for d in $(ALL_SUBDIRS); do \
617 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
618 rm -f $$d/qemu-options.def; \
619 done
620 rm -f config-all-devices.mak
622 VERSION ?= $(shell cat VERSION)
624 dist: qemu-$(VERSION).tar.bz2
626 qemu-%.tar.bz2:
627 $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
629 distclean: clean
630 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
631 rm -f config-all-devices.mak config-all-disas.mak config.status
632 rm -f $(SUBDIR_DEVICES_MAK)
633 rm -f po/*.mo tests/qemu-iotests/common.env
634 rm -f roms/seabios/config.mak roms/vgabios/config.mak
635 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps
636 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
637 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
638 rm -f qemu-doc.vr qemu-doc.txt
639 rm -f config.log
640 rm -f linux-headers/asm
641 rm -f docs/version.texi
642 rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi
643 rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7
644 rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
645 rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
646 rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
647 rm -f docs/qemu-block-drivers.7
648 rm -f docs/qemu-cpu-models.7
649 for d in $(TARGET_DIRS); do \
650 rm -rf $$d || exit 1 ; \
651 done
652 rm -Rf .sdk
653 if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
655 KEYMAPS=da en-gb et fr fr-ch is lt no pt-br sv \
656 ar de en-us fi fr-be hr it lv nl pl ru th \
657 de-ch es fo fr-ca hu ja mk pt sl tr \
658 bepo cz
660 ifdef INSTALL_BLOBS
661 BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
662 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
663 vgabios-ramfb.bin vgabios-bochs-display.bin \
664 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
665 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
666 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
667 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
668 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
669 efi-e1000e.rom efi-vmxnet3.rom \
670 qemu-icon.bmp qemu_logo_no_text.svg \
671 bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
672 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \
673 s390-ccw.img s390-netboot.img \
674 spapr-rtas.bin slof.bin skiboot.lid \
675 palcode-clipper \
676 u-boot.e500 u-boot-sam460-20100605.bin \
677 qemu_vga.ndrv \
678 hppa-firmware.img
679 else
680 BLOBS=
681 endif
683 install-doc: $(DOCS)
684 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
685 $(INSTALL_DATA) qemu-doc.html "$(DESTDIR)$(qemu_docdir)"
686 $(INSTALL_DATA) qemu-doc.txt "$(DESTDIR)$(qemu_docdir)"
687 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)"
688 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)"
689 ifdef CONFIG_POSIX
690 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
691 $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
692 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
693 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
694 $(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
695 $(INSTALL_DATA) docs/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
696 ifneq ($(TOOLS),)
697 $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
698 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
699 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
700 endif
701 ifneq (,$(findstring qemu-ga,$(TOOLS)))
702 $(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
703 $(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)"
704 $(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)"
705 $(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
706 endif
707 endif
708 ifdef CONFIG_VIRTFS
709 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
710 $(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
711 endif
713 install-datadir:
714 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
716 install-localstatedir:
717 ifdef CONFIG_POSIX
718 ifneq (,$(findstring qemu-ga,$(TOOLS)))
719 $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
720 endif
721 endif
724 install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir
725 ifneq ($(TOOLS),)
726 $(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
727 endif
728 ifneq ($(CONFIG_MODULES),)
729 $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
730 for s in $(modules-m:.mo=$(DSOSUF)); do \
731 t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
732 $(INSTALL_LIB) $$s "$$t"; \
733 test -z "$(STRIP)" || $(STRIP) "$$t"; \
734 done
735 endif
736 ifneq ($(HELPERS-y),)
737 $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
738 endif
739 ifneq ($(BLOBS),)
740 set -e; for x in $(BLOBS); do \
741 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
742 done
743 endif
744 ifdef CONFIG_GTK
745 $(MAKE) -C po $@
746 endif
747 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
748 set -e; for x in $(KEYMAPS); do \
749 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
750 done
751 $(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
752 for d in $(TARGET_DIRS); do \
753 $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
754 done
756 .PHONY: ctags
757 ctags:
758 rm -f tags
759 find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
761 .PHONY: TAGS
762 TAGS:
763 rm -f TAGS
764 find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
766 cscope:
767 rm -f "$(SRC_PATH)"/cscope.*
768 find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
769 cscope -b -i"$(SRC_PATH)/cscope.files"
771 # opengl shader programs
772 ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
773 @mkdir -p $(dir $@)
774 $(call quiet-command,\
775 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
776 "VERT","$@")
778 ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
779 @mkdir -p $(dir $@)
780 $(call quiet-command,\
781 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
782 "FRAG","$@")
784 ui/shader.o: $(SRC_PATH)/ui/shader.c \
785 ui/shader/texture-blit-vert.h \
786 ui/shader/texture-blit-flip-vert.h \
787 ui/shader/texture-blit-frag.h
789 # documentation
790 MAKEINFO=makeinfo
791 MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
792 MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
793 TEXI2PODFLAGS=$(MAKEINFOINCLUDES) "-DVERSION=$(VERSION)"
794 TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
796 docs/version.texi: $(SRC_PATH)/VERSION
797 $(call quiet-command,echo "@set VERSION $(VERSION)" > $@,"GEN","$@")
799 %.html: %.texi docs/version.texi
800 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
801 --html $< -o $@,"GEN","$@")
803 %.info: %.texi docs/version.texi
804 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
806 %.txt: %.texi docs/version.texi
807 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
808 --plaintext $< -o $@,"GEN","$@")
810 %.pdf: %.texi docs/version.texi
811 $(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@")
813 qemu-options.texi: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
814 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
816 qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
817 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
819 qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
820 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
822 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
823 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
825 docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
826 @cp -p $< $@
828 docs/interop/qemu-ga-qapi.texi: qga/qapi-generated/qga-qapi-doc.texi
829 @cp -p $< $@
831 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
832 qemu.1: qemu-option-trace.texi
833 qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
834 fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
835 qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
836 qemu-ga.8: qemu-ga.texi
837 docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
838 docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
840 html: qemu-doc.html docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
841 info: qemu-doc.info docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
842 pdf: qemu-doc.pdf docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
843 txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
845 qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
846 qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \
847 qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
848 qemu-monitor-info.texi docs/qemu-block-drivers.texi \
849 docs/qemu-cpu-models.texi
851 docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
852 docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
853 docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \
854 docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi
856 docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
857 docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \
858 docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
859 docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
861 $(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl
863 # Reports/Analysis
865 %/coverage-report.html:
866 @mkdir -p $*
867 $(call quiet-command,\
868 gcovr -p --html --html-details -o $@, \
869 "GEN", "coverage-report.html")
871 .PHONY: coverage-report
872 coverage-report: $(CURDIR)/reports/coverage/coverage-report.html
874 ifdef CONFIG_WIN32
876 INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
878 nsisflags = -V2 -NOCD
880 ifneq ($(wildcard $(SRC_PATH)/dll),)
881 ifeq ($(ARCH),x86_64)
882 # 64 bit executables
883 DLL_PATH = $(SRC_PATH)/dll/w64
884 nsisflags += -DW64
885 else
886 # 32 bit executables
887 DLL_PATH = $(SRC_PATH)/dll/w32
888 endif
889 endif
891 .PHONY: installer
892 installer: $(INSTALLER)
894 INSTDIR=/tmp/qemu-nsis
896 $(INSTALLER): $(SRC_PATH)/qemu.nsi
897 $(MAKE) install prefix=${INSTDIR}
898 ifdef SIGNCODE
899 (cd ${INSTDIR}; \
900 for i in *.exe; do \
901 $(SIGNCODE) $${i}; \
902 done \
904 endif # SIGNCODE
905 (cd ${INSTDIR}; \
906 for i in qemu-system-*.exe; do \
907 arch=$${i%.exe}; \
908 arch=$${arch#qemu-system-}; \
909 echo Section \"$$arch\" Section_$$arch; \
910 echo SetOutPath \"\$$INSTDIR\"; \
911 echo File \"\$${BINDIR}\\$$i\"; \
912 echo SectionEnd; \
913 done \
914 ) >${INSTDIR}/system-emulations.nsh
915 makensis $(nsisflags) \
916 $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
917 $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
918 -DBINDIR="${INSTDIR}" \
919 $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
920 -DSRCDIR="$(SRC_PATH)" \
921 -DOUTFILE="$(INSTALLER)" \
922 -DDISPLAYVERSION="$(VERSION)" \
923 $(SRC_PATH)/qemu.nsi
924 rm -r ${INSTDIR}
925 ifdef SIGNCODE
926 $(SIGNCODE) $(INSTALLER)
927 endif # SIGNCODE
928 endif # CONFIG_WIN
930 # Add a dependency on the generated files, so that they are always
931 # rebuilt before other object files
932 ifneq ($(wildcard config-host.mak),)
933 ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
934 Makefile: $(GENERATED_FILES)
935 endif
936 endif
938 .SECONDARY: $(TRACE_HEADERS) $(TRACE_HEADERS:%=%-timestamp) \
939 $(TRACE_SOURCES) $(TRACE_SOURCES:%=%-timestamp) \
940 $(TRACE_DTRACE) $(TRACE_DTRACE:%=%-timestamp)
942 # Include automatically generated dependency files
943 # Dependencies in Makefile.objs files come from our recursive subdir rules
944 -include $(wildcard *.d tests/*.d)
946 include $(SRC_PATH)/tests/docker/Makefile.include
947 include $(SRC_PATH)/tests/vm/Makefile.include
949 .PHONY: help
950 help:
951 @echo 'Generic targets:'
952 @echo ' all - Build all'
953 ifdef CONFIG_MODULES
954 @echo ' modules - Build all modules'
955 endif
956 @echo ' dir/file.o - Build specified target only'
957 @echo ' install - Install QEMU, documentation and tools'
958 @echo ' ctags/TAGS - Generate tags file for editors'
959 @echo ' cscope - Generate cscope index'
960 @echo ''
961 @$(if $(TARGET_DIRS), \
962 echo 'Architecture specific targets:'; \
963 $(foreach t, $(TARGET_DIRS), \
964 printf " %-30s - Build for %s\\n" $(patsubst %,subdir-%,$(t)) $(t);) \
965 echo '')
966 @echo 'Cleaning targets:'
967 @echo ' clean - Remove most generated files but keep the config'
968 ifdef CONFIG_GCOV
969 @echo ' clean-coverage - Remove coverage files'
970 endif
971 @echo ' distclean - Remove all generated files'
972 @echo ' dist - Build a distributable tarball'
973 @echo ''
974 @echo 'Test targets:'
975 @echo ' check - Run all tests (check-help for details)'
976 @echo ' docker - Help about targets running tests inside Docker containers'
977 @echo ' vm-test - Help about targets running tests inside VM'
978 @echo ''
979 @echo 'Documentation targets:'
980 @echo ' html info pdf txt'
981 @echo ' - Build documentation in specified format'
982 ifdef CONFIG_GCOV
983 @echo ' coverage-report - Create code coverage report'
984 endif
985 @echo ''
986 ifdef CONFIG_WIN32
987 @echo 'Windows targets:'
988 @echo ' installer - Build NSIS-based installer for QEMU'
989 ifdef QEMU_GA_MSI_ENABLED
990 @echo ' msi - Build MSI-based installer for qemu-ga'
991 endif
992 @echo ''
993 endif
994 @echo ' $(MAKE) [targets] (quiet build, default)'
995 @echo ' $(MAKE) V=1 [targets] (verbose build)'