xref: /openbmc/qemu/Makefile (revision d25f2a72)
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-%
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 speed test 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# various test targets
720test speed: all
721	$(MAKE) -C tests/tcg $@
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