3 # Always point to the root of the build tree (needs GNU make).
6 # Before including a proper config-host.mak, assume we are in the source tree
9 UNCHECKED_GOALS
:= %clean TAGS cscope ctags docker docker-
%
11 # All following code might depend on configuration variables
12 ifneq ($(wildcard config-host.mak
),)
13 # Put the all: rule here so that config-host.mak can contain dependencies.
15 include config-host.mak
19 .PHONY
: git-submodule-update
22 git_module_status
:= $(shell \
24 .
/scripts
/git-submodule.sh status
$(GIT_SUBMODULES
); \
28 ifeq (1,$(git_module_status
))
30 $(call quiet-command
, \
31 (cd
$(SRC_PATH
) && .
/scripts
/git-submodule.sh update
$(GIT_SUBMODULES
)), \
32 "GIT","$(GIT_SUBMODULES)")
36 .git-submodule-status
: git-submodule-update config-host.mak
38 # Check that we're not trying to do an out-of-tree build from
39 # a tree that's been used for an in-tree build.
40 ifneq ($(realpath
$(SRC_PATH
)),$(realpath .
))
41 ifneq ($(wildcard $(SRC_PATH
)/config-host.mak
),)
42 $(error This is an out of tree build but your source tree
($(SRC_PATH
)) \
43 seems to have been used for an in-tree build. You can fix this by running \
44 "make distclean && rm -rf *-linux-user *-softmmu" in your source tree
)
48 CONFIG_SOFTMMU
:= $(if
$(filter %-softmmu
,$(TARGET_DIRS
)),y
)
49 CONFIG_USER_ONLY
:= $(if
$(filter %-user
,$(TARGET_DIRS
)),y
)
50 CONFIG_XEN
:= $(CONFIG_XEN_BACKEND
)
52 -include config-all-devices.mak
53 -include config-all-disas.mak
55 config-host.mak
: $(SRC_PATH
)/configure
$(SRC_PATH
)/pc-bios
56 @echo
$@ is out-of-date
, running configure
57 @
# TODO: The next lines include code which supports a smooth
58 @
# transition from old configurations without config.status.
59 @
# This code can be removed after QEMU 1.7.
60 @if
test -x config.status
; then \
63 sed
-n
"/.*Configured with/s/[^:]*: //p" $@ | sh
; \
67 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
68 @echo
"Please call configure before running make!"
73 include $(SRC_PATH
)/rules.mak
75 GENERATED_FILES
= qemu-version.h config-host.h qemu-options.def
76 GENERATED_FILES
+= qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h
77 GENERATED_FILES
+= qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
78 GENERATED_FILES
+= qmp-introspect.h
79 GENERATED_FILES
+= qmp-introspect.c
81 GENERATED_FILES
+= trace
/generated-tcg-tracers.h
83 GENERATED_FILES
+= trace
/generated-helpers-wrappers.h
84 GENERATED_FILES
+= trace
/generated-helpers.h
85 GENERATED_FILES
+= trace
/generated-helpers.c
87 ifdef CONFIG_TRACE_UST
88 GENERATED_FILES
+= trace-ust-all.h
89 GENERATED_FILES
+= trace-ust-all.c
92 GENERATED_FILES
+= module_block.h
94 TRACE_HEADERS
= trace-root.h
$(trace-events-subdirs
:%=%/trace.h
)
95 TRACE_SOURCES
= trace-root.c
$(trace-events-subdirs
:%=%/trace.c
)
97 ifdef CONFIG_TRACE_DTRACE
98 TRACE_HEADERS
+= trace-dtrace-root.h
$(trace-events-subdirs
:%=%/trace-dtrace.h
)
99 TRACE_DTRACE
+= trace-dtrace-root.dtrace
$(trace-events-subdirs
:%=%/trace-dtrace.dtrace
)
101 ifdef CONFIG_TRACE_UST
102 TRACE_HEADERS
+= trace-ust-root.h
$(trace-events-subdirs
:%=%/trace-ust.h
)
105 GENERATED_FILES
+= $(TRACE_HEADERS
)
106 GENERATED_FILES
+= $(TRACE_SOURCES
)
107 GENERATED_FILES
+= $(BUILD_DIR
)/trace-events-all
108 GENERATED_FILES
+= .git-submodule-status
110 trace-group-name
= $(shell dirname
$1 | sed
-e
's/[^a-zA-Z0-9]/_/g')
112 tracetool-y
= $(SRC_PATH
)/scripts
/tracetool.py
113 tracetool-y
+= $(shell find
$(SRC_PATH
)/scripts
/tracetool
-name
"*.py")
115 %/trace.h
: %/trace.h-timestamp
116 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
117 %/trace.h-timestamp
: $(SRC_PATH
)/%/trace-events
$(tracetool-y
)
118 $(call quiet-command
,$(TRACETOOL
) \
119 --group
=$(call trace-group-name
,$@
) \
121 --backends
=$(TRACE_BACKENDS
) \
122 $< > $@
,"GEN","$(@:%-timestamp=%)")
124 %/trace.c
: %/trace.c-timestamp
125 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
126 %/trace.c-timestamp
: $(SRC_PATH
)/%/trace-events
$(tracetool-y
)
127 $(call quiet-command
,$(TRACETOOL
) \
128 --group
=$(call trace-group-name
,$@
) \
130 --backends
=$(TRACE_BACKENDS
) \
131 $< > $@
,"GEN","$(@:%-timestamp=%)")
133 %/trace-ust.h
: %/trace-ust.h-timestamp
134 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
135 %/trace-ust.h-timestamp
: $(SRC_PATH
)/%/trace-events
$(tracetool-y
)
136 $(call quiet-command
,$(TRACETOOL
) \
137 --group
=$(call trace-group-name
,$@
) \
138 --format
=ust-events-h \
139 --backends
=$(TRACE_BACKENDS
) \
140 $< > $@
,"GEN","$(@:%-timestamp=%)")
142 %/trace-dtrace.dtrace
: %/trace-dtrace.dtrace-timestamp
143 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
144 %/trace-dtrace.dtrace-timestamp
: $(SRC_PATH
)/%/trace-events
$(BUILD_DIR
)/config-host.mak
$(tracetool-y
)
145 $(call quiet-command
,$(TRACETOOL
) \
146 --group
=$(call trace-group-name
,$@
) \
148 --backends
=$(TRACE_BACKENDS
) \
149 $< > $@
,"GEN","$(@:%-timestamp=%)")
151 %/trace-dtrace.h
: %/trace-dtrace.dtrace
$(tracetool-y
)
152 $(call quiet-command
,dtrace
-o
$@
-h
-s
$<, "GEN","$@")
154 %/trace-dtrace.o
: %/trace-dtrace.dtrace
$(tracetool-y
)
157 trace-root.h
: trace-root.h-timestamp
158 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
159 trace-root.h-timestamp
: $(SRC_PATH
)/trace-events
$(tracetool-y
)
160 $(call quiet-command
,$(TRACETOOL
) \
163 --backends
=$(TRACE_BACKENDS
) \
164 $< > $@
,"GEN","$(@:%-timestamp=%)")
166 trace-root.c
: trace-root.c-timestamp
167 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
168 trace-root.c-timestamp
: $(SRC_PATH
)/trace-events
$(tracetool-y
)
169 $(call quiet-command
,$(TRACETOOL
) \
172 --backends
=$(TRACE_BACKENDS
) \
173 $< > $@
,"GEN","$(@:%-timestamp=%)")
175 trace-ust-root.h
: trace-ust-root.h-timestamp
176 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
177 trace-ust-root.h-timestamp
: $(SRC_PATH
)/trace-events
$(tracetool-y
)
178 $(call quiet-command
,$(TRACETOOL
) \
180 --format
=ust-events-h \
181 --backends
=$(TRACE_BACKENDS
) \
182 $< > $@
,"GEN","$(@:%-timestamp=%)")
184 trace-ust-all.h
: trace-ust-all.h-timestamp
185 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
186 trace-ust-all.h-timestamp
: $(trace-events-files
) $(tracetool-y
)
187 $(call quiet-command
,$(TRACETOOL
) \
189 --format
=ust-events-h \
190 --backends
=$(TRACE_BACKENDS
) \
191 $(trace-events-files
) > $@
,"GEN","$(@:%-timestamp=%)")
193 trace-ust-all.c
: trace-ust-all.c-timestamp
194 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
195 trace-ust-all.c-timestamp
: $(trace-events-files
) $(tracetool-y
)
196 $(call quiet-command
,$(TRACETOOL
) \
198 --format
=ust-events-c \
199 --backends
=$(TRACE_BACKENDS
) \
200 $(trace-events-files
) > $@
,"GEN","$(@:%-timestamp=%)")
202 trace-dtrace-root.dtrace
: trace-dtrace-root.dtrace-timestamp
203 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
204 trace-dtrace-root.dtrace-timestamp
: $(SRC_PATH
)/trace-events
$(BUILD_DIR
)/config-host.mak
$(tracetool-y
)
205 $(call quiet-command
,$(TRACETOOL
) \
208 --backends
=$(TRACE_BACKENDS
) \
209 $< > $@
,"GEN","$(@:%-timestamp=%)")
211 trace-dtrace-root.h
: trace-dtrace-root.dtrace
212 $(call quiet-command
,dtrace
-o
$@
-h
-s
$<, "GEN","$@")
214 trace-dtrace-root.o
: trace-dtrace-root.dtrace
216 KEYCODEMAP_GEN
= $(SRC_PATH
)/ui
/keycodemapdb
/tools
/keymap-gen
217 KEYCODEMAP_CSV
= $(SRC_PATH
)/ui
/keycodemapdb
/data
/keymaps.csv
220 ui
/input-keymap-linux-to-qcode.c \
221 ui
/input-keymap-qcode-to-qnum.c \
222 ui
/input-keymap-qnum-to-qcode.c \
225 GENERATED_FILES
+= $(KEYCODEMAP_FILES
)
227 ui
/input-keymap-
%.c
: $(KEYCODEMAP_GEN
) $(KEYCODEMAP_CSV
) $(SRC_PATH
)/ui
/Makefile.objs
228 $(call quiet-command
,\
229 src
=$$(echo
$@ | sed
-E
-e
"s,^ui/input-keymap-(.+)-to-(.+)\.c$$,\1,") && \
230 dst
=$$(echo
$@ | sed
-E
-e
"s,^ui/input-keymap-(.+)-to-(.+)\.c$$,\2,") && \
231 test -e
$(KEYCODEMAP_GEN
) && \
232 $(PYTHON
) $(KEYCODEMAP_GEN
) \
234 --varname qemu_input_map_
$${src}_to_
$${dst} \
235 code-map
$(KEYCODEMAP_CSV
) $${src} $${dst} \
236 > $@ ||
rm -f
$@
, "GEN", "$@")
238 $(KEYCODEMAP_GEN
): .git-submodule-status
239 $(KEYCODEMAP_CSV
): .git-submodule-status
241 # Don't try to regenerate Makefile or configure
242 # We don't generate any of them
246 .PHONY
: all clean cscope
distclean html
info install install-doc \
247 pdf txt recurse-all speed
test dist msi FORCE
249 $(call set-vpath
, $(SRC_PATH
))
251 LIBS
+=-lz
$(LIBS_TOOLS
)
253 HELPERS-
$(CONFIG_LINUX
) = qemu-bridge-helper
$(EXESUF
)
256 DOCS
=qemu-doc.html qemu-doc.txt qemu
.1 qemu-img
.1 qemu-nbd
.8 qemu-ga
.8
257 DOCS
+=docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7
258 DOCS
+=docs
/interop
/qemu-ga-ref.html docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7
259 DOCS
+=docs
/qemu-block-drivers
.7
261 DOCS
+=fsdev
/virtfs-proxy-helper
.1
267 SUBDIR_MAKEFLAGS
=$(if
$(V
),,--no-print-directory
) BUILD_DIR
=$(BUILD_DIR
)
268 SUBDIR_DEVICES_MAK
=$(patsubst %, %/config-devices.mak
, $(TARGET_DIRS
))
269 SUBDIR_DEVICES_MAK_DEP
=$(patsubst %, %-config-devices.mak.d
, $(TARGET_DIRS
))
271 ifeq ($(SUBDIR_DEVICES_MAK
),)
272 config-all-devices.mak
:
273 $(call quiet-command
,echo
'# no devices' > $@
,"GEN","$@")
275 config-all-devices.mak
: $(SUBDIR_DEVICES_MAK
)
276 $(call quiet-command
, sed
-n \
277 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
278 $(SUBDIR_DEVICES_MAK
) |
sort -u
> $@
, \
282 -include $(SUBDIR_DEVICES_MAK_DEP
)
284 %/config-devices.mak
: default-configs
/%.mak
$(SRC_PATH
)/scripts
/make_device_config.sh
285 $(call quiet-command
, \
286 $(SHELL
) $(SRC_PATH
)/scripts
/make_device_config.sh
$< $*-config-devices.mak.d
$@
> $@.tmp
,"GEN","$@.tmp")
287 $(call quiet-command
, if
test -f
$@
; then \
288 if cmp
-s
$@.old
$@
; then \
292 if
test -f
$@.old
; then \
293 echo
"WARNING: $@ (user modified) out of date.";\
295 echo
"WARNING: $@ out of date.";\
297 echo
"Run \"make defconfig\" to regenerate."; \
306 rm -f config-all-devices.mak
$(SUBDIR_DEVICES_MAK
)
308 ifneq ($(wildcard config-host.mak
),)
309 include $(SRC_PATH
)/Makefile.objs
312 dummy
:= $(call unnest-vars
,, \
317 ivshmem-client-obj-y \
318 ivshmem-server-obj-y \
319 libvhost-user-obj-y \
320 vhost-user-scsi-obj-y \
332 include $(SRC_PATH
)/tests
/Makefile.
include
334 all: $(DOCS
) $(TOOLS
) $(HELPERS-y
) recurse-all modules
336 qemu-version.h
: FORCE
337 $(call quiet-command
, \
339 printf
'#define QEMU_PKGVERSION '; \
340 if
test -n
"$(PKGVERSION)"; then \
341 printf
'"$(PKGVERSION)"\n'; \
343 if
test -d .git
; then \
345 git describe
--match
'v*' 2>/dev
/null | tr
-d
'\n'; \
346 if
! git diff-index
--quiet HEAD
&>/dev
/null
; then \
347 printf
-- '-dirty'; \
354 $(call quiet-command
, if
! cmp
-s
$@
$@.tmp
; then \
360 config-host.h
: config-host.h-timestamp
361 config-host.h-timestamp
: config-host.mak
362 qemu-options.def
: $(SRC_PATH
)/qemu-options.hx
$(SRC_PATH
)/scripts
/hxtool
363 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
365 SUBDIR_RULES
=$(patsubst %,subdir-
%, $(TARGET_DIRS
))
366 SOFTMMU_SUBDIR_RULES
=$(filter %-softmmu
,$(SUBDIR_RULES
))
368 $(SOFTMMU_SUBDIR_RULES
): $(block-obj-y
)
369 $(SOFTMMU_SUBDIR_RULES
): $(crypto-obj-y
)
370 $(SOFTMMU_SUBDIR_RULES
): $(io-obj-y
)
371 $(SOFTMMU_SUBDIR_RULES
): config-all-devices.mak
374 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$* V
="$(V)" TARGET_DIR
="$*/" all,)
376 DTC_MAKE_ARGS
=-I
$(SRC_PATH
)/dtc VPATH
=$(SRC_PATH
)/dtc
-C dtc V
="$(V)" LIBFDT_srcdir
=$(SRC_PATH
)/dtc
/libfdt
377 DTC_CFLAGS
=$(CFLAGS
) $(QEMU_CFLAGS
)
378 DTC_CPPFLAGS
=-I
$(BUILD_DIR
)/dtc
-I
$(SRC_PATH
)/dtc
-I
$(SRC_PATH
)/dtc
/libfdt
380 subdir-dtc
: .git-submodule-status dtc
/libfdt dtc
/tests
381 $(call quiet-command
,$(MAKE
) $(DTC_MAKE_ARGS
) CPPFLAGS
="$(DTC_CPPFLAGS)" CFLAGS
="$(DTC_CFLAGS)" LDFLAGS
="$(LDFLAGS)" ARFLAGS
="$(ARFLAGS)" CC
="$(CC)" AR
="$(AR)" LD
="$(LD)" $(SUBDIR_MAKEFLAGS
) libfdt
/libfdt.a
,)
383 dtc
/%: .git-submodule-status
386 $(SUBDIR_RULES
): libqemuutil.a
$(common-obj-y
) $(chardev-obj-y
) \
387 $(qom-obj-y
) $(crypto-aes-obj-
$(CONFIG_USER_ONLY
))
389 ROMSUBDIR_RULES
=$(patsubst %,romsubdir-
%, $(ROMS
))
390 # Only keep -O and -g cflags
392 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C pc-bios
/$* V
="$(V)" TARGET_DIR
="$*/" CFLAGS
="$(filter -O% -g%,$(CFLAGS))",)
394 ALL_SUBDIRS
=$(TARGET_DIRS
) $(patsubst %,pc-bios
/%, $(ROMS
))
396 recurse-all
: $(SUBDIR_RULES
) $(ROMSUBDIR_RULES
)
398 $(BUILD_DIR
)/version.o
: $(SRC_PATH
)/version.rc config-host.h
399 $(call quiet-command
,$(WINDRES
) -I
$(BUILD_DIR
) -o
$@
$<,"RC","version.o")
401 Makefile
: $(version-obj-y
)
403 ######################################################################
406 libqemuutil.a
: $(util-obj-y
) $(trace-obj-y
) $(stub-obj-y
)
407 libvhost-user.a
: $(libvhost-user-obj-y
)
409 ######################################################################
411 COMMON_LDADDS
= libqemuutil.a
413 qemu-img.o
: qemu-img-cmds.h
415 qemu-img
$(EXESUF
): qemu-img.o
$(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
416 qemu-nbd
$(EXESUF
): qemu-nbd.o
$(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
417 qemu-io
$(EXESUF
): qemu-io.o
$(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
419 qemu-bridge-helper
$(EXESUF
): qemu-bridge-helper.o
$(COMMON_LDADDS
)
421 qemu-keymap
$(EXESUF
): qemu-keymap.o ui
/input-keymap.o
$(COMMON_LDADDS
)
423 fsdev
/virtfs-proxy-helper
$(EXESUF
): fsdev
/virtfs-proxy-helper.o fsdev
/9p-marshal.o fsdev
/9p-iov-marshal.o
$(COMMON_LDADDS
)
424 fsdev
/virtfs-proxy-helper
$(EXESUF
): LIBS
+= -lcap
426 scsi
/qemu-pr-helper
$(EXESUF
): scsi
/qemu-pr-helper.o scsi
/utils.o
$(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
428 scsi
/qemu-pr-helper
$(EXESUF
): LIBS
+= -ludev
-lmultipath
-lmpathpersist
431 qemu-img-cmds.h
: $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/scripts
/hxtool
432 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
434 qemu-ga
$(EXESUF
): LIBS
= $(LIBS_QGA
)
435 qemu-ga
$(EXESUF
): QEMU_CFLAGS
+= -I qga
/qapi-generated
437 qemu-keymap
$(EXESUF
): LIBS
+= $(XKBCOMMON_LIBS
)
438 qemu-keymap
$(EXESUF
): QEMU_CFLAGS
+= $(XKBCOMMON_CFLAGS
)
440 gen-out-type
= $(subst .
,-,$(suffix $@
))
442 qapi-py
= $(SRC_PATH
)/scripts
/qapi.py
$(SRC_PATH
)/scripts
/ordereddict.py
444 qga
/qapi-generated
/qga-qapi-types.c qga
/qapi-generated
/qga-qapi-types.h
:\
445 $(SRC_PATH
)/qga
/qapi-schema.json
$(SRC_PATH
)/scripts
/qapi-types.py
$(qapi-py
)
446 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-types.py \
447 $(gen-out-type
) -o qga
/qapi-generated
-p
"qga-" $<, \
449 qga
/qapi-generated
/qga-qapi-visit.c qga
/qapi-generated
/qga-qapi-visit.h
:\
450 $(SRC_PATH
)/qga
/qapi-schema.json
$(SRC_PATH
)/scripts
/qapi-visit.py
$(qapi-py
)
451 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-visit.py \
452 $(gen-out-type
) -o qga
/qapi-generated
-p
"qga-" $<, \
454 qga
/qapi-generated
/qga-qmp-commands.h qga
/qapi-generated
/qga-qmp-marshal.c
:\
455 $(SRC_PATH
)/qga
/qapi-schema.json
$(SRC_PATH
)/scripts
/qapi-commands.py
$(qapi-py
)
456 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-commands.py \
457 $(gen-out-type
) -o qga
/qapi-generated
-p
"qga-" $<, \
460 qapi-modules
= $(SRC_PATH
)/qapi-schema.json
$(SRC_PATH
)/qapi
/common.json \
461 $(SRC_PATH
)/qapi
/block.json
$(SRC_PATH
)/qapi
/block-core.json \
462 $(SRC_PATH
)/qapi
/char.json \
463 $(SRC_PATH
)/qapi
/crypto.json \
464 $(SRC_PATH
)/qapi
/introspect.json \
465 $(SRC_PATH
)/qapi
/migration.json \
466 $(SRC_PATH
)/qapi
/net.json \
467 $(SRC_PATH
)/qapi
/rocker.json \
468 $(SRC_PATH
)/qapi
/run-state.json \
469 $(SRC_PATH
)/qapi
/sockets.json \
470 $(SRC_PATH
)/qapi
/tpm.json \
471 $(SRC_PATH
)/qapi
/trace.json \
472 $(SRC_PATH
)/qapi
/transaction.json \
473 $(SRC_PATH
)/qapi
/ui.json
475 qapi-types.c qapi-types.h
:\
476 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-types.py
$(qapi-py
)
477 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-types.py \
478 $(gen-out-type
) -o
"." -b
$<, \
480 qapi-visit.c qapi-visit.h
:\
481 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-visit.py
$(qapi-py
)
482 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-visit.py \
483 $(gen-out-type
) -o
"." -b
$<, \
485 qapi-event.c qapi-event.h
:\
486 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-event.py
$(qapi-py
)
487 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-event.py \
488 $(gen-out-type
) -o
"." $<, \
490 qmp-commands.h qmp-marshal.c
:\
491 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-commands.py
$(qapi-py
)
492 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-commands.py \
493 $(gen-out-type
) -o
"." $<, \
495 qmp-introspect.h qmp-introspect.c
:\
496 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-introspect.py
$(qapi-py
)
497 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-introspect.py \
498 $(gen-out-type
) -o
"." $<, \
501 QGALIB_GEN
=$(addprefix qga
/qapi-generated
/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h
)
502 $(qga-obj-y
): $(QGALIB_GEN
)
504 qemu-ga
$(EXESUF
): $(qga-obj-y
) $(COMMON_LDADDS
)
507 ifdef QEMU_GA_MSI_ENABLED
508 QEMU_GA_MSI
=qemu-ga-
$(ARCH
).msi
512 $(QEMU_GA_MSI
): qemu-ga.exe
$(QGA_VSS_PROVIDER
)
514 $(QEMU_GA_MSI
): config-host.mak
516 $(QEMU_GA_MSI
): $(SRC_PATH
)/qga
/installer
/qemu-ga.wxs
517 $(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)" \
518 wixl
-o
$@
$(QEMU_GA_MSI_ARCH
) $(QEMU_GA_MSI_WITH_VSS
) $(QEMU_GA_MSI_MINGW_DLL_PATH
) $<,"WIXL","$@")
521 @echo
"MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
526 qemu-ga
: qemu-ga
$(EXESUF
) $(QGA_VSS_PROVIDER
) $(QEMU_GA_MSI
)
530 ivshmem-client
$(EXESUF
): $(ivshmem-client-obj-y
) $(COMMON_LDADDS
)
532 ivshmem-server
$(EXESUF
): $(ivshmem-server-obj-y
) $(COMMON_LDADDS
)
535 vhost-user-scsi
$(EXESUF
): $(vhost-user-scsi-obj-y
) libvhost-user.a
538 module_block.h
: $(SRC_PATH
)/scripts
/modules
/module_block.py config-host.mak
539 $(call quiet-command
,$(PYTHON
) $< $@ \
540 $(addprefix $(SRC_PATH
)/,$(patsubst %.mo
,%.c
,$(block-obj-m
))), \
544 # avoid old build problems by removing potentially incorrect old files
545 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
546 rm -f qemu-options.def
548 find . \
( -name
'*.so' -o
-name
'*.dll' -o
-name
'*.mo' -o
-name
'*.[oda]' \
) -type f
-exec
rm {} +
549 rm -f
$(filter-out %.tlb
,$(TOOLS
)) $(HELPERS-y
) qemu-ga TAGS cscope.
* *.pod
*~
*/*~
550 rm -f fsdev
/*.pod scsi
/*.pod
551 rm -f qemu-img-cmds.h
552 rm -f ui
/shader
/*-vert.h ui
/shader
/*-frag.h
553 @
# May not be present in GENERATED_FILES
554 rm -f trace
/generated-tracers-dtrace.dtrace
*
555 rm -f trace
/generated-tracers-dtrace.h
*
556 rm -f
$(foreach f
,$(GENERATED_FILES
),$(f
) $(f
)-timestamp
)
557 rm -rf qapi-generated
558 rm -rf qga
/qapi-generated
559 for d in
$(ALL_SUBDIRS
); do \
560 if
test -d
$$d; then
$(MAKE
) -C
$$d $@ || exit
1; fi
; \
561 rm -f
$$d/qemu-options.def
; \
563 rm -f
$(SUBDIR_DEVICES_MAK
) config-all-devices.mak
565 VERSION ?
= $(shell cat VERSION
)
567 dist: qemu-
$(VERSION
).
tar.bz2
570 $(SRC_PATH
)/scripts
/make-release
"$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
573 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
574 rm -f config-all-devices.mak config-all-disas.mak config.status
575 rm -f po
/*.mo tests
/qemu-iotests
/common.env
576 rm -f roms
/seabios
/config.mak roms
/vgabios
/config.mak
577 rm -f qemu-doc.
info qemu-doc.aux qemu-doc.cp qemu-doc.cps
578 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.
info qemu-doc.ky qemu-doc.kys
579 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
580 rm -f qemu-doc.vr qemu-doc.txt
582 rm -f linux-headers
/asm
583 rm -f docs
/version.texi
584 rm -f docs
/interop
/qemu-ga-qapi.texi docs
/interop
/qemu-qmp-qapi.texi
585 rm -f docs
/interop
/qemu-qmp-ref
.7 docs
/interop
/qemu-ga-ref
.7
586 rm -f docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
587 rm -f docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
588 rm -f docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html
589 rm -f docs
/qemu-block-drivers
.7
590 for d in
$(TARGET_DIRS
); do \
591 rm -rf
$$d || exit
1 ; \
594 if
test -f dtc
/version_gen.h
; then
$(MAKE
) $(DTC_MAKE_ARGS
) clean; fi
596 KEYMAPS
=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
597 ar de en-us fi fr-be hr it lv nl pl ru th \
598 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr \
602 BLOBS
=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
603 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
605 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU
,tcx.bin QEMU
,cgthree.bin \
606 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
607 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
608 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
609 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
610 efi-e1000e.rom efi-vmxnet3.rom \
611 qemu-icon.bmp qemu_logo_no_text.svg \
612 bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
613 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \
614 s390-ccw.img s390-netboot.img \
615 spapr-rtas.bin slof.bin skiboot.lid \
624 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)"
625 $(INSTALL_DATA
) qemu-doc.html
"$(DESTDIR)$(qemu_docdir)"
626 $(INSTALL_DATA
) qemu-doc.txt
"$(DESTDIR)$(qemu_docdir)"
627 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.html
"$(DESTDIR)$(qemu_docdir)"
628 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.txt
"$(DESTDIR)$(qemu_docdir)"
630 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
631 $(INSTALL_DATA
) qemu
.1 "$(DESTDIR)$(mandir)/man1"
632 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man7"
633 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref
.7 "$(DESTDIR)$(mandir)/man7"
634 $(INSTALL_DATA
) docs
/qemu-block-drivers
.7 "$(DESTDIR)$(mandir)/man7"
636 $(INSTALL_DATA
) qemu-img
.1 "$(DESTDIR)$(mandir)/man1"
637 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man8"
638 $(INSTALL_DATA
) qemu-nbd
.8 "$(DESTDIR)$(mandir)/man8"
640 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
641 $(INSTALL_DATA
) qemu-ga
.8 "$(DESTDIR)$(mandir)/man8"
642 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.html
"$(DESTDIR)$(qemu_docdir)"
643 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.txt
"$(DESTDIR)$(qemu_docdir)"
644 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref
.7 "$(DESTDIR)$(mandir)/man7"
648 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
649 $(INSTALL_DATA
) fsdev
/virtfs-proxy-helper
.1 "$(DESTDIR)$(mandir)/man1"
653 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)"
655 install-localstatedir
:
657 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
658 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_localstatedir)"/run
663 install: all $(if
$(BUILD_DOCS
),install-doc
) install-datadir install-localstatedir
665 $(call install-prog
,$(subst qemu-ga
,qemu-ga
$(EXESUF
),$(TOOLS
)),$(DESTDIR
)$(bindir))
667 ifneq ($(CONFIG_MODULES
),)
668 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_moddir)"
669 for s in
$(modules-m
:.mo
=$(DSOSUF
)); do \
670 t
="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
671 $(INSTALL_LIB
) $$s "$$t"; \
672 test -z
"$(STRIP)" ||
$(STRIP
) "$$t"; \
675 ifneq ($(HELPERS-y
),)
676 $(call install-prog
,$(HELPERS-y
),$(DESTDIR
)$(libexecdir
))
679 set
-e
; for x in
$(BLOBS
); do \
680 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/$$x "$(DESTDIR)$(qemu_datadir)"; \
683 ifeq ($(CONFIG_GTK
),y
)
686 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/keymaps"
687 set
-e
; for x in
$(KEYMAPS
); do \
688 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/keymaps
/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
690 $(INSTALL_DATA
) $(BUILD_DIR
)/trace-events-all
"$(DESTDIR)$(qemu_datadir)/trace-events-all"
691 for d in
$(TARGET_DIRS
); do \
692 $(MAKE
) $(SUBDIR_MAKEFLAGS
) TARGET_DIR
=$$d/ -C
$$d $@ || exit
1 ; \
695 # various test targets
697 $(MAKE
) -C tests
/tcg
$@
702 find
"$(SRC_PATH)" -name
'*.[hc]' -exec ctags
--append
{} +
707 find
"$(SRC_PATH)" -name
'*.[hc]' -exec etags
--append
{} +
710 rm -f
"$(SRC_PATH)"/cscope.
*
711 find
"$(SRC_PATH)/" -name
"*.[chsS]" -print | sed
's,^\./,,' > "$(SRC_PATH)/cscope.files"
712 cscope
-b
-i
"$(SRC_PATH)/cscope.files"
714 # opengl shader programs
715 ui
/shader
/%-vert.h
: $(SRC_PATH
)/ui
/shader
/%.vert
$(SRC_PATH
)/scripts
/shaderinclude.pl
717 $(call quiet-command
,\
718 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
721 ui
/shader
/%-frag.h
: $(SRC_PATH
)/ui
/shader
/%.frag
$(SRC_PATH
)/scripts
/shaderinclude.pl
723 $(call quiet-command
,\
724 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
727 ui
/shader.o
: $(SRC_PATH
)/ui
/shader.c \
728 ui
/shader
/texture-blit-vert.h \
729 ui
/shader
/texture-blit-flip-vert.h \
730 ui
/shader
/texture-blit-frag.h
734 MAKEINFOINCLUDES
= -I docs
-I
$(<D
) -I
$(@D
)
735 MAKEINFOFLAGS
=--no-split
--number-sections
$(MAKEINFOINCLUDES
)
736 TEXI2PODFLAGS
=$(MAKEINFOINCLUDES
) "-DVERSION=$(VERSION)"
737 TEXI2PDFFLAGS
=$(if
$(V
),,--quiet
) -I
$(SRC_PATH
) $(MAKEINFOINCLUDES
)
739 docs
/version.texi
: $(SRC_PATH
)/VERSION
740 $(call quiet-command
,echo
"@set VERSION $(VERSION)" > $@
,"GEN","$@")
742 %.html
: %.texi docs
/version.texi
743 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
744 --html
$< -o
$@
,"GEN","$@")
746 %.
info: %.texi docs
/version.texi
747 $(call quiet-command
,$(MAKEINFO
) $(MAKEINFOFLAGS
) $< -o
$@
,"GEN","$@")
749 %.txt
: %.texi docs
/version.texi
750 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
751 --plaintext
$< -o
$@
,"GEN","$@")
753 %.pdf
: %.texi docs
/version.texi
754 $(call quiet-command
,texi2pdf
$(TEXI2PDFFLAGS
) $< -o
$@
,"GEN","$@")
756 qemu-options.texi
: $(SRC_PATH
)/qemu-options.hx
$(SRC_PATH
)/scripts
/hxtool
757 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
759 qemu-monitor.texi
: $(SRC_PATH
)/hmp-commands.hx
$(SRC_PATH
)/scripts
/hxtool
760 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
762 qemu-monitor-info.texi
: $(SRC_PATH
)/hmp-commands-info.hx
$(SRC_PATH
)/scripts
/hxtool
763 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
765 qemu-img-cmds.texi
: $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/scripts
/hxtool
766 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
768 docs
/interop
/qemu-qmp-qapi.texi docs
/interop
/qemu-ga-qapi.texi
: $(SRC_PATH
)/scripts
/qapi2texi.py
$(qapi-py
)
770 docs
/interop
/qemu-qmp-qapi.texi
: $(qapi-modules
)
771 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi2texi.py
$< > $@
,"GEN","$@")
773 docs
/interop
/qemu-ga-qapi.texi
: $(SRC_PATH
)/qga
/qapi-schema.json
774 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi2texi.py
$< > $@
,"GEN","$@")
776 qemu
.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
777 qemu
.1: qemu-option-trace.texi
778 qemu-img
.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
779 fsdev
/virtfs-proxy-helper
.1: fsdev
/virtfs-proxy-helper.texi
780 qemu-nbd
.8: qemu-nbd.texi qemu-option-trace.texi
781 qemu-ga
.8: qemu-ga.texi
782 docs
/qemu-block-drivers
.7: docs
/qemu-block-drivers.texi
784 html
: qemu-doc.html docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html
785 info: qemu-doc.
info docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-ga-ref.
info
786 pdf
: qemu-doc.pdf docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
787 txt
: qemu-doc.txt docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
789 qemu-doc.html qemu-doc.
info qemu-doc.pdf qemu-doc.txt
: \
790 qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \
791 qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
792 qemu-monitor-info.texi docs
/qemu-block-drivers.texi
794 docs
/interop
/qemu-ga-ref.
dvi docs
/interop
/qemu-ga-ref.html \
795 docs
/interop
/qemu-ga-ref.
info docs
/interop
/qemu-ga-ref.pdf \
796 docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7: \
797 docs
/interop
/qemu-ga-ref.texi docs
/interop
/qemu-ga-qapi.texi
799 docs
/interop
/qemu-qmp-ref.
dvi docs
/interop
/qemu-qmp-ref.html \
800 docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-qmp-ref.pdf \
801 docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7: \
802 docs
/interop
/qemu-qmp-ref.texi docs
/interop
/qemu-qmp-qapi.texi
807 INSTALLER
= qemu-setup-
$(VERSION
)$(EXESUF
)
809 nsisflags
= -V2
-NOCD
811 ifneq ($(wildcard $(SRC_PATH
)/dll
),)
812 ifeq ($(ARCH
),x86_64
)
814 DLL_PATH
= $(SRC_PATH
)/dll
/w64
818 DLL_PATH
= $(SRC_PATH
)/dll
/w32
823 installer
: $(INSTALLER
)
825 INSTDIR
=/tmp
/qemu-nsis
827 $(INSTALLER
): $(SRC_PATH
)/qemu.nsi
828 $(MAKE
) install prefix=${INSTDIR}
837 for i in qemu-system-
*.exe
; do \
839 arch
=$${arch
#qemu-system-}; \
840 echo Section
\"$$arch\" Section_
$$arch; \
841 echo SetOutPath
\"\
$$INSTDIR\"; \
842 echo File
\"\
$${BINDIR}\\$$i\"; \
845 ) >${INSTDIR}/system-emulations.nsh
846 makensis
$(nsisflags
) \
847 $(if
$(BUILD_DOCS
),-DCONFIG_DOCUMENTATION
="y") \
848 $(if
$(CONFIG_GTK
),-DCONFIG_GTK
="y") \
849 -DBINDIR
="${INSTDIR}" \
850 $(if
$(DLL_PATH
),-DDLLDIR
="$(DLL_PATH)") \
851 -DSRCDIR
="$(SRC_PATH)" \
852 -DOUTFILE
="$(INSTALLER)" \
853 -DDISPLAYVERSION
="$(VERSION)" \
857 $(SIGNCODE
) $(INSTALLER
)
861 # Add a dependency on the generated files, so that they are always
862 # rebuilt before other object files
863 ifneq ($(wildcard config-host.mak
),)
864 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
865 Makefile
: $(GENERATED_FILES
)
869 .SECONDARY
: $(TRACE_HEADERS
) $(TRACE_HEADERS
:%=%-timestamp
) \
870 $(TRACE_SOURCES
) $(TRACE_SOURCES
:%=%-timestamp
) \
871 $(TRACE_DTRACE
) $(TRACE_DTRACE
:%=%-timestamp
)
873 # Include automatically generated dependency files
874 # Dependencies in Makefile.objs files come from our recursive subdir rules
875 -include $(wildcard *.d tests
/*.d
)
877 include $(SRC_PATH
)/tests
/docker
/Makefile.
include
878 include $(SRC_PATH
)/tests
/vm
/Makefile.
include
882 @echo
'Generic targets:'
883 @echo
' all - Build all'
884 @echo
' dir/file.o - Build specified target only'
885 @echo
' install - Install QEMU, documentation and tools'
886 @echo
' ctags/TAGS - Generate tags file for editors'
887 @echo
' cscope - Generate cscope index'
889 @
$(if
$(TARGET_DIRS
), \
890 echo
'Architecture specific targets:'; \
891 $(foreach t
, $(TARGET_DIRS
), \
892 printf
" %-30s - Build for %s\\n" $(patsubst %,subdir-
%,$(t
)) $(t
);) \
894 @echo
'Cleaning targets:'
895 @echo
' clean - Remove most generated files but keep the config'
896 @echo
' distclean - Remove all generated files'
897 @echo
' dist - Build a distributable tarball'
899 @echo
'Test targets:'
900 @echo
' check - Run all tests (check-help for details)'
901 @echo
' docker - Help about targets running tests inside Docker containers'
902 @echo
' vm-test - Help about targets running tests inside VM'
904 @echo
'Documentation targets:'
905 @echo
' html info pdf txt'
906 @echo
' - Build documentation in specified format'
909 @echo
'Windows targets:'
910 @echo
' installer - Build NSIS-based installer for QEMU'
911 ifdef QEMU_GA_MSI_ENABLED
912 @echo
' msi - Build MSI-based installer for qemu-ga'
916 @echo
' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'