makefile: fix w32 install target for qemu-ga
[qemu/ar7.git] / Makefile
blobde76de4778b0faca3541f42705dbdd6b3a61fd32
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
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_ALL=y
30 -include config-all-devices.mak
31 -include config-all-disas.mak
33 include $(SRC_PATH)/rules.mak
34 config-host.mak: $(SRC_PATH)/configure
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 GENERATED_HEADERS = config-host.h qemu-options.def
53 GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h
54 GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
55 GENERATED_HEADERS += qmp-introspect.h
56 GENERATED_SOURCES += qmp-introspect.c
58 GENERATED_HEADERS += trace/generated-events.h
59 GENERATED_SOURCES += trace/generated-events.c
61 GENERATED_HEADERS += trace/generated-tracers.h
62 ifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace)
63 GENERATED_HEADERS += trace/generated-tracers-dtrace.h
64 endif
65 GENERATED_SOURCES += trace/generated-tracers.c
67 GENERATED_HEADERS += trace/generated-tcg-tracers.h
69 GENERATED_HEADERS += trace/generated-helpers-wrappers.h
70 GENERATED_HEADERS += trace/generated-helpers.h
71 GENERATED_SOURCES += trace/generated-helpers.c
73 ifeq ($(findstring ust,$(TRACE_BACKENDS)),ust)
74 GENERATED_HEADERS += trace/generated-ust-provider.h
75 GENERATED_SOURCES += trace/generated-ust.c
76 endif
78 # Don't try to regenerate Makefile or configure
79 # We don't generate any of them
80 Makefile: ;
81 configure: ;
83 .PHONY: all clean cscope dist distclean doc dvi html \
84 info install install-doc install-tools msi \
85 pdf recurse-all speed test tools
87 $(call set-vpath, $(SRC_PATH))
89 LIBS+=-lz $(LIBS_TOOLS)
91 HELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)
93 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8
94 DOCS+=qmp-commands.txt
95 ifdef CONFIG_LINUX
96 DOCS+=kvm_stat.1
97 endif
98 ifdef CONFIG_VIRTFS
99 DOCS+=fsdev/virtfs-proxy-helper.1
100 endif
102 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR)
103 SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
104 SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
106 ifeq ($(SUBDIR_DEVICES_MAK),)
107 config-all-devices.mak:
108 $(call quiet-command,echo '# no devices' > $@," GEN $@")
109 else
110 config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
111 $(call quiet-command, sed -n \
112 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
113 $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
114 " GEN $@")
115 endif
117 -include $(SUBDIR_DEVICES_MAK_DEP)
119 %/config-devices.mak: default-configs/%.mak
120 $(call quiet-command, \
121 $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > $@.tmp, " GEN $@.tmp")
122 $(call quiet-command, if test -f $@; then \
123 if cmp -s $@.old $@; then \
124 mv $@.tmp $@; \
125 cp -p $@ $@.old; \
126 else \
127 if test -f $@.old; then \
128 echo "WARNING: $@ (user modified) out of date.";\
129 else \
130 echo "WARNING: $@ out of date.";\
131 fi; \
132 echo "Run \"make defconfig\" to regenerate."; \
133 rm $@.tmp; \
134 fi; \
135 else \
136 mv $@.tmp $@; \
137 cp -p $@ $@.old; \
138 fi, " GEN $@");
140 defconfig:
141 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
143 ifneq ($(wildcard config-host.mak),)
144 include $(SRC_PATH)/Makefile.objs
145 endif
147 dummy := $(call unnest-vars,, \
148 stub-obj-y \
149 util-obj-y \
150 qga-obj-y \
151 ivshmem-client-obj-y \
152 ivshmem-server-obj-y \
153 qga-vss-dll-obj-y \
154 block-obj-y \
155 block-obj-m \
156 crypto-obj-y \
157 crypto-aes-obj-y \
158 qom-obj-y \
159 common-obj-y \
160 common-obj-m)
162 ifneq ($(wildcard config-host.mak),)
163 include $(SRC_PATH)/tests/Makefile
164 endif
166 all: recurse-all
168 ifdef BUILD_DOCS
169 all: doc
170 endif
172 ifdef BUILD_TOOLS
173 all: tools
174 endif
176 all: $(HELPERS-y)
177 all: modules
179 doc: $(DOCS)
180 tools: $(TOOLS)
182 config-host.h: config-host.h-timestamp
183 config-host.h-timestamp: config-host.mak
184 qemu-options.def: $(SRC_PATH)/qemu-options.hx
185 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
187 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
188 SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
190 $(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
191 $(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
192 $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
194 subdir-%:
195 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
197 subdir-pixman: pixman/Makefile
198 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pixman V="$(V)" all,)
200 pixman/Makefile: $(SRC_PATH)/pixman/configure
201 (cd pixman; CFLAGS="$(CFLAGS) -fPIC $(extra_cflags) $(extra_ldflags)" $(SRC_PATH)/pixman/configure $(AUTOCONF_HOST) --disable-gtk --disable-shared --enable-static)
203 $(SRC_PATH)/pixman/configure:
204 (cd $(SRC_PATH)/pixman; autoreconf -v --install)
206 DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
207 DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
208 DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
210 subdir-dtc:dtc/libfdt dtc/tests
211 $(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,)
213 dtc/%:
214 mkdir -p $@
216 $(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
218 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
219 romsubdir-%:
220 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
222 ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
224 recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
226 $(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h | $(BUILD_DIR)/version.lo
227 $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<," RC version.o")
228 $(BUILD_DIR)/version.lo: $(SRC_PATH)/version.rc config-host.h
229 $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<," RC version.lo")
231 Makefile: $(version-obj-y) $(version-lobj-y)
233 ######################################################################
234 # Build libraries
236 libqemustub.a: $(stub-obj-y)
237 libqemuutil.a: $(util-obj-y)
239 block-modules = $(foreach o,$(block-obj-m),"$(basename $(subst /,-,$o))",) NULL
240 util/module.o-cflags = -D'CONFIG_BLOCK_MODULES=$(block-modules)'
242 ######################################################################
244 qemu-img.o: qemu-img-cmds.h
246 qemu-img$(EXESUF): qemu-img.o $(block-obj-y) $(crypto-obj-y) $(qom-obj-y) libqemuutil.a libqemustub.a
247 qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) $(crypto-obj-y) $(qom-obj-y) libqemuutil.a libqemustub.a
248 qemu-io$(EXESUF): qemu-io.o $(block-obj-y) $(crypto-obj-y) $(qom-obj-y) libqemuutil.a libqemustub.a
250 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
252 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/virtio-9p-marshal.o libqemuutil.a libqemustub.a
253 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
255 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
256 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
258 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
259 qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
261 gen-out-type = $(subst .,-,$(suffix $@))
263 qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
265 qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
266 $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
267 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
268 $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
269 " GEN $@")
270 qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
271 $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
272 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
273 $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
274 " GEN $@")
275 qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
276 $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
277 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
278 $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
279 " GEN $@")
281 qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
282 $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
283 $(SRC_PATH)/qapi/event.json $(SRC_PATH)/qapi/introspect.json
285 qapi-types.c qapi-types.h :\
286 $(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
287 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
288 $(gen-out-type) -o "." -b $<, \
289 " GEN $@")
290 qapi-visit.c qapi-visit.h :\
291 $(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
292 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
293 $(gen-out-type) -o "." -b $<, \
294 " GEN $@")
295 qapi-event.c qapi-event.h :\
296 $(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
297 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
298 $(gen-out-type) -o "." $<, \
299 " GEN $@")
300 qmp-commands.h qmp-marshal.c :\
301 $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
302 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
303 $(gen-out-type) -o "." -m $<, \
304 " GEN $@")
305 qmp-introspect.h qmp-introspect.c :\
306 $(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
307 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
308 $(gen-out-type) -o "." $<, \
309 " GEN $@")
311 QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
312 $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
314 qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
315 $(call LINK, $^)
317 ifdef QEMU_GA_MSI_ENABLED
318 QEMU_GA_MSI=qemu-ga-$(ARCH).msi
320 msi: $(QEMU_GA_MSI)
322 $(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
324 $(QEMU_GA_MSI): config-host.mak
326 $(QEMU_GA_MSI): $(SRC_PATH)/qga/installer/qemu-ga.wxs
327 $(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)" \
328 wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<, " WIXL $@")
329 else
330 msi:
331 @echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
332 endif
334 ifneq ($(EXESUF),)
335 .PHONY: qemu-ga
336 qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
337 endif
339 ivshmem-client$(EXESUF): $(ivshmem-client-obj-y)
340 $(call LINK, $^)
341 ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) libqemuutil.a libqemustub.a
342 $(call LINK, $^)
344 clean:
345 # avoid old build problems by removing potentially incorrect old files
346 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
347 rm -f qemu-options.def
348 rm -f *.msi
349 find . \( -name '*.l[oa]' -o -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} +
350 rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
351 rm -f fsdev/*.pod
352 rm -rf .libs */.libs
353 rm -f qemu-img-cmds.h
354 rm -f ui/shader/*-vert.h ui/shader/*-frag.h
355 @# May not be present in GENERATED_HEADERS
356 rm -f trace/generated-tracers-dtrace.dtrace*
357 rm -f trace/generated-tracers-dtrace.h*
358 rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
359 rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
360 rm -rf qapi-generated
361 rm -rf qga/qapi-generated
362 for d in $(ALL_SUBDIRS); do \
363 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
364 rm -f $$d/qemu-options.def; \
365 done
367 VERSION ?= $(shell cat VERSION)
369 dist: qemu-$(VERSION).tar.bz2
371 qemu-%.tar.bz2:
372 $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
374 distclean: clean
375 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
376 rm -f config-all-devices.mak config-all-disas.mak config.status
377 rm -f po/*.mo tests/qemu-iotests/common.env
378 rm -f roms/seabios/config.mak roms/vgabios/config.mak
379 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps qemu-doc.dvi
380 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
381 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
382 rm -f qemu-doc.vr
383 rm -f config.log
384 rm -f linux-headers/asm
385 rm -f qemu-tech.info qemu-tech.aux qemu-tech.cp qemu-tech.dvi qemu-tech.fn qemu-tech.info qemu-tech.ky qemu-tech.log qemu-tech.pdf qemu-tech.pg qemu-tech.toc qemu-tech.tp qemu-tech.vr
386 for d in $(TARGET_DIRS); do \
387 rm -rf $$d || exit 1 ; \
388 done
389 rm -Rf .sdk
390 if test -f pixman/config.log; then $(MAKE) -C pixman distclean; fi
391 if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
393 KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
394 ar de en-us fi fr-be hr it lv nl pl ru th \
395 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr \
396 bepo cz
398 ifdef INSTALL_BLOBS
399 BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
400 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
401 acpi-dsdt.aml q35-acpi-dsdt.aml \
402 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
403 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
404 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
405 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
406 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
407 qemu-icon.bmp qemu_logo_no_text.svg \
408 bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
409 multiboot.bin linuxboot.bin kvmvapic.bin \
410 s390-zipl.rom \
411 s390-ccw.img \
412 spapr-rtas.bin slof.bin \
413 palcode-clipper \
414 u-boot.e500
415 else
416 BLOBS=
417 endif
419 install-doc: doc
420 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
421 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(qemu_docdir)"
422 $(INSTALL_DATA) qmp-commands.txt "$(DESTDIR)$(qemu_docdir)"
423 ifdef CONFIG_POSIX
424 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
425 $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
426 ifneq ($(TOOLS),)
427 $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
428 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
429 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
430 endif
431 ifneq (,$(findstring qemu-ga,$(TOOLS)))
432 $(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
433 endif
434 endif
435 ifdef CONFIG_VIRTFS
436 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
437 $(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
438 endif
440 install-datadir:
441 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
443 install-localstatedir:
444 ifdef CONFIG_POSIX
445 ifneq (,$(findstring qemu-ga,$(TOOLS)))
446 $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
447 endif
448 endif
451 install-tools: tools
452 $(call install-prog,$(filter-out qemu-ga,$(TOOLS)),$(DESTDIR)$(bindir))
453 # qemu-ga is included in TOOLS, but we need special install rules for w32
454 ifneq (,$(findstring qemu-ga,$(TOOLS)))
455 $(call install-prog,qemu-ga$(EXESUF),$(DESTDIR)$(bindir))
456 endif
459 install: all $(if $(BUILD_DOCS),install-doc) $(if $(BUILD_TOOLS),install-tools) \
460 install-datadir install-localstatedir
461 ifneq ($(CONFIG_MODULES),)
462 $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
463 for s in $(modules-m:.mo=$(DSOSUF)); do \
464 t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
465 $(INSTALL_LIB) $$s "$$t"; \
466 test -z "$(STRIP)" || $(STRIP) "$$t"; \
467 done
468 endif
469 ifneq ($(HELPERS-y),)
470 $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
471 endif
472 ifneq ($(BLOBS),)
473 set -e; for x in $(BLOBS); do \
474 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
475 done
476 endif
477 ifeq ($(CONFIG_GTK),y)
478 $(MAKE) -C po $@
479 endif
480 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
481 set -e; for x in $(KEYMAPS); do \
482 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
483 done
484 $(INSTALL_DATA) $(SRC_PATH)/trace-events "$(DESTDIR)$(qemu_datadir)/trace-events"
485 for d in $(TARGET_DIRS); do \
486 $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
487 done
489 # various test targets
490 test speed: all
491 $(MAKE) -C tests/tcg $@
493 .PHONY: ctags
494 ctags:
495 rm -f $@
496 find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
498 .PHONY: TAGS
499 TAGS:
500 rm -f $@
501 find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
503 cscope:
504 rm -f "$(SRC_PATH)"/cscope.*
505 find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
506 cscope -b -i"$(SRC_PATH)/cscope.files"
508 # opengl shader programs
509 ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
510 @mkdir -p $(dir $@)
511 $(call quiet-command,\
512 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
513 " VERT $@")
515 ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
516 @mkdir -p $(dir $@)
517 $(call quiet-command,\
518 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
519 " FRAG $@")
521 ui/console-gl.o: $(SRC_PATH)/ui/console-gl.c \
522 ui/shader/texture-blit-vert.h ui/shader/texture-blit-frag.h
524 # documentation
525 MAKEINFO=makeinfo
526 MAKEINFOFLAGS=--no-headers --no-split --number-sections
527 TEXIFLAG=$(if $(V),,--quiet)
528 %.dvi: %.texi
529 $(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<," GEN $@")
531 %.html: %.texi
532 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \
533 " GEN $@")
535 %.info: %.texi
536 $(call quiet-command,$(MAKEINFO) $< -o $@," GEN $@")
538 %.pdf: %.texi
539 $(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<," GEN $@")
541 qemu-options.texi: $(SRC_PATH)/qemu-options.hx
542 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
544 qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
545 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
547 qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx
548 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
550 qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
551 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@," GEN $@")
553 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
554 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
556 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
557 $(call quiet-command, \
558 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
559 $(POD2MAN) --section=1 --center=" " --release=" " qemu.pod > $@, \
560 " GEN $@")
562 qemu-img.1: qemu-img.texi qemu-img-cmds.texi
563 $(call quiet-command, \
564 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-img.pod && \
565 $(POD2MAN) --section=1 --center=" " --release=" " qemu-img.pod > $@, \
566 " GEN $@")
568 fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
569 $(call quiet-command, \
570 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< fsdev/virtfs-proxy-helper.pod && \
571 $(POD2MAN) --section=1 --center=" " --release=" " fsdev/virtfs-proxy-helper.pod > $@, \
572 " GEN $@")
574 qemu-nbd.8: qemu-nbd.texi
575 $(call quiet-command, \
576 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-nbd.pod && \
577 $(POD2MAN) --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
578 " GEN $@")
580 qemu-ga.8: qemu-ga.texi
581 $(call quiet-command, \
582 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-ga.pod && \
583 $(POD2MAN) --section=8 --center=" " --release=" " qemu-ga.pod > $@, \
584 " GEN $@")
586 kvm_stat.1: scripts/kvm/kvm_stat.texi
587 $(call quiet-command, \
588 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< kvm_stat.pod && \
589 $(POD2MAN) --section=1 --center=" " --release=" " kvm_stat.pod > $@, \
590 " GEN $@")
592 dvi: qemu-doc.dvi qemu-tech.dvi
593 html: qemu-doc.html qemu-tech.html
594 info: qemu-doc.info qemu-tech.info
595 pdf: qemu-doc.pdf qemu-tech.pdf
597 qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
598 qemu-img.texi qemu-nbd.texi qemu-options.texi \
599 qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
600 qemu-monitor-info.texi
602 ifdef CONFIG_WIN32
604 INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
606 nsisflags = -V2 -NOCD
608 ifneq ($(wildcard $(SRC_PATH)/dll),)
609 ifeq ($(ARCH),x86_64)
610 # 64 bit executables
611 DLL_PATH = $(SRC_PATH)/dll/w64
612 nsisflags += -DW64
613 else
614 # 32 bit executables
615 DLL_PATH = $(SRC_PATH)/dll/w32
616 endif
617 endif
619 .PHONY: installer
620 installer: $(INSTALLER)
622 INSTDIR=/tmp/qemu-nsis
624 $(INSTALLER): $(SRC_PATH)/qemu.nsi
625 $(MAKE) install prefix=${INSTDIR}
626 ifdef SIGNCODE
627 (cd ${INSTDIR}; \
628 for i in *.exe; do \
629 $(SIGNCODE) $${i}; \
630 done \
632 endif # SIGNCODE
633 (cd ${INSTDIR}; \
634 for i in qemu-system-*.exe; do \
635 arch=$${i%.exe}; \
636 arch=$${arch#qemu-system-}; \
637 echo Section \"$$arch\" Section_$$arch; \
638 echo SetOutPath \"\$$INSTDIR\"; \
639 echo File \"\$${BINDIR}\\$$i\"; \
640 echo SectionEnd; \
641 done \
642 ) >${INSTDIR}/system-emulations.nsh
643 makensis $(nsisflags) \
644 $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
645 $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
646 -DBINDIR="${INSTDIR}" \
647 $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
648 -DSRCDIR="$(SRC_PATH)" \
649 -DOUTFILE="$(INSTALLER)" \
650 -DDISPLAYVERSION="$(VERSION)" \
651 $(SRC_PATH)/qemu.nsi
652 rm -r ${INSTDIR}
653 ifdef SIGNCODE
654 $(SIGNCODE) $(INSTALLER)
655 endif # SIGNCODE
656 endif # CONFIG_WIN
658 # Add a dependency on the generated files, so that they are always
659 # rebuilt before other object files
660 ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
661 Makefile: $(GENERATED_HEADERS)
662 endif
664 # Include automatically generated dependency files
665 # Dependencies in Makefile.objs files come from our recursive subdir rules
666 -include $(wildcard *.d tests/*.d)