]>
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 | ||
3f885659 | 124 | generated-files-y = config-host.h |
bf582c34 | 125 | |
3dff199c | 126 | generated-files-y += module_block.h |
0c0c1fd9 | 127 | |
3dff199c | 128 | generated-files-y += .git-submodule-status |
0ab8ed18 | 129 | |
d9ace8b3 JQ |
130 | # Don't try to regenerate Makefile or configure |
131 | # We don't generate any of them | |
132 | Makefile: ; | |
133 | configure: ; | |
134 | ||
bd3f5706 | 135 | .PHONY: all clean cscope distclean html info install install-doc \ |
7c3d1917 | 136 | pdf txt recurse-all dist msi FORCE |
0cb3fb1e | 137 | |
fec90ff0 | 138 | $(call set-vpath, $(SRC_PATH)) |
8c462f8f | 139 | |
3e2e0e6b | 140 | LIBS+=-lz $(LIBS_TOOLS) |
67c0f08d | 141 | |
fdbff6bd | 142 | HELPERS-y = $(HELPERS) |
d52c454a | 143 | |
b53c54c6 PM |
144 | # Sphinx does not allow building manuals into the same directory as |
145 | # the source files, so if we're doing an in-tree QEMU build we must | |
146 | # build the manuals into a subdirectory (and then install them from | |
147 | # there for 'make install'). For an out-of-tree build we can just | |
148 | # use the docs/ subdirectory in the build tree as normal. | |
149 | ifeq ($(realpath $(SRC_PATH)),$(realpath .)) | |
150 | MANUAL_BUILDDIR := docs/built | |
151 | else | |
152 | MANUAL_BUILDDIR := docs | |
153 | endif | |
154 | ||
cc8ae6de | 155 | ifdef BUILD_DOCS |
d06118bf | 156 | DOCS+=$(MANUAL_BUILDDIR)/system/qemu.1 |
a08b4a9f PM |
157 | DOCS+=$(MANUAL_BUILDDIR)/tools/qemu-img.1 |
158 | DOCS+=$(MANUAL_BUILDDIR)/tools/qemu-nbd.8 | |
87c0868f | 159 | DOCS+=$(MANUAL_BUILDDIR)/interop/qemu-ga.8 |
6a7e2bbe | 160 | ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy) |
a08b4a9f | 161 | DOCS+=$(MANUAL_BUILDDIR)/tools/virtiofsd.1 |
6a7e2bbe | 162 | endif |
acab923d | 163 | DOCS+=$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 |
d59157ea PB |
164 | DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7 |
165 | DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7 | |
1bf84a1e | 166 | DOCS+=$(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 |
22108f33 | 167 | DOCS+=$(MANUAL_BUILDDIR)/index.html |
983eef5a | 168 | ifdef CONFIG_VIRTFS |
a08b4a9f | 169 | DOCS+=$(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 |
983eef5a | 170 | endif |
62dd1048 | 171 | ifdef CONFIG_TRACE_SYSTEMTAP |
a08b4a9f | 172 | DOCS+=$(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 |
62dd1048 | 173 | endif |
cc8ae6de PB |
174 | else |
175 | DOCS= | |
176 | endif | |
aa05ae6f | 177 | |
8cc357b5 | 178 | SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR) |
e0e312f3 PB |
179 | SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(filter %-softmmu, $(TARGET_DIRS))) |
180 | SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK)) | |
1f3d3c8f | 181 | |
8bdd3d49 | 182 | ifeq ($(SUBDIR_DEVICES_MAK),) |
b7c11e57 | 183 | config-all-devices.mak: config-host.mak |
0bdb12c7 | 184 | $(call quiet-command,echo '# no devices' > $@,"GEN","$@") |
8bdd3d49 | 185 | else |
b7c11e57 | 186 | config-all-devices.mak: $(SUBDIR_DEVICES_MAK) config-host.mak |
bb585a78 PB |
187 | $(call quiet-command, sed -n \ |
188 | 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \ | |
189 | $(SUBDIR_DEVICES_MAK) | sort -u > $@, \ | |
0bdb12c7 | 190 | "GEN","$@") |
8bdd3d49 | 191 | endif |
1f3d3c8f | 192 | |
bd9141bb PB |
193 | -include $(SUBDIR_DEVICES_MAK_DEP) |
194 | ||
e0e312f3 PB |
195 | # This has to be kept in sync with Kconfig.host. |
196 | MINIKCONF_ARGS = \ | |
f3494749 | 197 | $(CONFIG_MINIKCONF_MODE) \ |
aaa1b70a | 198 | $@ $*/config-devices.mak.d $< $(SRC_PATH)/Kconfig \ |
96df0fdd | 199 | CONFIG_TCG=$(CONFIG_TCG) \ |
e0e312f3 PB |
200 | CONFIG_KVM=$(CONFIG_KVM) \ |
201 | CONFIG_SPICE=$(CONFIG_SPICE) \ | |
202 | CONFIG_IVSHMEM=$(CONFIG_IVSHMEM) \ | |
203 | CONFIG_TPM=$(CONFIG_TPM) \ | |
204 | CONFIG_XEN=$(CONFIG_XEN) \ | |
205 | CONFIG_OPENGL=$(CONFIG_OPENGL) \ | |
206 | CONFIG_X11=$(CONFIG_X11) \ | |
207 | CONFIG_VHOST_USER=$(CONFIG_VHOST_USER) \ | |
21c6b0c8 | 208 | CONFIG_VHOST_KERNEL=$(CONFIG_VHOST_KERNEL) \ |
e0e312f3 | 209 | CONFIG_VIRTFS=$(CONFIG_VIRTFS) \ |
d6c1bd4a PB |
210 | CONFIG_LINUX=$(CONFIG_LINUX) \ |
211 | CONFIG_PVRDMA=$(CONFIG_PVRDMA) | |
e0e312f3 | 212 | |
f4bda37d | 213 | MINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py |
e0e312f3 | 214 | |
aaa1b70a | 215 | $(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak $(SRC_PATH)/Kconfig $(BUILD_DIR)/config-host.mak |
1e0ef873 PMD |
216 | $(call quiet-command, $(MINIKCONF) $(MINIKCONF_ARGS) \ |
217 | > $@.tmp, "GEN", "$@.tmp") | |
12ccfec9 | 218 | $(call quiet-command, if test -f $@; then \ |
904fe1fb | 219 | if cmp -s $@.old $@; then \ |
bd9141bb PB |
220 | mv $@.tmp $@; \ |
221 | cp -p $@ $@.old; \ | |
012f0879 SW |
222 | else \ |
223 | if test -f $@.old; then \ | |
224 | echo "WARNING: $@ (user modified) out of date.";\ | |
225 | else \ | |
226 | echo "WARNING: $@ out of date.";\ | |
227 | fi; \ | |
b98a3bae | 228 | echo "Run \"$(MAKE) defconfig\" to regenerate."; \ |
012f0879 SW |
229 | rm $@.tmp; \ |
230 | fi; \ | |
a992fe3d | 231 | else \ |
012f0879 SW |
232 | mv $@.tmp $@; \ |
233 | cp -p $@ $@.old; \ | |
0bdb12c7 | 234 | fi,"GEN","$@"); |
a992fe3d PB |
235 | |
236 | defconfig: | |
237 | rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK) | |
238 | ||
992aeb8e PB |
239 | ifneq ($(wildcard config-host.mak),) |
240 | include $(SRC_PATH)/Makefile.objs | |
ba1183da FZ |
241 | endif |
242 | ||
243 | dummy := $(call unnest-vars,, \ | |
5b76dd13 | 244 | authz-obj-y \ |
32d955a4 | 245 | chardev-obj-y \ |
ba1183da | 246 | block-obj-y \ |
cc475698 | 247 | block-obj-m \ |
14837c64 KW |
248 | storage-daemon-obj-y \ |
249 | storage-daemon-obj-m \ | |
fb37726d | 250 | crypto-obj-y \ |
0c7012e0 | 251 | qom-obj-y \ |
666a3af9 | 252 | io-obj-y \ |
cc475698 | 253 | common-obj-y \ |
a81df1b6 | 254 | common-obj-m) |
243af022 | 255 | |
46e7b706 | 256 | include $(SRC_PATH)/tests/Makefile.include |
992aeb8e | 257 | |
ea458960 | 258 | all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all modules |
b9dea4fb | 259 | |
1215c6e7 JQ |
260 | config-host.h: config-host.h-timestamp |
261 | config-host.h-timestamp: config-host.mak | |
262 | ||
c621dc3e | 263 | TARGET_DIRS_RULES := $(foreach t, all fuzz clean install, $(addsuffix /$(t), $(TARGET_DIRS))) |
916359f6 | 264 | |
1338a4b7 MA |
265 | SOFTMMU_ALL_RULES=$(filter %-softmmu/all, $(TARGET_DIRS_RULES)) |
266 | $(SOFTMMU_ALL_RULES): $(authz-obj-y) | |
267 | $(SOFTMMU_ALL_RULES): $(block-obj-y) | |
14837c64 | 268 | $(SOFTMMU_ALL_RULES): $(storage-daemon-obj-y) |
1338a4b7 MA |
269 | $(SOFTMMU_ALL_RULES): $(chardev-obj-y) |
270 | $(SOFTMMU_ALL_RULES): $(crypto-obj-y) | |
271 | $(SOFTMMU_ALL_RULES): $(io-obj-y) | |
272 | $(SOFTMMU_ALL_RULES): config-all-devices.mak | |
cec7d0b6 | 273 | |
c621dc3e AB |
274 | SOFTMMU_FUZZ_RULES=$(filter %-softmmu/fuzz, $(TARGET_DIRS_RULES)) |
275 | $(SOFTMMU_FUZZ_RULES): $(authz-obj-y) | |
276 | $(SOFTMMU_FUZZ_RULES): $(block-obj-y) | |
277 | $(SOFTMMU_FUZZ_RULES): $(chardev-obj-y) | |
278 | $(SOFTMMU_FUZZ_RULES): $(crypto-obj-y) | |
279 | $(SOFTMMU_FUZZ_RULES): $(io-obj-y) | |
280 | $(SOFTMMU_FUZZ_RULES): config-all-devices.mak | |
281 | $(SOFTMMU_FUZZ_RULES): $(edk2-decompressed) | |
282 | ||
1338a4b7 MA |
283 | .PHONY: $(TARGET_DIRS_RULES) |
284 | # The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that | |
285 | # $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal | |
286 | $(TARGET_DIRS_RULES): | |
287 | $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),) | |
4aa42531 | 288 | |
67953a37 CF |
289 | # LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC |
290 | DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_lib="" | |
965f486c | 291 | DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS) |
67953a37 | 292 | DTC_CPPFLAGS=-I$(SRC_PATH)/dtc/libfdt |
a540f158 | 293 | |
3b8593ee | 294 | .PHONY: dtc/all |
67953a37 CF |
295 | dtc/all: .git-submodule-status dtc/libfdt |
296 | $(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 | 297 | |
00525864 | 298 | dtc/%: .git-submodule-status |
814e1110 | 299 | @mkdir -p $@ |
a540f158 | 300 | |
e219c499 RH |
301 | # Overriding CFLAGS causes us to lose defines added in the sub-makefile. |
302 | # Not overriding CFLAGS leads to mis-matches between compilation modes. | |
303 | # Therefore we replicate some of the logic in the sub-makefile. | |
304 | # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't; | |
305 | # no need to annoy QEMU developers with such things. | |
306 | CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS)) | |
307 | CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM | |
308 | CAP_CFLAGS += -DCAPSTONE_HAS_ARM | |
309 | CAP_CFLAGS += -DCAPSTONE_HAS_ARM64 | |
310 | CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC | |
311 | CAP_CFLAGS += -DCAPSTONE_HAS_X86 | |
312 | ||
3b8593ee MA |
313 | .PHONY: capstone/all |
314 | capstone/all: .git-submodule-status | |
9f81aeb5 | 315 | $(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 | 316 | |
3b8593ee MA |
317 | .PHONY: slirp/all |
318 | slirp/all: .git-submodule-status | |
daa79d9a AB |
319 | $(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp \ |
320 | BUILD_DIR="$(BUILD_DIR)/slirp" \ | |
321 | PKG_CONFIG="$(PKG_CONFIG)" \ | |
322 | CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" \ | |
db5adeaa | 323 | CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)") |
675b9b53 | 324 | |
1338a4b7 | 325 | $(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \ |
b8d89ba8 | 326 | $(qom-obj-y) |
add16157 | 327 | |
c621dc3e AB |
328 | $(filter %/fuzz, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \ |
329 | $(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY)) | |
330 | ||
3b8593ee | 331 | ROM_DIRS = $(addprefix pc-bios/, $(ROMS)) |
1338a4b7 | 332 | ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS))) |
a9c87304 | 333 | # Only keep -O and -g cflags |
1338a4b7 MA |
334 | .PHONY: $(ROM_DIRS_RULES) |
335 | $(ROM_DIRS_RULES): | |
336 | $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))" $(notdir $@),) | |
c05ac895 | 337 | |
8d358a5e | 338 | .PHONY: recurse-all recurse-clean recurse-install |
1338a4b7 MA |
339 | recurse-all: $(addsuffix /all, $(TARGET_DIRS) $(ROM_DIRS)) |
340 | recurse-clean: $(addsuffix /clean, $(TARGET_DIRS) $(ROM_DIRS)) | |
341 | recurse-install: $(addsuffix /install, $(TARGET_DIRS)) | |
47ae060e | 342 | $(addsuffix /install, $(TARGET_DIRS)): all |
83f64091 | 343 | |
c17a18ef | 344 | $(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h |
0bdb12c7 | 345 | $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o") |
5354e4d2 | 346 | |
c17a18ef | 347 | Makefile: $(version-obj-y) |
3bc2f570 | 348 | |
44dc0ca3 | 349 | ###################################################################### |
4fb240a4 | 350 | |
ebedb37c | 351 | COMMON_LDADDS = libqemuutil.a |
0ab8ed18 | 352 | |
3c089e15 | 353 | qemu-img.o: qemu-img-cmds.h |
153859be | 354 | |
5b76dd13 DB |
355 | qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) |
356 | qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) | |
357 | qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) | |
5e6911cf | 358 | qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) $(storage-daemon-obj-y) $(COMMON_LDADDS) |
0a8e1acd | 359 | |
5b76dd13 | 360 | scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o $(authz-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) |
fe8fc5ae PB |
361 | ifdef CONFIG_MPATH |
362 | scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist | |
363 | endif | |
b855f8d1 | 364 | |
0c0c1fd9 MM |
365 | module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak |
366 | $(call quiet-command,$(PYTHON) $< $@ \ | |
367 | $(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \ | |
0bdb12c7 | 368 | "GEN","$@") |
0c0c1fd9 | 369 | |
a5665051 PB |
370 | clean: recurse-clean ninja-clean clean-ctlist |
371 | -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean | |
2d80ae89 | 372 | # avoid old build problems by removing potentially incorrect old files |
25be210f | 373 | rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h |
df2943ba | 374 | rm -f qemu-options.def |
23858f40 LE |
375 | find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \ |
376 | ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \ | |
377 | ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \ | |
378 | ! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \ | |
379 | -exec rm {} + | |
0814465a | 380 | rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) TAGS cscope.* *.pod *~ */*~ |
b855f8d1 | 381 | rm -f fsdev/*.pod scsi/*.pod |
3dff199c | 382 | rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp) |
e92af6ec | 383 | rm -f config-all-devices.mak |
d69cda7e | 384 | rm -f $(SUBDIR_DEVICES_MAK) |
31e31b8a | 385 | |
34bb443e AL |
386 | VERSION ?= $(shell cat VERSION) |
387 | ||
388 | dist: qemu-$(VERSION).tar.bz2 | |
389 | ||
34bb443e AL |
390 | qemu-%.tar.bz2: |
391 | $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)" | |
392 | ||
5f71eac0 | 393 | define clean-manual = |
1290e671 PM |
394 | rm -rf $(MANUAL_BUILDDIR)/$1/_static |
395 | rm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(MANUAL_BUILDDIR)/$1/*.html | |
5f71eac0 PM |
396 | endef |
397 | ||
a5665051 PB |
398 | distclean: clean ninja-distclean |
399 | -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean -g | |
ee5195ee | 400 | rm -f config-host.mak config-host.h* $(DOCS) |
2038f8c8 | 401 | rm -f tests/tcg/config-*.mak |
ae219359 | 402 | rm -f config-all-devices.mak config-all-disas.mak config.status |
e92af6ec | 403 | rm -f $(SUBDIR_DEVICES_MAK) |
ae219359 | 404 | rm -f po/*.mo tests/qemu-iotests/common.env |
fc8e320e | 405 | rm -f roms/seabios/config.mak roms/vgabios/config.mak |
26fffe29 | 406 | rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols |
a5665051 | 407 | rm -rf meson-private meson-logs meson-info compile_commands.json |
245dac4a | 408 | rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest |
793553ac | 409 | rm -f config.log |
67ed96f9 | 410 | rm -f linux-headers/asm |
d59157ea PB |
411 | rm -f docs/version.texi |
412 | rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi | |
413 | rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7 | |
414 | rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt | |
415 | rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf | |
416 | rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html | |
81f33401 | 417 | rm -rf .doctrees |
5f71eac0 PM |
418 | $(call clean-manual,devel) |
419 | $(call clean-manual,interop) | |
0783a732 | 420 | $(call clean-manual,specs) |
0928523a | 421 | $(call clean-manual,system) |
65c3542b | 422 | $(call clean-manual,tools) |
09147930 | 423 | $(call clean-manual,user) |
2b1f35b9 | 424 | for d in $(TARGET_DIRS); do \ |
bc1b050d | 425 | rm -rf $$d || exit 1 ; \ |
76bc6838 | 426 | done |
d9840e25 | 427 | rm -Rf .sdk |
7d13299d | 428 | |
06e7772f | 429 | KEYMAPS=da en-gb et fr fr-ch is lt no pt-br sv \ |
fed4a9ad | 430 | ar de en-us fi fr-be hr it lv nl pl ru th \ |
26b1cbf8 | 431 | de-ch es fo fr-ca hu ja mk pt sl tr \ |
3751e722 | 432 | bepo cz |
fed4a9ad | 433 | |
77755340 | 434 | ifdef INSTALL_BLOBS |
32eb2da3 | 435 | BLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \ |
7a4dfd1e | 436 | vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \ |
0a87fd69 | 437 | vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \ |
b2ce76a0 | 438 | openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \ |
5ee8ad71 AW |
439 | pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \ |
440 | pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \ | |
9fd02979 SE |
441 | efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \ |
442 | efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \ | |
45027808 | 443 | efi-e1000e.rom efi-vmxnet3.rom \ |
b3ce38dc | 444 | qemu-nsis.bmp \ |
4b387f9e | 445 | bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \ |
2785dc7b | 446 | multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \ |
6c5359e1 | 447 | s390-ccw.img s390-netboot.img \ |
744a928c | 448 | slof.bin skiboot.lid \ |
0c6ab8c9 | 449 | palcode-clipper \ |
82e65fe0 | 450 | u-boot.e500 u-boot-sam460-20100605.bin \ |
43ad2564 | 451 | qemu_vga.ndrv \ |
26ce90fd | 452 | edk2-licenses.txt \ |
91f3a2f0 | 453 | hppa-firmware.img \ |
a6fcc80b | 454 | opensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \ |
91f3a2f0 | 455 | opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin |
77755340 TS |
456 | else |
457 | BLOBS= | |
458 | endif | |
459 | ||
336cfef4 | 460 | # Note that we manually filter-out the non-Sphinx documentation which |
27a296fc PM |
461 | # is currently built into the docs/interop directory in the build tree, |
462 | # and also any sphinx-built manpages. | |
5f71eac0 | 463 | define install-manual = |
1290e671 | 464 | for d in $$(cd $(MANUAL_BUILDDIR) && find $1 -type d); do $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/$$d"; done |
27a296fc | 465 | 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 |
466 | endef |
467 | ||
468 | # Note that we deliberately do not install the "devel" manual: it is | |
469 | # for QEMU developers, and not interesting to our users. | |
470 | .PHONY: install-sphinxdocs | |
471 | install-sphinxdocs: sphinxdocs | |
472 | $(call install-manual,interop) | |
0783a732 | 473 | $(call install-manual,specs) |
0928523a | 474 | $(call install-manual,system) |
65c3542b | 475 | $(call install-manual,tools) |
09147930 | 476 | $(call install-manual,user) |
5f71eac0 PM |
477 | |
478 | install-doc: $(DOCS) install-sphinxdocs | |
d7dd65ba | 479 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)" |
22108f33 | 480 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/index.html "$(DESTDIR)$(qemu_docdir)" |
c13dba2c LP |
481 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop" |
482 | $(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)/interop" | |
483 | $(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)/interop" | |
96d409eb | 484 | ifdef CONFIG_POSIX |
58f8aead | 485 | $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" |
d06118bf | 486 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu.1 "$(DESTDIR)$(mandir)/man1" |
56e8bdd4 | 487 | $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7" |
d59157ea | 488 | $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7" |
acab923d | 489 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7" |
1bf84a1e | 490 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7" |
c932ce31 | 491 | ifeq ($(CONFIG_TOOLS),y) |
a08b4a9f | 492 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-img.1 "$(DESTDIR)$(mandir)/man1" |
58f8aead | 493 | $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" |
a08b4a9f | 494 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" |
38954dca | 495 | endif |
62dd1048 | 496 | ifdef CONFIG_TRACE_SYSTEMTAP |
a08b4a9f | 497 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1" |
62dd1048 | 498 | endif |
f15bff25 | 499 | ifeq ($(CONFIG_GUEST_AGENT),y) |
b53c54c6 | 500 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-ga.8 "$(DESTDIR)$(mandir)/man8" |
c13dba2c LP |
501 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop" |
502 | $(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)/interop" | |
503 | $(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)/interop" | |
d59157ea | 504 | $(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7" |
665b5d0d | 505 | endif |
8a3e8f7f | 506 | endif |
a2d8f1be MK |
507 | ifdef CONFIG_VIRTFS |
508 | $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" | |
a08b4a9f | 509 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1" |
a2d8f1be | 510 | endif |
6a7e2bbe | 511 | ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy) |
a08b4a9f | 512 | $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtiofsd.1 "$(DESTDIR)$(mandir)/man1" |
6a7e2bbe | 513 | endif |
e2d87bff EH |
514 | |
515 | install-datadir: | |
516 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)" | |
517 | ||
f2e3978b LE |
518 | install-localstatedir: |
519 | ifdef CONFIG_POSIX | |
f15bff25 | 520 | ifeq ($(CONFIG_GUEST_AGENT),y) |
f2e3978b LE |
521 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run |
522 | endif | |
523 | endif | |
524 | ||
a8260d38 | 525 | ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512 |
e2d87bff | 526 | |
54cb65d8 EC |
527 | install-includedir: |
528 | $(INSTALL_DIR) "$(DESTDIR)$(includedir)" | |
529 | ||
a5665051 PB |
530 | # Needed by "meson install" |
531 | export DESTDIR | |
54cb65d8 EC |
532 | install: all $(if $(BUILD_DOCS),install-doc) \ |
533 | install-datadir install-localstatedir install-includedir \ | |
1338a4b7 | 534 | recurse-install |
932a79df | 535 | ifneq ($(TOOLS),) |
0814465a | 536 | $(call install-prog,$(TOOLS),$(DESTDIR)$(bindir)) |
932a79df | 537 | endif |
e3be6f0e FZ |
538 | ifneq ($(CONFIG_MODULES),) |
539 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)" | |
2115182f MT |
540 | for s in $(modules-m:.mo=$(DSOSUF)); do \ |
541 | t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \ | |
264f8b4f | 542 | $(INSTALL_LIB) $$s "$$t"; \ |
2115182f | 543 | test -z "$(STRIP)" || $(STRIP) "$$t"; \ |
e3be6f0e FZ |
544 | done |
545 | endif | |
7b93fadf | 546 | ifneq ($(HELPERS-y),) |
0d659426 | 547 | $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir)) |
7b93fadf | 548 | endif |
62dd1048 DB |
549 | ifdef CONFIG_TRACE_SYSTEMTAP |
550 | $(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir) | |
551 | endif | |
77755340 | 552 | ifneq ($(BLOBS),) |
77755340 | 553 | set -e; for x in $(BLOBS); do \ |
6aae2a2e | 554 | $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \ |
ad064840 | 555 | done |
834574ea | 556 | endif |
a8260d38 | 557 | for s in $(ICON_SIZES); do \ |
6c11dda9 | 558 | mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \ |
a8260d38 | 559 | $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \ |
6c11dda9 | 560 | "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \ |
a8260d38 | 561 | done; \ |
6c11dda9 | 562 | mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \ |
a8260d38 | 563 | $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \ |
6c11dda9 SH |
564 | "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \ |
565 | mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \ | |
a8260d38 | 566 | $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \ |
6c11dda9 SH |
567 | "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg" |
568 | mkdir -p "$(DESTDIR)$(qemu_desktopdir)" | |
67ea9546 | 569 | $(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \ |
6c11dda9 | 570 | "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop" |
2a6b5372 | 571 | ifdef CONFIG_GTK |
834574ea | 572 | $(MAKE) -C po $@ |
54cb65d8 EC |
573 | endif |
574 | ifeq ($(CONFIG_PLUGIN),y) | |
575 | $(INSTALL_DATA) $(SRC_PATH)/include/qemu/qemu-plugin.h "$(DESTDIR)$(includedir)/qemu-plugin.h" | |
77755340 | 576 | endif |
6aae2a2e | 577 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps" |
18be8d77 | 578 | set -e; for x in $(KEYMAPS); do \ |
6aae2a2e | 579 | $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \ |
ad064840 | 580 | done |
a81df1b6 PB |
581 | for d in $(TARGET_DIRS); do \ |
582 | $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \ | |
583 | done | |
612384d7 | 584 | |
3ef693a0 | 585 | # documentation |
e8518c92 | 586 | MAKEINFO=makeinfo |
d59157ea PB |
587 | MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D) |
588 | MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES) | |
e8338fdb | 589 | TEXI2PODFLAGS=$(MAKEINFOINCLUDES) -DVERSION="$(VERSION)" -DCONFDIR="$(qemu_confdir)" |
d59157ea | 590 | TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES) |
56e8bdd4 | 591 | |
e8338fdb MAL |
592 | docs/version.texi: $(SRC_PATH)/VERSION config-host.mak |
593 | $(call quiet-command,(\ | |
594 | echo "@set VERSION $(VERSION)" && \ | |
595 | echo "@set CONFDIR $(qemu_confdir)" \ | |
596 | )> $@,"GEN","$@") | |
fea346f5 | 597 | |
44cb280d | 598 | %.html: %.texi docs/version.texi |
e9ee06bd MAL |
599 | $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \ |
600 | --html $< -o $@,"GEN","$@") | |
3ef693a0 | 601 | |
44cb280d | 602 | %.info: %.texi docs/version.texi |
e9ee06bd | 603 | $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@") |
f3548328 | 604 | |
44cb280d | 605 | %.txt: %.texi docs/version.texi |
f8bab10b MAL |
606 | $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \ |
607 | --plaintext $< -o $@,"GEN","$@") | |
608 | ||
44cb280d | 609 | %.pdf: %.texi docs/version.texi |
d59157ea | 610 | $(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@") |
bd7f9747 | 611 | |
5f71eac0 PM |
612 | # Sphinx builds all its documentation at once in one invocation |
613 | # and handles "don't rebuild things unless necessary" itself. | |
614 | # The '.doctrees' files are cached information to speed this up. | |
615 | .PHONY: sphinxdocs | |
0928523a PM |
616 | sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \ |
617 | $(MANUAL_BUILDDIR)/interop/index.html \ | |
618 | $(MANUAL_BUILDDIR)/specs/index.html \ | |
65c3542b | 619 | $(MANUAL_BUILDDIR)/system/index.html \ |
09147930 PB |
620 | $(MANUAL_BUILDDIR)/tools/index.html \ |
621 | $(MANUAL_BUILDDIR)/user/index.html | |
5f71eac0 PM |
622 | |
623 | # Canned command to build a single manual | |
27a296fc | 624 | # Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man') |
6bda415c EH |
625 | # Note the use of different doctree for each (manual, builder) tuple; |
626 | # this works around Sphinx not handling parallel invocation on | |
627 | # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946 | |
516e8b7d | 628 | 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 | 629 | # We assume all RST files in the manual's directory are used in it |
814e068f | 630 | manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \ |
de1572ca | 631 | $(SRC_PATH)/docs/defs.rst.inc \ |
9165d323 PM |
632 | $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py \ |
633 | $(SRC_PATH)/docs/sphinx/*.py | |
e0f3728d PM |
634 | # Macro to write out the rule and dependencies for building manpages |
635 | # Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps]) | |
636 | # 'extradeps' is optional, and specifies extra files (eg .hx files) that | |
637 | # the manual page depends on. | |
638 | define define-manpage-rule | |
639 | $(call atomic,$(foreach manpage,$2,$(MANUAL_BUILDDIR)/$1/$(manpage)),$(call manual-deps,$1) $3) | |
640 | $(call build-manual,$1,man) | |
641 | endef | |
5f71eac0 | 642 | |
1290e671 | 643 | $(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel) |
27a296fc | 644 | $(call build-manual,devel,html) |
5f71eac0 | 645 | |
a08b4a9f | 646 | $(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop) |
27a296fc | 647 | $(call build-manual,interop,html) |
5f71eac0 | 648 | |
0783a732 | 649 | $(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs) |
27a296fc PM |
650 | $(call build-manual,specs,html) |
651 | ||
09ce5f2d | 652 | $(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 |
653 | $(call build-manual,system,html) |
654 | ||
a08b4a9f | 655 | $(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 |
656 | $(call build-manual,tools,html) |
657 | ||
09147930 PB |
658 | $(MANUAL_BUILDDIR)/user/index.html: $(call manual-deps,user) |
659 | $(call build-manual,user,html) | |
660 | ||
a08b4a9f | 661 | $(call define-manpage-rule,interop,qemu-ga.8) |
87c0868f | 662 | |
d06118bf | 663 | $(call define-manpage-rule,system,qemu.1 qemu-block-drivers.7 qemu-cpu-models.7) |
acab923d | 664 | |
a08b4a9f PM |
665 | $(call define-manpage-rule,tools,\ |
666 | qemu-img.1 qemu-nbd.8 qemu-trace-stap.1\ | |
667 | virtiofsd.1 virtfs-proxy-helper.1,\ | |
668 | $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc) | |
669 | ||
22108f33 | 670 | $(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version.h |
d83bbeda | 671 | @mkdir -p "$(MANUAL_BUILDDIR)" |
22108f33 SH |
672 | $(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \ |
673 | "GEN","$@") | |
674 | ||
eb815e24 | 675 | docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi |
fb0bc835 | 676 | @cp -p $< $@ |
4afeeb57 | 677 | |
f15bff25 | 678 | docs/interop/qemu-ga-qapi.texi: qga/qga-qapi-doc.texi |
fb0bc835 | 679 | @cp -p $< $@ |
56e8bdd4 | 680 | |
5b1d0e92 PM |
681 | html: docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs |
682 | info: docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info | |
683 | pdf: docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf | |
684 | txt: docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt | |
818220f5 | 685 | |
d59157ea PB |
686 | docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \ |
687 | docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \ | |
688 | docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \ | |
689 | docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi | |
56e8bdd4 | 690 | |
d59157ea PB |
691 | docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \ |
692 | docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \ | |
693 | docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \ | |
694 | docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi | |
56e8bdd4 | 695 | |
ae560cc3 EB |
696 | $(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl |
697 | ||
fe8bf5f6 AB |
698 | # Reports/Analysis |
699 | ||
700 | %/coverage-report.html: | |
701 | @mkdir -p $* | |
702 | $(call quiet-command,\ | |
5eda6e42 AB |
703 | gcovr -r $(SRC_PATH) \ |
704 | $(foreach t, $(TARGET_DIRS), --object-directory $(BUILD_DIR)/$(t)) \ | |
705 | --object-directory $(BUILD_DIR) \ | |
337f2311 | 706 | -p --html --html-details -o $@, \ |
fe8bf5f6 AB |
707 | "GEN", "coverage-report.html") |
708 | ||
709 | .PHONY: coverage-report | |
710 | coverage-report: $(CURDIR)/reports/coverage/coverage-report.html | |
56e8bdd4 | 711 | |
f53ec699 SW |
712 | ifdef CONFIG_WIN32 |
713 | ||
714 | INSTALLER = qemu-setup-$(VERSION)$(EXESUF) | |
715 | ||
716 | nsisflags = -V2 -NOCD | |
717 | ||
718 | ifneq ($(wildcard $(SRC_PATH)/dll),) | |
719 | ifeq ($(ARCH),x86_64) | |
720 | # 64 bit executables | |
721 | DLL_PATH = $(SRC_PATH)/dll/w64 | |
722 | nsisflags += -DW64 | |
723 | else | |
724 | # 32 bit executables | |
725 | DLL_PATH = $(SRC_PATH)/dll/w32 | |
726 | endif | |
727 | endif | |
728 | ||
729 | .PHONY: installer | |
730 | installer: $(INSTALLER) | |
731 | ||
732 | INSTDIR=/tmp/qemu-nsis | |
733 | ||
1b00a4c4 PB |
734 | $(INSTALLER): $(SRC_PATH)/qemu.nsi |
735 | $(MAKE) install DESTDIR=${INSTDIR} | |
f53ec699 | 736 | ifdef SIGNCODE |
1b00a4c4 | 737 | (cd ${INSTDIR}/${bindir}; \ |
f53ec699 SW |
738 | for i in *.exe; do \ |
739 | $(SIGNCODE) $${i}; \ | |
740 | done \ | |
741 | ) | |
742 | endif # SIGNCODE | |
1b00a4c4 | 743 | (cd ${INSTDIR}/${bindir}; \ |
f53ec699 SW |
744 | for i in qemu-system-*.exe; do \ |
745 | arch=$${i%.exe}; \ | |
746 | arch=$${arch#qemu-system-}; \ | |
747 | echo Section \"$$arch\" Section_$$arch; \ | |
748 | echo SetOutPath \"\$$INSTDIR\"; \ | |
749 | echo File \"\$${BINDIR}\\$$i\"; \ | |
750 | echo SectionEnd; \ | |
751 | done \ | |
1b00a4c4 | 752 | ) >${INSTDIR}/${bindir}/system-emulations.nsh |
f53ec699 SW |
753 | makensis $(nsisflags) \ |
754 | $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \ | |
755 | $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \ | |
1b00a4c4 | 756 | -DBINDIR="${INSTDIR}/${bindir}" \ |
f53ec699 SW |
757 | $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \ |
758 | -DSRCDIR="$(SRC_PATH)" \ | |
759 | -DOUTFILE="$(INSTALLER)" \ | |
805d8a67 | 760 | -DDISPLAYVERSION="$(VERSION)" \ |
f53ec699 SW |
761 | $(SRC_PATH)/qemu.nsi |
762 | rm -r ${INSTDIR} | |
763 | ifdef SIGNCODE | |
764 | $(SIGNCODE) $(INSTALLER) | |
765 | endif # SIGNCODE | |
766 | endif # CONFIG_WIN | |
767 | ||
cb5fc67d AL |
768 | # Add a dependency on the generated files, so that they are always |
769 | # rebuilt before other object files | |
428952cf | 770 | ifneq ($(wildcard config-host.mak),) |
eaa2ddbb | 771 | ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) |
3dff199c | 772 | Makefile: $(generated-files-y) |
7748b8cb | 773 | endif |
428952cf | 774 | endif |
cb5fc67d | 775 | |
4fb240a4 | 776 | # Include automatically generated dependency files |
1435ddb8 PB |
777 | # Dependencies in Makefile.objs files come from our recursive subdir rules |
778 | -include $(wildcard *.d tests/*.d) | |
324027c2 FZ |
779 | |
780 | include $(SRC_PATH)/tests/docker/Makefile.include | |
b1fb9a63 | 781 | include $(SRC_PATH)/tests/vm/Makefile.include |
0d8e065f | 782 | |
c355de59 PMD |
783 | print-help-run = printf " %-30s - %s\\n" "$1" "$2" |
784 | print-help = $(quiet-@)$(call print-help-run,$1,$2) | |
785 | ||
0d8e065f MAL |
786 | .PHONY: help |
787 | help: | |
788 | @echo 'Generic targets:' | |
c355de59 | 789 | $(call print-help,all,Build all) |
0decdfe2 | 790 | ifdef CONFIG_MODULES |
c355de59 | 791 | $(call print-help,modules,Build all modules) |
0decdfe2 | 792 | endif |
c355de59 PMD |
793 | $(call print-help,dir/file.o,Build specified target only) |
794 | $(call print-help,install,Install QEMU, documentation and tools) | |
795 | $(call print-help,ctags/TAGS,Generate tags file for editors) | |
796 | $(call print-help,cscope,Generate cscope index) | |
968b4db3 | 797 | $(call print-help,sparse,Run sparse on the QEMU source) |
0d8e065f | 798 | @echo '' |
2b1f35b9 | 799 | @$(if $(TARGET_DIRS), \ |
0d8e065f | 800 | echo 'Architecture specific targets:'; \ |
2b1f35b9 | 801 | $(foreach t, $(TARGET_DIRS), \ |
763815a8 PMD |
802 | $(call print-help-run,$(t)/all,Build for $(t)); \ |
803 | $(if $(CONFIG_FUZZ), \ | |
804 | $(if $(findstring softmmu,$(t)), \ | |
805 | $(call print-help-run,$(t)/fuzz,Build fuzzer for $(t)); \ | |
806 | ))) \ | |
0d8e065f | 807 | echo '') |
fdbff6bd PMD |
808 | @$(if $(HELPERS-y), \ |
809 | echo 'Helper targets:'; \ | |
810 | $(foreach t, $(HELPERS-y), \ | |
811 | $(call print-help-run,$(t),Build $(shell basename $(t)));) \ | |
812 | echo '') | |
81ed0a57 PMD |
813 | @$(if $(TOOLS), \ |
814 | echo 'Tools targets:'; \ | |
815 | $(foreach t, $(TOOLS), \ | |
816 | $(call print-help-run,$(t),Build $(shell basename $(t)) tool);) \ | |
0d8e065f MAL |
817 | echo '') |
818 | @echo 'Cleaning targets:' | |
c355de59 | 819 | $(call print-help,clean,Remove most generated files but keep the config) |
c355de59 PMD |
820 | $(call print-help,distclean,Remove all generated files) |
821 | $(call print-help,dist,Build a distributable tarball) | |
0d8e065f MAL |
822 | @echo '' |
823 | @echo 'Test targets:' | |
c355de59 PMD |
824 | $(call print-help,check,Run all tests (check-help for details)) |
825 | $(call print-help,docker,Help about targets running tests inside containers) | |
826 | $(call print-help,vm-help,Help about targets running tests inside VM) | |
0d8e065f MAL |
827 | @echo '' |
828 | @echo 'Documentation targets:' | |
c355de59 | 829 | $(call print-help,html info pdf txt,Build documentation in specified format) |
0d8e065f MAL |
830 | @echo '' |
831 | ifdef CONFIG_WIN32 | |
832 | @echo 'Windows targets:' | |
c355de59 | 833 | $(call print-help,installer,Build NSIS-based installer for QEMU) |
0d8e065f | 834 | ifdef QEMU_GA_MSI_ENABLED |
c355de59 | 835 | $(call print-help,msi,Build MSI-based installer for qemu-ga) |
0d8e065f MAL |
836 | endif |
837 | @echo '' | |
838 | endif | |
c355de59 PMD |
839 | $(call print-help,$(MAKE) [targets],(quiet build, default)) |
840 | $(call print-help,$(MAKE) V=1 [targets],(verbose build)) |