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