blob: ab0354c153bbf568e3239f75df11c9fe4645a9fb [file] [log] [blame]
pbrook0cb3fb12006-05-14 12:07:53 +00001# Makefile for QEMU.
2
Stefan Weil519e1692011-09-16 21:50:43 +02003# Always point to the root of the build tree (needs GNU make).
4BUILD_DIR=$(CURDIR)
Lluís Vilanova388d4752011-09-15 22:45:35 +02005
Fam Zhengeaa2ddb2015-05-22 13:35:07 +08006# Before including a proper config-host.mak, assume we are in the source tree
7SRC_PATH=.
8
Philippe Mathieu-Daudéb8e535a2017-11-08 00:20:52 -03009UNCHECKED_GOALS := %clean TAGS cscope ctags docker docker-% help
Fam Zhengeaa2ddb2015-05-22 13:35:07 +080010
Lluís Vilanova250b0862012-03-06 19:50:38 +010011# All following code might depend on configuration variables
aurel3255d7e8f2009-04-15 14:42:57 +000012ifneq ($(wildcard config-host.mak),)
Paul Brook1ad21342009-05-19 16:17:58 +010013# Put the all: rule here so that config-host.mak can contain dependencies.
Stefan Weil8f67aa82012-07-09 20:36:36 +020014all:
pbrookad064842006-04-16 12:41:07 +000015include config-host.mak
Peter Maydelld1bd2422012-10-19 14:54:23 +010016
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +010017git-submodule-update:
18
19.PHONY: git-submodule-update
20
Daniel P. Berrangec4b01c72017-11-06 11:08:14 +000021git_module_status := $(shell \
22 cd '$(SRC_PATH)' && \
23 GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
24 echo $$?; \
25)
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +010026
27ifeq (1,$(git_module_status))
Daniel P. Berrangef62bbee2017-10-26 13:52:26 +010028ifeq (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
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +010038git-submodule-update:
39 $(call quiet-command, \
Daniel P. Berrangecc84d632017-10-20 15:02:43 +010040 (cd $(SRC_PATH) && GIT="$(GIT)" ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +010041 "GIT","$(GIT_SUBMODULES)")
42endif
43endif
44
Daniel P. Berrange92712822017-09-29 11:11:58 +010045.git-submodule-status: git-submodule-update config-host.mak
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +010046
Peter Maydelld1bd2422012-10-19 14:54:23 +010047# 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
Paolo Bonzinif3aa8442013-04-16 10:50:38 +020057CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
58CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
Stefano Stabellini6b827cc2017-03-16 13:01:50 -070059CONFIG_XEN := $(CONFIG_XEN_BACKEND)
Paolo Bonzinif3aa8442013-04-16 10:50:38 +020060CONFIG_ALL=y
61-include config-all-devices.mak
62-include config-all-disas.mak
63
Gerd Hoffmann8df42d82016-07-01 13:28:37 +020064config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios
Juan Quintelae5efe7f2009-10-07 02:40:59 +020065 @echo $@ is out-of-date, running configure
Stefan Weilbdf523e2013-10-20 18:39:21 +020066 @# 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
aurel3255d7e8f2009-04-15 14:42:57 +000074else
75config-host.mak:
Fam Zhengeaa2ddb2015-05-22 13:35:07 +080076ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
aurel3255d7e8f2009-04-15 14:42:57 +000077 @echo "Please call configure before running make!"
78 @exit 1
79endif
Mike Frysinger7748b8c2012-09-16 16:07:13 -040080endif
bellard766a4872003-02-18 23:35:48 +000081
Fam Zhengfb57c882016-06-01 12:25:16 +080082include $(SRC_PATH)/rules.mak
83
Daniel P. Berrange4f04f132017-02-28 12:29:00 +000084GENERATED_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
Lluís Vilanovaeac236e2012-12-14 20:13:09 +010089
Daniel P. Berrange4f04f132017-02-28 12:29:00 +000090GENERATED_FILES += trace/generated-tcg-tracers.h
Lluís Vilanova465830f2014-05-30 14:12:13 +020091
Daniel P. Berrange4f04f132017-02-28 12:29:00 +000092GENERATED_FILES += trace/generated-helpers-wrappers.h
93GENERATED_FILES += trace/generated-helpers.h
94GENERATED_FILES += trace/generated-helpers.c
Lluís Vilanova707c8a92014-05-30 14:11:50 +020095
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +000096ifdef CONFIG_TRACE_UST
Daniel P. Berrange4f04f132017-02-28 12:29:00 +000097GENERATED_FILES += trace-ust-all.h
98GENERATED_FILES += trace-ust-all.c
Mohamad Gebaie6bf23f2014-01-29 22:47:56 -050099endif
100
Daniel P. Berrange4f04f132017-02-28 12:29:00 +0000101GENERATED_FILES += module_block.h
Marc Mari0c0c1fd2016-08-12 09:27:02 -0400102
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +0000103TRACE_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
Daniel P. Berrange4f04f132017-02-28 12:29:00 +0000114GENERATED_FILES += $(TRACE_HEADERS)
115GENERATED_FILES += $(TRACE_SOURCES)
Daniel P. Berrange41753042017-02-28 12:29:01 +0000116GENERATED_FILES += $(BUILD_DIR)/trace-events-all
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +0100117GENERATED_FILES += .git-submodule-status
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +0000118
119trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
120
Daniel P. Berrange8755b4a2017-03-15 12:34:21 +0000121tracetool-y = $(SRC_PATH)/scripts/tracetool.py
122tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
123
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +0000124%/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
Daniel P. Berrange92712822017-09-29 11:11:58 +0100225KEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen
226KEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv
227
228KEYCODEMAP_FILES = \
Daniel P. Berrangebcd5ac92017-09-29 11:11:59 +0100229 ui/input-keymap-linux-to-qcode.c \
230 ui/input-keymap-qcode-to-qnum.c \
231 ui/input-keymap-qnum-to-qcode.c \
Daniel P. Berrange92712822017-09-29 11:11:58 +0100232 $(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
Juan Quintelad9ace8b2009-10-06 21:11:15 +0200250# Don't try to regenerate Makefile or configure
251# We don't generate any of them
252Makefile: ;
253configure: ;
254
Marc-André Lureaubd3f5702017-01-13 15:41:32 +0100255.PHONY: all clean cscope distclean html info install install-doc \
Daniel P. Berrange7c3d1912017-11-21 14:25:38 +0000256 pdf txt recurse-all dist msi FORCE
pbrook0cb3fb12006-05-14 12:07:53 +0000257
Paolo Bonzinifec90ff2012-05-29 11:49:50 +0200258$(call set-vpath, $(SRC_PATH))
pbrook8c462f82007-11-18 21:12:37 +0000259
Juan Quintela3e2e0e62009-08-03 14:47:06 +0200260LIBS+=-lz $(LIBS_TOOLS)
Juan Quintela67c0f082009-07-27 16:12:51 +0200261
Corey Bryant7b93fad2012-01-26 09:42:24 -0500262HELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)
263
pbrookcc8ae6d2006-04-23 17:57:59 +0000264ifdef BUILD_DOCS
Marc-André Lureauf8bab102017-01-13 15:41:34 +0100265DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200266DOCS+=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
Stefan Hajnoczi78aa8aa2017-09-08 09:39:41 +0100268DOCS+=docs/qemu-block-drivers.7
Meador Inge983eef52012-02-24 14:00:42 +0530269ifdef CONFIG_VIRTFS
M. Mohan Kumara2d8f1b2011-12-14 13:58:47 +0530270DOCS+=fsdev/virtfs-proxy-helper.1
Meador Inge983eef52012-02-24 14:00:42 +0530271endif
pbrookcc8ae6d2006-04-23 17:57:59 +0000272else
273DOCS=
274endif
bellard7d132992003-03-06 23:23:54 +0000275
Lluís Vilanova388d4752011-09-15 22:45:35 +0200276SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR)
Juan Quintela1f3d3c82009-10-07 02:41:02 +0200277SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
Andreas Färber88070802013-02-21 16:26:46 +0100278SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
Juan Quintela1f3d3c82009-10-07 02:41:02 +0200279
Stefan Weil8bdd3d42012-09-14 19:02:30 +0200280ifeq ($(SUBDIR_DEVICES_MAK),)
281config-all-devices.mak:
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100282 $(call quiet-command,echo '# no devices' > $@,"GEN","$@")
Stefan Weil8bdd3d42012-09-14 19:02:30 +0200283else
Juan Quintela1f3d3c82009-10-07 02:41:02 +0200284config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
Paolo Bonzinibb585a72013-04-03 17:53:21 +0200285 $(call quiet-command, sed -n \
286 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
287 $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100288 "GEN","$@")
Stefan Weil8bdd3d42012-09-14 19:02:30 +0200289endif
Juan Quintela1f3d3c82009-10-07 02:41:02 +0200290
Paul Brookbd9141b2010-11-26 18:47:45 +0000291-include $(SUBDIR_DEVICES_MAK_DEP)
292
Paolo Bonzini0ab0c992016-06-07 13:25:58 +0200293%/config-devices.mak: default-configs/%.mak $(SRC_PATH)/scripts/make_device_config.sh
Paolo Bonzini15564d82015-03-12 16:00:05 +0100294 $(call quiet-command, \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100295 $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > $@.tmp,"GEN","$@.tmp")
Michael S. Tsirkin12ccfec2015-02-19 08:48:46 +0100296 $(call quiet-command, if test -f $@; then \
Blue Swirl904fe1f2010-10-02 14:28:08 +0000297 if cmp -s $@.old $@; then \
Paul Brookbd9141b2010-11-26 18:47:45 +0000298 mv $@.tmp $@; \
299 cp -p $@ $@.old; \
Stefan Weil012f0872009-12-20 15:39:03 +0100300 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; \
Paul Brooka992fe32009-11-22 16:25:30 +0000309 else \
Stefan Weil012f0872009-12-20 15:39:03 +0100310 mv $@.tmp $@; \
311 cp -p $@ $@.old; \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100312 fi,"GEN","$@");
Paul Brooka992fe32009-11-22 16:25:30 +0000313
314defconfig:
315 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
316
Paolo Bonzini992aeb82012-12-21 08:34:49 +0100317ifneq ($(wildcard config-host.mak),)
318include $(SRC_PATH)/Makefile.objs
Fam Zhengba1183d2014-02-10 14:48:52 +0800319endif
320
321dummy := $(call unnest-vars,, \
322 stub-obj-y \
Marc-André Lureau32d955a2016-12-12 15:49:01 +0300323 chardev-obj-y \
Fam Zhengba1183d2014-02-10 14:48:52 +0800324 util-obj-y \
325 qga-obj-y \
David Marchanda75eb032014-09-08 11:17:48 +0200326 ivshmem-client-obj-y \
327 ivshmem-server-obj-y \
Marc-André Lureau7b2e5c62016-10-18 12:24:04 +0300328 libvhost-user-obj-y \
Felipe Franciosi49cc0342017-03-02 10:25:53 -0800329 vhost-user-scsi-obj-y \
Tomoki Sekiyama577a6722014-03-26 14:28:45 -0400330 qga-vss-dll-obj-y \
Fam Zhengba1183d2014-02-10 14:48:52 +0800331 block-obj-y \
Fam Zhengcc475692014-02-10 14:48:59 +0800332 block-obj-m \
Daniel P. Berrangefb377262015-09-02 10:57:27 +0100333 crypto-obj-y \
334 crypto-aes-obj-y \
Daniel P. Berrange0c7012e2015-09-02 11:18:16 +0100335 qom-obj-y \
Daniel P. Berrange666a3af2015-02-27 16:19:33 +0000336 io-obj-y \
Fam Zhengcc475692014-02-10 14:48:59 +0800337 common-obj-y \
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +0000338 common-obj-m \
339 trace-obj-y)
Fam Zhengba1183d2014-02-10 14:48:52 +0800340
Fam Zheng46e7b702016-06-01 10:23:31 +0800341include $(SRC_PATH)/tests/Makefile.include
Paolo Bonzini992aeb82012-12-21 08:34:49 +0100342
Fam Zheng17969262014-02-10 14:48:56 +0800343all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules
pbrookb9dea4f2006-05-13 16:54:03 +0000344
Fam Zheng67a1de02016-06-01 17:44:21 +0800345qemu-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)
Lin Mad9e73d32017-02-15 10:40:30 +0800363 $(call quiet-command, if ! cmp -s $@ $@.tmp; then \
364 mv $@.tmp $@; \
365 else \
366 rm $@.tmp; \
367 fi)
Fam Zheng67a1de02016-06-01 17:44:21 +0800368
Juan Quintela1215c6e2009-10-07 02:40:58 +0200369config-host.h: config-host.h-timestamp
370config-host.h-timestamp: config-host.mak
Paolo Bonzini077de812016-06-07 13:27:04 +0200371qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100372 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
Juan Quintela1215c6e2009-10-07 02:40:58 +0200373
pbrookcec7d0b2008-05-28 16:44:57 +0000374SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
Andreas Färber916359f2013-02-21 16:26:47 +0100375SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
376
Stefan Weil57f45b62014-02-27 21:28:03 +0100377$(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
Daniel P. Berrangefb377262015-09-02 10:57:27 +0100378$(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
Daniel P. Berrange666a3af2015-02-27 16:19:33 +0000379$(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
Andreas Färber916359f2013-02-21 16:26:47 +0100380$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
pbrookcec7d0b2008-05-28 16:44:57 +0000381
Paolo Bonzini41158522012-05-29 12:41:34 +0200382subdir-%:
Paul Brook00873752009-05-07 02:00:31 +0100383 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
pbrook4aa42532006-05-13 13:55:08 +0000384
Peter Crosthwaitea540f152013-04-18 14:47:31 +1000385DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
Peter Maydell965f4862013-06-21 14:00:17 +0100386DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
387DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
Peter Crosthwaitea540f152013-04-18 14:47:31 +1000388
Daniel P. Berrangeaef45d52017-09-29 11:11:56 +0100389subdir-dtc: .git-submodule-status dtc/libfdt dtc/tests
Peter Maydell965f4862013-06-21 14:00:17 +0100390 $(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,)
Peter Crosthwaitea540f152013-04-18 14:47:31 +1000391
Aaron Lindsay00525862017-10-18 14:40:23 -0400392dtc/%: .git-submodule-status
Peter Crosthwaitea540f152013-04-18 14:47:31 +1000393 mkdir -p $@
394
Richard Hendersone219c492017-09-28 09:01:23 -0700395# 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
Alistair Francis9f81aeb2017-11-07 17:10:46 -0800408 $(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))
Richard Hendersone219c492017-09-28 09:01:23 -0700409
Paolo Bonziniebedb372017-09-19 16:20:31 +0200410$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) \
Xu, Anthony3d1bacc2017-04-04 21:39:39 +0000411 $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
Blue Swirladd16152009-09-27 16:26:02 +0000412
Paul Brookc05ac892009-07-31 13:18:32 +0100413ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
Marc-André Lureaua9c87302016-08-05 12:23:46 +0400414# Only keep -O and -g cflags
Paul Brookc05ac892009-07-31 13:18:32 +0100415romsubdir-%:
Marc-André Lureaua9c87302016-08-05 12:23:46 +0400416 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
Paul Brookc05ac892009-07-31 13:18:32 +0100417
418ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
419
420recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
bellard83f64092006-08-01 16:21:11 +0000421
Marc-André Lureauc17a18e2016-11-08 11:05:13 +0400422$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100423 $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
Marc-André Lureau5354e4d2013-02-25 23:31:13 +0100424
Marc-André Lureauc17a18e2016-11-08 11:05:13 +0400425Makefile: $(version-obj-y)
Paolo Bonzini3bc2f572012-11-16 18:35:27 +0100426
427######################################################################
Paolo Bonzini8a090702012-12-20 15:40:20 +0100428# Build libraries
Paolo Bonzini3bc2f572012-11-16 18:35:27 +0100429
Paolo Bonziniebedb372017-09-19 16:20:31 +0200430libqemuutil.a: $(util-obj-y) $(trace-obj-y) $(stub-obj-y)
Marc-André Lureaude97cde2017-08-17 20:56:08 +0200431libvhost-user.a: $(libvhost-user-obj-y)
Paolo Bonzini3bc2f572012-11-16 18:35:27 +0100432
bellard4fb240a2007-11-07 19:24:02 +0000433######################################################################
434
Paolo Bonziniebedb372017-09-19 16:20:31 +0200435COMMON_LDADDS = libqemuutil.a
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +0000436
Juan Quintela3c089e12010-01-20 20:54:18 +0100437qemu-img.o: qemu-img-cmds.h
Stuart Brady153859b2009-06-07 00:42:17 +0100438
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +0000439qemu-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)
aliguori0a8e1ac2009-04-05 18:41:23 +0000442
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +0000443qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
Corey Bryant7b93fad2012-01-26 09:42:24 -0500444
Gerd Hoffmann6a021532017-10-05 17:33:28 +0200445qemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS)
446
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +0000447fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
M. Mohan Kumar17bff522011-12-14 13:58:42 +0530448fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
449
Paolo Bonzinib855f8d2017-08-22 06:50:18 +0200450scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
Paolo Bonzinife8fc5a2017-08-22 06:50:55 +0200451ifdef CONFIG_MPATH
452scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
453endif
Paolo Bonzinib855f8d2017-08-22 06:50:18 +0200454
Paolo Bonzini077de812016-06-07 13:27:04 +0200455qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100456 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
Stuart Brady153859b2009-06-07 00:42:17 +0100457
Michael Roth957f1f92011-08-11 15:38:12 -0500458qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
Dunrong Huang54c2e502012-07-29 03:11:24 +0800459qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
Michael Roth640e5402011-07-19 14:50:44 -0500460
Gerd Hoffmann6a021532017-10-05 17:33:28 +0200461qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
462qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
463
Avi Kivity19bf7c82011-12-28 12:26:58 +0200464gen-out-type = $(subst .,-,$(suffix $@))
Avi Kivity8d3bc512011-12-27 16:02:16 +0200465
Stefan Hajnoczi0521d372012-08-10 14:08:42 +0100466qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
467
Dunrong Huang54c2e502012-07-29 03:11:24 +0800468qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
Paolo Bonzini2870dc32012-10-24 11:26:49 +0200469$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
Lluís Vilanova0a607742014-05-02 15:52:24 +0200470 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
Markus Armbruster16d80f62015-04-02 13:32:16 +0200471 $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100472 "GEN","$@")
Dunrong Huang54c2e502012-07-29 03:11:24 +0800473qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
Paolo Bonzini2870dc32012-10-24 11:26:49 +0200474$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
Lluís Vilanova0a607742014-05-02 15:52:24 +0200475 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
Markus Armbruster16d80f62015-04-02 13:32:16 +0200476 $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100477 "GEN","$@")
Dunrong Huang54c2e502012-07-29 03:11:24 +0800478qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
Paolo Bonzini2870dc32012-10-24 11:26:49 +0200479$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
Lluís Vilanova0a607742014-05-02 15:52:24 +0200480 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
Markus Armbruster16d80f62015-04-02 13:32:16 +0200481 $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100482 "GEN","$@")
Michael Rothe3d4d252011-07-19 15:41:55 -0500483
Max Reitzbe13d462014-06-18 08:43:26 +0200484qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
Wenchao Xiaf6684702014-06-18 08:43:32 +0200485 $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
Markus Armbrusterdbeee392017-08-24 21:13:58 +0200486 $(SRC_PATH)/qapi/char.json \
Markus Armbrustera2ff5a42017-08-24 21:13:56 +0200487 $(SRC_PATH)/qapi/crypto.json \
Markus Armbrusterc09656f2017-08-24 21:14:05 +0200488 $(SRC_PATH)/qapi/introspect.json \
Markus Armbruster48685a82017-08-24 21:14:01 +0200489 $(SRC_PATH)/qapi/migration.json \
Markus Armbruster3c0bd372017-08-24 21:13:59 +0200490 $(SRC_PATH)/qapi/net.json \
Markus Armbrustera2ff5a42017-08-24 21:13:56 +0200491 $(SRC_PATH)/qapi/rocker.json \
Markus Armbruster0e201d32017-08-24 21:13:57 +0200492 $(SRC_PATH)/qapi/run-state.json \
Markus Armbrustera2ff5a42017-08-24 21:13:56 +0200493 $(SRC_PATH)/qapi/sockets.json \
Markus Armbruster3859b6c2017-08-24 21:14:03 +0200494 $(SRC_PATH)/qapi/tpm.json \
Markus Armbruster608cfed2017-08-24 21:14:00 +0200495 $(SRC_PATH)/qapi/trace.json \
Markus Armbrusterfa988e32017-08-24 21:14:02 +0200496 $(SRC_PATH)/qapi/transaction.json \
Markus Armbruster608cfed2017-08-24 21:14:00 +0200497 $(SRC_PATH)/qapi/ui.json
Max Reitzbe13d462014-06-18 08:43:26 +0200498
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200499qapi-types.c qapi-types.h :\
Max Reitzbe13d462014-06-18 08:43:26 +0200500$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
Lluís Vilanova0a607742014-05-02 15:52:24 +0200501 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
Markus Armbruster16d80f62015-04-02 13:32:16 +0200502 $(gen-out-type) -o "." -b $<, \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100503 "GEN","$@")
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200504qapi-visit.c qapi-visit.h :\
Max Reitzbe13d462014-06-18 08:43:26 +0200505$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
Lluís Vilanova0a607742014-05-02 15:52:24 +0200506 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
Markus Armbruster16d80f62015-04-02 13:32:16 +0200507 $(gen-out-type) -o "." -b $<, \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100508 "GEN","$@")
Wenchao Xia21cd70d2014-06-18 08:43:28 +0200509qapi-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 \
Markus Armbruster16d80f62015-04-02 13:32:16 +0200512 $(gen-out-type) -o "." $<, \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100513 "GEN","$@")
Michael S. Tsirkin599825c2011-11-16 23:58:18 +0200514qmp-commands.h qmp-marshal.c :\
Max Reitzbe13d462014-06-18 08:43:26 +0200515$(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
Lluís Vilanova0a607742014-05-02 15:52:24 +0200516 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
Marc-André Lureauc8235012016-09-12 13:19:04 +0400517 $(gen-out-type) -o "." $<, \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100518 "GEN","$@")
Markus Armbruster39a18152015-09-16 13:06:28 +0200519qmp-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 "." $<, \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100523 "GEN","$@")
Anthony Liguorie3193602011-09-02 12:34:47 -0500524
Dunrong Huang54c2e502012-07-29 03:11:24 +0800525QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
Marc-André Lureau7a0b7eb2017-07-27 17:45:05 +0200526$(qga-obj-y): $(QGALIB_GEN)
Michael Roth957f1f92011-08-11 15:38:12 -0500527
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +0000528qemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
Michael Rothfafcaf12015-09-07 18:47:05 -0500529 $(call LINK, $^)
Michael Roth48ff7a62011-07-20 15:19:37 -0500530
Yossi Hindin9dacf322015-05-06 14:57:40 +0300531ifdef QEMU_GA_MSI_ENABLED
532QEMU_GA_MSI=qemu-ga-$(ARCH).msi
533
Leonid Bloch0a187502015-07-29 20:10:51 +0300534msi: $(QEMU_GA_MSI)
Yossi Hindin9dacf322015-05-06 14:57:40 +0300535
Michael Rothfafcaf12015-09-07 18:47:05 -0500536$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
Yossi Hindin9dacf322015-05-06 14:57:40 +0300537
Yossi Hindin9dacf322015-05-06 14:57:40 +0300538$(QEMU_GA_MSI): config-host.mak
539
Leonid Blochdecdfbd2015-08-26 15:07:16 +0300540$(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)" \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100542 wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<,"WIXL","$@")
Yossi Hindin9dacf322015-05-06 14:57:40 +0300543else
544msi:
Michael Roth15b19ed2015-08-26 17:05:01 -0500545 @echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
Yossi Hindin9dacf322015-05-06 14:57:40 +0300546endif
547
Michael Rothfafcaf12015-09-07 18:47:05 -0500548ifneq ($(EXESUF),)
549.PHONY: qemu-ga
550qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
551endif
552
Kamil Rytarowskib1449ed2017-07-14 09:33:45 +0100553ifdef CONFIG_IVSHMEM
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +0000554ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS)
David Marchanda75eb032014-09-08 11:17:48 +0200555 $(call LINK, $^)
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +0000556ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
David Marchanda75eb032014-09-08 11:17:48 +0200557 $(call LINK, $^)
Kamil Rytarowskib1449ed2017-07-14 09:33:45 +0100558endif
Marc-André Lureaud59a0312017-09-19 17:25:04 +0200559vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a
Felipe Franciosi49cc0342017-03-02 10:25:53 -0800560 $(call LINK, $^)
David Marchanda75eb032014-09-08 11:17:48 +0200561
Marc Mari0c0c1fd2016-08-12 09:27:02 -0400562module_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))), \
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100565 "GEN","$@")
Marc Mari0c0c1fd2016-08-12 09:27:02 -0400566
bellard31e31b82003-02-18 22:55:36 +0000567clean:
bellard2d80ae82003-08-11 23:01:33 +0000568# avoid old build problems by removing potentially incorrect old files
Juan Quintela25be210f2009-10-07 02:41:00 +0200569 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
Michael S. Tsirkindf2943b2010-10-26 17:53:41 +0200570 rm -f qemu-options.def
Yossi Hindin9dacf322015-05-06 14:57:40 +0300571 rm -f *.msi
Marc-André Lureauc17a18e2016-11-08 11:05:13 +0400572 find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} +
Tomoki Sekiyamab39297a2013-08-07 11:40:18 -0400573 rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
Paolo Bonzinib855f8d2017-08-22 06:50:18 +0200574 rm -f fsdev/*.pod scsi/*.pod
Blue Swirl07b44ce2009-06-09 18:45:16 +0000575 rm -f qemu-img-cmds.h
Gerd Hoffmannd98bc0b2015-01-16 13:59:17 +0100576 rm -f ui/shader/*-vert.h ui/shader/*-frag.h
Daniel P. Berrange4f04f132017-02-28 12:29:00 +0000577 @# May not be present in GENERATED_FILES
Lluís Vilanovaeac236e2012-12-14 20:13:09 +0100578 rm -f trace/generated-tracers-dtrace.dtrace*
579 rm -f trace/generated-tracers-dtrace.h*
Daniel P. Berrange4f04f132017-02-28 12:29:00 +0000580 rm -f $(foreach f,$(GENERATED_FILES),$(f) $(f)-timestamp)
Stefan Weil8f0e5c6bb2012-06-09 09:08:39 +0200581 rm -rf qapi-generated
Dunrong Huang54c2e502012-07-29 03:11:24 +0800582 rm -rf qga/qapi-generated
Stefan Hajnoczi781c0c32013-01-15 08:47:26 +0100583 for d in $(ALL_SUBDIRS); do \
Magnus Dammfc8e3202009-11-13 18:51:05 +0900584 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
Michael S. Tsirkindf2943b2010-10-26 17:53:41 +0200585 rm -f $$d/qemu-options.def; \
bellard626df762003-08-10 21:39:31 +0000586 done
Peter Maydell168340b2016-05-17 12:27:31 +0100587 rm -f $(SUBDIR_DEVICES_MAK) config-all-devices.mak
bellard31e31b82003-02-18 22:55:36 +0000588
Anthony Liguori34bb4432012-07-17 13:33:32 -0500589VERSION ?= $(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
bellard7d132992003-03-06 23:23:54 +0000596distclean: clean
Pavel Butsykin2cd8af22015-09-10 18:39:01 +0300597 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
Thomas Huthae219352014-12-15 11:19:46 +0100598 rm -f config-all-devices.mak config-all-disas.mak config.status
599 rm -f po/*.mo tests/qemu-iotests/common.env
Magnus Dammfc8e3202009-11-13 18:51:05 +0900600 rm -f roms/seabios/config.mak roms/vgabios/config.mak
Marc-André Lureaubd3f5702017-01-13 15:41:32 +0100601 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps
Brad Hards7a734b82011-04-13 16:42:16 +1000602 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
Peter Maydelld5e85102017-01-24 14:02:18 +0000604 rm -f qemu-doc.vr qemu-doc.txt
Alexandre Raymond793553a2011-07-25 23:56:02 -0400605 rm -f config.log
Peter Maydell67ed96f2012-02-01 18:50:42 +0000606 rm -f linux-headers/asm
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200607 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
Stefan Hajnoczi78aa8aa2017-09-08 09:39:41 +0100613 rm -f docs/qemu-block-drivers.7
Paolo Bonzini8e98e2e2012-10-24 11:16:01 +0200614 for d in $(TARGET_DIRS); do \
bellardbc1b0502003-10-28 00:12:52 +0000615 rm -rf $$d || exit 1 ; \
bellard76bc6832003-08-10 23:41:46 +0000616 done
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -0400617 rm -Rf .sdk
Ed Mastefb8597b2015-04-01 13:58:38 -0400618 if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
bellard7d132992003-03-06 23:23:54 +0000619
bellardfed4a9a2004-12-12 22:18:34 +0000620KEYMAPS=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 \
Frédéric Boiteux471fbf42012-06-08 20:06:25 +0200622common de-ch es fo fr-ca hu ja mk nl-be pt sl tr \
Jan Krupa3751e722013-10-16 14:40:04 +0200623bepo cz
bellardfed4a9a2004-12-12 22:18:34 +0000624
ths77755342008-11-27 15:45:16 +0000625ifdef INSTALL_BLOBS
Gerd Hoffmann3b1154f2016-07-04 17:22:17 +0200626BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
Gerd Hoffmann7a4dfd12014-09-10 13:04:17 +0200627vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
Eduardo Habkost75fb3d22016-01-23 14:02:12 -0200628acpi-dsdt.aml \
Mark Cave-Ayland9eb08a42013-10-15 21:03:04 +0100629ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
Alex Williamson5ee8ad72011-04-18 11:46:01 -0600630pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
631pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
Sander Eikelenboom9fd02972013-04-08 23:08:13 +0200632efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
633efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
Gerd Hoffmann45027802016-07-01 13:26:57 +0200634efi-e1000e.rom efi-vmxnet3.rom \
Anthony Liguorif7da9c12013-06-07 13:24:17 -0500635qemu-icon.bmp qemu_logo_no_text.svg \
Michal Simek00914b72011-03-14 11:29:19 +0100636bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
Marc Maríb2a575a2016-05-23 19:11:33 +0100637multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \
Christian Borntraeger6c5359e2017-07-12 16:00:41 +0200638s390-ccw.img s390-netboot.img \
Cédric Le Goaterbcad45d2016-10-22 11:46:34 +0200639spapr-rtas.bin slof.bin skiboot.lid \
Cole Robinson0c6ab8c2014-07-04 15:43:18 -0400640palcode-clipper \
Mark Cave-Aylandfbe92142017-05-01 14:43:31 +0100641u-boot.e500 \
642qemu_vga.ndrv
ths77755342008-11-27 15:45:16 +0000643else
644BLOBS=
645endif
646
pbrook38954dc2006-04-30 23:54:18 +0000647install-doc: $(DOCS)
Eduardo Habkostd7dd65b2012-04-18 16:55:44 -0300648 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
Paolo Bonzini78e87792016-10-06 16:12:11 +0200649 $(INSTALL_DATA) qemu-doc.html "$(DESTDIR)$(qemu_docdir)"
Marc-André Lureauf8bab102017-01-13 15:41:34 +0100650 $(INSTALL_DATA) qemu-doc.txt "$(DESTDIR)$(qemu_docdir)"
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200651 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)"
652 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)"
Juan Quintela96d409e2009-08-03 14:47:00 +0200653ifdef CONFIG_POSIX
aliguori58f8aea2009-04-18 15:36:02 +0000654 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
Andreas Färber8a3e8f72013-06-11 13:13:58 +0200655 $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
Marc-André Lureau56e8bdd2017-01-13 15:41:35 +0100656 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200657 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
Stefan Hajnoczi78aa8aa2017-09-08 09:39:41 +0100658 $(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
Andreas Färber8a3e8f72013-06-11 13:13:58 +0200659ifneq ($(TOOLS),)
660 $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
aliguori58f8aea2009-04-18 15:36:02 +0000661 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
662 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
pbrook38954dc2006-04-30 23:54:18 +0000663endif
Marc-André Lureau665b5d02015-08-27 01:34:59 +0200664ifneq (,$(findstring qemu-ga,$(TOOLS)))
665 $(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200666 $(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"
Marc-André Lureau665b5d02015-08-27 01:34:59 +0200669endif
Andreas Färber8a3e8f72013-06-11 13:13:58 +0200670endif
M. Mohan Kumara2d8f1b2011-12-14 13:58:47 +0530671ifdef CONFIG_VIRTFS
672 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
673 $(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
674endif
john cooperb5ec5ce2010-02-20 11:14:59 -0600675
Eduardo Habkoste2d87bf2012-05-02 13:07:30 -0300676install-datadir:
677 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
678
Laszlo Ersekf2e39782013-05-18 07:13:14 +0200679install-localstatedir:
680ifdef CONFIG_POSIX
681ifneq (,$(findstring qemu-ga,$(TOOLS)))
682 $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
683endif
684endif
685
Eduardo Habkoste2d87bf2012-05-02 13:07:30 -0300686
Daniel P. Berrange41753042017-02-28 12:29:01 +0000687install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir
ths932a79d2007-10-20 18:29:34 +0000688ifneq ($(TOOLS),)
Michael Roth68aa2622015-11-23 15:48:58 -0600689 $(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
ths932a79d2007-10-20 18:29:34 +0000690endif
Fam Zhenge3be6f02014-02-10 14:48:58 +0800691ifneq ($(CONFIG_MODULES),)
692 $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
Michael Tokarev21151822014-05-08 14:56:58 +0400693 for s in $(modules-m:.mo=$(DSOSUF)); do \
694 t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
Michael Tokarev264f8b42014-05-08 15:06:03 +0400695 $(INSTALL_LIB) $$s "$$t"; \
Michael Tokarev21151822014-05-08 14:56:58 +0400696 test -z "$(STRIP)" || $(STRIP) "$$t"; \
Fam Zhenge3be6f02014-02-10 14:48:58 +0800697 done
698endif
Corey Bryant7b93fad2012-01-26 09:42:24 -0500699ifneq ($(HELPERS-y),)
Michael Tokarev0d659422014-06-22 10:55:23 +0400700 $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
Corey Bryant7b93fad2012-01-26 09:42:24 -0500701endif
ths77755342008-11-27 15:45:16 +0000702ifneq ($(BLOBS),)
ths77755342008-11-27 15:45:16 +0000703 set -e; for x in $(BLOBS); do \
Eduardo Habkost6aae2a22012-04-18 16:55:41 -0300704 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
pbrookad064842006-04-16 12:41:07 +0000705 done
ths77755342008-11-27 15:45:16 +0000706endif
Anthony Liguori834574e2013-02-20 07:43:24 -0600707ifeq ($(CONFIG_GTK),y)
708 $(MAKE) -C po $@
709endif
Eduardo Habkost6aae2a22012-04-18 16:55:41 -0300710 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
blueswir118be8d72008-03-05 18:16:09 +0000711 set -e; for x in $(KEYMAPS); do \
Eduardo Habkost6aae2a22012-04-18 16:55:41 -0300712 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
pbrookad064842006-04-16 12:41:07 +0000713 done
Daniel P. Berrange1412cf52016-06-16 09:39:47 +0100714 $(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
bellard626df762003-08-10 21:39:31 +0000715 for d in $(TARGET_DIRS); do \
Lluís Vilanova65700252014-01-20 12:21:54 +0100716 $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
bellard626df762003-08-10 21:39:31 +0000717 done
bellard612384d2003-03-22 17:31:19 +0000718
Fam Zhengae5fdc82015-05-22 13:35:08 +0800719.PHONY: ctags
720ctags:
Sergey Fedorovac99c622016-06-09 20:58:35 +0300721 rm -f tags
Fam Zhengae5fdc82015-05-22 13:35:08 +0800722 find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
723
Alexandre Bique21d4e8e2009-08-07 15:43:11 +0100724.PHONY: TAGS
ths5fafdf22007-09-16 21:08:06 +0000725TAGS:
Sergey Fedorovac99c622016-06-09 20:58:35 +0300726 rm -f TAGS
David Gibsonb1999e82013-03-12 13:57:28 +1100727 find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
bellard31e31b82003-02-18 22:55:36 +0000728
bellard6688bc62005-08-21 09:23:39 +0000729cscope:
Fam Zhengeaa2ddb2015-05-22 13:35:07 +0800730 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"
bellard6688bc62005-08-21 09:23:39 +0000733
Gerd Hoffmannd98bc0b2015-01-16 13:59:17 +0100734# 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 $< > $@,\
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100739 "VERT","$@")
Gerd Hoffmannd98bc0b2015-01-16 13:59:17 +0100740
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 $< > $@,\
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100745 "FRAG","$@")
Gerd Hoffmannd98bc0b2015-01-16 13:59:17 +0100746
Gerd Hoffmann46e19e12017-10-10 15:54:49 +0200747ui/shader.o: $(SRC_PATH)/ui/shader.c \
Gerd Hoffmann2e1d70b2017-10-10 15:54:50 +0200748 ui/shader/texture-blit-vert.h \
749 ui/shader/texture-blit-flip-vert.h \
750 ui/shader/texture-blit-frag.h
Gerd Hoffmanncd2bc882015-01-09 11:40:23 +0100751
bellard3ef693a2003-03-23 20:17:16 +0000752# documentation
Markus Armbrustere8518c92017-01-19 10:06:44 +0100753MAKEINFO=makeinfo
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200754MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
755MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
Paolo Bonzini44cb2802017-06-06 16:59:37 +0200756TEXI2PODFLAGS=$(MAKEINFOINCLUDES) "-DVERSION=$(VERSION)"
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200757TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
Marc-André Lureau56e8bdd2017-01-13 15:41:35 +0100758
Markus Armbrusterbd7f9742017-03-15 13:56:56 +0100759docs/version.texi: $(SRC_PATH)/VERSION
Peter Maydellfea346f2017-02-17 18:59:28 +0000760 $(call quiet-command,echo "@set VERSION $(VERSION)" > $@,"GEN","$@")
761
Paolo Bonzini44cb2802017-06-06 16:59:37 +0200762%.html: %.texi docs/version.texi
Marc-André Lureaue9ee06b2017-01-13 15:41:31 +0100763 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
764 --html $< -o $@,"GEN","$@")
bellard3ef693a2003-03-23 20:17:16 +0000765
Paolo Bonzini44cb2802017-06-06 16:59:37 +0200766%.info: %.texi docs/version.texi
Marc-André Lureaue9ee06b2017-01-13 15:41:31 +0100767 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
bellardf3548322006-04-30 22:51:54 +0000768
Paolo Bonzini44cb2802017-06-06 16:59:37 +0200769%.txt: %.texi docs/version.texi
Marc-André Lureauf8bab102017-01-13 15:41:34 +0100770 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
771 --plaintext $< -o $@,"GEN","$@")
772
Paolo Bonzini44cb2802017-06-06 16:59:37 +0200773%.pdf: %.texi docs/version.texi
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200774 $(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@")
Markus Armbrusterbd7f9742017-03-15 13:56:56 +0100775
Paolo Bonzini077de812016-06-07 13:27:04 +0200776qemu-options.texi: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100777 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
bellardf3548322006-04-30 22:51:54 +0000778
Paolo Bonzini077de812016-06-07 13:27:04 +0200779qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100780 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
Blue Swirl23130862009-06-06 08:22:04 +0000781
Paolo Bonzini077de812016-06-07 13:27:04 +0200782qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100783 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
Pavel Butsykin2cd8af22015-09-10 18:39:01 +0300784
Paolo Bonzini077de812016-06-07 13:27:04 +0200785qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
Peter Maydell0bdb12c2016-10-04 17:27:21 +0100786 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
Stuart Brady153859b2009-06-07 00:42:17 +0100787
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200788docs/interop/qemu-qmp-qapi.texi docs/interop/qemu-ga-qapi.texi: $(SRC_PATH)/scripts/qapi2texi.py $(qapi-py)
Markus Armbruster4afeeb52017-03-20 14:11:50 +0100789
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200790docs/interop/qemu-qmp-qapi.texi: $(qapi-modules)
Markus Armbrustere8518c92017-01-19 10:06:44 +0100791 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")
Marc-André Lureau56e8bdd2017-01-13 15:41:35 +0100792
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200793docs/interop/qemu-ga-qapi.texi: $(SRC_PATH)/qga/qapi-schema.json
Marc-André Lureau56e8bdd2017-01-13 15:41:35 +0100794 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")
795
Pavel Butsykin2cd8af22015-09-10 18:39:01 +0300796qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
Denis V. Luneveeb2b8f2016-06-17 17:44:09 +0300797qemu.1: qemu-option-trace.texi
Denis V. Lunev06a1e0c2016-06-17 17:44:14 +0300798qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
M. Mohan Kumara2d8f1b2011-12-14 13:58:47 +0530799fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
Denis V. Lunev39ca4632016-06-17 17:44:12 +0300800qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
Marc-André Lureau665b5d02015-08-27 01:34:59 +0200801qemu-ga.8: qemu-ga.texi
Stefan Hajnoczi78aa8aa2017-09-08 09:39:41 +0100802docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
Marc-André Lureau665b5d02015-08-27 01:34:59 +0200803
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200804html: 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
pbrook0cb3fb12006-05-14 12:07:53 +0000808
Peter Maydelld5e85102017-01-24 14:02:18 +0000809qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
Denis V. Luneveeb2b8f2016-06-17 17:44:09 +0300810 qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \
Pavel Butsykin2cd8af22015-09-10 18:39:01 +0300811 qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
Stefan Hajnoczi78aa8aa2017-09-08 09:39:41 +0100812 qemu-monitor-info.texi docs/qemu-block-drivers.texi
aliguori818220f2008-09-24 01:13:40 +0000813
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200814docs/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
Marc-André Lureau56e8bdd2017-01-13 15:41:35 +0100818
Paolo Bonzinid59157e2017-06-06 16:55:19 +0200819docs/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
Marc-André Lureau56e8bdd2017-01-13 15:41:35 +0100823
824
Stefan Weilf53ec692013-07-15 23:49:57 +0200825ifdef 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
Ed Mastefb8597b2015-04-01 13:58:38 -0400848 $(MAKE) install prefix=${INSTDIR}
Stefan Weilf53ec692013-07-15 23:49:57 +0200849ifdef 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)" \
Stefan Weil805d8a62015-05-03 19:57:09 +0200873 -DDISPLAYVERSION="$(VERSION)" \
Stefan Weilf53ec692013-07-15 23:49:57 +0200874 $(SRC_PATH)/qemu.nsi
875 rm -r ${INSTDIR}
876ifdef SIGNCODE
877 $(SIGNCODE) $(INSTALLER)
878endif # SIGNCODE
879endif # CONFIG_WIN
880
Anthony Liguoricb5fc672012-07-17 18:58:20 -0500881# Add a dependency on the generated files, so that they are always
882# rebuilt before other object files
Thomas Huth428952c2017-06-08 14:59:59 +0200883ifneq ($(wildcard config-host.mak),)
Fam Zhengeaa2ddb2015-05-22 13:35:07 +0800884ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
Daniel P. Berrange4f04f132017-02-28 12:29:00 +0000885Makefile: $(GENERATED_FILES)
Mike Frysinger7748b8c2012-09-16 16:07:13 -0400886endif
Thomas Huth428952c2017-06-08 14:59:59 +0200887endif
Anthony Liguoricb5fc672012-07-17 18:58:20 -0500888
Daniel P. Berrange0ab8ed12017-01-25 16:14:15 +0000889.SECONDARY: $(TRACE_HEADERS) $(TRACE_HEADERS:%=%-timestamp) \
890 $(TRACE_SOURCES) $(TRACE_SOURCES:%=%-timestamp) \
891 $(TRACE_DTRACE) $(TRACE_DTRACE:%=%-timestamp)
892
bellard4fb240a2007-11-07 19:24:02 +0000893# Include automatically generated dependency files
Paolo Bonzini1435ddb2012-07-11 16:40:21 +0200894# Dependencies in Makefile.objs files come from our recursive subdir rules
895-include $(wildcard *.d tests/*.d)
Fam Zheng324027c2016-06-01 12:25:17 +0800896
897include $(SRC_PATH)/tests/docker/Makefile.include
Fam Zhengb1fb9a62017-09-05 10:11:58 +0800898include $(SRC_PATH)/tests/vm/Makefile.include
Marc-André Lureau0d8e0652016-09-13 18:20:33 +0400899
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'
Fam Zhengb1fb9a62017-09-05 10:11:58 +0800922 @echo ' vm-test - Help about targets running tests inside VM'
Marc-André Lureau0d8e0652016-09-13 18:20:33 +0400923 @echo ''
924 @echo 'Documentation targets:'
Marc-André Lureauf8bab102017-01-13 15:41:34 +0100925 @echo ' html info pdf txt'
Marc-André Lureau0d8e0652016-09-13 18:20:33 +0400926 @echo ' - Build documentation in specified format'
927 @echo ''
928ifdef CONFIG_WIN32
929 @echo 'Windows targets:'
Stefan Weil6bd67f82016-10-20 21:36:32 +0200930 @echo ' installer - Build NSIS-based installer for QEMU'
Marc-André Lureau0d8e0652016-09-13 18:20:33 +0400931ifdef 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'