xref: /openbmc/qemu/Makefile (revision 4fe6d78b)
1# Makefile for QEMU.
2
3# Always point to the root of the build tree (needs GNU make).
4BUILD_DIR=$(CURDIR)
5
6# Before including a proper config-host.mak, assume we are in the source tree
7SRC_PATH=.
8
9UNCHECKED_GOALS := %clean TAGS cscope ctags dist \
10    html info pdf txt \
11    help check-help print-% \
12    docker docker-% vm-test vm-build-%
13
14print-%:
15	@echo '$*=$($*)'
16
17# All following code might depend on configuration variables
18ifneq ($(wildcard config-host.mak),)
19# Put the all: rule here so that config-host.mak can contain dependencies.
20all:
21include config-host.mak
22
23git-submodule-update:
24
25.PHONY: git-submodule-update
26
27git_module_status := $(shell \
28  cd '$(SRC_PATH)' && \
29  GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
30  echo $$?; \
31)
32
33ifeq (1,$(git_module_status))
34ifeq (no,$(GIT_UPDATE))
35git-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)
43else
44git-submodule-update:
45	$(call quiet-command, \
46          (cd $(SRC_PATH) && GIT="$(GIT)" ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \
47          "GIT","$(GIT_SUBMODULES)")
48endif
49endif
50
51.git-submodule-status: git-submodule-update config-host.mak
52
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.
55ifneq ($(realpath $(SRC_PATH)),$(realpath .))
56ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
57$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
58seems 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)
60endif
61endif
62
63CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
64CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
65CONFIG_XEN := $(CONFIG_XEN_BACKEND)
66CONFIG_ALL=y
67-include config-all-devices.mak
68-include config-all-disas.mak
69
70config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios
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; \
79	fi
80else
81config-host.mak:
82ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
83	@echo "Please call configure before running make!"
84	@exit 1
85endif
86endif
87
88include $(SRC_PATH)/rules.mak
89
90GENERATED_FILES = qemu-version.h config-host.h qemu-options.def
91GENERATED_FILES += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h
92GENERATED_FILES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
93GENERATED_FILES += qmp-introspect.h
94GENERATED_FILES += qmp-introspect.c
95
96GENERATED_FILES += trace/generated-tcg-tracers.h
97
98GENERATED_FILES += trace/generated-helpers-wrappers.h
99GENERATED_FILES += trace/generated-helpers.h
100GENERATED_FILES += trace/generated-helpers.c
101
102ifdef CONFIG_TRACE_UST
103GENERATED_FILES += trace-ust-all.h
104GENERATED_FILES += trace-ust-all.c
105endif
106
107GENERATED_FILES += module_block.h
108
109TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h)
110TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c)
111TRACE_DTRACE =
112ifdef CONFIG_TRACE_DTRACE
113TRACE_HEADERS += trace-dtrace-root.h $(trace-events-subdirs:%=%/trace-dtrace.h)
114TRACE_DTRACE += trace-dtrace-root.dtrace $(trace-events-subdirs:%=%/trace-dtrace.dtrace)
115endif
116ifdef CONFIG_TRACE_UST
117TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h)
118endif
119
120GENERATED_FILES += $(TRACE_HEADERS)
121GENERATED_FILES += $(TRACE_SOURCES)
122GENERATED_FILES += $(BUILD_DIR)/trace-events-all
123GENERATED_FILES += .git-submodule-status
124
125trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
126
127tracetool-y = $(SRC_PATH)/scripts/tracetool.py
128tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
129
130%/trace.h: %/trace.h-timestamp
131	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
132%/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y)
133	$(call quiet-command,$(TRACETOOL) \
134		--group=$(call trace-group-name,$@) \
135		--format=h \
136		--backends=$(TRACE_BACKENDS) \
137		$< > $@,"GEN","$(@:%-timestamp=%)")
138
139%/trace.c: %/trace.c-timestamp
140	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
141%/trace.c-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y)
142	$(call quiet-command,$(TRACETOOL) \
143		--group=$(call trace-group-name,$@) \
144		--format=c \
145		--backends=$(TRACE_BACKENDS) \
146		$< > $@,"GEN","$(@:%-timestamp=%)")
147
148%/trace-ust.h: %/trace-ust.h-timestamp
149	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
150%/trace-ust.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y)
151	$(call quiet-command,$(TRACETOOL) \
152		--group=$(call trace-group-name,$@) \
153		--format=ust-events-h \
154		--backends=$(TRACE_BACKENDS) \
155		$< > $@,"GEN","$(@:%-timestamp=%)")
156
157%/trace-dtrace.dtrace: %/trace-dtrace.dtrace-timestamp
158	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
159%/trace-dtrace.dtrace-timestamp: $(SRC_PATH)/%/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
160	$(call quiet-command,$(TRACETOOL) \
161		--group=$(call trace-group-name,$@) \
162		--format=d \
163		--backends=$(TRACE_BACKENDS) \
164		$< > $@,"GEN","$(@:%-timestamp=%)")
165
166%/trace-dtrace.h: %/trace-dtrace.dtrace $(tracetool-y)
167	$(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@")
168
169%/trace-dtrace.o: %/trace-dtrace.dtrace $(tracetool-y)
170
171
172trace-root.h: trace-root.h-timestamp
173	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
174trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y)
175	$(call quiet-command,$(TRACETOOL) \
176		--group=root \
177		--format=h \
178		--backends=$(TRACE_BACKENDS) \
179		$< > $@,"GEN","$(@:%-timestamp=%)")
180
181trace-root.c: trace-root.c-timestamp
182	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
183trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y)
184	$(call quiet-command,$(TRACETOOL) \
185		--group=root \
186		--format=c \
187		--backends=$(TRACE_BACKENDS) \
188		$< > $@,"GEN","$(@:%-timestamp=%)")
189
190trace-ust-root.h: trace-ust-root.h-timestamp
191	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
192trace-ust-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y)
193	$(call quiet-command,$(TRACETOOL) \
194		--group=root \
195		--format=ust-events-h \
196		--backends=$(TRACE_BACKENDS) \
197		$< > $@,"GEN","$(@:%-timestamp=%)")
198
199trace-ust-all.h: trace-ust-all.h-timestamp
200	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
201trace-ust-all.h-timestamp: $(trace-events-files) $(tracetool-y)
202	$(call quiet-command,$(TRACETOOL) \
203		--group=all \
204		--format=ust-events-h \
205		--backends=$(TRACE_BACKENDS) \
206		$(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)")
207
208trace-ust-all.c: trace-ust-all.c-timestamp
209	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
210trace-ust-all.c-timestamp: $(trace-events-files) $(tracetool-y)
211	$(call quiet-command,$(TRACETOOL) \
212		--group=all \
213		--format=ust-events-c \
214		--backends=$(TRACE_BACKENDS) \
215		$(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)")
216
217trace-dtrace-root.dtrace: trace-dtrace-root.dtrace-timestamp
218	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
219trace-dtrace-root.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
220	$(call quiet-command,$(TRACETOOL) \
221		--group=root \
222		--format=d \
223		--backends=$(TRACE_BACKENDS) \
224		$< > $@,"GEN","$(@:%-timestamp=%)")
225
226trace-dtrace-root.h: trace-dtrace-root.dtrace
227	$(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@")
228
229trace-dtrace-root.o: trace-dtrace-root.dtrace
230
231KEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen
232KEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv
233
234KEYCODEMAP_FILES = \
235		 ui/input-keymap-linux-to-qcode.c \
236		 ui/input-keymap-qcode-to-qnum.c \
237		 ui/input-keymap-qnum-to-qcode.c \
238		 ui/input-keymap-qcode-to-linux.c \
239		 $(NULL)
240
241GENERATED_FILES += $(KEYCODEMAP_FILES)
242
243ui/input-keymap-%.c: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile.objs
244	$(call quiet-command,\
245	    src=$$(echo $@ | sed -E -e "s,^ui/input-keymap-(.+)-to-(.+)\.c$$,\1,") && \
246	    dst=$$(echo $@ | sed -E -e "s,^ui/input-keymap-(.+)-to-(.+)\.c$$,\2,") && \
247	    test -e $(KEYCODEMAP_GEN) && \
248	    $(PYTHON) $(KEYCODEMAP_GEN) \
249	          --lang glib2 \
250	          --varname qemu_input_map_$${src}_to_$${dst} \
251	          code-map $(KEYCODEMAP_CSV) $${src} $${dst} \
252	        > $@ || rm -f $@, "GEN", "$@")
253
254$(KEYCODEMAP_GEN): .git-submodule-status
255$(KEYCODEMAP_CSV): .git-submodule-status
256
257# Don't try to regenerate Makefile or configure
258# We don't generate any of them
259Makefile: ;
260configure: ;
261
262.PHONY: all clean cscope distclean html info install install-doc \
263	pdf txt recurse-all dist msi FORCE
264
265$(call set-vpath, $(SRC_PATH))
266
267LIBS+=-lz $(LIBS_TOOLS)
268
269HELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)
270
271ifdef BUILD_DOCS
272DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8
273DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
274DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
275DOCS+=docs/qemu-block-drivers.7
276ifdef CONFIG_VIRTFS
277DOCS+=fsdev/virtfs-proxy-helper.1
278endif
279else
280DOCS=
281endif
282
283SUBDIR_MAKEFLAGS=BUILD_DIR=$(BUILD_DIR)
284SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
285SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
286
287ifeq ($(SUBDIR_DEVICES_MAK),)
288config-all-devices.mak:
289	$(call quiet-command,echo '# no devices' > $@,"GEN","$@")
290else
291config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
292	$(call quiet-command, sed -n \
293             's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
294             $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
295             "GEN","$@")
296endif
297
298-include $(SUBDIR_DEVICES_MAK_DEP)
299
300%/config-devices.mak: default-configs/%.mak $(SRC_PATH)/scripts/make_device_config.sh
301	$(call quiet-command, \
302            $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > $@.tmp,"GEN","$@.tmp")
303	$(call quiet-command, if test -f $@; then \
304	  if cmp -s $@.old $@; then \
305	    mv $@.tmp $@; \
306	    cp -p $@ $@.old; \
307	  else \
308	    if test -f $@.old; then \
309	      echo "WARNING: $@ (user modified) out of date.";\
310	    else \
311	      echo "WARNING: $@ out of date.";\
312	    fi; \
313	    echo "Run \"$(MAKE) defconfig\" to regenerate."; \
314	    rm $@.tmp; \
315	  fi; \
316	 else \
317	  mv $@.tmp $@; \
318	  cp -p $@ $@.old; \
319	 fi,"GEN","$@");
320
321defconfig:
322	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
323
324ifneq ($(wildcard config-host.mak),)
325include $(SRC_PATH)/Makefile.objs
326endif
327
328dummy := $(call unnest-vars,, \
329                stub-obj-y \
330                chardev-obj-y \
331                util-obj-y \
332                qga-obj-y \
333                ivshmem-client-obj-y \
334                ivshmem-server-obj-y \
335                libvhost-user-obj-y \
336                vhost-user-scsi-obj-y \
337                vhost-user-blk-obj-y \
338                qga-vss-dll-obj-y \
339                block-obj-y \
340                block-obj-m \
341                crypto-obj-y \
342                crypto-aes-obj-y \
343                qom-obj-y \
344                io-obj-y \
345                common-obj-y \
346                common-obj-m \
347                trace-obj-y)
348
349include $(SRC_PATH)/tests/Makefile.include
350
351all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules
352
353qemu-version.h: FORCE
354	$(call quiet-command, \
355		(cd $(SRC_PATH); \
356		printf '#define QEMU_PKGVERSION '; \
357		if test -n "$(PKGVERSION)"; then \
358			printf '"$(PKGVERSION)"\n'; \
359		else \
360			if test -d .git; then \
361				printf '" ('; \
362				git describe --match 'v*' 2>/dev/null | tr -d '\n'; \
363				if ! git diff-index --quiet HEAD &>/dev/null; then \
364					printf -- '-dirty'; \
365				fi; \
366				printf ')"\n'; \
367			else \
368				printf '""\n'; \
369			fi; \
370		fi) > $@.tmp)
371	$(call quiet-command, if ! cmp -s $@ $@.tmp; then \
372	  mv $@.tmp $@; \
373	 else \
374	  rm $@.tmp; \
375	 fi)
376
377config-host.h: config-host.h-timestamp
378config-host.h-timestamp: config-host.mak
379qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
380	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
381
382SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
383SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
384
385$(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
386$(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
387$(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
388$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
389
390subdir-%:
391	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
392
393DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
394DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
395DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
396
397subdir-dtc: .git-submodule-status dtc/libfdt dtc/tests
398	$(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,)
399
400dtc/%: .git-submodule-status
401	mkdir -p $@
402
403# Overriding CFLAGS causes us to lose defines added in the sub-makefile.
404# Not overriding CFLAGS leads to mis-matches between compilation modes.
405# Therefore we replicate some of the logic in the sub-makefile.
406# Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
407# no need to annoy QEMU developers with such things.
408CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS))
409CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
410CAP_CFLAGS += -DCAPSTONE_HAS_ARM
411CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
412CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
413CAP_CFLAGS += -DCAPSTONE_HAS_X86
414
415subdir-capstone: .git-submodule-status
416	$(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))
417
418$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) \
419	$(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
420
421ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
422# Only keep -O and -g cflags
423romsubdir-%:
424	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
425
426ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
427
428recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
429
430$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
431	$(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
432
433Makefile: $(version-obj-y)
434
435######################################################################
436# Build libraries
437
438libqemuutil.a: $(util-obj-y) $(trace-obj-y) $(stub-obj-y)
439libvhost-user.a: $(libvhost-user-obj-y)
440
441######################################################################
442
443COMMON_LDADDS = libqemuutil.a
444
445qemu-img.o: qemu-img-cmds.h
446
447qemu-img$(EXESUF): qemu-img.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
448qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
449qemu-io$(EXESUF): qemu-io.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
450
451qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
452
453qemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS)
454
455fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
456fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
457
458scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
459ifdef CONFIG_MPATH
460scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
461endif
462
463qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
464	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
465
466qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
467qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
468
469qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
470qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
471
472gen-out-type = $(subst .,-,$(suffix $@))
473
474qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
475
476qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
477$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
478	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
479		$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
480		"GEN","$@")
481qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
482$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
483	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
484		$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
485		"GEN","$@")
486qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
487$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
488	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
489		$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
490		"GEN","$@")
491
492qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
493               $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
494               $(SRC_PATH)/qapi/char.json \
495               $(SRC_PATH)/qapi/crypto.json \
496               $(SRC_PATH)/qapi/introspect.json \
497               $(SRC_PATH)/qapi/migration.json \
498               $(SRC_PATH)/qapi/net.json \
499               $(SRC_PATH)/qapi/rocker.json \
500               $(SRC_PATH)/qapi/run-state.json \
501               $(SRC_PATH)/qapi/sockets.json \
502               $(SRC_PATH)/qapi/tpm.json \
503               $(SRC_PATH)/qapi/trace.json \
504               $(SRC_PATH)/qapi/transaction.json \
505               $(SRC_PATH)/qapi/ui.json
506
507qapi-types.c qapi-types.h :\
508$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
509	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
510		$(gen-out-type) -o "." -b $<, \
511		"GEN","$@")
512qapi-visit.c qapi-visit.h :\
513$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
514	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
515		$(gen-out-type) -o "." -b $<, \
516		"GEN","$@")
517qapi-event.c qapi-event.h :\
518$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
519	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
520		$(gen-out-type) -o "." $<, \
521		"GEN","$@")
522qmp-commands.h qmp-marshal.c :\
523$(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
524	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
525		$(gen-out-type) -o "." $<, \
526		"GEN","$@")
527qmp-introspect.h qmp-introspect.c :\
528$(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
529	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
530		$(gen-out-type) -o "." $<, \
531		"GEN","$@")
532
533QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
534$(qga-obj-y): $(QGALIB_GEN)
535
536qemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
537	$(call LINK, $^)
538
539ifdef QEMU_GA_MSI_ENABLED
540QEMU_GA_MSI=qemu-ga-$(ARCH).msi
541
542msi: $(QEMU_GA_MSI)
543
544$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
545
546$(QEMU_GA_MSI): config-host.mak
547
548$(QEMU_GA_MSI):  $(SRC_PATH)/qga/installer/qemu-ga.wxs
549	$(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)" \
550	wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<,"WIXL","$@")
551else
552msi:
553	@echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
554endif
555
556ifneq ($(EXESUF),)
557.PHONY: qemu-ga
558qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
559endif
560
561ifdef CONFIG_IVSHMEM
562ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS)
563	$(call LINK, $^)
564ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
565	$(call LINK, $^)
566endif
567vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a
568	$(call LINK, $^)
569vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a
570	$(call LINK, $^)
571
572module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
573	$(call quiet-command,$(PYTHON) $< $@ \
574	$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
575	"GEN","$@")
576
577clean:
578# avoid old build problems by removing potentially incorrect old files
579	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
580	rm -f qemu-options.def
581	rm -f *.msi
582	find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} +
583	rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
584	rm -f fsdev/*.pod scsi/*.pod
585	rm -f qemu-img-cmds.h
586	rm -f ui/shader/*-vert.h ui/shader/*-frag.h
587	@# May not be present in GENERATED_FILES
588	rm -f trace/generated-tracers-dtrace.dtrace*
589	rm -f trace/generated-tracers-dtrace.h*
590	rm -f $(foreach f,$(GENERATED_FILES),$(f) $(f)-timestamp)
591	rm -rf qapi-generated
592	rm -rf qga/qapi-generated
593	for d in $(ALL_SUBDIRS); do \
594	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
595	rm -f $$d/qemu-options.def; \
596        done
597	rm -f $(SUBDIR_DEVICES_MAK) config-all-devices.mak
598
599VERSION ?= $(shell cat VERSION)
600
601dist: qemu-$(VERSION).tar.bz2
602
603qemu-%.tar.bz2:
604	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
605
606distclean: clean
607	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
608	rm -f config-all-devices.mak config-all-disas.mak config.status
609	rm -f po/*.mo tests/qemu-iotests/common.env
610	rm -f roms/seabios/config.mak roms/vgabios/config.mak
611	rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps
612	rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
613	rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
614	rm -f qemu-doc.vr qemu-doc.txt
615	rm -f config.log
616	rm -f linux-headers/asm
617	rm -f docs/version.texi
618	rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi
619	rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7
620	rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
621	rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
622	rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
623	rm -f docs/qemu-block-drivers.7
624	for d in $(TARGET_DIRS); do \
625	rm -rf $$d || exit 1 ; \
626        done
627	rm -Rf .sdk
628	if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
629
630KEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
631ar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
632common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr \
633bepo    cz
634
635ifdef INSTALL_BLOBS
636BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
637vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
638acpi-dsdt.aml \
639ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
640pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
641pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
642efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
643efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
644efi-e1000e.rom efi-vmxnet3.rom \
645qemu-icon.bmp qemu_logo_no_text.svg \
646bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
647multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \
648s390-ccw.img s390-netboot.img \
649spapr-rtas.bin slof.bin skiboot.lid \
650palcode-clipper \
651u-boot.e500 \
652qemu_vga.ndrv
653else
654BLOBS=
655endif
656
657install-doc: $(DOCS)
658	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
659	$(INSTALL_DATA) qemu-doc.html "$(DESTDIR)$(qemu_docdir)"
660	$(INSTALL_DATA) qemu-doc.txt "$(DESTDIR)$(qemu_docdir)"
661	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)"
662	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)"
663ifdef CONFIG_POSIX
664	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
665	$(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
666	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
667	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
668	$(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
669ifneq ($(TOOLS),)
670	$(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
671	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
672	$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
673endif
674ifneq (,$(findstring qemu-ga,$(TOOLS)))
675	$(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
676	$(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)"
677	$(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)"
678	$(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
679endif
680endif
681ifdef CONFIG_VIRTFS
682	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
683	$(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
684endif
685
686install-datadir:
687	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
688
689install-localstatedir:
690ifdef CONFIG_POSIX
691ifneq (,$(findstring qemu-ga,$(TOOLS)))
692	$(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
693endif
694endif
695
696
697install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir
698ifneq ($(TOOLS),)
699	$(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
700endif
701ifneq ($(CONFIG_MODULES),)
702	$(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
703	for s in $(modules-m:.mo=$(DSOSUF)); do \
704		t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
705		$(INSTALL_LIB) $$s "$$t"; \
706		test -z "$(STRIP)" || $(STRIP) "$$t"; \
707	done
708endif
709ifneq ($(HELPERS-y),)
710	$(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
711endif
712ifneq ($(BLOBS),)
713	set -e; for x in $(BLOBS); do \
714		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
715	done
716endif
717ifeq ($(CONFIG_GTK),y)
718	$(MAKE) -C po $@
719endif
720	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
721	set -e; for x in $(KEYMAPS); do \
722		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
723	done
724	$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
725	for d in $(TARGET_DIRS); do \
726	$(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
727        done
728
729.PHONY: ctags
730ctags:
731	rm -f tags
732	find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
733
734.PHONY: TAGS
735TAGS:
736	rm -f TAGS
737	find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
738
739cscope:
740	rm -f "$(SRC_PATH)"/cscope.*
741	find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
742	cscope -b -i"$(SRC_PATH)/cscope.files"
743
744# opengl shader programs
745ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
746	@mkdir -p $(dir $@)
747	$(call quiet-command,\
748		perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
749		"VERT","$@")
750
751ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
752	@mkdir -p $(dir $@)
753	$(call quiet-command,\
754		perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
755		"FRAG","$@")
756
757ui/shader.o: $(SRC_PATH)/ui/shader.c \
758	ui/shader/texture-blit-vert.h \
759	ui/shader/texture-blit-flip-vert.h \
760	ui/shader/texture-blit-frag.h
761
762# documentation
763MAKEINFO=makeinfo
764MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
765MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
766TEXI2PODFLAGS=$(MAKEINFOINCLUDES) "-DVERSION=$(VERSION)"
767TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
768
769docs/version.texi: $(SRC_PATH)/VERSION
770	$(call quiet-command,echo "@set VERSION $(VERSION)" > $@,"GEN","$@")
771
772%.html: %.texi docs/version.texi
773	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
774	--html $< -o $@,"GEN","$@")
775
776%.info: %.texi docs/version.texi
777	$(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
778
779%.txt: %.texi docs/version.texi
780	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
781	--plaintext $< -o $@,"GEN","$@")
782
783%.pdf: %.texi docs/version.texi
784	$(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@")
785
786qemu-options.texi: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
787	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
788
789qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
790	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
791
792qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
793	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
794
795qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
796	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
797
798docs/interop/qemu-qmp-qapi.texi docs/interop/qemu-ga-qapi.texi: $(SRC_PATH)/scripts/qapi2texi.py $(qapi-py)
799
800docs/interop/qemu-qmp-qapi.texi: $(qapi-modules)
801	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")
802
803docs/interop/qemu-ga-qapi.texi: $(SRC_PATH)/qga/qapi-schema.json
804	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")
805
806qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
807qemu.1: qemu-option-trace.texi
808qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
809fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
810qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
811qemu-ga.8: qemu-ga.texi
812docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
813
814html: qemu-doc.html docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
815info: qemu-doc.info docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
816pdf: qemu-doc.pdf docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
817txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
818
819qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
820	qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \
821	qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
822	qemu-monitor-info.texi docs/qemu-block-drivers.texi
823
824docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
825    docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
826    docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \
827	docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi
828
829docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
830    docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \
831    docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
832	docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
833
834
835ifdef CONFIG_WIN32
836
837INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
838
839nsisflags = -V2 -NOCD
840
841ifneq ($(wildcard $(SRC_PATH)/dll),)
842ifeq ($(ARCH),x86_64)
843# 64 bit executables
844DLL_PATH = $(SRC_PATH)/dll/w64
845nsisflags += -DW64
846else
847# 32 bit executables
848DLL_PATH = $(SRC_PATH)/dll/w32
849endif
850endif
851
852.PHONY: installer
853installer: $(INSTALLER)
854
855INSTDIR=/tmp/qemu-nsis
856
857$(INSTALLER): $(SRC_PATH)/qemu.nsi
858	$(MAKE) install prefix=${INSTDIR}
859ifdef SIGNCODE
860	(cd ${INSTDIR}; \
861         for i in *.exe; do \
862           $(SIGNCODE) $${i}; \
863         done \
864        )
865endif # SIGNCODE
866	(cd ${INSTDIR}; \
867         for i in qemu-system-*.exe; do \
868           arch=$${i%.exe}; \
869           arch=$${arch#qemu-system-}; \
870           echo Section \"$$arch\" Section_$$arch; \
871           echo SetOutPath \"\$$INSTDIR\"; \
872           echo File \"\$${BINDIR}\\$$i\"; \
873           echo SectionEnd; \
874         done \
875        ) >${INSTDIR}/system-emulations.nsh
876	makensis $(nsisflags) \
877                $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
878                $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
879                -DBINDIR="${INSTDIR}" \
880                $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
881                -DSRCDIR="$(SRC_PATH)" \
882                -DOUTFILE="$(INSTALLER)" \
883                -DDISPLAYVERSION="$(VERSION)" \
884                $(SRC_PATH)/qemu.nsi
885	rm -r ${INSTDIR}
886ifdef SIGNCODE
887	$(SIGNCODE) $(INSTALLER)
888endif # SIGNCODE
889endif # CONFIG_WIN
890
891# Add a dependency on the generated files, so that they are always
892# rebuilt before other object files
893ifneq ($(wildcard config-host.mak),)
894ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
895Makefile: $(GENERATED_FILES)
896endif
897endif
898
899.SECONDARY: $(TRACE_HEADERS) $(TRACE_HEADERS:%=%-timestamp) \
900	$(TRACE_SOURCES) $(TRACE_SOURCES:%=%-timestamp) \
901	$(TRACE_DTRACE) $(TRACE_DTRACE:%=%-timestamp)
902
903# Include automatically generated dependency files
904# Dependencies in Makefile.objs files come from our recursive subdir rules
905-include $(wildcard *.d tests/*.d)
906
907include $(SRC_PATH)/tests/docker/Makefile.include
908include $(SRC_PATH)/tests/vm/Makefile.include
909
910.PHONY: help
911help:
912	@echo  'Generic targets:'
913	@echo  '  all             - Build all'
914	@echo  '  dir/file.o      - Build specified target only'
915	@echo  '  install         - Install QEMU, documentation and tools'
916	@echo  '  ctags/TAGS      - Generate tags file for editors'
917	@echo  '  cscope          - Generate cscope index'
918	@echo  ''
919	@$(if $(TARGET_DIRS), \
920		echo 'Architecture specific targets:'; \
921		$(foreach t, $(TARGET_DIRS), \
922		printf "  %-30s - Build for %s\\n" $(patsubst %,subdir-%,$(t)) $(t);) \
923		echo '')
924	@echo  'Cleaning targets:'
925	@echo  '  clean           - Remove most generated files but keep the config'
926	@echo  '  distclean       - Remove all generated files'
927	@echo  '  dist            - Build a distributable tarball'
928	@echo  ''
929	@echo  'Test targets:'
930	@echo  '  check           - Run all tests (check-help for details)'
931	@echo  '  docker          - Help about targets running tests inside Docker containers'
932	@echo  '  vm-test         - Help about targets running tests inside VM'
933	@echo  ''
934	@echo  'Documentation targets:'
935	@echo  '  html info pdf txt'
936	@echo  '                  - Build documentation in specified format'
937	@echo  ''
938ifdef CONFIG_WIN32
939	@echo  'Windows targets:'
940	@echo  '  installer       - Build NSIS-based installer for QEMU'
941ifdef QEMU_GA_MSI_ENABLED
942	@echo  '  msi             - Build MSI-based installer for qemu-ga'
943endif
944	@echo  ''
945endif
946	@echo  '  $(MAKE) V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
947