]>
Commit | Line | Data |
---|---|---|
0cb3fb1e PB |
1 | # Makefile for QEMU. |
2 | ||
4ace32e2 AO |
3 | ifneq ($(words $(subst :, ,$(CURDIR))), 1) |
4 | $(error main directory cannot contain spaces nor colons) | |
5 | endif | |
6 | ||
519e1693 SW |
7 | # Always point to the root of the build tree (needs GNU make). |
8 | BUILD_DIR=$(CURDIR) | |
388d4758 | 9 | |
eaa2ddbb FZ |
10 | # Before including a proper config-host.mak, assume we are in the source tree |
11 | SRC_PATH=. | |
12 | ||
28fa2927 PMD |
13 | UNCHECKED_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 | 19 | ifneq ($(wildcard config-host.mak),) |
1ad2134f | 20 | # Put the all: rule here so that config-host.mak can contain dependencies. |
8f67aa82 | 21 | all: |
ad064840 | 22 | include config-host.mak |
d1bd2423 | 23 | |
aef45d51 DB |
24 | git-submodule-update: |
25 | ||
26 | .PHONY: git-submodule-update | |
27 | ||
c4b01c7c DB |
28 | git_module_status := $(shell \ |
29 | cd '$(SRC_PATH)' && \ | |
30 | GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \ | |
31 | echo $$?; \ | |
32 | ) | |
aef45d51 DB |
33 | |
34 | ifeq (1,$(git_module_status)) | |
f62bbee5 DB |
35 | ifeq (no,$(GIT_UPDATE)) |
36 | git-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) | |
44 | else | |
aef45d51 DB |
45 | git-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)") |
49 | endif | |
50 | endif | |
51 | ||
a5665051 PB |
52 | export NINJA=./ninjatool |
53 | ||
54 | # Running meson regenerates both build.ninja and ninjatool, and that is | |
55 | # enough to prime the rest of the build. | |
56 | ninjatool: build.ninja | |
57 | ||
58 | # Only needed in case Makefile.ninja does not exist. | |
59 | .PHONY: ninja-clean ninja-distclean clean-ctlist | |
60 | clean-ctlist: | |
61 | ninja-clean:: | |
62 | ninja-distclean:: | |
63 | build.ninja: config-host.mak | |
64 | ||
65 | Makefile.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). | |
73 | ifneq ($(MESON),) | |
74 | Makefile.mtest: build.ninja scripts/mtest2make.py | |
75 | $(MESON) introspect --tests | $(PYTHON) scripts/mtest2make.py > $@ | |
76 | -include Makefile.mtest | |
77 | endif | |
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. | |
83 | ifneq ($(realpath $(SRC_PATH)),$(realpath .)) | |
84 | ifneq ($(wildcard $(SRC_PATH)/config-host.mak),) | |
85 | $(error This is an out of tree build but your source tree ($(SRC_PATH)) \ | |
86 | seems 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 |
88 | endif |
89 | endif | |
90 | ||
2b1f35b9 AB |
91 | CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y) |
92 | CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y) | |
6b827cca | 93 | CONFIG_XEN := $(CONFIG_XEN_BACKEND) |
f3aa844b PB |
94 | CONFIG_ALL=y |
95 | -include config-all-devices.mak | |
96 | -include config-all-disas.mak | |
97 | ||
3a6b016d | 98 | config-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 | |
107 | ifeq ($(CONFIG_PLUGIN),y) | |
108 | config-host.mak: $(SRC_PATH)/plugins/qemu-plugins.symbols | |
109 | endif | |
110 | ||
55d7e8f6 AJ |
111 | else |
112 | config-host.mak: | |
eaa2ddbb | 113 | ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) |
55d7e8f6 AJ |
114 | @echo "Please call configure before running make!" |
115 | @exit 1 | |
116 | endif | |
7748b8cb | 117 | endif |
766a487a | 118 | |
fb57c881 FZ |
119 | include $(SRC_PATH)/rules.mak |
120 | ||
c932ce31 | 121 | # lor is defined in rules.mak |
29de2804 LV |
122 | CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS)) |
123 | ||
3dff199c | 124 | generated-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 | |
128 | Makefile: ; | |
129 | configure: ; | |
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 | 136 | LIBS+=-lz $(LIBS_TOOLS) |
67c0f08d | 137 | |
b53c54c6 PM |
138 | # Sphinx does not allow building manuals into the same directory as |
139 | # the source files, so if we're doing an in-tree QEMU build we must | |
140 | # build the manuals into a subdirectory (and then install them from | |
141 | # there for 'make install'). For an out-of-tree build we can just | |
142 | # use the docs/ subdirectory in the build tree as normal. | |
143 | ifeq ($(realpath $(SRC_PATH)),$(realpath .)) | |
144 | MANUAL_BUILDDIR := docs/built | |
145 | else | |
146 | MANUAL_BUILDDIR := docs | |
147 | endif | |
148 | ||
cc8ae6de | 149 | ifdef BUILD_DOCS |
d06118bf | 150 | DOCS+=$(MANUAL_BUILDDIR)/system/qemu.1 |
a08b4a9f PM |
151 | DOCS+=$(MANUAL_BUILDDIR)/tools/qemu-img.1 |
152 | DOCS+=$(MANUAL_BUILDDIR)/tools/qemu-nbd.8 | |
87c0868f | 153 | DOCS+=$(MANUAL_BUILDDIR)/interop/qemu-ga.8 |
6a7e2bbe | 154 | ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy) |
a08b4a9f | 155 | DOCS+=$(MANUAL_BUILDDIR)/tools/virtiofsd.1 |
6a7e2bbe | 156 | endif |
acab923d | 157 | DOCS+=$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 |
d59157ea PB |
158 | DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7 |
159 | DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7 | |
1bf84a1e | 160 | DOCS+=$(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 |
22108f33 | 161 | DOCS+=$(MANUAL_BUILDDIR)/index.html |
983eef5a | 162 | ifdef CONFIG_VIRTFS |
a08b4a9f | 163 | DOCS+=$(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 |
983eef5a | 164 | endif |
62dd1048 | 165 | ifdef CONFIG_TRACE_SYSTEMTAP |
a08b4a9f | 166 | DOCS+=$(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 |
62dd1048 | 167 | endif |
cc8ae6de PB |
168 | else |
169 | DOCS= | |
170 | endif | |
aa05ae6f | 171 | |
8cc357b5 | 172 | SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR) |
a992fe3d | 173 | |
992aeb8e PB |
174 | ifneq ($(wildcard config-host.mak),) |
175 | include $(SRC_PATH)/Makefile.objs | |
ba1183da FZ |
176 | endif |
177 | ||
46e7b706 | 178 | include $(SRC_PATH)/tests/Makefile.include |
992aeb8e | 179 | |
c3a0ee84 | 180 | all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) recurse-all modules |
b9dea4fb | 181 | |
67953a37 CF |
182 | # LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC |
183 | DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_lib="" | |
965f486c | 184 | DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS) |
67953a37 | 185 | DTC_CPPFLAGS=-I$(SRC_PATH)/dtc/libfdt |
a540f158 | 186 | |
3b8593ee | 187 | .PHONY: dtc/all |
67953a37 CF |
188 | dtc/all: .git-submodule-status dtc/libfdt |
189 | $(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 | 190 | |
00525864 | 191 | dtc/%: .git-submodule-status |
814e1110 | 192 | @mkdir -p $@ |
a540f158 | 193 | |
e219c499 RH |
194 | # Overriding CFLAGS causes us to lose defines added in the sub-makefile. |
195 | # Not overriding CFLAGS leads to mis-matches between compilation modes. | |
196 | # Therefore we replicate some of the logic in the sub-makefile. | |
197 | # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't; | |
198 | # no need to annoy QEMU developers with such things. | |
199 | CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS)) | |
200 | CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM | |
201 | CAP_CFLAGS += -DCAPSTONE_HAS_ARM | |
202 | CAP_CFLAGS += -DCAPSTONE_HAS_ARM64 | |
203 | CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC | |
204 | CAP_CFLAGS += -DCAPSTONE_HAS_X86 | |
205 | ||
3b8593ee MA |
206 | .PHONY: capstone/all |
207 | capstone/all: .git-submodule-status | |
9f81aeb5 | 208 | $(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 | 209 | |
3b8593ee MA |
210 | .PHONY: slirp/all |
211 | slirp/all: .git-submodule-status | |
daa79d9a AB |
212 | $(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp \ |
213 | BUILD_DIR="$(BUILD_DIR)/slirp" \ | |
214 | PKG_CONFIG="$(PKG_CONFIG)" \ | |
215 | CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" \ | |
db5adeaa | 216 | CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)") |
675b9b53 | 217 | |
3b8593ee | 218 | ROM_DIRS = $(addprefix pc-bios/, $(ROMS)) |
1338a4b7 | 219 | ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS))) |
a9c87304 | 220 | # Only keep -O and -g cflags |
1338a4b7 MA |
221 | .PHONY: $(ROM_DIRS_RULES) |
222 | $(ROM_DIRS_RULES): | |
223 | $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))" $(notdir $@),) | |
c05ac895 | 224 | |
5e6d1573 PB |
225 | .PHONY: recurse-all recurse-clean |
226 | recurse-all: $(ROM_DIRS) | |
227 | recurse-clean: $(addsuffix /clean, $(ROM_DIRS)) | |
83f64091 | 228 | |
44dc0ca3 | 229 | ###################################################################### |
4fb240a4 | 230 | |
a5665051 PB |
231 | clean: recurse-clean ninja-clean clean-ctlist |
232 | -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean | |
2d80ae89 | 233 | # avoid old build problems by removing potentially incorrect old files |
25be210f | 234 | 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 |
235 | find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \ |
236 | ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \ | |
237 | ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \ | |
238 | ! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \ | |
239 | -exec rm {} + | |
c3a0ee84 | 240 | rm -f TAGS cscope.* *.pod *~ */*~ |
b855f8d1 | 241 | rm -f fsdev/*.pod scsi/*.pod |
3dff199c | 242 | rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp) |
31e31b8a | 243 | |
34bb443e AL |
244 | VERSION ?= $(shell cat VERSION) |
245 | ||
246 | dist: qemu-$(VERSION).tar.bz2 | |
247 | ||
34bb443e AL |
248 | qemu-%.tar.bz2: |
249 | $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)" | |
250 | ||
5f71eac0 | 251 | define clean-manual = |
1290e671 PM |
252 | rm -rf $(MANUAL_BUILDDIR)/$1/_static |
253 | rm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(MANUAL_BUILDDIR)/$1/*.html | |
5f71eac0 PM |
254 | endef |
255 | ||
a5665051 PB |
256 | distclean: clean ninja-distclean |
257 | -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean -g | |
ee5195ee | 258 | rm -f config-host.mak config-host.h* $(DOCS) |
2038f8c8 | 259 | rm -f tests/tcg/config-*.mak |
2becc36a | 260 | rm -f config-all-disas.mak config.status |
ae219359 | 261 | rm -f po/*.mo tests/qemu-iotests/common.env |
fc8e320e | 262 | rm -f roms/seabios/config.mak roms/vgabios/config.mak |
26fffe29 | 263 | rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols |
64ed6f92 | 264 | rm -f *-config-target.h *-config-devices.mak *-config-devices.h |
a5665051 | 265 | rm -rf meson-private meson-logs meson-info compile_commands.json |
245dac4a | 266 | rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest |
793553ac | 267 | rm -f config.log |
67ed96f9 | 268 | rm -f linux-headers/asm |
d59157ea PB |
269 | rm -f docs/version.texi |
270 | rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi | |
271 | rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7 | |
272 | rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt | |
273 | rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf | |
274 | rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html | |
81f33401 | 275 | rm -rf .doctrees |
5f71eac0 PM |
276 | $(call clean-manual,devel) |
277 | $(call clean-manual,interop) | |
0783a732 | 278 | $(call clean-manual,specs) |
0928523a | 279 | $(call clean-manual,system) |
65c3542b | 280 | $(call clean-manual,tools) |
09147930 | 281 | $(call clean-manual,user) |
d9840e25 | 282 | rm -Rf .sdk |
7d13299d | 283 | |
06e7772f | 284 | KEYMAPS=da en-gb et fr fr-ch is lt no pt-br sv \ |
fed4a9ad | 285 | ar de en-us fi fr-be hr it lv nl pl ru th \ |
26b1cbf8 | 286 | de-ch es fo fr-ca hu ja mk pt sl tr \ |
3751e722 | 287 | bepo cz |
fed4a9ad | 288 | |
77755340 | 289 | ifdef INSTALL_BLOBS |
32eb2da3 | 290 | BLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \ |
7a4dfd1e | 291 | vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \ |
0a87fd69 | 292 | vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \ |
b2ce76a0 | 293 | openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \ |
5ee8ad71 AW |
294 | pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \ |
295 | pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \ | |
9fd02979 SE |
296 | efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \ |
297 | efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \ | |
45027808 | 298 | efi-e1000e.rom efi-vmxnet3.rom \ |
b3ce38dc | 299 | qemu-nsis.bmp \ |
4b387f9e | 300 | bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \ |
2785dc7b | 301 | multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \ |
6c5359e1 | 302 | s390-ccw.img s390-netboot.img \ |
744a928c | 303 | slof.bin skiboot.lid \ |
0c6ab8c9 | 304 | palcode-clipper \ |
82e65fe0 | 305 | u-boot.e500 u-boot-sam460-20100605.bin \ |
43ad2564 | 306 | qemu_vga.ndrv \ |
26ce90fd | 307 | edk2-licenses.txt \ |
91f3a2f0 | 308 | hppa-firmware.img \ |
a6fcc80b | 309 | opensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \ |
91f3a2f0 | 310 | opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin |
77755340 TS |
311 | else |
312 | BLOBS= | |
313 | endif | |
314 | ||
336cfef4 | 315 | # Note that we manually filter-out the non-Sphinx documentation which |
27a296fc PM |
316 | # is currently built into the docs/interop directory in the build tree, |
317 | # and also any sphinx-built manpages. | |
5f71eac0 | 318 | define install-manual = |
1290e671 | 319 | for d in $$(cd $(MANUAL_BUILDDIR) && find $1 -type d); do $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/$$d"; done |
27a296fc | 320 | for f in $$(cd $(MANUAL_BUILDDIR) && find $1 -type f -a '!' '(' -name '*.[0-9]' -o -name 'qemu-*-qapi.*' -o -name 'qemu-*-ref.*' ')' ); do $(INSTALL_DATA) "$(MANUAL_BUILDDIR)/$$f" "$(DESTDIR)$(qemu_docdir)/$$f"; done |
5f71eac0 PM |
321 | endef |
322 | ||
323 | # Note that we deliberately do not install the "devel" manual: it is | |
324 | # for QEMU developers, and not interesting to our users. | |
325 | .PHONY: install-sphinxdocs | |
326 | install-sphinxdocs: sphinxdocs | |
327 | $(call install-manual,interop) | |
0783a732 | 328 | $(call install-manual,specs) |
0928523a | 329 | $(call install-manual,system) |
65c3542b | 330 | $(call install-manual,tools) |
09147930 | 331 | $(call install-manual,user) |
5f71eac0 PM |
332 | |
333 | install-doc: $(DOCS) install-sphinxdocs | |
d7dd65ba | 334 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)" |
22108f33 | 335 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/index.html "$(DESTDIR)$(qemu_docdir)" |
c13dba2c LP |
336 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop" |
337 | $(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)/interop" | |
338 | $(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)/interop" | |
96d409eb | 339 | ifdef CONFIG_POSIX |
58f8aead | 340 | $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" |
d06118bf | 341 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu.1 "$(DESTDIR)$(mandir)/man1" |
56e8bdd4 | 342 | $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7" |
d59157ea | 343 | $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7" |
acab923d | 344 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7" |
1bf84a1e | 345 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7" |
c932ce31 | 346 | ifeq ($(CONFIG_TOOLS),y) |
a08b4a9f | 347 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-img.1 "$(DESTDIR)$(mandir)/man1" |
58f8aead | 348 | $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" |
a08b4a9f | 349 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" |
38954dca | 350 | endif |
62dd1048 | 351 | ifdef CONFIG_TRACE_SYSTEMTAP |
a08b4a9f | 352 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1" |
62dd1048 | 353 | endif |
f15bff25 | 354 | ifeq ($(CONFIG_GUEST_AGENT),y) |
b53c54c6 | 355 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-ga.8 "$(DESTDIR)$(mandir)/man8" |
c13dba2c LP |
356 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop" |
357 | $(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)/interop" | |
358 | $(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)/interop" | |
d59157ea | 359 | $(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7" |
665b5d0d | 360 | endif |
8a3e8f7f | 361 | endif |
a2d8f1be MK |
362 | ifdef CONFIG_VIRTFS |
363 | $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" | |
a08b4a9f | 364 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1" |
a2d8f1be | 365 | endif |
6a7e2bbe | 366 | ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy) |
a08b4a9f | 367 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtiofsd.1 "$(DESTDIR)$(mandir)/man1" |
6a7e2bbe | 368 | endif |
e2d87bff EH |
369 | |
370 | install-datadir: | |
371 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)" | |
372 | ||
f2e3978b LE |
373 | install-localstatedir: |
374 | ifdef CONFIG_POSIX | |
f15bff25 | 375 | ifeq ($(CONFIG_GUEST_AGENT),y) |
f2e3978b LE |
376 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run |
377 | endif | |
378 | endif | |
379 | ||
a8260d38 | 380 | ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512 |
e2d87bff | 381 | |
a5665051 PB |
382 | # Needed by "meson install" |
383 | export DESTDIR | |
54cb65d8 | 384 | install: all $(if $(BUILD_DOCS),install-doc) \ |
5e6d1573 | 385 | install-datadir install-localstatedir |
62dd1048 DB |
386 | ifdef CONFIG_TRACE_SYSTEMTAP |
387 | $(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir) | |
388 | endif | |
77755340 | 389 | ifneq ($(BLOBS),) |
77755340 | 390 | set -e; for x in $(BLOBS); do \ |
6aae2a2e | 391 | $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \ |
ad064840 | 392 | done |
834574ea | 393 | endif |
a8260d38 | 394 | for s in $(ICON_SIZES); do \ |
6c11dda9 | 395 | mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \ |
a8260d38 | 396 | $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \ |
6c11dda9 | 397 | "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \ |
a8260d38 | 398 | done; \ |
6c11dda9 | 399 | mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \ |
a8260d38 | 400 | $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \ |
6c11dda9 SH |
401 | "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \ |
402 | mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \ | |
a8260d38 | 403 | $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \ |
6c11dda9 SH |
404 | "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg" |
405 | mkdir -p "$(DESTDIR)$(qemu_desktopdir)" | |
67ea9546 | 406 | $(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \ |
6c11dda9 | 407 | "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop" |
2a6b5372 | 408 | ifdef CONFIG_GTK |
834574ea | 409 | $(MAKE) -C po $@ |
77755340 | 410 | endif |
6aae2a2e | 411 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps" |
18be8d77 | 412 | set -e; for x in $(KEYMAPS); do \ |
6aae2a2e | 413 | $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \ |
ad064840 | 414 | done |
612384d7 | 415 | |
3ef693a0 | 416 | # documentation |
e8518c92 | 417 | MAKEINFO=makeinfo |
d59157ea PB |
418 | MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D) |
419 | MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES) | |
e8338fdb | 420 | TEXI2PODFLAGS=$(MAKEINFOINCLUDES) -DVERSION="$(VERSION)" -DCONFDIR="$(qemu_confdir)" |
d59157ea | 421 | TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES) |
56e8bdd4 | 422 | |
e8338fdb MAL |
423 | docs/version.texi: $(SRC_PATH)/VERSION config-host.mak |
424 | $(call quiet-command,(\ | |
425 | echo "@set VERSION $(VERSION)" && \ | |
426 | echo "@set CONFDIR $(qemu_confdir)" \ | |
427 | )> $@,"GEN","$@") | |
fea346f5 | 428 | |
44cb280d | 429 | %.html: %.texi docs/version.texi |
e9ee06bd MAL |
430 | $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \ |
431 | --html $< -o $@,"GEN","$@") | |
3ef693a0 | 432 | |
44cb280d | 433 | %.info: %.texi docs/version.texi |
e9ee06bd | 434 | $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@") |
f3548328 | 435 | |
44cb280d | 436 | %.txt: %.texi docs/version.texi |
f8bab10b MAL |
437 | $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \ |
438 | --plaintext $< -o $@,"GEN","$@") | |
439 | ||
44cb280d | 440 | %.pdf: %.texi docs/version.texi |
d59157ea | 441 | $(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@") |
bd7f9747 | 442 | |
5f71eac0 PM |
443 | # Sphinx builds all its documentation at once in one invocation |
444 | # and handles "don't rebuild things unless necessary" itself. | |
445 | # The '.doctrees' files are cached information to speed this up. | |
446 | .PHONY: sphinxdocs | |
0928523a PM |
447 | sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \ |
448 | $(MANUAL_BUILDDIR)/interop/index.html \ | |
449 | $(MANUAL_BUILDDIR)/specs/index.html \ | |
65c3542b | 450 | $(MANUAL_BUILDDIR)/system/index.html \ |
09147930 PB |
451 | $(MANUAL_BUILDDIR)/tools/index.html \ |
452 | $(MANUAL_BUILDDIR)/user/index.html | |
5f71eac0 PM |
453 | |
454 | # Canned command to build a single manual | |
27a296fc | 455 | # Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man') |
6bda415c EH |
456 | # Note the use of different doctree for each (manual, builder) tuple; |
457 | # this works around Sphinx not handling parallel invocation on | |
458 | # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946 | |
516e8b7d | 459 | build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) $(SPHINX_WERROR) -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1") |
5f71eac0 | 460 | # We assume all RST files in the manual's directory are used in it |
814e068f | 461 | manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \ |
de1572ca | 462 | $(SRC_PATH)/docs/defs.rst.inc \ |
9165d323 PM |
463 | $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py \ |
464 | $(SRC_PATH)/docs/sphinx/*.py | |
e0f3728d PM |
465 | # Macro to write out the rule and dependencies for building manpages |
466 | # Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps]) | |
467 | # 'extradeps' is optional, and specifies extra files (eg .hx files) that | |
468 | # the manual page depends on. | |
469 | define define-manpage-rule | |
470 | $(call atomic,$(foreach manpage,$2,$(MANUAL_BUILDDIR)/$1/$(manpage)),$(call manual-deps,$1) $3) | |
471 | $(call build-manual,$1,man) | |
472 | endef | |
5f71eac0 | 473 | |
1290e671 | 474 | $(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel) |
27a296fc | 475 | $(call build-manual,devel,html) |
5f71eac0 | 476 | |
a08b4a9f | 477 | $(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop) |
27a296fc | 478 | $(call build-manual,interop,html) |
5f71eac0 | 479 | |
0783a732 | 480 | $(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs) |
27a296fc PM |
481 | $(call build-manual,specs,html) |
482 | ||
09ce5f2d | 483 | $(MANUAL_BUILDDIR)/system/index.html: $(call manual-deps,system) $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/qemu-options.hx |
0928523a PM |
484 | $(call build-manual,system,html) |
485 | ||
a08b4a9f | 486 | $(MANUAL_BUILDDIR)/tools/index.html: $(call manual-deps,tools) $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc |
65c3542b PM |
487 | $(call build-manual,tools,html) |
488 | ||
09147930 PB |
489 | $(MANUAL_BUILDDIR)/user/index.html: $(call manual-deps,user) |
490 | $(call build-manual,user,html) | |
491 | ||
a08b4a9f | 492 | $(call define-manpage-rule,interop,qemu-ga.8) |
87c0868f | 493 | |
d06118bf | 494 | $(call define-manpage-rule,system,qemu.1 qemu-block-drivers.7 qemu-cpu-models.7) |
acab923d | 495 | |
a08b4a9f PM |
496 | $(call define-manpage-rule,tools,\ |
497 | qemu-img.1 qemu-nbd.8 qemu-trace-stap.1\ | |
498 | virtiofsd.1 virtfs-proxy-helper.1,\ | |
499 | $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc) | |
500 | ||
22108f33 | 501 | $(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version.h |
d83bbeda | 502 | @mkdir -p "$(MANUAL_BUILDDIR)" |
22108f33 SH |
503 | $(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \ |
504 | "GEN","$@") | |
505 | ||
eb815e24 | 506 | docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi |
fb0bc835 | 507 | @cp -p $< $@ |
4afeeb57 | 508 | |
f15bff25 | 509 | docs/interop/qemu-ga-qapi.texi: qga/qga-qapi-doc.texi |
fb0bc835 | 510 | @cp -p $< $@ |
56e8bdd4 | 511 | |
5b1d0e92 PM |
512 | html: docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs |
513 | info: docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info | |
514 | pdf: docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf | |
515 | txt: docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt | |
818220f5 | 516 | |
d59157ea PB |
517 | docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \ |
518 | docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \ | |
519 | docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \ | |
520 | docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi | |
56e8bdd4 | 521 | |
d59157ea PB |
522 | docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \ |
523 | docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \ | |
524 | docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \ | |
525 | docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi | |
56e8bdd4 | 526 | |
ae560cc3 EB |
527 | $(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl |
528 | ||
f53ec699 SW |
529 | ifdef CONFIG_WIN32 |
530 | ||
531 | INSTALLER = qemu-setup-$(VERSION)$(EXESUF) | |
532 | ||
533 | nsisflags = -V2 -NOCD | |
534 | ||
535 | ifneq ($(wildcard $(SRC_PATH)/dll),) | |
536 | ifeq ($(ARCH),x86_64) | |
537 | # 64 bit executables | |
538 | DLL_PATH = $(SRC_PATH)/dll/w64 | |
539 | nsisflags += -DW64 | |
540 | else | |
541 | # 32 bit executables | |
542 | DLL_PATH = $(SRC_PATH)/dll/w32 | |
543 | endif | |
544 | endif | |
545 | ||
546 | .PHONY: installer | |
547 | installer: $(INSTALLER) | |
548 | ||
549 | INSTDIR=/tmp/qemu-nsis | |
550 | ||
1b00a4c4 PB |
551 | $(INSTALLER): $(SRC_PATH)/qemu.nsi |
552 | $(MAKE) install DESTDIR=${INSTDIR} | |
f53ec699 | 553 | ifdef SIGNCODE |
1b00a4c4 | 554 | (cd ${INSTDIR}/${bindir}; \ |
f53ec699 SW |
555 | for i in *.exe; do \ |
556 | $(SIGNCODE) $${i}; \ | |
557 | done \ | |
558 | ) | |
559 | endif # SIGNCODE | |
1b00a4c4 | 560 | (cd ${INSTDIR}/${bindir}; \ |
f53ec699 SW |
561 | for i in qemu-system-*.exe; do \ |
562 | arch=$${i%.exe}; \ | |
563 | arch=$${arch#qemu-system-}; \ | |
564 | echo Section \"$$arch\" Section_$$arch; \ | |
565 | echo SetOutPath \"\$$INSTDIR\"; \ | |
566 | echo File \"\$${BINDIR}\\$$i\"; \ | |
567 | echo SectionEnd; \ | |
568 | done \ | |
1b00a4c4 | 569 | ) >${INSTDIR}/${bindir}/system-emulations.nsh |
f53ec699 SW |
570 | makensis $(nsisflags) \ |
571 | $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \ | |
572 | $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \ | |
1b00a4c4 | 573 | -DBINDIR="${INSTDIR}/${bindir}" \ |
f53ec699 SW |
574 | $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \ |
575 | -DSRCDIR="$(SRC_PATH)" \ | |
576 | -DOUTFILE="$(INSTALLER)" \ | |
805d8a67 | 577 | -DDISPLAYVERSION="$(VERSION)" \ |
f53ec699 SW |
578 | $(SRC_PATH)/qemu.nsi |
579 | rm -r ${INSTDIR} | |
580 | ifdef SIGNCODE | |
581 | $(SIGNCODE) $(INSTALLER) | |
582 | endif # SIGNCODE | |
583 | endif # CONFIG_WIN | |
584 | ||
cb5fc67d AL |
585 | # Add a dependency on the generated files, so that they are always |
586 | # rebuilt before other object files | |
428952cf | 587 | ifneq ($(wildcard config-host.mak),) |
eaa2ddbb | 588 | ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) |
3dff199c | 589 | Makefile: $(generated-files-y) |
7748b8cb | 590 | endif |
428952cf | 591 | endif |
cb5fc67d | 592 | |
4fb240a4 | 593 | # Include automatically generated dependency files |
1435ddb8 PB |
594 | # Dependencies in Makefile.objs files come from our recursive subdir rules |
595 | -include $(wildcard *.d tests/*.d) | |
324027c2 FZ |
596 | |
597 | include $(SRC_PATH)/tests/docker/Makefile.include | |
b1fb9a63 | 598 | include $(SRC_PATH)/tests/vm/Makefile.include |
0d8e065f | 599 | |
c355de59 PMD |
600 | print-help-run = printf " %-30s - %s\\n" "$1" "$2" |
601 | print-help = $(quiet-@)$(call print-help-run,$1,$2) | |
602 | ||
0d8e065f MAL |
603 | .PHONY: help |
604 | help: | |
605 | @echo 'Generic targets:' | |
c355de59 | 606 | $(call print-help,all,Build all) |
0decdfe2 | 607 | ifdef CONFIG_MODULES |
c355de59 | 608 | $(call print-help,modules,Build all modules) |
0decdfe2 | 609 | endif |
c355de59 PMD |
610 | $(call print-help,dir/file.o,Build specified target only) |
611 | $(call print-help,install,Install QEMU, documentation and tools) | |
612 | $(call print-help,ctags/TAGS,Generate tags file for editors) | |
613 | $(call print-help,cscope,Generate cscope index) | |
968b4db3 | 614 | $(call print-help,sparse,Run sparse on the QEMU source) |
0d8e065f | 615 | @echo '' |
0d8e065f | 616 | @echo 'Cleaning targets:' |
c355de59 | 617 | $(call print-help,clean,Remove most generated files but keep the config) |
c355de59 PMD |
618 | $(call print-help,distclean,Remove all generated files) |
619 | $(call print-help,dist,Build a distributable tarball) | |
0d8e065f MAL |
620 | @echo '' |
621 | @echo 'Test targets:' | |
c355de59 PMD |
622 | $(call print-help,check,Run all tests (check-help for details)) |
623 | $(call print-help,docker,Help about targets running tests inside containers) | |
624 | $(call print-help,vm-help,Help about targets running tests inside VM) | |
0d8e065f MAL |
625 | @echo '' |
626 | @echo 'Documentation targets:' | |
c355de59 | 627 | $(call print-help,html info pdf txt,Build documentation in specified format) |
0d8e065f MAL |
628 | @echo '' |
629 | ifdef CONFIG_WIN32 | |
630 | @echo 'Windows targets:' | |
c355de59 | 631 | $(call print-help,installer,Build NSIS-based installer for QEMU) |
0d8e065f | 632 | ifdef QEMU_GA_MSI_ENABLED |
c355de59 | 633 | $(call print-help,msi,Build MSI-based installer for qemu-ga) |
0d8e065f MAL |
634 | endif |
635 | @echo '' | |
636 | endif | |
c355de59 PMD |
637 | $(call print-help,$(MAKE) [targets],(quiet build, default)) |
638 | $(call print-help,$(MAKE) V=1 [targets],(verbose build)) |