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
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 # Don't try to regenerate Makefile or configure
217 # We don't generate any of them
221 .PHONY
: all clean cscope
distclean html
info install install-doc \
222 pdf txt recurse-all speed
test dist msi FORCE
224 $(call set-vpath
, $(SRC_PATH
))
226 LIBS
+=-lz
$(LIBS_TOOLS
)
228 HELPERS-
$(CONFIG_LINUX
) = qemu-bridge-helper
$(EXESUF
)
231 DOCS
=qemu-doc.html qemu-doc.txt qemu
.1 qemu-img
.1 qemu-nbd
.8 qemu-ga
.8
232 DOCS
+=docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7
233 DOCS
+=docs
/interop
/qemu-ga-ref.html docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7
234 DOCS
+=docs
/qemu-block-drivers
.7
236 DOCS
+=fsdev
/virtfs-proxy-helper
.1
242 SUBDIR_MAKEFLAGS
=$(if
$(V
),,--no-print-directory
) BUILD_DIR
=$(BUILD_DIR
)
243 SUBDIR_DEVICES_MAK
=$(patsubst %, %/config-devices.mak
, $(TARGET_DIRS
))
244 SUBDIR_DEVICES_MAK_DEP
=$(patsubst %, %-config-devices.mak.d
, $(TARGET_DIRS
))
246 ifeq ($(SUBDIR_DEVICES_MAK
),)
247 config-all-devices.mak
:
248 $(call quiet-command
,echo
'# no devices' > $@
,"GEN","$@")
250 config-all-devices.mak
: $(SUBDIR_DEVICES_MAK
)
251 $(call quiet-command
, sed
-n \
252 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
253 $(SUBDIR_DEVICES_MAK
) |
sort -u
> $@
, \
257 -include $(SUBDIR_DEVICES_MAK_DEP
)
259 %/config-devices.mak
: default-configs
/%.mak
$(SRC_PATH
)/scripts
/make_device_config.sh
260 $(call quiet-command
, \
261 $(SHELL
) $(SRC_PATH
)/scripts
/make_device_config.sh
$< $*-config-devices.mak.d
$@
> $@.tmp
,"GEN","$@.tmp")
262 $(call quiet-command
, if
test -f
$@
; then \
263 if cmp
-s
$@.old
$@
; then \
267 if
test -f
$@.old
; then \
268 echo
"WARNING: $@ (user modified) out of date.";\
270 echo
"WARNING: $@ out of date.";\
272 echo
"Run \"make defconfig\" to regenerate."; \
281 rm -f config-all-devices.mak
$(SUBDIR_DEVICES_MAK
)
283 ifneq ($(wildcard config-host.mak
),)
284 include $(SRC_PATH
)/Makefile.objs
287 dummy
:= $(call unnest-vars
,, \
292 ivshmem-client-obj-y \
293 ivshmem-server-obj-y \
294 libvhost-user-obj-y \
295 vhost-user-scsi-obj-y \
307 include $(SRC_PATH
)/tests
/Makefile.
include
309 all: $(DOCS
) $(TOOLS
) $(HELPERS-y
) recurse-all modules
311 qemu-version.h
: FORCE
312 $(call quiet-command
, \
314 printf
'#define QEMU_PKGVERSION '; \
315 if
test -n
"$(PKGVERSION)"; then \
316 printf
'"$(PKGVERSION)"\n'; \
318 if
test -d .git
; then \
320 git describe
--match
'v*' 2>/dev
/null | tr
-d
'\n'; \
321 if
! git diff-index
--quiet HEAD
&>/dev
/null
; then \
322 printf
-- '-dirty'; \
329 $(call quiet-command
, if
! cmp
-s
$@
$@.tmp
; then \
335 config-host.h
: config-host.h-timestamp
336 config-host.h-timestamp
: config-host.mak
337 qemu-options.def
: $(SRC_PATH
)/qemu-options.hx
$(SRC_PATH
)/scripts
/hxtool
338 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
340 SUBDIR_RULES
=$(patsubst %,subdir-
%, $(TARGET_DIRS
))
341 SOFTMMU_SUBDIR_RULES
=$(filter %-softmmu
,$(SUBDIR_RULES
))
343 $(SOFTMMU_SUBDIR_RULES
): $(block-obj-y
)
344 $(SOFTMMU_SUBDIR_RULES
): $(crypto-obj-y
)
345 $(SOFTMMU_SUBDIR_RULES
): $(io-obj-y
)
346 $(SOFTMMU_SUBDIR_RULES
): config-all-devices.mak
349 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$* V
="$(V)" TARGET_DIR
="$*/" all,)
351 DTC_MAKE_ARGS
=-I
$(SRC_PATH
)/dtc VPATH
=$(SRC_PATH
)/dtc
-C dtc V
="$(V)" LIBFDT_srcdir
=$(SRC_PATH
)/dtc
/libfdt
352 DTC_CFLAGS
=$(CFLAGS
) $(QEMU_CFLAGS
)
353 DTC_CPPFLAGS
=-I
$(BUILD_DIR
)/dtc
-I
$(SRC_PATH
)/dtc
-I
$(SRC_PATH
)/dtc
/libfdt
355 subdir-dtc
: .git-submodule-status dtc
/libfdt dtc
/tests
356 $(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
,)
361 $(SUBDIR_RULES
): libqemuutil.a
$(common-obj-y
) $(chardev-obj-y
) \
362 $(qom-obj-y
) $(crypto-aes-obj-
$(CONFIG_USER_ONLY
))
364 ROMSUBDIR_RULES
=$(patsubst %,romsubdir-
%, $(ROMS
))
365 # Only keep -O and -g cflags
367 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C pc-bios
/$* V
="$(V)" TARGET_DIR
="$*/" CFLAGS
="$(filter -O% -g%,$(CFLAGS))",)
369 ALL_SUBDIRS
=$(TARGET_DIRS
) $(patsubst %,pc-bios
/%, $(ROMS
))
371 recurse-all
: $(SUBDIR_RULES
) $(ROMSUBDIR_RULES
)
373 $(BUILD_DIR
)/version.o
: $(SRC_PATH
)/version.rc config-host.h
374 $(call quiet-command
,$(WINDRES
) -I
$(BUILD_DIR
) -o
$@
$<,"RC","version.o")
376 Makefile
: $(version-obj-y
)
378 ######################################################################
381 libqemuutil.a
: $(util-obj-y
) $(trace-obj-y
) $(stub-obj-y
)
382 libvhost-user.a
: $(libvhost-user-obj-y
)
384 ######################################################################
386 COMMON_LDADDS
= libqemuutil.a
388 qemu-img.o
: qemu-img-cmds.h
390 qemu-img
$(EXESUF
): qemu-img.o
$(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
391 qemu-nbd
$(EXESUF
): qemu-nbd.o
$(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
392 qemu-io
$(EXESUF
): qemu-io.o
$(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
394 qemu-bridge-helper
$(EXESUF
): qemu-bridge-helper.o
$(COMMON_LDADDS
)
396 fsdev
/virtfs-proxy-helper
$(EXESUF
): fsdev
/virtfs-proxy-helper.o fsdev
/9p-marshal.o fsdev
/9p-iov-marshal.o
$(COMMON_LDADDS
)
397 fsdev
/virtfs-proxy-helper
$(EXESUF
): LIBS
+= -lcap
399 scsi
/qemu-pr-helper
$(EXESUF
): scsi
/qemu-pr-helper.o scsi
/utils.o
$(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
401 scsi
/qemu-pr-helper
$(EXESUF
): LIBS
+= -ludev
-lmultipath
-lmpathpersist
404 qemu-img-cmds.h
: $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/scripts
/hxtool
405 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
407 qemu-ga
$(EXESUF
): LIBS
= $(LIBS_QGA
)
408 qemu-ga
$(EXESUF
): QEMU_CFLAGS
+= -I qga
/qapi-generated
410 gen-out-type
= $(subst .
,-,$(suffix $@
))
412 qapi-py
= $(SRC_PATH
)/scripts
/qapi.py
$(SRC_PATH
)/scripts
/ordereddict.py
414 qga
/qapi-generated
/qga-qapi-types.c qga
/qapi-generated
/qga-qapi-types.h
:\
415 $(SRC_PATH
)/qga
/qapi-schema.json
$(SRC_PATH
)/scripts
/qapi-types.py
$(qapi-py
)
416 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-types.py \
417 $(gen-out-type
) -o qga
/qapi-generated
-p
"qga-" $<, \
419 qga
/qapi-generated
/qga-qapi-visit.c qga
/qapi-generated
/qga-qapi-visit.h
:\
420 $(SRC_PATH
)/qga
/qapi-schema.json
$(SRC_PATH
)/scripts
/qapi-visit.py
$(qapi-py
)
421 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-visit.py \
422 $(gen-out-type
) -o qga
/qapi-generated
-p
"qga-" $<, \
424 qga
/qapi-generated
/qga-qmp-commands.h qga
/qapi-generated
/qga-qmp-marshal.c
:\
425 $(SRC_PATH
)/qga
/qapi-schema.json
$(SRC_PATH
)/scripts
/qapi-commands.py
$(qapi-py
)
426 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-commands.py \
427 $(gen-out-type
) -o qga
/qapi-generated
-p
"qga-" $<, \
430 qapi-modules
= $(SRC_PATH
)/qapi-schema.json
$(SRC_PATH
)/qapi
/common.json \
431 $(SRC_PATH
)/qapi
/block.json
$(SRC_PATH
)/qapi
/block-core.json \
432 $(SRC_PATH
)/qapi
/char.json \
433 $(SRC_PATH
)/qapi
/crypto.json \
434 $(SRC_PATH
)/qapi
/introspect.json \
435 $(SRC_PATH
)/qapi
/migration.json \
436 $(SRC_PATH
)/qapi
/net.json \
437 $(SRC_PATH
)/qapi
/rocker.json \
438 $(SRC_PATH
)/qapi
/run-state.json \
439 $(SRC_PATH
)/qapi
/sockets.json \
440 $(SRC_PATH
)/qapi
/tpm.json \
441 $(SRC_PATH
)/qapi
/trace.json \
442 $(SRC_PATH
)/qapi
/transaction.json \
443 $(SRC_PATH
)/qapi
/ui.json
445 qapi-types.c qapi-types.h
:\
446 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-types.py
$(qapi-py
)
447 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-types.py \
448 $(gen-out-type
) -o
"." -b
$<, \
450 qapi-visit.c qapi-visit.h
:\
451 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-visit.py
$(qapi-py
)
452 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-visit.py \
453 $(gen-out-type
) -o
"." -b
$<, \
455 qapi-event.c qapi-event.h
:\
456 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-event.py
$(qapi-py
)
457 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-event.py \
458 $(gen-out-type
) -o
"." $<, \
460 qmp-commands.h qmp-marshal.c
:\
461 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-commands.py
$(qapi-py
)
462 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-commands.py \
463 $(gen-out-type
) -o
"." $<, \
465 qmp-introspect.h qmp-introspect.c
:\
466 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-introspect.py
$(qapi-py
)
467 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-introspect.py \
468 $(gen-out-type
) -o
"." $<, \
471 QGALIB_GEN
=$(addprefix qga
/qapi-generated
/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h
)
472 $(qga-obj-y
): $(QGALIB_GEN
)
474 qemu-ga
$(EXESUF
): $(qga-obj-y
) $(COMMON_LDADDS
)
477 ifdef QEMU_GA_MSI_ENABLED
478 QEMU_GA_MSI
=qemu-ga-
$(ARCH
).msi
482 $(QEMU_GA_MSI
): qemu-ga.exe
$(QGA_VSS_PROVIDER
)
484 $(QEMU_GA_MSI
): config-host.mak
486 $(QEMU_GA_MSI
): $(SRC_PATH
)/qga
/installer
/qemu-ga.wxs
487 $(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)" \
488 wixl
-o
$@
$(QEMU_GA_MSI_ARCH
) $(QEMU_GA_MSI_WITH_VSS
) $(QEMU_GA_MSI_MINGW_DLL_PATH
) $<,"WIXL","$@")
491 @echo
"MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
496 qemu-ga
: qemu-ga
$(EXESUF
) $(QGA_VSS_PROVIDER
) $(QEMU_GA_MSI
)
500 ivshmem-client
$(EXESUF
): $(ivshmem-client-obj-y
) $(COMMON_LDADDS
)
502 ivshmem-server
$(EXESUF
): $(ivshmem-server-obj-y
) $(COMMON_LDADDS
)
505 vhost-user-scsi
$(EXESUF
): $(vhost-user-scsi-obj-y
) libvhost-user.a
508 module_block.h
: $(SRC_PATH
)/scripts
/modules
/module_block.py config-host.mak
509 $(call quiet-command
,$(PYTHON
) $< $@ \
510 $(addprefix $(SRC_PATH
)/,$(patsubst %.mo
,%.c
,$(block-obj-m
))), \
514 # avoid old build problems by removing potentially incorrect old files
515 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
516 rm -f qemu-options.def
518 find . \
( -name
'*.so' -o
-name
'*.dll' -o
-name
'*.mo' -o
-name
'*.[oda]' \
) -type f
-exec
rm {} +
519 rm -f
$(filter-out %.tlb
,$(TOOLS
)) $(HELPERS-y
) qemu-ga TAGS cscope.
* *.pod
*~
*/*~
520 rm -f fsdev
/*.pod scsi
/*.pod
521 rm -f qemu-img-cmds.h
522 rm -f ui
/shader
/*-vert.h ui
/shader
/*-frag.h
523 @
# May not be present in GENERATED_FILES
524 rm -f trace
/generated-tracers-dtrace.dtrace
*
525 rm -f trace
/generated-tracers-dtrace.h
*
526 rm -f
$(foreach f
,$(GENERATED_FILES
),$(f
) $(f
)-timestamp
)
527 rm -rf qapi-generated
528 rm -rf qga
/qapi-generated
529 for d in
$(ALL_SUBDIRS
); do \
530 if
test -d
$$d; then
$(MAKE
) -C
$$d $@ || exit
1; fi
; \
531 rm -f
$$d/qemu-options.def
; \
533 rm -f
$(SUBDIR_DEVICES_MAK
) config-all-devices.mak
535 VERSION ?
= $(shell cat VERSION
)
537 dist: qemu-
$(VERSION
).
tar.bz2
540 $(SRC_PATH
)/scripts
/make-release
"$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
543 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
544 rm -f config-all-devices.mak config-all-disas.mak config.status
545 rm -f po
/*.mo tests
/qemu-iotests
/common.env
546 rm -f roms
/seabios
/config.mak roms
/vgabios
/config.mak
547 rm -f qemu-doc.
info qemu-doc.aux qemu-doc.cp qemu-doc.cps
548 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.
info qemu-doc.ky qemu-doc.kys
549 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
550 rm -f qemu-doc.vr qemu-doc.txt
552 rm -f linux-headers
/asm
553 rm -f docs
/version.texi
554 rm -f docs
/interop
/qemu-ga-qapi.texi docs
/interop
/qemu-qmp-qapi.texi
555 rm -f docs
/interop
/qemu-qmp-ref
.7 docs
/interop
/qemu-ga-ref
.7
556 rm -f docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
557 rm -f docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
558 rm -f docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html
559 rm -f docs
/qemu-block-drivers
.7
560 for d in
$(TARGET_DIRS
); do \
561 rm -rf
$$d || exit
1 ; \
564 if
test -f dtc
/version_gen.h
; then
$(MAKE
) $(DTC_MAKE_ARGS
) clean; fi
566 KEYMAPS
=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
567 ar de en-us fi fr-be hr it lv nl pl ru th \
568 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr \
572 BLOBS
=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
573 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
575 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU
,tcx.bin QEMU
,cgthree.bin \
576 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
577 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
578 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
579 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
580 efi-e1000e.rom efi-vmxnet3.rom \
581 qemu-icon.bmp qemu_logo_no_text.svg \
582 bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
583 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \
584 s390-ccw.img s390-netboot.img \
585 spapr-rtas.bin slof.bin skiboot.lid \
594 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)"
595 $(INSTALL_DATA
) qemu-doc.html
"$(DESTDIR)$(qemu_docdir)"
596 $(INSTALL_DATA
) qemu-doc.txt
"$(DESTDIR)$(qemu_docdir)"
597 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.html
"$(DESTDIR)$(qemu_docdir)"
598 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref.txt
"$(DESTDIR)$(qemu_docdir)"
600 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
601 $(INSTALL_DATA
) qemu
.1 "$(DESTDIR)$(mandir)/man1"
602 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man7"
603 $(INSTALL_DATA
) docs
/interop
/qemu-qmp-ref
.7 "$(DESTDIR)$(mandir)/man7"
604 $(INSTALL_DATA
) docs
/qemu-block-drivers
.7 "$(DESTDIR)$(mandir)/man7"
606 $(INSTALL_DATA
) qemu-img
.1 "$(DESTDIR)$(mandir)/man1"
607 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man8"
608 $(INSTALL_DATA
) qemu-nbd
.8 "$(DESTDIR)$(mandir)/man8"
610 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
611 $(INSTALL_DATA
) qemu-ga
.8 "$(DESTDIR)$(mandir)/man8"
612 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.html
"$(DESTDIR)$(qemu_docdir)"
613 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref.txt
"$(DESTDIR)$(qemu_docdir)"
614 $(INSTALL_DATA
) docs
/interop
/qemu-ga-ref
.7 "$(DESTDIR)$(mandir)/man7"
618 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
619 $(INSTALL_DATA
) fsdev
/virtfs-proxy-helper
.1 "$(DESTDIR)$(mandir)/man1"
623 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)"
625 install-localstatedir
:
627 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
628 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_localstatedir)"/run
633 install: all $(if
$(BUILD_DOCS
),install-doc
) install-datadir install-localstatedir
635 $(call install-prog
,$(subst qemu-ga
,qemu-ga
$(EXESUF
),$(TOOLS
)),$(DESTDIR
)$(bindir))
637 ifneq ($(CONFIG_MODULES
),)
638 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_moddir)"
639 for s in
$(modules-m
:.mo
=$(DSOSUF
)); do \
640 t
="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
641 $(INSTALL_LIB
) $$s "$$t"; \
642 test -z
"$(STRIP)" ||
$(STRIP
) "$$t"; \
645 ifneq ($(HELPERS-y
),)
646 $(call install-prog
,$(HELPERS-y
),$(DESTDIR
)$(libexecdir
))
649 set
-e
; for x in
$(BLOBS
); do \
650 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/$$x "$(DESTDIR)$(qemu_datadir)"; \
653 ifeq ($(CONFIG_GTK
),y
)
656 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/keymaps"
657 set
-e
; for x in
$(KEYMAPS
); do \
658 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/keymaps
/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
660 $(INSTALL_DATA
) $(BUILD_DIR
)/trace-events-all
"$(DESTDIR)$(qemu_datadir)/trace-events-all"
661 for d in
$(TARGET_DIRS
); do \
662 $(MAKE
) $(SUBDIR_MAKEFLAGS
) TARGET_DIR
=$$d/ -C
$$d $@ || exit
1 ; \
665 # various test targets
667 $(MAKE
) -C tests
/tcg
$@
672 find
"$(SRC_PATH)" -name
'*.[hc]' -exec ctags
--append
{} +
677 find
"$(SRC_PATH)" -name
'*.[hc]' -exec etags
--append
{} +
680 rm -f
"$(SRC_PATH)"/cscope.
*
681 find
"$(SRC_PATH)/" -name
"*.[chsS]" -print | sed
's,^\./,,' > "$(SRC_PATH)/cscope.files"
682 cscope
-b
-i
"$(SRC_PATH)/cscope.files"
684 # opengl shader programs
685 ui
/shader
/%-vert.h
: $(SRC_PATH
)/ui
/shader
/%.vert
$(SRC_PATH
)/scripts
/shaderinclude.pl
687 $(call quiet-command
,\
688 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
691 ui
/shader
/%-frag.h
: $(SRC_PATH
)/ui
/shader
/%.frag
$(SRC_PATH
)/scripts
/shaderinclude.pl
693 $(call quiet-command
,\
694 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
697 ui
/console-gl.o
: $(SRC_PATH
)/ui
/console-gl.c \
698 ui
/shader
/texture-blit-vert.h ui
/shader
/texture-blit-frag.h
702 MAKEINFOINCLUDES
= -I docs
-I
$(<D
) -I
$(@D
)
703 MAKEINFOFLAGS
=--no-split
--number-sections
$(MAKEINFOINCLUDES
)
704 TEXI2PODFLAGS
=$(MAKEINFOINCLUDES
) "-DVERSION=$(VERSION)"
705 TEXI2PDFFLAGS
=$(if
$(V
),,--quiet
) -I
$(SRC_PATH
) $(MAKEINFOINCLUDES
)
707 docs
/version.texi
: $(SRC_PATH
)/VERSION
708 $(call quiet-command
,echo
"@set VERSION $(VERSION)" > $@
,"GEN","$@")
710 %.html
: %.texi docs
/version.texi
711 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
712 --html
$< -o
$@
,"GEN","$@")
714 %.
info: %.texi docs
/version.texi
715 $(call quiet-command
,$(MAKEINFO
) $(MAKEINFOFLAGS
) $< -o
$@
,"GEN","$@")
717 %.txt
: %.texi docs
/version.texi
718 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
719 --plaintext
$< -o
$@
,"GEN","$@")
721 %.pdf
: %.texi docs
/version.texi
722 $(call quiet-command
,texi2pdf
$(TEXI2PDFFLAGS
) $< -o
$@
,"GEN","$@")
724 qemu-options.texi
: $(SRC_PATH
)/qemu-options.hx
$(SRC_PATH
)/scripts
/hxtool
725 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
727 qemu-monitor.texi
: $(SRC_PATH
)/hmp-commands.hx
$(SRC_PATH
)/scripts
/hxtool
728 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
730 qemu-monitor-info.texi
: $(SRC_PATH
)/hmp-commands-info.hx
$(SRC_PATH
)/scripts
/hxtool
731 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
733 qemu-img-cmds.texi
: $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/scripts
/hxtool
734 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
736 docs
/interop
/qemu-qmp-qapi.texi docs
/interop
/qemu-ga-qapi.texi
: $(SRC_PATH
)/scripts
/qapi2texi.py
$(qapi-py
)
738 docs
/interop
/qemu-qmp-qapi.texi
: $(qapi-modules
)
739 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi2texi.py
$< > $@
,"GEN","$@")
741 docs
/interop
/qemu-ga-qapi.texi
: $(SRC_PATH
)/qga
/qapi-schema.json
742 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi2texi.py
$< > $@
,"GEN","$@")
744 qemu
.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
745 qemu
.1: qemu-option-trace.texi
746 qemu-img
.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
747 fsdev
/virtfs-proxy-helper
.1: fsdev
/virtfs-proxy-helper.texi
748 qemu-nbd
.8: qemu-nbd.texi qemu-option-trace.texi
749 qemu-ga
.8: qemu-ga.texi
750 docs
/qemu-block-drivers
.7: docs
/qemu-block-drivers.texi
752 html
: qemu-doc.html docs
/interop
/qemu-qmp-ref.html docs
/interop
/qemu-ga-ref.html
753 info: qemu-doc.
info docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-ga-ref.
info
754 pdf
: qemu-doc.pdf docs
/interop
/qemu-qmp-ref.pdf docs
/interop
/qemu-ga-ref.pdf
755 txt
: qemu-doc.txt docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-ga-ref.txt
757 qemu-doc.html qemu-doc.
info qemu-doc.pdf qemu-doc.txt
: \
758 qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \
759 qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
760 qemu-monitor-info.texi docs
/qemu-block-drivers.texi
762 docs
/interop
/qemu-ga-ref.
dvi docs
/interop
/qemu-ga-ref.html \
763 docs
/interop
/qemu-ga-ref.
info docs
/interop
/qemu-ga-ref.pdf \
764 docs
/interop
/qemu-ga-ref.txt docs
/interop
/qemu-ga-ref
.7: \
765 docs
/interop
/qemu-ga-ref.texi docs
/interop
/qemu-ga-qapi.texi
767 docs
/interop
/qemu-qmp-ref.
dvi docs
/interop
/qemu-qmp-ref.html \
768 docs
/interop
/qemu-qmp-ref.
info docs
/interop
/qemu-qmp-ref.pdf \
769 docs
/interop
/qemu-qmp-ref.txt docs
/interop
/qemu-qmp-ref
.7: \
770 docs
/interop
/qemu-qmp-ref.texi docs
/interop
/qemu-qmp-qapi.texi
775 INSTALLER
= qemu-setup-
$(VERSION
)$(EXESUF
)
777 nsisflags
= -V2
-NOCD
779 ifneq ($(wildcard $(SRC_PATH
)/dll
),)
780 ifeq ($(ARCH
),x86_64
)
782 DLL_PATH
= $(SRC_PATH
)/dll
/w64
786 DLL_PATH
= $(SRC_PATH
)/dll
/w32
791 installer
: $(INSTALLER
)
793 INSTDIR
=/tmp
/qemu-nsis
795 $(INSTALLER
): $(SRC_PATH
)/qemu.nsi
796 $(MAKE
) install prefix=${INSTDIR}
805 for i in qemu-system-
*.exe
; do \
807 arch
=$${arch
#qemu-system-}; \
808 echo Section
\"$$arch\" Section_
$$arch; \
809 echo SetOutPath
\"\
$$INSTDIR\"; \
810 echo File
\"\
$${BINDIR}\\$$i\"; \
813 ) >${INSTDIR}/system-emulations.nsh
814 makensis
$(nsisflags
) \
815 $(if
$(BUILD_DOCS
),-DCONFIG_DOCUMENTATION
="y") \
816 $(if
$(CONFIG_GTK
),-DCONFIG_GTK
="y") \
817 -DBINDIR
="${INSTDIR}" \
818 $(if
$(DLL_PATH
),-DDLLDIR
="$(DLL_PATH)") \
819 -DSRCDIR
="$(SRC_PATH)" \
820 -DOUTFILE
="$(INSTALLER)" \
821 -DDISPLAYVERSION
="$(VERSION)" \
825 $(SIGNCODE
) $(INSTALLER
)
829 # Add a dependency on the generated files, so that they are always
830 # rebuilt before other object files
831 ifneq ($(wildcard config-host.mak
),)
832 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
833 Makefile
: $(GENERATED_FILES
)
837 .SECONDARY
: $(TRACE_HEADERS
) $(TRACE_HEADERS
:%=%-timestamp
) \
838 $(TRACE_SOURCES
) $(TRACE_SOURCES
:%=%-timestamp
) \
839 $(TRACE_DTRACE
) $(TRACE_DTRACE
:%=%-timestamp
)
841 # Include automatically generated dependency files
842 # Dependencies in Makefile.objs files come from our recursive subdir rules
843 -include $(wildcard *.d tests
/*.d
)
845 include $(SRC_PATH
)/tests
/docker
/Makefile.
include
846 include $(SRC_PATH
)/tests
/vm
/Makefile.
include
850 @echo
'Generic targets:'
851 @echo
' all - Build all'
852 @echo
' dir/file.o - Build specified target only'
853 @echo
' install - Install QEMU, documentation and tools'
854 @echo
' ctags/TAGS - Generate tags file for editors'
855 @echo
' cscope - Generate cscope index'
857 @
$(if
$(TARGET_DIRS
), \
858 echo
'Architecture specific targets:'; \
859 $(foreach t
, $(TARGET_DIRS
), \
860 printf
" %-30s - Build for %s\\n" $(patsubst %,subdir-
%,$(t
)) $(t
);) \
862 @echo
'Cleaning targets:'
863 @echo
' clean - Remove most generated files but keep the config'
864 @echo
' distclean - Remove all generated files'
865 @echo
' dist - Build a distributable tarball'
867 @echo
'Test targets:'
868 @echo
' check - Run all tests (check-help for details)'
869 @echo
' docker - Help about targets running tests inside Docker containers'
870 @echo
' vm-test - Help about targets running tests inside VM'
872 @echo
'Documentation targets:'
873 @echo
' html info pdf txt'
874 @echo
' - Build documentation in specified format'
877 @echo
'Windows targets:'
878 @echo
' installer - Build NSIS-based installer for QEMU'
879 ifdef QEMU_GA_MSI_ENABLED
880 @echo
' msi - Build MSI-based installer for qemu-ga'
884 @echo
' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'