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