3 ifneq ($(words $(subst :, ,$(CURDIR
))), 1)
4 $(error main directory cannot contain spaces nor colons
)
7 # Always point to the root of the build tree (needs GNU make).
10 # Before including a proper config-host.mak, assume we are in the source tree
13 UNCHECKED_GOALS
:= %clean TAGS cscope ctags
dist \
15 help check-help print-
% \
16 docker docker-
% vm-help vm-test vm-build-
%
21 # All following code might depend on configuration variables
22 ifneq ($(wildcard config-host.mak
),)
23 # Put the all: rule here so that config-host.mak can contain dependencies.
25 include config-host.mak
29 .PHONY
: git-submodule-update
31 git_module_status
:= $(shell \
33 GIT
="$(GIT)" .
/scripts
/git-submodule.sh status
$(GIT_SUBMODULES
); \
37 ifeq (1,$(git_module_status
))
38 ifeq (no
,$(GIT_UPDATE
))
40 $(call quiet-command
, \
42 echo
"GIT submodule checkout is out of date. Please run" && \
43 echo
" scripts/git-submodule.sh update $(GIT_SUBMODULES)" && \
44 echo
"from the source directory checkout $(SRC_PATH)" && \
49 $(call quiet-command
, \
50 (cd
$(SRC_PATH
) && GIT
="$(GIT)" .
/scripts
/git-submodule.sh update
$(GIT_SUBMODULES
)), \
51 "GIT","$(GIT_SUBMODULES)")
55 .git-submodule-status
: git-submodule-update config-host.mak
57 # Check that we're not trying to do an out-of-tree build from
58 # a tree that's been used for an in-tree build.
59 ifneq ($(realpath
$(SRC_PATH
)),$(realpath .
))
60 ifneq ($(wildcard $(SRC_PATH
)/config-host.mak
),)
61 $(error This is an out of tree build but your source tree
($(SRC_PATH
)) \
62 seems to have been used for an in-tree build. You can fix this by running \
63 "$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree
)
67 CONFIG_SOFTMMU
:= $(if
$(filter %-softmmu
,$(TARGET_DIRS
)),y
)
68 CONFIG_USER_ONLY
:= $(if
$(filter %-user
,$(TARGET_DIRS
)),y
)
69 CONFIG_XEN
:= $(CONFIG_XEN_BACKEND
)
71 -include config-all-devices.mak
72 -include config-all-disas.mak
74 config-host.mak
: $(SRC_PATH
)/configure
$(SRC_PATH
)/pc-bios
$(SRC_PATH
)/VERSION
75 @echo
$@ is out-of-date
, running configure
78 # Force configure to re-run if the API symbols are updated
79 ifeq ($(CONFIG_PLUGIN
),y
)
80 config-host.mak
: $(SRC_PATH
)/plugins
/qemu-plugins.symbols
85 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
86 @echo
"Please call configure before running make!"
91 include $(SRC_PATH
)/rules.mak
93 # lor is defined in rules.mak
94 CONFIG_BLOCK
:= $(call lor
,$(CONFIG_SOFTMMU
),$(CONFIG_TOOLS
))
96 # Create QEMU_PKGVERSION and FULL_VERSION strings
97 # If PKGVERSION is set, use that; otherwise get version and -dirty status from git
98 QEMU_PKGVERSION
:= $(if
$(PKGVERSION
),$(PKGVERSION
),$(shell \
100 if
test -e .git
; then \
101 git describe
--match
'v*' 2>/dev
/null | tr
-d
'\n'; \
102 if
! git diff-index
--quiet HEAD
&>/dev
/null
; then \
107 # Either "version (pkgversion)", or just "version" if pkgversion not set
108 FULL_VERSION
:= $(if
$(QEMU_PKGVERSION
),$(VERSION
) ($(QEMU_PKGVERSION
)),$(VERSION
))
110 generated-files-y
= qemu-version.h config-host.h qemu-options.def
112 GENERATED_QAPI_FILES
= qapi
/qapi-builtin-types.h qapi
/qapi-builtin-types.c
113 GENERATED_QAPI_FILES
+= qapi
/qapi-types.h qapi
/qapi-types.c
114 GENERATED_QAPI_FILES
+= $(QAPI_MODULES
:%=qapi
/qapi-types-
%.h
)
115 GENERATED_QAPI_FILES
+= $(QAPI_MODULES
:%=qapi
/qapi-types-
%.c
)
116 GENERATED_QAPI_FILES
+= qapi
/qapi-builtin-visit.h qapi
/qapi-builtin-visit.c
117 GENERATED_QAPI_FILES
+= qapi
/qapi-visit.h qapi
/qapi-visit.c
118 GENERATED_QAPI_FILES
+= $(QAPI_MODULES
:%=qapi
/qapi-visit-
%.h
)
119 GENERATED_QAPI_FILES
+= $(QAPI_MODULES
:%=qapi
/qapi-visit-
%.c
)
120 GENERATED_QAPI_FILES
+= qapi
/qapi-init-commands.h qapi
/qapi-init-commands.c
121 GENERATED_QAPI_FILES
+= qapi
/qapi-commands.h qapi
/qapi-commands.c
122 GENERATED_QAPI_FILES
+= $(QAPI_MODULES
:%=qapi
/qapi-commands-
%.h
)
123 GENERATED_QAPI_FILES
+= $(QAPI_MODULES
:%=qapi
/qapi-commands-
%.c
)
124 GENERATED_QAPI_FILES
+= qapi
/qapi-emit-events.h qapi
/qapi-emit-events.c
125 GENERATED_QAPI_FILES
+= qapi
/qapi-events.h qapi
/qapi-events.c
126 GENERATED_QAPI_FILES
+= $(QAPI_MODULES
:%=qapi
/qapi-events-
%.h
)
127 GENERATED_QAPI_FILES
+= $(QAPI_MODULES
:%=qapi
/qapi-events-
%.c
)
128 GENERATED_QAPI_FILES
+= qapi
/qapi-introspect.c qapi
/qapi-introspect.h
129 GENERATED_QAPI_FILES
+= qapi
/qapi-doc.texi
131 generated-files-y
+= $(GENERATED_QAPI_FILES
)
133 generated-files-y
+= trace
/generated-tcg-tracers.h
135 generated-files-y
+= trace
/generated-helpers-wrappers.h
136 generated-files-y
+= trace
/generated-helpers.h
137 generated-files-y
+= trace
/generated-helpers.c
139 generated-files-
$(CONFIG_TRACE_UST
) += trace-ust-all.h
140 generated-files-
$(CONFIG_TRACE_UST
) += trace-ust-all.c
142 generated-files-y
+= module_block.h
144 TRACE_HEADERS
= trace-root.h
$(trace-events-subdirs
:%=%/trace.h
)
145 TRACE_SOURCES
= trace-root.c
$(trace-events-subdirs
:%=%/trace.c
)
147 ifdef CONFIG_TRACE_DTRACE
148 TRACE_HEADERS
+= trace-dtrace-root.h
$(trace-events-subdirs
:%=%/trace-dtrace.h
)
149 TRACE_DTRACE
+= trace-dtrace-root.dtrace
$(trace-events-subdirs
:%=%/trace-dtrace.dtrace
)
151 ifdef CONFIG_TRACE_UST
152 TRACE_HEADERS
+= trace-ust-root.h
$(trace-events-subdirs
:%=%/trace-ust.h
)
155 generated-files-y
+= $(TRACE_HEADERS
)
156 generated-files-y
+= $(TRACE_SOURCES
)
157 generated-files-y
+= $(BUILD_DIR
)/trace-events-all
158 generated-files-y
+= .git-submodule-status
160 trace-group-name
= $(shell dirname
$1 | sed
-e
's/[^a-zA-Z0-9]/_/g')
162 tracetool-y
= $(SRC_PATH
)/scripts
/tracetool.py
163 tracetool-y
+= $(shell find
$(SRC_PATH
)/scripts
/tracetool
-name
"*.py")
165 %/trace.h
: %/trace.h-timestamp
166 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
167 %/trace.h-timestamp
: $(SRC_PATH
)/%/trace-events
$(tracetool-y
) $(BUILD_DIR
)/config-host.mak
168 $(call quiet-command
,$(TRACETOOL
) \
169 --group
=$(call trace-group-name
,$@
) \
171 --backends
=$(TRACE_BACKENDS
) \
172 $< > $@
,"GEN","$(@:%-timestamp=%)")
174 %/trace.c
: %/trace.c-timestamp
175 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
176 %/trace.c-timestamp
: $(SRC_PATH
)/%/trace-events
$(tracetool-y
) $(BUILD_DIR
)/config-host.mak
177 $(call quiet-command
,$(TRACETOOL
) \
178 --group
=$(call trace-group-name
,$@
) \
180 --backends
=$(TRACE_BACKENDS
) \
181 $< > $@
,"GEN","$(@:%-timestamp=%)")
183 %/trace-ust.h
: %/trace-ust.h-timestamp
184 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
185 %/trace-ust.h-timestamp
: $(SRC_PATH
)/%/trace-events
$(tracetool-y
) $(BUILD_DIR
)/config-host.mak
186 $(call quiet-command
,$(TRACETOOL
) \
187 --group
=$(call trace-group-name
,$@
) \
188 --format
=ust-events-h \
189 --backends
=$(TRACE_BACKENDS
) \
190 $< > $@
,"GEN","$(@:%-timestamp=%)")
192 %/trace-dtrace.dtrace
: %/trace-dtrace.dtrace-timestamp
193 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
194 %/trace-dtrace.dtrace-timestamp
: $(SRC_PATH
)/%/trace-events
$(BUILD_DIR
)/config-host.mak
$(tracetool-y
)
195 $(call quiet-command
,$(TRACETOOL
) \
196 --group
=$(call trace-group-name
,$@
) \
198 --backends
=$(TRACE_BACKENDS
) \
199 $< > $@
,"GEN","$(@:%-timestamp=%)")
201 %/trace-dtrace.h
: %/trace-dtrace.dtrace
$(tracetool-y
)
202 $(call quiet-command
,dtrace
-o
$@
-h
-s
$<, "GEN","$@")
204 %/trace-dtrace.o
: %/trace-dtrace.dtrace
$(tracetool-y
)
207 trace-root.h
: trace-root.h-timestamp
208 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
209 trace-root.h-timestamp
: $(SRC_PATH
)/trace-events
$(tracetool-y
) $(BUILD_DIR
)/config-host.mak
210 $(call quiet-command
,$(TRACETOOL
) \
213 --backends
=$(TRACE_BACKENDS
) \
214 $< > $@
,"GEN","$(@:%-timestamp=%)")
216 trace-root.c
: trace-root.c-timestamp
217 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
218 trace-root.c-timestamp
: $(SRC_PATH
)/trace-events
$(tracetool-y
) $(BUILD_DIR
)/config-host.mak
219 $(call quiet-command
,$(TRACETOOL
) \
222 --backends
=$(TRACE_BACKENDS
) \
223 $< > $@
,"GEN","$(@:%-timestamp=%)")
225 trace-ust-root.h
: trace-ust-root.h-timestamp
226 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
227 trace-ust-root.h-timestamp
: $(SRC_PATH
)/trace-events
$(tracetool-y
) $(BUILD_DIR
)/config-host.mak
228 $(call quiet-command
,$(TRACETOOL
) \
230 --format
=ust-events-h \
231 --backends
=$(TRACE_BACKENDS
) \
232 $< > $@
,"GEN","$(@:%-timestamp=%)")
234 trace-ust-all.h
: trace-ust-all.h-timestamp
235 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
236 trace-ust-all.h-timestamp
: $(trace-events-files
) $(tracetool-y
) $(BUILD_DIR
)/config-host.mak
237 $(call quiet-command
,$(TRACETOOL
) \
239 --format
=ust-events-h \
240 --backends
=$(TRACE_BACKENDS
) \
241 $(trace-events-files
) > $@
,"GEN","$(@:%-timestamp=%)")
243 trace-ust-all.c
: trace-ust-all.c-timestamp
244 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
245 trace-ust-all.c-timestamp
: $(trace-events-files
) $(tracetool-y
) $(BUILD_DIR
)/config-host.mak
246 $(call quiet-command
,$(TRACETOOL
) \
248 --format
=ust-events-c \
249 --backends
=$(TRACE_BACKENDS
) \
250 $(trace-events-files
) > $@
,"GEN","$(@:%-timestamp=%)")
252 trace-dtrace-root.dtrace
: trace-dtrace-root.dtrace-timestamp
253 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
254 trace-dtrace-root.dtrace-timestamp
: $(SRC_PATH
)/trace-events
$(BUILD_DIR
)/config-host.mak
$(tracetool-y
)
255 $(call quiet-command
,$(TRACETOOL
) \
258 --backends
=$(TRACE_BACKENDS
) \
259 $< > $@
,"GEN","$(@:%-timestamp=%)")
261 trace-dtrace-root.h
: trace-dtrace-root.dtrace
262 $(call quiet-command
,dtrace
-o
$@
-h
-s
$<, "GEN","$@")
264 trace-dtrace-root.o
: trace-dtrace-root.dtrace
266 KEYCODEMAP_GEN
= $(SRC_PATH
)/ui
/keycodemapdb
/tools
/keymap-gen
267 KEYCODEMAP_CSV
= $(SRC_PATH
)/ui
/keycodemapdb
/data
/keymaps.csv
270 ui
/input-keymap-atset1-to-qcode.c \
271 ui
/input-keymap-linux-to-qcode.c \
272 ui
/input-keymap-qcode-to-atset1.c \
273 ui
/input-keymap-qcode-to-atset2.c \
274 ui
/input-keymap-qcode-to-atset3.c \
275 ui
/input-keymap-qcode-to-linux.c \
276 ui
/input-keymap-qcode-to-qnum.c \
277 ui
/input-keymap-qcode-to-sun.c \
278 ui
/input-keymap-qnum-to-qcode.c \
279 ui
/input-keymap-usb-to-qcode.c \
280 ui
/input-keymap-win32-to-qcode.c \
281 ui
/input-keymap-x11-to-qcode.c \
282 ui
/input-keymap-xorgevdev-to-qcode.c \
283 ui
/input-keymap-xorgkbd-to-qcode.c \
284 ui
/input-keymap-xorgxquartz-to-qcode.c \
285 ui
/input-keymap-xorgxwin-to-qcode.c \
286 ui
/input-keymap-osx-to-qcode.c \
289 generated-files-
$(CONFIG_SOFTMMU
) += $(KEYCODEMAP_FILES
)
291 ui
/input-keymap-
%.c
: $(KEYCODEMAP_GEN
) $(KEYCODEMAP_CSV
) $(SRC_PATH
)/ui
/Makefile.objs
292 $(call quiet-command
,\
293 stem
=$* && src
=$${stem
%-to-
*} dst
=$${stem
#*-to-} && \
294 test -e
$(KEYCODEMAP_GEN
) && \
295 $(PYTHON
) $(KEYCODEMAP_GEN
) \
297 --varname qemu_input_map_
$${src}_to_
$${dst} \
298 code-map
$(KEYCODEMAP_CSV
) $${src} $${dst} \
299 > $@ ||
rm -f
$@
, "GEN", "$@")
301 $(KEYCODEMAP_GEN
): .git-submodule-status
302 $(KEYCODEMAP_CSV
): .git-submodule-status
304 edk2-decompressed
= $(basename $(wildcard pc-bios
/edk2-
*.fd.bz2
))
305 pc-bios
/edk2-
%.fd
: pc-bios
/edk2-
%.fd.bz2
306 $(call quiet-command
,bzip2
-d
-c
$< > $@
,"BUNZIP2",$<)
308 # Don't try to regenerate Makefile or configure
309 # We don't generate any of them
313 .PHONY
: all clean cscope
distclean html
info install install-doc \
314 pdf txt recurse-all
dist msi FORCE
316 $(call set-vpath
, $(SRC_PATH
))
318 LIBS
+=-lz
$(LIBS_TOOLS
)
323 HELPERS-
$(call land
,$(CONFIG_SOFTMMU
),$(CONFIG_LINUX
)) = qemu-bridge-helper
$(EXESUF
)
325 ifeq ($(CONFIG_LINUX
)$(CONFIG_VIRGL
)$(CONFIG_GBM
)$(CONFIG_TOOLS
),yyyy
)
326 HELPERS-y
+= vhost-user-gpu
$(EXESUF
)
327 vhost-user-json-y
+= contrib
/vhost-user-gpu
/50-qemu-gpu.json
330 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
331 HELPERS-y
+= virtiofsd
$(EXESUF
)
332 vhost-user-json-y
+= tools
/virtiofsd
/50-qemu-virtiofsd.json
335 # Sphinx does not allow building manuals into the same directory as
336 # the source files, so if we're doing an in-tree QEMU build we must
337 # build the manuals into a subdirectory (and then install them from
338 # there for 'make install'). For an out-of-tree build we can just
339 # use the docs/ subdirectory in the build tree as normal.
340 ifeq ($(realpath
$(SRC_PATH
)),$(realpath .
))
341 MANUAL_BUILDDIR
:= docs
/built
343 MANUAL_BUILDDIR
:= docs
347 DOCS
=qemu-doc.html qemu-doc.txt qemu
.1 qemu-img
.1
348 DOCS
+=$(MANUAL_BUILDDIR
)/interop
/qemu-nbd
.8
349 DOCS
+=$(MANUAL_BUILDDIR
)/interop
/qemu-ga
.8
350 DOCS
+=$(MANUAL_BUILDDIR
)/system
/qemu-block-drivers
.7
351 DOCS
+=docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7
352 DOCS
+=docs
/interop
/qemu-ga-ref.html docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7
353 DOCS
+=docs
/qemu-cpu-models
.7
354 DOCS
+=$(MANUAL_BUILDDIR
)/index.html
356 DOCS
+=fsdev
/virtfs-proxy-helper
.1
358 ifdef CONFIG_TRACE_SYSTEMTAP
359 DOCS
+=scripts
/qemu-trace-stap
.1
365 SUBDIR_MAKEFLAGS
=$(if
$(V
),,--no-print-directory
--quiet
) BUILD_DIR
=$(BUILD_DIR
)
366 SUBDIR_DEVICES_MAK
=$(patsubst %, %/config-devices.mak
, $(filter %-softmmu
, $(TARGET_DIRS
)))
367 SUBDIR_DEVICES_MAK_DEP
=$(patsubst %, %.d
, $(SUBDIR_DEVICES_MAK
))
369 ifeq ($(SUBDIR_DEVICES_MAK
),)
370 config-all-devices.mak
: config-host.mak
371 $(call quiet-command
,echo
'# no devices' > $@
,"GEN","$@")
373 config-all-devices.mak
: $(SUBDIR_DEVICES_MAK
) config-host.mak
374 $(call quiet-command
, sed
-n \
375 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
376 $(SUBDIR_DEVICES_MAK
) |
sort -u
> $@
, \
380 -include $(SUBDIR_DEVICES_MAK_DEP
)
382 # This has to be kept in sync with Kconfig.host.
384 $(CONFIG_MINIKCONF_MODE
) \
385 $@
$*/config-devices.mak.d
$< $(MINIKCONF_INPUTS
) \
386 CONFIG_KVM
=$(CONFIG_KVM
) \
387 CONFIG_SPICE
=$(CONFIG_SPICE
) \
388 CONFIG_IVSHMEM
=$(CONFIG_IVSHMEM
) \
389 CONFIG_TPM
=$(CONFIG_TPM
) \
390 CONFIG_XEN
=$(CONFIG_XEN
) \
391 CONFIG_OPENGL
=$(CONFIG_OPENGL
) \
392 CONFIG_X11
=$(CONFIG_X11
) \
393 CONFIG_VHOST_USER
=$(CONFIG_VHOST_USER
) \
394 CONFIG_VHOST_KERNEL
=$(CONFIG_VHOST_KERNEL
) \
395 CONFIG_VIRTFS
=$(CONFIG_VIRTFS
) \
396 CONFIG_LINUX
=$(CONFIG_LINUX
) \
397 CONFIG_PVRDMA
=$(CONFIG_PVRDMA
)
399 MINIKCONF_INPUTS
= $(SRC_PATH
)/Kconfig.host
$(SRC_PATH
)/hw
/Kconfig \
400 $(wildcard $(SRC_PATH
)/hw
/*/Kconfig
)
401 MINIKCONF
= $(PYTHON
) $(SRC_PATH
)/scripts
/minikconf.py \
403 $(SUBDIR_DEVICES_MAK
): %/config-devices.mak
: default-configs
/%.mak
$(MINIKCONF_INPUTS
) $(BUILD_DIR
)/config-host.mak
404 $(call quiet-command
, $(MINIKCONF
) $(MINIKCONF_ARGS
) > $@.tmp
, "GEN", "$@.tmp")
405 $(call quiet-command
, if
test -f
$@
; then \
406 if cmp
-s
$@.old
$@
; then \
410 if
test -f
$@.old
; then \
411 echo
"WARNING: $@ (user modified) out of date.";\
413 echo
"WARNING: $@ out of date.";\
415 echo
"Run \"$(MAKE) defconfig\" to regenerate."; \
424 rm -f config-all-devices.mak
$(SUBDIR_DEVICES_MAK
)
426 ifneq ($(wildcard config-host.mak
),)
427 include $(SRC_PATH
)/Makefile.objs
430 dummy
:= $(call unnest-vars
,, \
437 ivshmem-client-obj-y \
438 ivshmem-server-obj-y \
441 libvhost-user-obj-y \
442 vhost-user-scsi-obj-y \
443 vhost-user-blk-obj-y \
444 vhost-user-input-obj-y \
445 vhost-user-gpu-obj-y \
456 include $(SRC_PATH
)/tests
/Makefile.
include
458 all: $(DOCS
) $(if
$(BUILD_DOCS
),sphinxdocs
) $(TOOLS
) $(HELPERS-y
) recurse-all modules
$(vhost-user-json-y
)
460 qemu-version.h
: FORCE
461 $(call quiet-command
, \
462 (printf
'#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \
463 printf
'#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \
465 $(call quiet-command
, if
! cmp
-s
$@
$@.tmp
; then \
471 config-host.h
: config-host.h-timestamp
472 config-host.h-timestamp
: config-host.mak
473 qemu-options.def
: $(SRC_PATH
)/qemu-options.hx
$(SRC_PATH
)/scripts
/hxtool
474 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
476 TARGET_DIRS_RULES
:= $(foreach t
, all clean install, $(addsuffix /$(t
), $(TARGET_DIRS
)))
478 SOFTMMU_ALL_RULES
=$(filter %-softmmu
/all, $(TARGET_DIRS_RULES
))
479 $(SOFTMMU_ALL_RULES
): $(authz-obj-y
)
480 $(SOFTMMU_ALL_RULES
): $(block-obj-y
)
481 $(SOFTMMU_ALL_RULES
): $(chardev-obj-y
)
482 $(SOFTMMU_ALL_RULES
): $(crypto-obj-y
)
483 $(SOFTMMU_ALL_RULES
): $(io-obj-y
)
484 $(SOFTMMU_ALL_RULES
): config-all-devices.mak
485 ifdef DECOMPRESS_EDK2_BLOBS
486 $(SOFTMMU_ALL_RULES
): $(edk2-decompressed
)
489 .PHONY
: $(TARGET_DIRS_RULES
)
490 # The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
491 # $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
492 $(TARGET_DIRS_RULES
):
493 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" $(notdir $@
),)
495 DTC_MAKE_ARGS
=-I
$(SRC_PATH
)/dtc VPATH
=$(SRC_PATH
)/dtc
-C dtc V
="$(V)" LIBFDT_srcdir
=$(SRC_PATH
)/dtc
/libfdt
496 DTC_CFLAGS
=$(CFLAGS
) $(QEMU_CFLAGS
)
497 DTC_CPPFLAGS
=-I
$(BUILD_DIR
)/dtc
-I
$(SRC_PATH
)/dtc
-I
$(SRC_PATH
)/dtc
/libfdt
500 dtc
/all: .git-submodule-status dtc
/libfdt dtc
/tests
501 $(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
/libfdt.a
,)
503 dtc
/%: .git-submodule-status
506 # Overriding CFLAGS causes us to lose defines added in the sub-makefile.
507 # Not overriding CFLAGS leads to mis-matches between compilation modes.
508 # Therefore we replicate some of the logic in the sub-makefile.
509 # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
510 # no need to annoy QEMU developers with such things.
511 CAP_CFLAGS
= $(patsubst -W
%,,$(CFLAGS
) $(QEMU_CFLAGS
))
512 CAP_CFLAGS
+= -DCAPSTONE_USE_SYS_DYN_MEM
513 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM
514 CAP_CFLAGS
+= -DCAPSTONE_HAS_ARM64
515 CAP_CFLAGS
+= -DCAPSTONE_HAS_POWERPC
516 CAP_CFLAGS
+= -DCAPSTONE_HAS_X86
519 capstone
/all: .git-submodule-status
520 $(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
))
523 slirp
/all: .git-submodule-status
524 $(call quiet-command
,$(MAKE
) -C
$(SRC_PATH
)/slirp \
525 BUILD_DIR
="$(BUILD_DIR)/slirp" \
526 PKG_CONFIG
="$(PKG_CONFIG)" \
527 CC
="$(CC)" AR
="$(AR)" LD
="$(LD)" RANLIB
="$(RANLIB)" \
528 CFLAGS
="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS
="$(QEMU_LDFLAGS)")
530 # Compatibility gunk to keep make working across the rename of targets
531 # for recursion, to be removed some time after 4.1.
533 subdir-capstone
: capstone
/all
534 subdir-slirp
: slirp
/all
536 $(filter %/all, $(TARGET_DIRS_RULES
)): libqemuutil.a
$(common-obj-y
) \
539 ROM_DIRS
= $(addprefix pc-bios
/, $(ROMS
))
540 ROM_DIRS_RULES
=$(foreach t
, all clean, $(addsuffix /$(t
), $(ROM_DIRS
)))
541 # Only keep -O and -g cflags
542 .PHONY
: $(ROM_DIRS_RULES
)
544 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$(dir $@
) V
="$(V)" TARGET_DIR
="$(dir $@)" CFLAGS
="$(filter -O% -g%,$(CFLAGS))" $(notdir $@
),)
546 .PHONY
: recurse-all recurse-clean recurse-install
547 recurse-all
: $(addsuffix /all, $(TARGET_DIRS
) $(ROM_DIRS
))
548 recurse-clean
: $(addsuffix /clean, $(TARGET_DIRS
) $(ROM_DIRS
))
549 recurse-install
: $(addsuffix /install, $(TARGET_DIRS
))
550 $(addsuffix /install, $(TARGET_DIRS
)): all
552 $(BUILD_DIR
)/version.o
: $(SRC_PATH
)/version.rc config-host.h
553 $(call quiet-command
,$(WINDRES
) -I
$(BUILD_DIR
) -o
$@
$<,"RC","version.o")
555 Makefile
: $(version-obj-y
)
557 ######################################################################
560 libqemuutil.a
: $(util-obj-y
) $(trace-obj-y
) $(stub-obj-y
)
561 libvhost-user.a
: $(libvhost-user-obj-y
) $(util-obj-y
) $(stub-obj-y
)
563 ######################################################################
565 COMMON_LDADDS
= libqemuutil.a
567 qemu-img.o
: qemu-img-cmds.h
569 qemu-img
$(EXESUF
): qemu-img.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
570 qemu-nbd
$(EXESUF
): qemu-nbd.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
571 qemu-io
$(EXESUF
): qemu-io.o
$(authz-obj-y
) $(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
573 qemu-bridge-helper
$(EXESUF
): qemu-bridge-helper.o
$(COMMON_LDADDS
)
575 qemu-keymap
$(EXESUF
): qemu-keymap.o ui
/input-keymap.o
$(COMMON_LDADDS
)
577 qemu-edid
$(EXESUF
): qemu-edid.o hw
/display
/edid-generate.o
$(COMMON_LDADDS
)
579 fsdev
/virtfs-proxy-helper
$(EXESUF
): fsdev
/virtfs-proxy-helper.o fsdev
/9p-marshal.o fsdev
/9p-iov-marshal.o
$(COMMON_LDADDS
)
581 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
)
583 scsi
/qemu-pr-helper
$(EXESUF
): LIBS
+= -ludev
-lmultipath
-lmpathpersist
586 qemu-img-cmds.h
: $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/scripts
/hxtool
587 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
589 qemu-ga
$(EXESUF
): LIBS
= $(LIBS_QGA
)
590 qemu-ga
$(EXESUF
): QEMU_CFLAGS
+= -I qga
/qapi-generated
592 qemu-keymap
$(EXESUF
): LIBS
+= $(XKBCOMMON_LIBS
)
593 qemu-keymap
$(EXESUF
): QEMU_CFLAGS
+= $(XKBCOMMON_CFLAGS
)
595 qapi-py
= $(SRC_PATH
)/scripts
/qapi
/__init__.py \
596 $(SRC_PATH
)/scripts
/qapi
/commands.py \
597 $(SRC_PATH
)/scripts
/qapi
/common.py \
598 $(SRC_PATH
)/scripts
/qapi
/doc.py \
599 $(SRC_PATH
)/scripts
/qapi
/error.py \
600 $(SRC_PATH
)/scripts
/qapi
/events.py \
601 $(SRC_PATH
)/scripts
/qapi
/expr.py \
602 $(SRC_PATH
)/scripts
/qapi
/gen.py \
603 $(SRC_PATH
)/scripts
/qapi
/introspect.py \
604 $(SRC_PATH
)/scripts
/qapi
/parser.py \
605 $(SRC_PATH
)/scripts
/qapi
/schema.py \
606 $(SRC_PATH
)/scripts
/qapi
/source.py \
607 $(SRC_PATH
)/scripts
/qapi
/types.py \
608 $(SRC_PATH
)/scripts
/qapi
/visit.py \
609 $(SRC_PATH
)/scripts
/qapi-gen.py
611 qga
/qapi-generated
/qga-qapi-types.c qga
/qapi-generated
/qga-qapi-types.h \
612 qga
/qapi-generated
/qga-qapi-visit.c qga
/qapi-generated
/qga-qapi-visit.h \
613 qga
/qapi-generated
/qga-qapi-commands.h qga
/qapi-generated
/qga-qapi-commands.c \
614 qga
/qapi-generated
/qga-qapi-init-commands.h qga
/qapi-generated
/qga-qapi-init-commands.c \
615 qga
/qapi-generated
/qga-qapi-doc.texi
: \
616 qga
/qapi-generated
/qapi-gen-timestamp
;
617 qga
/qapi-generated
/qapi-gen-timestamp
: $(SRC_PATH
)/qga
/qapi-schema.json
$(qapi-py
)
618 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-gen.py \
619 -o qga
/qapi-generated
-p
"qga-" $<, \
620 "GEN","$(@:%-timestamp=%)")
623 qapi-modules
= $(SRC_PATH
)/qapi
/qapi-schema.json \
624 $(QAPI_MODULES
:%=$(SRC_PATH
)/qapi
/%.json
)
626 $(GENERATED_QAPI_FILES
): qapi-gen-timestamp
;
627 qapi-gen-timestamp
: $(qapi-modules
) $(qapi-py
)
628 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-gen.py \
630 "GEN","$(@:%-timestamp=%)")
633 QGALIB_GEN
=$(addprefix qga
/qapi-generated
/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h qga-qapi-init-commands.h
)
634 $(qga-obj-y
): $(QGALIB_GEN
)
636 qemu-ga
$(EXESUF
): $(qga-obj-y
) $(COMMON_LDADDS
)
639 ifdef QEMU_GA_MSI_ENABLED
640 QEMU_GA_MSI
=qemu-ga-
$(ARCH
).msi
644 $(QEMU_GA_MSI
): qemu-ga.exe
$(QGA_VSS_PROVIDER
)
646 $(QEMU_GA_MSI
): config-host.mak
648 $(QEMU_GA_MSI
): $(SRC_PATH
)/qga
/installer
/qemu-ga.wxs
649 $(call quiet-command
,QEMU_GA_VERSION
="$(QEMU_GA_VERSION)" QEMU_GA_MANUFACTURER
="$(QEMU_GA_MANUFACTURER)" QEMU_GA_DISTRO
="$(QEMU_GA_DISTRO)" BUILD_DIR
="$(BUILD_DIR)" \
650 wixl
-o
$@
$(QEMU_GA_MSI_ARCH
) $(QEMU_GA_MSI_WITH_VSS
) $(QEMU_GA_MSI_MINGW_DLL_PATH
) $<,"WIXL","$@")
653 @echo
"MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
658 qemu-ga
: qemu-ga
$(EXESUF
) $(QGA_VSS_PROVIDER
) $(QEMU_GA_MSI
)
661 elf2dmp
$(EXESUF
): $(elf2dmp-obj-y
)
665 ivshmem-client
$(EXESUF
): $(ivshmem-client-obj-y
) $(COMMON_LDADDS
)
667 ivshmem-server
$(EXESUF
): $(ivshmem-server-obj-y
) $(COMMON_LDADDS
)
670 vhost-user-scsi
$(EXESUF
): $(vhost-user-scsi-obj-y
) libvhost-user.a
672 vhost-user-blk
$(EXESUF
): $(vhost-user-blk-obj-y
) libvhost-user.a
675 rdmacm-mux
$(EXESUF
): LIBS
+= "-libumad"
676 rdmacm-mux
$(EXESUF
): $(rdmacm-mux-obj-y
) $(COMMON_LDADDS
)
679 # relies on Linux-specific syscalls
680 ifeq ($(CONFIG_LINUX
)$(CONFIG_SECCOMP
)$(CONFIG_LIBCAP_NG
),yyy
)
681 virtiofsd
$(EXESUF
): $(virtiofsd-obj-y
) libvhost-user.a
$(COMMON_LDADDS
)
685 vhost-user-gpu
$(EXESUF
): $(vhost-user-gpu-obj-y
) $(libvhost-user-obj-y
) libqemuutil.a libqemustub.a
688 ifdef CONFIG_VHOST_USER_INPUT
690 vhost-user-input
$(EXESUF
): $(vhost-user-input-obj-y
) libvhost-user.a libqemuutil.a
693 # build by default, do not install
694 all: vhost-user-input
$(EXESUF
)
698 module_block.h
: $(SRC_PATH
)/scripts
/modules
/module_block.py config-host.mak
699 $(call quiet-command
,$(PYTHON
) $< $@ \
700 $(addprefix $(SRC_PATH
)/,$(patsubst %.mo
,%.c
,$(block-obj-m
))), \
704 .PHONY
: clean-coverage
706 $(call quiet-command
, \
707 find . \
( -name
'*.gcda' -o
-name
'*.gcov' \
) -type f
-exec
rm {} +, \
708 "CLEAN", "coverage files")
712 # avoid old build problems by removing potentially incorrect old files
713 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
714 rm -f qemu-options.def
716 find . \
( -name
'*.so' -o
-name
'*.dll' -o
-name
'*.mo' -o
-name
'*.[oda]' \
) -type f \
717 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-aarch64.a \
718 ! -path .
/roms
/edk2
/ArmPkg
/Library
/GccLto
/liblto-arm.a \
719 ! -path .
/roms
/edk2
/BaseTools
/Source
/Python
/UPT
/Dll
/sqlite3.dll \
721 rm -f
$(edk2-decompressed
)
722 rm -f
$(filter-out %.tlb
,$(TOOLS
)) $(HELPERS-y
) TAGS cscope.
* *.pod
*~
*/*~
723 rm -f fsdev
/*.pod scsi
/*.pod
724 rm -f qemu-img-cmds.h
725 rm -f ui
/shader
/*-vert.h ui
/shader
/*-frag.h
726 @
# May not be present in generated-files-y
727 rm -f trace
/generated-tracers-dtrace.dtrace
*
728 rm -f trace
/generated-tracers-dtrace.h
*
729 rm -f
$(foreach f
,$(generated-files-y
),$(f
) $(f
)-timestamp
)
730 rm -f qapi-gen-timestamp
731 rm -rf qga
/qapi-generated
732 rm -f config-all-devices.mak
734 VERSION ?
= $(shell cat VERSION
)
736 dist: qemu-
$(VERSION
).
tar.bz2
739 $(SRC_PATH
)/scripts
/make-release
"$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
741 define clean-manual
=
742 rm -rf
$(MANUAL_BUILDDIR
)/$1/_static
743 rm -f
$(MANUAL_BUILDDIR
)/$1/objects.inv
$(MANUAL_BUILDDIR
)/$1/searchindex.js
$(MANUAL_BUILDDIR
)/$1/*.html
747 rm -f config-host.mak config-host.h
* config-host.
ld $(DOCS
) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi qemu-monitor-info.texi
748 rm -f tests
/tcg
/config-
*.mak
749 rm -f config-all-devices.mak config-all-disas.mak config.status
750 rm -f
$(SUBDIR_DEVICES_MAK
)
751 rm -f po
/*.mo tests
/qemu-iotests
/common.env
752 rm -f roms
/seabios
/config.mak roms
/vgabios
/config.mak
753 rm -f qemu-doc.
info qemu-doc.aux qemu-doc.cp qemu-doc.cps
754 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.
info qemu-doc.ky qemu-doc.kys
755 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
756 rm -f qemu-doc.vr qemu-doc.txt
757 rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
759 rm -f linux-headers
/asm
760 rm -f docs
/version.texi
761 rm -f docs
/interop
/qemu-ga-qapi.texi docs
/interop
/qemu-qmp-qapi.texi
762 rm -f docs
/interop
/qemu-qmp-ref
.7 docs
/interop
/qemu-ga-ref
.7
763 rm -f docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
764 rm -f docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
765 rm -f docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html
766 rm -f docs
/qemu-cpu-models
.7
768 $(call clean-manual
,devel
)
769 $(call clean-manual
,interop
)
770 $(call clean-manual
,specs
)
771 $(call clean-manual
,system
)
772 for d in
$(TARGET_DIRS
); do \
773 rm -rf
$$d || exit
1 ; \
776 if
test -f dtc
/version_gen.h
; then
$(MAKE
) $(DTC_MAKE_ARGS
) clean; fi
778 KEYMAPS
=da en-gb et fr fr-ch is lt no pt-br sv \
779 ar de en-us fi fr-be hr it lv nl pl ru th \
780 de-ch es fo fr-ca hu ja mk pt sl tr \
784 BLOBS
=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
785 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
786 vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
787 openbios-sparc32 openbios-sparc64 openbios-ppc QEMU
,tcx.bin QEMU
,cgthree.bin \
788 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
789 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
790 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
791 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
792 efi-e1000e.rom efi-vmxnet3.rom \
794 bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
795 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
796 s390-ccw.img s390-netboot.img \
797 slof.bin skiboot.lid \
799 u-boot.e500 u-boot-sam460-20100605.bin \
803 opensbi-riscv32-virt-fw_jump.bin \
804 opensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
807 DESCS
=50-edk2-i386-secure.json
50-edk2-x86_64-secure.json \
808 60-edk2-aarch64.json
60-edk2-arm.json
60-edk2-i386.json
60-edk2-x86_64.json
814 # Note that we manually filter-out the non-Sphinx documentation which
815 # is currently built into the docs/interop directory in the build tree,
816 # and also any sphinx-built manpages.
817 define install-manual
=
818 for d in
$$(cd
$(MANUAL_BUILDDIR
) && find
$1 -type d
); do
$(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)/$$d"; done
819 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
822 # Note that we deliberately do not install the "devel" manual: it is
823 # for QEMU developers, and not interesting to our users.
824 .PHONY
: install-sphinxdocs
825 install-sphinxdocs
: sphinxdocs
826 $(call install-manual
,interop
)
827 $(call install-manual
,specs
)
828 $(call install-manual
,system
)
830 install-doc
: $(DOCS
) install-sphinxdocs
831 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)"
832 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/index.html
"$(DESTDIR)$(qemu_docdir)"
833 $(INSTALL_DATA
) qemu-doc.html
"$(DESTDIR)$(qemu_docdir)"
834 $(INSTALL_DATA
) qemu-doc.txt
"$(DESTDIR)$(qemu_docdir)"
835 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.html
"$(DESTDIR)$(qemu_docdir)"
836 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.txt
"$(DESTDIR)$(qemu_docdir)"
838 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
839 $(INSTALL_DATA
) qemu
.1 "$(DESTDIR)$(mandir)/man1"
840 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man7"
841 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref
.7 "$(DESTDIR)$(mandir)/man7"
842 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/system
/qemu-block-drivers
.7 "$(DESTDIR)$(mandir)/man7"
843 $(INSTALL_DATA
) docs
/qemu-cpu-models
.7 "$(DESTDIR)$(mandir)/man7"
844 ifeq ($(CONFIG_TOOLS
),y
)
845 $(INSTALL_DATA
) qemu-img
.1 "$(DESTDIR)$(mandir)/man1"
846 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man8"
847 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/interop
/qemu-nbd
.8 "$(DESTDIR)$(mandir)/man8"
849 ifdef CONFIG_TRACE_SYSTEMTAP
850 $(INSTALL_DATA
) scripts
/qemu-trace-stap
.1 "$(DESTDIR)$(mandir)/man1"
852 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
853 $(INSTALL_DATA
) $(MANUAL_BUILDDIR
)/interop
/qemu-ga
.8 "$(DESTDIR)$(mandir)/man8"
854 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.html
"$(DESTDIR)$(qemu_docdir)"
855 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.txt
"$(DESTDIR)$(qemu_docdir)"
856 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref
.7 "$(DESTDIR)$(mandir)/man7"
860 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
861 $(INSTALL_DATA
) fsdev
/virtfs-proxy-helper
.1 "$(DESTDIR)$(mandir)/man1"
865 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)"
867 install-localstatedir
:
869 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
870 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_localstatedir)"/run
874 ICON_SIZES
=16x16
24x24
32x32
48x48
64x64
128x128
256x256
512x512
877 $(INSTALL_DIR
) "$(DESTDIR)$(includedir)"
879 install: all $(if
$(BUILD_DOCS
),install-doc
) \
880 install-datadir install-localstatedir install-includedir \
881 $(if
$(INSTALL_BLOBS
),$(edk2-decompressed
)) \
884 $(call install-prog
,$(TOOLS
),$(DESTDIR
)$(bindir))
886 ifneq ($(CONFIG_MODULES
),)
887 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_moddir)"
888 for s in
$(modules-m
:.mo
=$(DSOSUF
)); do \
889 t
="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
890 $(INSTALL_LIB
) $$s "$$t"; \
891 test -z
"$(STRIP)" ||
$(STRIP
) "$$t"; \
894 ifneq ($(HELPERS-y
),)
895 $(call install-prog
,$(HELPERS-y
),$(DESTDIR
)$(libexecdir
))
897 ifneq ($(vhost-user-json-y
),)
898 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/vhost-user/"
899 for x in
$(vhost-user-json-y
); do \
900 $(INSTALL_DATA
) $$x "$(DESTDIR)$(qemu_datadir)/vhost-user/"; \
903 ifdef CONFIG_TRACE_SYSTEMTAP
904 $(INSTALL_PROG
) "scripts/qemu-trace-stap" $(DESTDIR
)$(bindir)
907 set
-e
; for x in
$(BLOBS
); do \
908 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/$$x "$(DESTDIR)$(qemu_datadir)"; \
912 set
-e
; for x in
$(edk2-decompressed
); do \
913 $(INSTALL_DATA
) $$x "$(DESTDIR)$(qemu_datadir)"; \
917 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/firmware"
918 set
-e
; tmpf
=$$(mktemp
); trap
'rm -f -- "$$tmpf"' EXIT
; \
919 for x in
$(DESCS
); do \
920 sed
-e
's,@DATADIR@,$(qemu_datadir),' \
921 "$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
922 $(INSTALL_DATA
) "$$tmpf" \
923 "$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
926 for s in
$(ICON_SIZES
); do \
927 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
928 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_
$${s}.png \
929 "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
931 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
932 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu_32x32.bmp \
933 "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
934 mkdir
-p
"$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
935 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/icons
/qemu.svg \
936 "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
937 mkdir
-p
"$(DESTDIR)$(qemu_desktopdir)"
938 $(INSTALL_DATA
) $(SRC_PATH
)/ui
/qemu.desktop \
939 "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
943 ifeq ($(CONFIG_PLUGIN
),y
)
944 $(INSTALL_DATA
) $(SRC_PATH
)/include/qemu
/qemu-plugin.h
"$(DESTDIR)$(includedir)/qemu-plugin.h"
946 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/keymaps"
947 set
-e
; for x in
$(KEYMAPS
); do \
948 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/keymaps
/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
950 $(INSTALL_DATA
) $(BUILD_DIR
)/trace-events-all
"$(DESTDIR)$(qemu_datadir)/trace-events-all"
955 find
"$(SRC_PATH)" -name
'*.[hc]' -exec ctags
--append
{} +
960 find
"$(SRC_PATH)" -name
'*.[hc]' -exec etags
--append
{} +
963 rm -f
"$(SRC_PATH)"/cscope.
*
964 find
"$(SRC_PATH)/" -name
"*.[chsS]" -print | sed
's,^\./,,' > "$(SRC_PATH)/cscope.files"
965 cscope
-b
-i
"$(SRC_PATH)/cscope.files"
967 # opengl shader programs
968 ui
/shader
/%-vert.h
: $(SRC_PATH
)/ui
/shader
/%.vert
$(SRC_PATH
)/scripts
/shaderinclude.pl
970 $(call quiet-command
,\
971 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
974 ui
/shader
/%-frag.h
: $(SRC_PATH
)/ui
/shader
/%.frag
$(SRC_PATH
)/scripts
/shaderinclude.pl
976 $(call quiet-command
,\
977 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
980 ui
/shader.o
: $(SRC_PATH
)/ui
/shader.c \
981 ui
/shader
/texture-blit-vert.h \
982 ui
/shader
/texture-blit-flip-vert.h \
983 ui
/shader
/texture-blit-frag.h
987 MAKEINFOINCLUDES
= -I docs
-I
$(<D
) -I
$(@D
)
988 MAKEINFOFLAGS
=--no-split
--number-sections
$(MAKEINFOINCLUDES
)
989 TEXI2PODFLAGS
=$(MAKEINFOINCLUDES
) -DVERSION
="$(VERSION)" -DCONFDIR
="$(qemu_confdir)"
990 TEXI2PDFFLAGS
=$(if
$(V
),,--quiet
) -I
$(SRC_PATH
) $(MAKEINFOINCLUDES
)
992 docs
/version.texi
: $(SRC_PATH
)/VERSION config-host.mak
993 $(call quiet-command
,(\
994 echo
"@set VERSION $(VERSION)" && \
995 echo
"@set CONFDIR $(qemu_confdir)" \
998 %.html
: %.texi docs
/version.texi
999 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
1000 --html
$< -o
$@
,"GEN","$@")
1002 %.
info: %.texi docs
/version.texi
1003 $(call quiet-command
,$(MAKEINFO
) $(MAKEINFOFLAGS
) $< -o
$@
,"GEN","$@")
1005 %.txt
: %.texi docs
/version.texi
1006 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
1007 --plaintext
$< -o
$@
,"GEN","$@")
1009 %.pdf
: %.texi docs
/version.texi
1010 $(call quiet-command
,texi2pdf
$(TEXI2PDFFLAGS
) $< -o
$@
,"GEN","$@")
1012 # Sphinx builds all its documentation at once in one invocation
1013 # and handles "don't rebuild things unless necessary" itself.
1014 # The '.doctrees' files are cached information to speed this up.
1016 sphinxdocs
: $(MANUAL_BUILDDIR
)/devel
/index.html \
1017 $(MANUAL_BUILDDIR
)/interop
/index.html \
1018 $(MANUAL_BUILDDIR
)/specs
/index.html \
1019 $(MANUAL_BUILDDIR
)/system
/index.html
1021 # Canned command to build a single manual
1022 # Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
1023 # Note the use of different doctree for each (manual, builder) tuple;
1024 # this works around Sphinx not handling parallel invocation on
1025 # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
1026 build-manual
= $(call quiet-command
,CONFDIR
="$(qemu_confdir)" sphinx-build
$(if
$(V
),,-q
) -W
-b
$2 -D version
=$(VERSION
) -D release
="$(FULL_VERSION)" -d .doctrees
/$1-$2 $(SRC_PATH
)/docs
/$1 $(MANUAL_BUILDDIR
)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
1027 # We assume all RST files in the manual's directory are used in it
1028 manual-deps
= $(wildcard $(SRC_PATH
)/docs
/$1/*.rst
) \
1029 $(wildcard $(SRC_PATH
)/docs
/$1/*.rst.inc
) \
1030 $(SRC_PATH
)/docs
/$1/conf.py
$(SRC_PATH
)/docs
/conf.py
1031 # Macro to write out the rule and dependencies for building manpages
1032 # Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps])
1033 # 'extradeps' is optional, and specifies extra files (eg .hx files) that
1034 # the manual page depends on.
1035 define define-manpage-rule
1036 $(call atomic
,$(foreach manpage
,$2,$(MANUAL_BUILDDIR
)/$1/$(manpage
)),$(call manual-deps
,$1) $3)
1037 $(call build-manual
,$1,man
)
1040 $(MANUAL_BUILDDIR
)/devel
/index.html
: $(call manual-deps
,devel
)
1041 $(call build-manual
,devel
,html
)
1043 $(MANUAL_BUILDDIR
)/interop
/index.html
: $(call manual-deps
,interop
)
1044 $(call build-manual
,interop
,html
)
1046 $(MANUAL_BUILDDIR
)/specs
/index.html
: $(call manual-deps
,specs
)
1047 $(call build-manual
,specs
,html
)
1049 $(MANUAL_BUILDDIR
)/system
/index.html
: $(call manual-deps
,system
)
1050 $(call build-manual
,system
,html
)
1052 $(call define-manpage-rule
,interop
,qemu-ga
.8 qemu-nbd
.8)
1054 $(call define-manpage-rule
,system
,qemu-block-drivers
.7)
1056 $(MANUAL_BUILDDIR
)/index.html
: $(SRC_PATH
)/docs
/index.html.in qemu-version.h
1057 @mkdir
-p
"$(MANUAL_BUILDDIR)"
1058 $(call quiet-command
, sed
"s|@@VERSION@@|${VERSION}|g" $< >$@
, \
1061 qemu-options.texi
: $(SRC_PATH
)/qemu-options.hx
$(SRC_PATH
)/scripts
/hxtool
1062 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
1064 qemu-monitor.texi
: $(SRC_PATH
)/hmp-commands.hx
$(SRC_PATH
)/scripts
/hxtool
1065 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
1067 qemu-monitor-info.texi
: $(SRC_PATH
)/hmp-commands-info.hx
$(SRC_PATH
)/scripts
/hxtool
1068 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
1070 qemu-img-cmds.texi
: $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/scripts
/hxtool
1071 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
1073 docs
/interop
/qemu-qmp-qapi.texi
: qapi
/qapi-doc.texi
1076 docs
/interop
/qemu-ga-qapi.texi
: qga
/qapi-generated
/qga-qapi-doc.texi
1079 qemu
.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
1080 qemu
.1: qemu-option-trace.texi
1081 qemu-img
.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
1082 fsdev
/virtfs-proxy-helper
.1: fsdev
/virtfs-proxy-helper.texi
1083 docs
/qemu-cpu-models
.7: docs
/qemu-cpu-models.texi
1084 scripts
/qemu-trace-stap
.1: scripts
/qemu-trace-stap.texi
1086 html
: qemu-doc.html docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html sphinxdocs
1087 info: qemu-doc.
info docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-ga-ref.
info
1088 pdf
: qemu-doc.pdf docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
1089 txt
: qemu-doc.txt docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
1091 qemu-doc.html qemu-doc.
info qemu-doc.pdf qemu-doc.txt
: \
1092 qemu-img.texi qemu-options.texi \
1093 qemu-tech.texi qemu-option-trace.texi \
1094 qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi \
1095 qemu-monitor-info.texi \
1096 docs
/qemu-cpu-models.texi docs
/security.texi
1098 docs
/interop
/qemu-ga-ref.
dvi docs
/interop
/qemu-ga-ref.html \
1099 docs
/interop
/qemu-ga-ref.
info docs
/interop
/qemu-ga-ref.pdf \
1100 docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7: \
1101 docs
/interop
/qemu-ga-ref.texi docs
/interop
/qemu-ga-qapi.texi
1103 docs
/interop
/qemu-qmp-ref.
dvi docs
/interop
/qemu-qmp-ref.html \
1104 docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-qmp-ref.pdf \
1105 docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7: \
1106 docs
/interop
/qemu-qmp-ref.texi docs
/interop
/qemu-qmp-qapi.texi
1108 $(filter %.1 %.7 %.8,$(DOCS
)): scripts
/texi2pod.pl
1112 %/coverage-report.html
:
1114 $(call quiet-command
,\
1115 gcovr
-r
$(SRC_PATH
) \
1116 $(foreach t
, $(TARGET_DIRS
), --object-directory
$(BUILD_DIR
)/$(t
)) \
1117 --object-directory
$(BUILD_DIR
) \
1118 -p
--html
--html-details
-o
$@
, \
1119 "GEN", "coverage-report.html")
1121 .PHONY
: coverage-report
1122 coverage-report
: $(CURDIR
)/reports
/coverage
/coverage-report.html
1126 INSTALLER
= qemu-setup-
$(VERSION
)$(EXESUF
)
1128 nsisflags
= -V2
-NOCD
1130 ifneq ($(wildcard $(SRC_PATH
)/dll
),)
1131 ifeq ($(ARCH
),x86_64
)
1132 # 64 bit executables
1133 DLL_PATH
= $(SRC_PATH
)/dll
/w64
1136 # 32 bit executables
1137 DLL_PATH
= $(SRC_PATH
)/dll
/w32
1142 installer
: $(INSTALLER
)
1144 INSTDIR
=/tmp
/qemu-nsis
1146 $(INSTALLER
): install-doc
$(SRC_PATH
)/qemu.nsi
1147 $(MAKE
) install prefix=${INSTDIR}
1150 for i in
*.exe
; do \
1151 $(SIGNCODE
) $${i}; \
1156 for i in qemu-system-
*.exe
; do \
1158 arch
=$${arch
#qemu-system-}; \
1159 echo Section
\"$$arch\" Section_
$$arch; \
1160 echo SetOutPath
\"\
$$INSTDIR\"; \
1161 echo File
\"\
$${BINDIR}\\$$i\"; \
1164 ) >${INSTDIR}/system-emulations.nsh
1165 makensis
$(nsisflags
) \
1166 $(if
$(BUILD_DOCS
),-DCONFIG_DOCUMENTATION
="y") \
1167 $(if
$(CONFIG_GTK
),-DCONFIG_GTK
="y") \
1168 -DBINDIR
="${INSTDIR}" \
1169 $(if
$(DLL_PATH
),-DDLLDIR
="$(DLL_PATH)") \
1170 -DSRCDIR
="$(SRC_PATH)" \
1171 -DOUTFILE
="$(INSTALLER)" \
1172 -DDISPLAYVERSION
="$(VERSION)" \
1173 $(SRC_PATH
)/qemu.nsi
1176 $(SIGNCODE
) $(INSTALLER
)
1180 # Add a dependency on the generated files, so that they are always
1181 # rebuilt before other object files
1182 ifneq ($(wildcard config-host.mak
),)
1183 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
1184 Makefile
: $(generated-files-y
)
1188 .SECONDARY
: $(TRACE_HEADERS
) $(TRACE_HEADERS
:%=%-timestamp
) \
1189 $(TRACE_SOURCES
) $(TRACE_SOURCES
:%=%-timestamp
) \
1190 $(TRACE_DTRACE
) $(TRACE_DTRACE
:%=%-timestamp
)
1192 # Include automatically generated dependency files
1193 # Dependencies in Makefile.objs files come from our recursive subdir rules
1194 -include $(wildcard *.d tests
/*.d
)
1196 include $(SRC_PATH
)/tests
/docker
/Makefile.
include
1197 include $(SRC_PATH
)/tests
/vm
/Makefile.
include
1201 @echo
'Generic targets:'
1202 @echo
' all - Build all'
1203 ifdef CONFIG_MODULES
1204 @echo
' modules - Build all modules'
1206 @echo
' dir/file.o - Build specified target only'
1207 @echo
' install - Install QEMU, documentation and tools'
1208 @echo
' ctags/TAGS - Generate tags file for editors'
1209 @echo
' cscope - Generate cscope index'
1211 @
$(if
$(TARGET_DIRS
), \
1212 echo
'Architecture specific targets:'; \
1213 $(foreach t
, $(TARGET_DIRS
), \
1214 printf
" %-30s - Build for %s\\n" $(t
)/all $(t
);) \
1216 @echo
'Cleaning targets:'
1217 @echo
' clean - Remove most generated files but keep the config'
1219 @echo
' clean-coverage - Remove coverage files'
1221 @echo
' distclean - Remove all generated files'
1222 @echo
' dist - Build a distributable tarball'
1224 @echo
'Test targets:'
1225 @echo
' check - Run all tests (check-help for details)'
1226 @echo
' docker - Help about targets running tests inside containers'
1227 @echo
' vm-help - Help about targets running tests inside VM'
1229 @echo
'Documentation targets:'
1230 @echo
' html info pdf txt'
1231 @echo
' - Build documentation in specified format'
1233 @echo
' coverage-report - Create code coverage report'
1237 @echo
'Windows targets:'
1238 @echo
' installer - Build NSIS-based installer for QEMU'
1239 ifdef QEMU_GA_MSI_ENABLED
1240 @echo
' msi - Build MSI-based installer for qemu-ga'
1244 @echo
' $(MAKE) [targets] (quiet build, default)'
1245 @echo
' $(MAKE) V=1 [targets] (verbose build)'