Merge remote-tracking branch 'qemu/master'
[qemu/ar7.git] / Makefile
bloba8054f5b7ffbb55e11aa34ce5cf3f6bc60df6f23
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 io-obj-y \
160 common-obj-y \
161 common-obj-m)
163 ifneq ($(wildcard config-host.mak),)
164 include $(SRC_PATH)/tests/Makefile
165 endif
167 all: recurse-all
169 ifdef BUILD_DOCS
170 all: doc
171 endif
173 ifdef BUILD_TOOLS
174 all: tools
175 endif
177 all: $(HELPERS-y)
178 all: modules
180 doc: $(DOCS)
181 tools: $(TOOLS)
183 config-host.h: config-host.h-timestamp
184 config-host.h-timestamp: config-host.mak
185 qemu-options.def: $(SRC_PATH)/qemu-options.hx
186 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
188 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
189 SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
191 $(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
192 $(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
193 $(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
194 $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
196 subdir-%:
197 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
199 subdir-pixman: pixman/Makefile
200 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pixman V="$(V)" all,)
202 pixman/Makefile: $(SRC_PATH)/pixman/configure
203 (cd pixman; CFLAGS="$(CFLAGS) -fPIC $(extra_cflags) $(extra_ldflags)" $(SRC_PATH)/pixman/configure $(AUTOCONF_HOST) --disable-gtk --disable-shared --enable-static)
205 $(SRC_PATH)/pixman/configure:
206 (cd $(SRC_PATH)/pixman; autoreconf -v --install)
208 DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
209 DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
210 DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
212 subdir-dtc:dtc/libfdt dtc/tests
213 $(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,)
215 dtc/%:
216 mkdir -p $@
218 $(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
220 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
221 romsubdir-%:
222 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
224 ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
226 recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
228 $(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h | $(BUILD_DIR)/version.lo
229 $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<," RC version.o")
230 $(BUILD_DIR)/version.lo: $(SRC_PATH)/version.rc config-host.h
231 $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<," RC version.lo")
233 Makefile: $(version-obj-y) $(version-lobj-y)
235 ######################################################################
236 # Build libraries
238 libqemustub.a: $(stub-obj-y)
239 libqemuutil.a: $(util-obj-y)
241 block-modules = $(foreach o,$(block-obj-m),"$(basename $(subst /,-,$o))",) NULL
242 util/module.o-cflags = -D'CONFIG_BLOCK_MODULES=$(block-modules)'
244 ######################################################################
246 qemu-img.o: qemu-img-cmds.h
248 qemu-img$(EXESUF): qemu-img.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) libqemuutil.a libqemustub.a
249 qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) libqemuutil.a libqemustub.a
250 qemu-io$(EXESUF): qemu-io.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) libqemuutil.a libqemustub.a
252 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o libqemuutil.a libqemustub.a
254 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o libqemuutil.a libqemustub.a
255 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
257 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
258 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
260 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
261 qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
263 gen-out-type = $(subst .,-,$(suffix $@))
265 qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
267 qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
268 $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
269 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
270 $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
271 " GEN $@")
272 qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
273 $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
274 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
275 $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
276 " GEN $@")
277 qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
278 $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
279 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
280 $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
281 " GEN $@")
283 qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
284 $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
285 $(SRC_PATH)/qapi/event.json $(SRC_PATH)/qapi/introspect.json \
286 $(SRC_PATH)/qapi/crypto.json $(SRC_PATH)/qapi/rocker.json \
287 $(SRC_PATH)/qapi/trace.json
289 qapi-types.c qapi-types.h :\
290 $(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
291 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
292 $(gen-out-type) -o "." -b $<, \
293 " GEN $@")
294 qapi-visit.c qapi-visit.h :\
295 $(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
296 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
297 $(gen-out-type) -o "." -b $<, \
298 " GEN $@")
299 qapi-event.c qapi-event.h :\
300 $(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
301 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
302 $(gen-out-type) -o "." $<, \
303 " GEN $@")
304 qmp-commands.h qmp-marshal.c :\
305 $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
306 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
307 $(gen-out-type) -o "." -m $<, \
308 " GEN $@")
309 qmp-introspect.h qmp-introspect.c :\
310 $(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
311 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
312 $(gen-out-type) -o "." $<, \
313 " GEN $@")
315 QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
316 $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
318 qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
319 $(call LINK, $^)
321 ifdef QEMU_GA_MSI_ENABLED
322 QEMU_GA_MSI=qemu-ga-$(ARCH).msi
324 msi: $(QEMU_GA_MSI)
326 $(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
328 $(QEMU_GA_MSI): config-host.mak
330 $(QEMU_GA_MSI): $(SRC_PATH)/qga/installer/qemu-ga.wxs
331 $(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)" \
332 wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<, " WIXL $@")
333 else
334 msi:
335 @echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
336 endif
338 ifneq ($(EXESUF),)
339 .PHONY: qemu-ga
340 qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
341 endif
343 ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) libqemuutil.a libqemustub.a
344 $(call LINK, $^)
345 ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) libqemuutil.a libqemustub.a
346 $(call LINK, $^)
348 clean:
349 # avoid old build problems by removing potentially incorrect old files
350 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
351 rm -f qemu-options.def
352 rm -f *.msi
353 find . \( -name '*.l[oa]' -o -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} +
354 rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
355 rm -f fsdev/*.pod
356 rm -rf .libs */.libs
357 rm -f qemu-img-cmds.h
358 rm -f ui/shader/*-vert.h ui/shader/*-frag.h
359 @# May not be present in GENERATED_HEADERS
360 rm -f trace/generated-tracers-dtrace.dtrace*
361 rm -f trace/generated-tracers-dtrace.h*
362 rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
363 rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
364 rm -rf qapi-generated
365 rm -rf qga/qapi-generated
366 for d in $(ALL_SUBDIRS); do \
367 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
368 rm -f $$d/qemu-options.def; \
369 done
371 VERSION ?= $(shell cat VERSION)
373 dist: qemu-$(VERSION).tar.bz2
375 qemu-%.tar.bz2:
376 $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
378 distclean: clean
379 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
380 rm -f config-all-devices.mak config-all-disas.mak config.status
381 rm -f po/*.mo tests/qemu-iotests/common.env
382 rm -f roms/seabios/config.mak roms/vgabios/config.mak
383 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps qemu-doc.dvi
384 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
385 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
386 rm -f qemu-doc.vr
387 rm -f config.log
388 rm -f linux-headers/asm
389 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
390 for d in $(TARGET_DIRS); do \
391 rm -rf $$d || exit 1 ; \
392 done
393 rm -Rf .sdk
394 if test -f pixman/config.log; then $(MAKE) -C pixman distclean; fi
395 if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
397 KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
398 ar de en-us fi fr-be hr it lv nl pl ru th \
399 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr \
400 bepo cz
402 ifdef INSTALL_BLOBS
403 BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
404 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
405 acpi-dsdt.aml \
406 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
407 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
408 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
409 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
410 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
411 qemu-icon.bmp qemu_logo_no_text.svg \
412 bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
413 multiboot.bin linuxboot.bin kvmvapic.bin \
414 s390-ccw.img \
415 spapr-rtas.bin slof.bin \
416 palcode-clipper \
417 u-boot.e500
418 else
419 BLOBS=
420 endif
422 install-doc: doc
423 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
424 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(qemu_docdir)"
425 $(INSTALL_DATA) qmp-commands.txt "$(DESTDIR)$(qemu_docdir)"
426 ifdef CONFIG_POSIX
427 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
428 $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
429 ifneq ($(TOOLS),)
430 $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
431 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
432 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
433 endif
434 ifneq (,$(findstring qemu-ga,$(TOOLS)))
435 $(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
436 endif
437 endif
438 ifdef CONFIG_VIRTFS
439 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
440 $(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
441 endif
443 install-datadir:
444 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
446 install-localstatedir:
447 ifdef CONFIG_POSIX
448 ifneq (,$(findstring qemu-ga,$(TOOLS)))
449 $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
450 endif
451 endif
454 install-tools: tools
455 $(call install-prog,$(filter-out qemu-ga,$(TOOLS)),$(DESTDIR)$(bindir))
456 # qemu-ga is included in TOOLS, but we need special install rules for w32
457 ifneq (,$(findstring qemu-ga,$(TOOLS)))
458 $(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
459 endif
462 install: all $(if $(BUILD_DOCS),install-doc) $(if $(BUILD_TOOLS),install-tools) \
463 install-datadir install-localstatedir
464 ifneq ($(CONFIG_MODULES),)
465 $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
466 for s in $(modules-m:.mo=$(DSOSUF)); do \
467 t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
468 $(INSTALL_LIB) $$s "$$t"; \
469 test -z "$(STRIP)" || $(STRIP) "$$t"; \
470 done
471 endif
472 ifneq ($(HELPERS-y),)
473 $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
474 endif
475 ifneq ($(BLOBS),)
476 set -e; for x in $(BLOBS); do \
477 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
478 done
479 endif
480 ifeq ($(CONFIG_GTK),y)
481 $(MAKE) -C po $@
482 endif
483 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
484 set -e; for x in $(KEYMAPS); do \
485 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
486 done
487 $(INSTALL_DATA) $(SRC_PATH)/trace-events "$(DESTDIR)$(qemu_datadir)/trace-events"
488 for d in $(TARGET_DIRS); do \
489 $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
490 done
492 # various test targets
493 test speed: all
494 $(MAKE) -C tests/tcg $@
496 .PHONY: ctags
497 ctags:
498 rm -f $@
499 find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
501 .PHONY: TAGS
502 TAGS:
503 rm -f $@
504 find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
506 cscope:
507 rm -f "$(SRC_PATH)"/cscope.*
508 find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
509 cscope -b -i"$(SRC_PATH)/cscope.files"
511 # opengl shader programs
512 ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
513 @mkdir -p $(dir $@)
514 $(call quiet-command,\
515 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
516 " VERT $@")
518 ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
519 @mkdir -p $(dir $@)
520 $(call quiet-command,\
521 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
522 " FRAG $@")
524 ui/console-gl.o: $(SRC_PATH)/ui/console-gl.c \
525 ui/shader/texture-blit-vert.h ui/shader/texture-blit-frag.h
527 # documentation
528 MAKEINFO=makeinfo
529 MAKEINFOFLAGS=--no-headers --no-split --number-sections
530 TEXIFLAG=$(if $(V),,--quiet)
531 %.dvi: %.texi
532 $(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<," GEN $@")
534 %.html: %.texi
535 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \
536 " GEN $@")
538 %.info: %.texi
539 $(call quiet-command,$(MAKEINFO) $< -o $@," GEN $@")
541 %.pdf: %.texi
542 $(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<," GEN $@")
544 qemu-options.texi: $(SRC_PATH)/qemu-options.hx
545 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
547 qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
548 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
550 qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx
551 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
553 qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
554 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@," GEN $@")
556 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
557 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
559 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
560 $(call quiet-command, \
561 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
562 $(POD2MAN) --section=1 --center=" " --release=" " qemu.pod > $@, \
563 " GEN $@")
565 qemu-img.1: qemu-img.texi qemu-img-cmds.texi
566 $(call quiet-command, \
567 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-img.pod && \
568 $(POD2MAN) --section=1 --center=" " --release=" " qemu-img.pod > $@, \
569 " GEN $@")
571 fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
572 $(call quiet-command, \
573 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< fsdev/virtfs-proxy-helper.pod && \
574 $(POD2MAN) --section=1 --center=" " --release=" " fsdev/virtfs-proxy-helper.pod > $@, \
575 " GEN $@")
577 qemu-nbd.8: qemu-nbd.texi
578 $(call quiet-command, \
579 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-nbd.pod && \
580 $(POD2MAN) --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
581 " GEN $@")
583 qemu-ga.8: qemu-ga.texi
584 $(call quiet-command, \
585 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-ga.pod && \
586 $(POD2MAN) --section=8 --center=" " --release=" " qemu-ga.pod > $@, \
587 " GEN $@")
589 kvm_stat.1: scripts/kvm/kvm_stat.texi
590 $(call quiet-command, \
591 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< kvm_stat.pod && \
592 $(POD2MAN) --section=1 --center=" " --release=" " kvm_stat.pod > $@, \
593 " GEN $@")
595 dvi: qemu-doc.dvi qemu-tech.dvi
596 html: qemu-doc.html qemu-tech.html
597 info: qemu-doc.info qemu-tech.info
598 pdf: qemu-doc.pdf qemu-tech.pdf
600 qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
601 qemu-img.texi qemu-nbd.texi qemu-options.texi \
602 qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
603 qemu-monitor-info.texi
605 ifdef CONFIG_WIN32
607 INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
609 nsisflags = -V2 -NOCD
611 ifneq ($(wildcard $(SRC_PATH)/dll),)
612 ifeq ($(ARCH),x86_64)
613 # 64 bit executables
614 DLL_PATH = $(SRC_PATH)/dll/w64
615 nsisflags += -DW64
616 else
617 # 32 bit executables
618 DLL_PATH = $(SRC_PATH)/dll/w32
619 endif
620 endif
622 .PHONY: installer
623 installer: $(INSTALLER)
625 INSTDIR=/tmp/qemu-nsis
627 $(INSTALLER): $(SRC_PATH)/qemu.nsi
628 $(MAKE) install prefix=${INSTDIR}
629 ifdef SIGNCODE
630 (cd ${INSTDIR}; \
631 for i in *.exe; do \
632 $(SIGNCODE) $${i}; \
633 done \
635 endif # SIGNCODE
636 (cd ${INSTDIR}; \
637 for i in qemu-system-*.exe; do \
638 arch=$${i%.exe}; \
639 arch=$${arch#qemu-system-}; \
640 echo Section \"$$arch\" Section_$$arch; \
641 echo SetOutPath \"\$$INSTDIR\"; \
642 echo File \"\$${BINDIR}\\$$i\"; \
643 echo SectionEnd; \
644 done \
645 ) >${INSTDIR}/system-emulations.nsh
646 makensis $(nsisflags) \
647 $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
648 $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
649 -DBINDIR="${INSTDIR}" \
650 $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
651 -DSRCDIR="$(SRC_PATH)" \
652 -DOUTFILE="$(INSTALLER)" \
653 -DDISPLAYVERSION="$(VERSION)" \
654 $(SRC_PATH)/qemu.nsi
655 rm -r ${INSTDIR}
656 ifdef SIGNCODE
657 $(SIGNCODE) $(INSTALLER)
658 endif # SIGNCODE
659 endif # CONFIG_WIN
661 # Add a dependency on the generated files, so that they are always
662 # rebuilt before other object files
663 ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
664 Makefile: $(GENERATED_HEADERS)
665 endif
667 # Include automatically generated dependency files
668 # Dependencies in Makefile.objs files come from our recursive subdir rules
669 -include $(wildcard *.d tests/*.d)