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