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