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