]> git.proxmox.com Git - mirror_qemu.git/blame - Makefile
docs: automatically track manual dependencies
[mirror_qemu.git] / Makefile
CommitLineData
0cb3fb1e
PB
1# Makefile for QEMU.
2
4ace32e2
AO
3ifneq ($(words $(subst :, ,$(CURDIR))), 1)
4 $(error main directory cannot contain spaces nor colons)
5endif
6
519e1693
SW
7# Always point to the root of the build tree (needs GNU make).
8BUILD_DIR=$(CURDIR)
388d4758 9
eaa2ddbb
FZ
10# Before including a proper config-host.mak, assume we are in the source tree
11SRC_PATH=.
12
28fa2927
PMD
13UNCHECKED_GOALS := %clean TAGS cscope ctags dist \
14 html info pdf txt \
de1da442 15 help check-help print-% \
4f2f6276 16 docker docker-% vm-help vm-test vm-build-%
eaa2ddbb 17
250b086e 18# All following code might depend on configuration variables
55d7e8f6 19ifneq ($(wildcard config-host.mak),)
1ad2134f 20# Put the all: rule here so that config-host.mak can contain dependencies.
8f67aa82 21all:
ad064840 22include config-host.mak
d1bd2423 23
aef45d51
DB
24git-submodule-update:
25
26.PHONY: git-submodule-update
27
c4b01c7c
DB
28git_module_status := $(shell \
29 cd '$(SRC_PATH)' && \
30 GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
31 echo $$?; \
32)
aef45d51
DB
33
34ifeq (1,$(git_module_status))
f62bbee5
DB
35ifeq (no,$(GIT_UPDATE))
36git-submodule-update:
37 $(call quiet-command, \
38 echo && \
39 echo "GIT submodule checkout is out of date. Please run" && \
40 echo " scripts/git-submodule.sh update $(GIT_SUBMODULES)" && \
41 echo "from the source directory checkout $(SRC_PATH)" && \
42 echo && \
43 exit 1)
44else
aef45d51
DB
45git-submodule-update:
46 $(call quiet-command, \
cc84d63a 47 (cd $(SRC_PATH) && GIT="$(GIT)" ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \
aef45d51
DB
48 "GIT","$(GIT_SUBMODULES)")
49endif
50endif
51
a5665051
PB
52export NINJA=./ninjatool
53
54# Running meson regenerates both build.ninja and ninjatool, and that is
55# enough to prime the rest of the build.
56ninjatool: build.ninja
57
58# Only needed in case Makefile.ninja does not exist.
59.PHONY: ninja-clean ninja-distclean clean-ctlist
60clean-ctlist:
61ninja-clean::
62ninja-distclean::
63build.ninja: config-host.mak
64
65Makefile.ninja: build.ninja ninjatool
66 ./ninjatool -t ninja2make --omit clean dist uninstall < $< > $@
67-include Makefile.ninja
68
69${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
70
245dac4a
PB
71# If MESON is empty, the rule will be re-evaluated after Makefiles are
72# reread (and MESON won't be empty anymore).
73ifneq ($(MESON),)
74Makefile.mtest: build.ninja scripts/mtest2make.py
75 $(MESON) introspect --tests | $(PYTHON) scripts/mtest2make.py > $@
76-include Makefile.mtest
77endif
78
92712822 79.git-submodule-status: git-submodule-update config-host.mak
aef45d51 80
d1bd2423
PM
81# Check that we're not trying to do an out-of-tree build from
82# a tree that's been used for an in-tree build.
83ifneq ($(realpath $(SRC_PATH)),$(realpath .))
84ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
85$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
86seems to have been used for an in-tree build. You can fix this by running \
b98a3bae 87"$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
d1bd2423
PM
88endif
89endif
90
2b1f35b9
AB
91CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
92CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
6b827cca 93CONFIG_XEN := $(CONFIG_XEN_BACKEND)
f3aa844b
PB
94CONFIG_ALL=y
95-include config-all-devices.mak
96-include config-all-disas.mak
97
3a6b016d 98config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
e5efe7f5 99 @echo $@ is out-of-date, running configure
a5665051
PB
100 @if test -f meson-private/coredata.dat; then \
101 ./config.status --skip-meson; \
102 else \
103 ./config.status; \
104 fi
26fffe29
EC
105
106# Force configure to re-run if the API symbols are updated
107ifeq ($(CONFIG_PLUGIN),y)
108config-host.mak: $(SRC_PATH)/plugins/qemu-plugins.symbols
109endif
110
55d7e8f6
AJ
111else
112config-host.mak:
eaa2ddbb 113ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
55d7e8f6
AJ
114 @echo "Please call configure before running make!"
115 @exit 1
116endif
7748b8cb 117endif
766a487a 118
fb57c881
FZ
119include $(SRC_PATH)/rules.mak
120
c932ce31 121# lor is defined in rules.mak
29de2804
LV
122CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
123
3dff199c 124generated-files-y += .git-submodule-status
0ab8ed18 125
d9ace8b3
JQ
126# Don't try to regenerate Makefile or configure
127# We don't generate any of them
128Makefile: ;
129configure: ;
130
bd3f5706 131.PHONY: all clean cscope distclean html info install install-doc \
7c3d1917 132 pdf txt recurse-all dist msi FORCE
0cb3fb1e 133
fec90ff0 134$(call set-vpath, $(SRC_PATH))
8c462f8f 135
3e2e0e6b 136LIBS+=-lz $(LIBS_TOOLS)
67c0f08d 137
cc8ae6de 138ifdef BUILD_DOCS
d59157ea
PB
139DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
140DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
cc8ae6de
PB
141else
142DOCS=
143endif
aa05ae6f 144
8cc357b5 145SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
a992fe3d 146
992aeb8e
PB
147ifneq ($(wildcard config-host.mak),)
148include $(SRC_PATH)/Makefile.objs
ba1183da
FZ
149endif
150
46e7b706 151include $(SRC_PATH)/tests/Makefile.include
992aeb8e 152
c3a0ee84 153all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) recurse-all modules
b9dea4fb 154
67953a37
CF
155# LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
156DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_lib=""
965f486c 157DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
67953a37 158DTC_CPPFLAGS=-I$(SRC_PATH)/dtc/libfdt
a540f158 159
3b8593ee 160.PHONY: dtc/all
67953a37
CF
161dtc/all: .git-submodule-status dtc/libfdt
162 $(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt,)
a540f158 163
00525864 164dtc/%: .git-submodule-status
814e1110 165 @mkdir -p $@
a540f158 166
e219c499
RH
167# Overriding CFLAGS causes us to lose defines added in the sub-makefile.
168# Not overriding CFLAGS leads to mis-matches between compilation modes.
169# Therefore we replicate some of the logic in the sub-makefile.
170# Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
171# no need to annoy QEMU developers with such things.
172CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS))
173CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
174CAP_CFLAGS += -DCAPSTONE_HAS_ARM
175CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
176CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
177CAP_CFLAGS += -DCAPSTONE_HAS_X86
178
3b8593ee
MA
179.PHONY: capstone/all
180capstone/all: .git-submodule-status
9f81aeb5 181 $(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS) $(BUILD_DIR)/capstone/$(LIBCAPSTONE))
e219c499 182
3b8593ee
MA
183.PHONY: slirp/all
184slirp/all: .git-submodule-status
daa79d9a
AB
185 $(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp \
186 BUILD_DIR="$(BUILD_DIR)/slirp" \
187 PKG_CONFIG="$(PKG_CONFIG)" \
188 CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" \
db5adeaa 189 CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)")
675b9b53 190
3b8593ee 191ROM_DIRS = $(addprefix pc-bios/, $(ROMS))
1338a4b7 192ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
a9c87304 193# Only keep -O and -g cflags
1338a4b7
MA
194.PHONY: $(ROM_DIRS_RULES)
195$(ROM_DIRS_RULES):
196 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))" $(notdir $@),)
c05ac895 197
5e6d1573
PB
198.PHONY: recurse-all recurse-clean
199recurse-all: $(ROM_DIRS)
200recurse-clean: $(addsuffix /clean, $(ROM_DIRS))
83f64091 201
44dc0ca3 202######################################################################
4fb240a4 203
a5665051
PB
204clean: recurse-clean ninja-clean clean-ctlist
205 -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
2d80ae89 206# avoid old build problems by removing potentially incorrect old files
25be210f 207 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
23858f40
LE
208 find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \
209 ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
210 ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
211 ! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
212 -exec rm {} +
c3a0ee84 213 rm -f TAGS cscope.* *.pod *~ */*~
b855f8d1 214 rm -f fsdev/*.pod scsi/*.pod
3dff199c 215 rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
31e31b8a 216
34bb443e
AL
217VERSION ?= $(shell cat VERSION)
218
219dist: qemu-$(VERSION).tar.bz2
220
34bb443e
AL
221qemu-%.tar.bz2:
222 $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
223
a5665051
PB
224distclean: clean ninja-distclean
225 -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean -g
ee5195ee 226 rm -f config-host.mak config-host.h* $(DOCS)
2038f8c8 227 rm -f tests/tcg/config-*.mak
2becc36a 228 rm -f config-all-disas.mak config.status
ae219359 229 rm -f po/*.mo tests/qemu-iotests/common.env
fc8e320e 230 rm -f roms/seabios/config.mak roms/vgabios/config.mak
26fffe29 231 rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
64ed6f92 232 rm -f *-config-target.h *-config-devices.mak *-config-devices.h
a5665051 233 rm -rf meson-private meson-logs meson-info compile_commands.json
245dac4a 234 rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest
793553ac 235 rm -f config.log
67ed96f9 236 rm -f linux-headers/asm
d59157ea
PB
237 rm -f docs/version.texi
238 rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi
239 rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7
240 rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
241 rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
242 rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
d9840e25 243 rm -Rf .sdk
7d13299d 244
06e7772f 245KEYMAPS=da en-gb et fr fr-ch is lt no pt-br sv \
fed4a9ad 246ar de en-us fi fr-be hr it lv nl pl ru th \
26b1cbf8 247de-ch es fo fr-ca hu ja mk pt sl tr \
3751e722 248bepo cz
fed4a9ad 249
77755340 250ifdef INSTALL_BLOBS
32eb2da3 251BLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
7a4dfd1e 252vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
0a87fd69 253vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
b2ce76a0 254openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
5ee8ad71
AW
255pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
256pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
9fd02979
SE
257efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
258efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
45027808 259efi-e1000e.rom efi-vmxnet3.rom \
b3ce38dc 260qemu-nsis.bmp \
4b387f9e 261bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
2785dc7b 262multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
6c5359e1 263s390-ccw.img s390-netboot.img \
744a928c 264slof.bin skiboot.lid \
0c6ab8c9 265palcode-clipper \
82e65fe0 266u-boot.e500 u-boot-sam460-20100605.bin \
43ad2564 267qemu_vga.ndrv \
26ce90fd 268edk2-licenses.txt \
91f3a2f0 269hppa-firmware.img \
a6fcc80b 270opensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
91f3a2f0 271opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
77755340
TS
272else
273BLOBS=
274endif
275
f8aa24ea 276install-doc: $(DOCS)
d7dd65ba 277 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
c13dba2c
LP
278 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)/interop"
279 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)/interop"
96d409eb 280ifdef CONFIG_POSIX
58f8aead 281 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
d06118bf 282 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu.1 "$(DESTDIR)$(mandir)/man1"
56e8bdd4 283 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
d59157ea 284 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
f15bff25 285ifeq ($(CONFIG_GUEST_AGENT),y)
c13dba2c
LP
286 $(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)/interop"
287 $(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)/interop"
d59157ea 288 $(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
665b5d0d 289endif
8a3e8f7f 290endif
a2d8f1be
MK
291ifdef CONFIG_VIRTFS
292 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
a08b4a9f 293 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
a2d8f1be 294endif
6a7e2bbe 295ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
a08b4a9f 296 $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtiofsd.1 "$(DESTDIR)$(mandir)/man1"
6a7e2bbe 297endif
e2d87bff
EH
298
299install-datadir:
300 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
301
f2e3978b
LE
302install-localstatedir:
303ifdef CONFIG_POSIX
f15bff25 304ifeq ($(CONFIG_GUEST_AGENT),y)
f2e3978b
LE
305 $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
306endif
307endif
308
a8260d38 309ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
e2d87bff 310
a5665051
PB
311# Needed by "meson install"
312export DESTDIR
54cb65d8 313install: all $(if $(BUILD_DOCS),install-doc) \
5e6d1573 314 install-datadir install-localstatedir
62dd1048
DB
315ifdef CONFIG_TRACE_SYSTEMTAP
316 $(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
317endif
77755340 318ifneq ($(BLOBS),)
77755340 319 set -e; for x in $(BLOBS); do \
6aae2a2e 320 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
ad064840 321 done
834574ea 322endif
a8260d38 323 for s in $(ICON_SIZES); do \
6c11dda9 324 mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
a8260d38 325 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \
6c11dda9 326 "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
a8260d38 327 done; \
6c11dda9 328 mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
a8260d38 329 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \
6c11dda9
SH
330 "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
331 mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
a8260d38 332 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \
6c11dda9
SH
333 "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
334 mkdir -p "$(DESTDIR)$(qemu_desktopdir)"
67ea9546 335 $(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
6c11dda9 336 "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
2a6b5372 337ifdef CONFIG_GTK
834574ea 338 $(MAKE) -C po $@
77755340 339endif
6aae2a2e 340 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
18be8d77 341 set -e; for x in $(KEYMAPS); do \
6aae2a2e 342 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
ad064840 343 done
612384d7 344
3ef693a0 345# documentation
e8518c92 346MAKEINFO=makeinfo
d59157ea
PB
347MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
348MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
e8338fdb 349TEXI2PODFLAGS=$(MAKEINFOINCLUDES) -DVERSION="$(VERSION)" -DCONFDIR="$(qemu_confdir)"
d59157ea 350TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
56e8bdd4 351
e8338fdb
MAL
352docs/version.texi: $(SRC_PATH)/VERSION config-host.mak
353 $(call quiet-command,(\
354 echo "@set VERSION $(VERSION)" && \
355 echo "@set CONFDIR $(qemu_confdir)" \
356 )> $@,"GEN","$@")
fea346f5 357
44cb280d 358%.html: %.texi docs/version.texi
e9ee06bd
MAL
359 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
360 --html $< -o $@,"GEN","$@")
3ef693a0 361
44cb280d 362%.info: %.texi docs/version.texi
e9ee06bd 363 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
f3548328 364
44cb280d 365%.txt: %.texi docs/version.texi
f8bab10b
MAL
366 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
367 --plaintext $< -o $@,"GEN","$@")
368
44cb280d 369%.pdf: %.texi docs/version.texi
d59157ea 370 $(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@")
bd7f9747 371
eb815e24 372docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
fb0bc835 373 @cp -p $< $@
4afeeb57 374
f15bff25 375docs/interop/qemu-ga-qapi.texi: qga/qga-qapi-doc.texi
fb0bc835 376 @cp -p $< $@
56e8bdd4 377
5b1d0e92
PM
378html: docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs
379info: docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
380pdf: docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
381txt: docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
818220f5 382
d59157ea
PB
383docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
384 docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
385 docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \
386 docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi
56e8bdd4 387
d59157ea
PB
388docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
389 docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \
390 docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
391 docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
56e8bdd4 392
ae560cc3 393$(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl
f8aa24ea
PB
394 $(call quiet-command, \
395 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $(TEXI2PODFLAGS) $< $@.pod && \
396 $(POD2MAN) --section=$(subst .,,$(suffix $@)) --center=" " --release=" " $@.pod > $@, \
397 "GEN","$@")
398
399man: $(filter %.1 %.7 %.8,$(DOCS))
ae560cc3 400
f53ec699
SW
401ifdef CONFIG_WIN32
402
403INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
404
405nsisflags = -V2 -NOCD
406
407ifneq ($(wildcard $(SRC_PATH)/dll),)
408ifeq ($(ARCH),x86_64)
409# 64 bit executables
410DLL_PATH = $(SRC_PATH)/dll/w64
411nsisflags += -DW64
412else
413# 32 bit executables
414DLL_PATH = $(SRC_PATH)/dll/w32
415endif
416endif
417
418.PHONY: installer
419installer: $(INSTALLER)
420
421INSTDIR=/tmp/qemu-nsis
422
1b00a4c4
PB
423$(INSTALLER): $(SRC_PATH)/qemu.nsi
424 $(MAKE) install DESTDIR=${INSTDIR}
f53ec699 425ifdef SIGNCODE
1b00a4c4 426 (cd ${INSTDIR}/${bindir}; \
f53ec699
SW
427 for i in *.exe; do \
428 $(SIGNCODE) $${i}; \
429 done \
430 )
431endif # SIGNCODE
1b00a4c4 432 (cd ${INSTDIR}/${bindir}; \
f53ec699
SW
433 for i in qemu-system-*.exe; do \
434 arch=$${i%.exe}; \
435 arch=$${arch#qemu-system-}; \
436 echo Section \"$$arch\" Section_$$arch; \
437 echo SetOutPath \"\$$INSTDIR\"; \
438 echo File \"\$${BINDIR}\\$$i\"; \
439 echo SectionEnd; \
440 done \
1b00a4c4 441 ) >${INSTDIR}/${bindir}/system-emulations.nsh
f53ec699
SW
442 makensis $(nsisflags) \
443 $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
444 $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
1b00a4c4 445 -DBINDIR="${INSTDIR}/${bindir}" \
f53ec699
SW
446 $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
447 -DSRCDIR="$(SRC_PATH)" \
448 -DOUTFILE="$(INSTALLER)" \
805d8a67 449 -DDISPLAYVERSION="$(VERSION)" \
f53ec699
SW
450 $(SRC_PATH)/qemu.nsi
451 rm -r ${INSTDIR}
452ifdef SIGNCODE
453 $(SIGNCODE) $(INSTALLER)
454endif # SIGNCODE
455endif # CONFIG_WIN
456
cb5fc67d
AL
457# Add a dependency on the generated files, so that they are always
458# rebuilt before other object files
428952cf 459ifneq ($(wildcard config-host.mak),)
eaa2ddbb 460ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
3dff199c 461Makefile: $(generated-files-y)
7748b8cb 462endif
428952cf 463endif
cb5fc67d 464
4fb240a4 465# Include automatically generated dependency files
1435ddb8
PB
466# Dependencies in Makefile.objs files come from our recursive subdir rules
467-include $(wildcard *.d tests/*.d)
324027c2
FZ
468
469include $(SRC_PATH)/tests/docker/Makefile.include
b1fb9a63 470include $(SRC_PATH)/tests/vm/Makefile.include
0d8e065f 471
c355de59
PMD
472print-help-run = printf " %-30s - %s\\n" "$1" "$2"
473print-help = $(quiet-@)$(call print-help-run,$1,$2)
474
0d8e065f
MAL
475.PHONY: help
476help:
477 @echo 'Generic targets:'
c355de59 478 $(call print-help,all,Build all)
0decdfe2 479ifdef CONFIG_MODULES
c355de59 480 $(call print-help,modules,Build all modules)
0decdfe2 481endif
c355de59
PMD
482 $(call print-help,dir/file.o,Build specified target only)
483 $(call print-help,install,Install QEMU, documentation and tools)
484 $(call print-help,ctags/TAGS,Generate tags file for editors)
485 $(call print-help,cscope,Generate cscope index)
968b4db3 486 $(call print-help,sparse,Run sparse on the QEMU source)
0d8e065f 487 @echo ''
0d8e065f 488 @echo 'Cleaning targets:'
c355de59 489 $(call print-help,clean,Remove most generated files but keep the config)
c355de59
PMD
490 $(call print-help,distclean,Remove all generated files)
491 $(call print-help,dist,Build a distributable tarball)
0d8e065f
MAL
492 @echo ''
493 @echo 'Test targets:'
c355de59
PMD
494 $(call print-help,check,Run all tests (check-help for details))
495 $(call print-help,docker,Help about targets running tests inside containers)
496 $(call print-help,vm-help,Help about targets running tests inside VM)
0d8e065f
MAL
497 @echo ''
498 @echo 'Documentation targets:'
c355de59 499 $(call print-help,html info pdf txt,Build documentation in specified format)
0d8e065f
MAL
500 @echo ''
501ifdef CONFIG_WIN32
502 @echo 'Windows targets:'
c355de59 503 $(call print-help,installer,Build NSIS-based installer for QEMU)
0d8e065f 504ifdef QEMU_GA_MSI_ENABLED
c355de59 505 $(call print-help,msi,Build MSI-based installer for qemu-ga)
0d8e065f
MAL
506endif
507 @echo ''
508endif
c355de59
PMD
509 $(call print-help,$(MAKE) [targets],(quiet build, default))
510 $(call print-help,$(MAKE) V=1 [targets],(verbose build))