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