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