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