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