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
17 # Check that we're not trying to do an out-of-tree build from
18 # a tree that's been used for an in-tree build.
19 ifneq ($(realpath
$(SRC_PATH
)),$(realpath .
))
20 ifneq ($(wildcard $(SRC_PATH
)/config-host.mak
),)
21 $(error This is an out of tree build but your source tree
($(SRC_PATH
)) \
22 seems to have been used for an in-tree build. You can fix this by running \
23 "make distclean && rm -rf *-linux-user *-softmmu" in your source tree
)
27 CONFIG_SOFTMMU
:= $(if
$(filter %-softmmu
,$(TARGET_DIRS
)),y
)
28 CONFIG_USER_ONLY
:= $(if
$(filter %-user
,$(TARGET_DIRS
)),y
)
30 -include config-all-devices.mak
31 -include config-all-disas.mak
33 config-host.mak
: $(SRC_PATH
)/configure
$(SRC_PATH
)/pc-bios
34 @echo
$@ is out-of-date
, running configure
35 @
# TODO: The next lines include code which supports a smooth
36 @
# transition from old configurations without config.status.
37 @
# This code can be removed after QEMU 1.7.
38 @if
test -x config.status
; then \
41 sed
-n
"/.*Configured with/s/[^:]*: //p" $@ | sh
; \
45 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
46 @echo
"Please call configure before running make!"
51 include $(SRC_PATH
)/rules.mak
53 GENERATED_FILES
= qemu-version.h config-host.h qemu-options.def
54 GENERATED_FILES
+= qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h
55 GENERATED_FILES
+= qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
56 GENERATED_FILES
+= qmp-introspect.h
57 GENERATED_FILES
+= qmp-introspect.c
59 GENERATED_FILES
+= trace
/generated-tcg-tracers.h
61 GENERATED_FILES
+= trace
/generated-helpers-wrappers.h
62 GENERATED_FILES
+= trace
/generated-helpers.h
63 GENERATED_FILES
+= trace
/generated-helpers.c
65 ifdef CONFIG_TRACE_UST
66 GENERATED_FILES
+= trace-ust-all.h
67 GENERATED_FILES
+= trace-ust-all.c
70 GENERATED_FILES
+= module_block.h
72 TRACE_HEADERS
= trace-root.h
$(trace-events-subdirs
:%=%/trace.h
)
73 TRACE_SOURCES
= trace-root.c
$(trace-events-subdirs
:%=%/trace.c
)
75 ifdef CONFIG_TRACE_DTRACE
76 TRACE_HEADERS
+= trace-dtrace-root.h
$(trace-events-subdirs
:%=%/trace-dtrace.h
)
77 TRACE_DTRACE
+= trace-dtrace-root.dtrace
$(trace-events-subdirs
:%=%/trace-dtrace.dtrace
)
79 ifdef CONFIG_TRACE_UST
80 TRACE_HEADERS
+= trace-ust-root.h
$(trace-events-subdirs
:%=%/trace-ust.h
)
83 GENERATED_FILES
+= $(TRACE_HEADERS
)
84 GENERATED_FILES
+= $(TRACE_SOURCES
)
85 GENERATED_FILES
+= $(BUILD_DIR
)/trace-events-all
87 trace-group-name
= $(shell dirname
$1 | sed
-e
's/[^a-zA-Z0-9]/_/g')
89 %/trace.h
: %/trace.h-timestamp
90 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
91 %/trace.h-timestamp
: $(SRC_PATH
)/%/trace-events
$(tracetool-y
)
92 $(call quiet-command
,$(TRACETOOL
) \
93 --group
=$(call trace-group-name
,$@
) \
95 --backends
=$(TRACE_BACKENDS
) \
96 $< > $@
,"GEN","$(@:%-timestamp=%)")
98 %/trace.c
: %/trace.c-timestamp
99 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
100 %/trace.c-timestamp
: $(SRC_PATH
)/%/trace-events
$(tracetool-y
)
101 $(call quiet-command
,$(TRACETOOL
) \
102 --group
=$(call trace-group-name
,$@
) \
104 --backends
=$(TRACE_BACKENDS
) \
105 $< > $@
,"GEN","$(@:%-timestamp=%)")
107 %/trace-ust.h
: %/trace-ust.h-timestamp
108 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
109 %/trace-ust.h-timestamp
: $(SRC_PATH
)/%/trace-events
$(tracetool-y
)
110 $(call quiet-command
,$(TRACETOOL
) \
111 --group
=$(call trace-group-name
,$@
) \
112 --format
=ust-events-h \
113 --backends
=$(TRACE_BACKENDS
) \
114 $< > $@
,"GEN","$(@:%-timestamp=%)")
116 %/trace-dtrace.dtrace
: %/trace-dtrace.dtrace-timestamp
117 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
118 %/trace-dtrace.dtrace-timestamp
: $(SRC_PATH
)/%/trace-events
$(BUILD_DIR
)/config-host.mak
$(tracetool-y
)
119 $(call quiet-command
,$(TRACETOOL
) \
120 --group
=$(call trace-group-name
,$@
) \
122 --backends
=$(TRACE_BACKENDS
) \
123 $< > $@
,"GEN","$(@:%-timestamp=%)")
125 %/trace-dtrace.h
: %/trace-dtrace.dtrace
$(tracetool-y
)
126 $(call quiet-command
,dtrace
-o
$@
-h
-s
$<, "GEN","$@")
128 %/trace-dtrace.o
: %/trace-dtrace.dtrace
$(tracetool-y
)
131 trace-root.h
: trace-root.h-timestamp
132 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
133 trace-root.h-timestamp
: $(SRC_PATH
)/trace-events
$(tracetool-y
)
134 $(call quiet-command
,$(TRACETOOL
) \
137 --backends
=$(TRACE_BACKENDS
) \
138 $< > $@
,"GEN","$(@:%-timestamp=%)")
140 trace-root.c
: trace-root.c-timestamp
141 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
142 trace-root.c-timestamp
: $(SRC_PATH
)/trace-events
$(tracetool-y
)
143 $(call quiet-command
,$(TRACETOOL
) \
146 --backends
=$(TRACE_BACKENDS
) \
147 $< > $@
,"GEN","$(@:%-timestamp=%)")
149 trace-ust-root.h
: trace-ust-root.h-timestamp
150 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
151 trace-ust-root.h-timestamp
: $(SRC_PATH
)/trace-events
$(tracetool-y
)
152 $(call quiet-command
,$(TRACETOOL
) \
154 --format
=ust-events-h \
155 --backends
=$(TRACE_BACKENDS
) \
156 $< > $@
,"GEN","$(@:%-timestamp=%)")
158 trace-ust-all.h
: trace-ust-all.h-timestamp
159 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
160 trace-ust-all.h-timestamp
: $(trace-events-files
) $(tracetool-y
)
161 $(call quiet-command
,$(TRACETOOL
) \
163 --format
=ust-events-h \
164 --backends
=$(TRACE_BACKENDS
) \
165 $(trace-events-files
) > $@
,"GEN","$(@:%-timestamp=%)")
167 trace-ust-all.c
: trace-ust-all.c-timestamp
168 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
169 trace-ust-all.c-timestamp
: $(trace-events-files
) $(tracetool-y
)
170 $(call quiet-command
,$(TRACETOOL
) \
172 --format
=ust-events-c \
173 --backends
=$(TRACE_BACKENDS
) \
174 $(trace-events-files
) > $@
,"GEN","$(@:%-timestamp=%)")
176 trace-dtrace-root.dtrace
: trace-dtrace-root.dtrace-timestamp
177 @cmp
$< $@
>/dev
/null
2>&1 || cp
$< $@
178 trace-dtrace-root.dtrace-timestamp
: $(SRC_PATH
)/trace-events
$(BUILD_DIR
)/config-host.mak
$(tracetool-y
)
179 $(call quiet-command
,$(TRACETOOL
) \
182 --backends
=$(TRACE_BACKENDS
) \
183 $< > $@
,"GEN","$(@:%-timestamp=%)")
185 trace-dtrace-root.h
: trace-dtrace-root.dtrace
186 $(call quiet-command
,dtrace
-o
$@
-h
-s
$<, "GEN","$@")
188 trace-dtrace-root.o
: trace-dtrace-root.dtrace
190 # Don't try to regenerate Makefile or configure
191 # We don't generate any of them
195 .PHONY
: all clean cscope
distclean html
info install install-doc \
196 pdf txt recurse-all speed
test dist msi FORCE
198 $(call set-vpath
, $(SRC_PATH
))
200 LIBS
+=-lz
$(LIBS_TOOLS
)
202 HELPERS-
$(CONFIG_LINUX
) = qemu-bridge-helper
$(EXESUF
)
205 DOCS
=qemu-doc.html qemu-doc.txt qemu
.1 qemu-img
.1 qemu-nbd
.8 qemu-ga
.8
206 DOCS
+=docs
/qemu-qmp-ref.html docs
/qemu-qmp-ref.txt docs
/qemu-qmp-ref
.7
207 DOCS
+=docs
/qemu-ga-ref.html docs
/qemu-ga-ref.txt docs
/qemu-ga-ref
.7
209 DOCS
+=fsdev
/virtfs-proxy-helper
.1
215 SUBDIR_MAKEFLAGS
=$(if
$(V
),,--no-print-directory
) BUILD_DIR
=$(BUILD_DIR
)
216 SUBDIR_DEVICES_MAK
=$(patsubst %, %/config-devices.mak
, $(TARGET_DIRS
))
217 SUBDIR_DEVICES_MAK_DEP
=$(patsubst %, %-config-devices.mak.d
, $(TARGET_DIRS
))
219 ifeq ($(SUBDIR_DEVICES_MAK
),)
220 config-all-devices.mak
:
221 $(call quiet-command
,echo
'# no devices' > $@
,"GEN","$@")
223 config-all-devices.mak
: $(SUBDIR_DEVICES_MAK
)
224 $(call quiet-command
, sed
-n \
225 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
226 $(SUBDIR_DEVICES_MAK
) |
sort -u
> $@
, \
230 -include $(SUBDIR_DEVICES_MAK_DEP
)
232 %/config-devices.mak
: default-configs
/%.mak
$(SRC_PATH
)/scripts
/make_device_config.sh
233 $(call quiet-command
, \
234 $(SHELL
) $(SRC_PATH
)/scripts
/make_device_config.sh
$< $*-config-devices.mak.d
$@
> $@.tmp
,"GEN","$@.tmp")
235 $(call quiet-command
, if
test -f
$@
; then \
236 if cmp
-s
$@.old
$@
; then \
240 if
test -f
$@.old
; then \
241 echo
"WARNING: $@ (user modified) out of date.";\
243 echo
"WARNING: $@ out of date.";\
245 echo
"Run \"make defconfig\" to regenerate."; \
254 rm -f config-all-devices.mak
$(SUBDIR_DEVICES_MAK
)
256 ifneq ($(wildcard config-host.mak
),)
257 include $(SRC_PATH
)/Makefile.objs
260 dummy
:= $(call unnest-vars
,, \
265 ivshmem-client-obj-y \
266 ivshmem-server-obj-y \
267 libvhost-user-obj-y \
279 ifneq ($(wildcard config-host.mak
),)
280 include $(SRC_PATH
)/tests
/Makefile.
include
283 all: $(DOCS
) $(TOOLS
) $(HELPERS-y
) recurse-all modules
285 qemu-version.h
: FORCE
286 $(call quiet-command
, \
288 printf
'#define QEMU_PKGVERSION '; \
289 if
test -n
"$(PKGVERSION)"; then \
290 printf
'"$(PKGVERSION)"\n'; \
292 if
test -d .git
; then \
294 git describe
--match
'v*' 2>/dev
/null | tr
-d
'\n'; \
295 if
! git diff-index
--quiet HEAD
&>/dev
/null
; then \
296 printf
-- '-dirty'; \
303 $(call quiet-command
, if
! cmp
-s
$@
$@.tmp
; then \
309 config-host.h
: config-host.h-timestamp
310 config-host.h-timestamp
: config-host.mak
311 qemu-options.def
: $(SRC_PATH
)/qemu-options.hx
$(SRC_PATH
)/scripts
/hxtool
312 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
314 SUBDIR_RULES
=$(patsubst %,subdir-
%, $(TARGET_DIRS
))
315 SOFTMMU_SUBDIR_RULES
=$(filter %-softmmu
,$(SUBDIR_RULES
))
317 $(SOFTMMU_SUBDIR_RULES
): $(block-obj-y
)
318 $(SOFTMMU_SUBDIR_RULES
): $(crypto-obj-y
)
319 $(SOFTMMU_SUBDIR_RULES
): $(io-obj-y
)
320 $(SOFTMMU_SUBDIR_RULES
): config-all-devices.mak
323 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$* V
="$(V)" TARGET_DIR
="$*/" all,)
325 subdir-pixman
: pixman
/Makefile
326 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C pixman V
="$(V)" all,)
328 pixman
/Makefile
: $(SRC_PATH
)/pixman
/configure
329 (cd pixman
; CFLAGS
="$(CFLAGS) -fPIC $(extra_cflags) $(extra_ldflags)" $(SRC_PATH
)/pixman
/configure
$(AUTOCONF_HOST
) --disable-gtk
--disable-shared
--enable-static
)
331 $(SRC_PATH
)/pixman
/configure
:
332 (cd
$(SRC_PATH
)/pixman
; autoreconf
-v
--install)
334 DTC_MAKE_ARGS
=-I
$(SRC_PATH
)/dtc VPATH
=$(SRC_PATH
)/dtc
-C dtc V
="$(V)" LIBFDT_srcdir
=$(SRC_PATH
)/dtc
/libfdt
335 DTC_CFLAGS
=$(CFLAGS
) $(QEMU_CFLAGS
)
336 DTC_CPPFLAGS
=-I
$(BUILD_DIR
)/dtc
-I
$(SRC_PATH
)/dtc
-I
$(SRC_PATH
)/dtc
/libfdt
338 subdir-dtc
:dtc
/libfdt dtc
/tests
339 $(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
,)
344 $(SUBDIR_RULES
): libqemuutil.a libqemustub.a
$(common-obj-y
) $(chardev-obj-y
) \
345 $(qom-obj-y
) $(crypto-aes-obj-
$(CONFIG_USER_ONLY
)) $(trace-obj-y
)
347 ROMSUBDIR_RULES
=$(patsubst %,romsubdir-
%, $(ROMS
))
348 # Only keep -O and -g cflags
350 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C pc-bios
/$* V
="$(V)" TARGET_DIR
="$*/" CFLAGS
="$(filter -O% -g%,$(CFLAGS))",)
352 ALL_SUBDIRS
=$(TARGET_DIRS
) $(patsubst %,pc-bios
/%, $(ROMS
))
354 recurse-all
: $(SUBDIR_RULES
) $(ROMSUBDIR_RULES
)
356 $(BUILD_DIR
)/version.o
: $(SRC_PATH
)/version.rc config-host.h
357 $(call quiet-command
,$(WINDRES
) -I
$(BUILD_DIR
) -o
$@
$<,"RC","version.o")
359 Makefile
: $(version-obj-y
)
361 ######################################################################
364 libqemustub.a
: $(stub-obj-y
)
365 libqemuutil.a
: $(util-obj-y
)
367 ######################################################################
369 COMMON_LDADDS
= $(trace-obj-y
) libqemuutil.a libqemustub.a
371 qemu-img.o
: qemu-img-cmds.h
373 qemu-img
$(EXESUF
): qemu-img.o
$(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
374 qemu-nbd
$(EXESUF
): qemu-nbd.o
$(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
375 qemu-io
$(EXESUF
): qemu-io.o
$(block-obj-y
) $(crypto-obj-y
) $(io-obj-y
) $(qom-obj-y
) $(COMMON_LDADDS
)
377 qemu-bridge-helper
$(EXESUF
): qemu-bridge-helper.o
$(COMMON_LDADDS
)
379 fsdev
/virtfs-proxy-helper
$(EXESUF
): fsdev
/virtfs-proxy-helper.o fsdev
/9p-marshal.o fsdev
/9p-iov-marshal.o
$(COMMON_LDADDS
)
380 fsdev
/virtfs-proxy-helper
$(EXESUF
): LIBS
+= -lcap
382 qemu-img-cmds.h
: $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/scripts
/hxtool
383 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
,"GEN","$@")
385 qemu-ga
$(EXESUF
): LIBS
= $(LIBS_QGA
)
386 qemu-ga
$(EXESUF
): QEMU_CFLAGS
+= -I qga
/qapi-generated
388 gen-out-type
= $(subst .
,-,$(suffix $@
))
390 qapi-py
= $(SRC_PATH
)/scripts
/qapi.py
$(SRC_PATH
)/scripts
/ordereddict.py
391 qapi-py
+= $(SRC_PATH
)/scripts
/qapi2texi.py
393 qga
/qapi-generated
/qga-qapi-types.c qga
/qapi-generated
/qga-qapi-types.h
:\
394 $(SRC_PATH
)/qga
/qapi-schema.json
$(SRC_PATH
)/scripts
/qapi-types.py
$(qapi-py
)
395 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-types.py \
396 $(gen-out-type
) -o qga
/qapi-generated
-p
"qga-" $<, \
398 qga
/qapi-generated
/qga-qapi-visit.c qga
/qapi-generated
/qga-qapi-visit.h
:\
399 $(SRC_PATH
)/qga
/qapi-schema.json
$(SRC_PATH
)/scripts
/qapi-visit.py
$(qapi-py
)
400 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-visit.py \
401 $(gen-out-type
) -o qga
/qapi-generated
-p
"qga-" $<, \
403 qga
/qapi-generated
/qga-qmp-commands.h qga
/qapi-generated
/qga-qmp-marshal.c
:\
404 $(SRC_PATH
)/qga
/qapi-schema.json
$(SRC_PATH
)/scripts
/qapi-commands.py
$(qapi-py
)
405 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-commands.py \
406 $(gen-out-type
) -o qga
/qapi-generated
-p
"qga-" $<, \
409 qapi-modules
= $(SRC_PATH
)/qapi-schema.json
$(SRC_PATH
)/qapi
/common.json \
410 $(SRC_PATH
)/qapi
/block.json
$(SRC_PATH
)/qapi
/block-core.json \
411 $(SRC_PATH
)/qapi
/event.json
$(SRC_PATH
)/qapi
/introspect.json \
412 $(SRC_PATH
)/qapi
/crypto.json
$(SRC_PATH
)/qapi
/rocker.json \
413 $(SRC_PATH
)/qapi
/trace.json
415 qapi-types.c qapi-types.h
:\
416 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-types.py
$(qapi-py
)
417 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-types.py \
418 $(gen-out-type
) -o
"." -b
$<, \
420 qapi-visit.c qapi-visit.h
:\
421 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-visit.py
$(qapi-py
)
422 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-visit.py \
423 $(gen-out-type
) -o
"." -b
$<, \
425 qapi-event.c qapi-event.h
:\
426 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-event.py
$(qapi-py
)
427 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-event.py \
428 $(gen-out-type
) -o
"." $<, \
430 qmp-commands.h qmp-marshal.c
:\
431 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-commands.py
$(qapi-py
)
432 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-commands.py \
433 $(gen-out-type
) -o
"." $<, \
435 qmp-introspect.h qmp-introspect.c
:\
436 $(qapi-modules
) $(SRC_PATH
)/scripts
/qapi-introspect.py
$(qapi-py
)
437 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi-introspect.py \
438 $(gen-out-type
) -o
"." $<, \
441 QGALIB_GEN
=$(addprefix qga
/qapi-generated
/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h
)
442 $(qga-obj-y
) qemu-ga.o
: $(QGALIB_GEN
)
444 qemu-ga
$(EXESUF
): $(qga-obj-y
) $(COMMON_LDADDS
)
447 ifdef QEMU_GA_MSI_ENABLED
448 QEMU_GA_MSI
=qemu-ga-
$(ARCH
).msi
452 $(QEMU_GA_MSI
): qemu-ga.exe
$(QGA_VSS_PROVIDER
)
454 $(QEMU_GA_MSI
): config-host.mak
456 $(QEMU_GA_MSI
): $(SRC_PATH
)/qga
/installer
/qemu-ga.wxs
457 $(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)" \
458 wixl
-o
$@
$(QEMU_GA_MSI_ARCH
) $(QEMU_GA_MSI_WITH_VSS
) $(QEMU_GA_MSI_MINGW_DLL_PATH
) $<,"WIXL","$@")
461 @echo
"MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
466 qemu-ga
: qemu-ga
$(EXESUF
) $(QGA_VSS_PROVIDER
) $(QEMU_GA_MSI
)
469 ivshmem-client
$(EXESUF
): $(ivshmem-client-obj-y
) $(COMMON_LDADDS
)
471 ivshmem-server
$(EXESUF
): $(ivshmem-server-obj-y
) $(COMMON_LDADDS
)
474 module_block.h
: $(SRC_PATH
)/scripts
/modules
/module_block.py config-host.mak
475 $(call quiet-command
,$(PYTHON
) $< $@ \
476 $(addprefix $(SRC_PATH
)/,$(patsubst %.mo
,%.c
,$(block-obj-m
))), \
480 # avoid old build problems by removing potentially incorrect old files
481 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
482 rm -f qemu-options.def
484 find . \
( -name
'*.so' -o
-name
'*.dll' -o
-name
'*.mo' -o
-name
'*.[oda]' \
) -type f
-exec
rm {} +
485 rm -f
$(filter-out %.tlb
,$(TOOLS
)) $(HELPERS-y
) qemu-ga TAGS cscope.
* *.pod
*~
*/*~
487 rm -f qemu-img-cmds.h
488 rm -f ui
/shader
/*-vert.h ui
/shader
/*-frag.h
489 @
# May not be present in GENERATED_FILES
490 rm -f trace
/generated-tracers-dtrace.dtrace
*
491 rm -f trace
/generated-tracers-dtrace.h
*
492 rm -f
$(foreach f
,$(GENERATED_FILES
),$(f
) $(f
)-timestamp
)
493 rm -rf qapi-generated
494 rm -rf qga
/qapi-generated
495 for d in
$(ALL_SUBDIRS
); do \
496 if
test -d
$$d; then
$(MAKE
) -C
$$d $@ || exit
1; fi
; \
497 rm -f
$$d/qemu-options.def
; \
499 rm -f
$(SUBDIR_DEVICES_MAK
) config-all-devices.mak
501 VERSION ?
= $(shell cat VERSION
)
503 dist: qemu-
$(VERSION
).
tar.bz2
506 $(SRC_PATH
)/scripts
/make-release
"$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
509 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
510 rm -f config-all-devices.mak config-all-disas.mak config.status
511 rm -f po
/*.mo tests
/qemu-iotests
/common.env
512 rm -f roms
/seabios
/config.mak roms
/vgabios
/config.mak
513 rm -f qemu-doc.
info qemu-doc.aux qemu-doc.cp qemu-doc.cps
514 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.
info qemu-doc.ky qemu-doc.kys
515 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
516 rm -f qemu-doc.vr qemu-doc.txt
518 rm -f linux-headers
/asm
519 rm -f qemu-ga-qapi.texi qemu-qapi.texi version.texi
520 rm -f docs
/qemu-qmp-ref
.7 docs
/qemu-ga-ref
.7
521 rm -f docs
/qemu-qmp-ref.txt docs
/qemu-ga-ref.txt
522 rm -f docs
/qemu-qmp-ref.pdf docs
/qemu-ga-ref.pdf
523 rm -f docs
/qemu-qmp-ref.html docs
/qemu-ga-ref.html
524 for d in
$(TARGET_DIRS
); do \
525 rm -rf
$$d || exit
1 ; \
528 if
test -f pixman
/config.log
; then
$(MAKE
) -C pixman
distclean; fi
529 if
test -f dtc
/version_gen.h
; then
$(MAKE
) $(DTC_MAKE_ARGS
) clean; fi
531 KEYMAPS
=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
532 ar de en-us fi fr-be hr it lv nl pl ru th \
533 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr \
537 BLOBS
=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
538 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
540 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU
,tcx.bin QEMU
,cgthree.bin \
541 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
542 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
543 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
544 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
545 efi-e1000e.rom efi-vmxnet3.rom \
546 qemu-icon.bmp qemu_logo_no_text.svg \
547 bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
548 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \
550 spapr-rtas.bin slof.bin skiboot.lid \
558 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_docdir)"
559 $(INSTALL_DATA
) qemu-doc.html
"$(DESTDIR)$(qemu_docdir)"
560 $(INSTALL_DATA
) qemu-doc.txt
"$(DESTDIR)$(qemu_docdir)"
561 $(INSTALL_DATA
) docs
/qemu-qmp-ref.html
"$(DESTDIR)$(qemu_docdir)"
562 $(INSTALL_DATA
) docs
/qemu-qmp-ref.txt
"$(DESTDIR)$(qemu_docdir)"
564 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
565 $(INSTALL_DATA
) qemu
.1 "$(DESTDIR)$(mandir)/man1"
566 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man7"
567 $(INSTALL_DATA
) docs
/qemu-qmp-ref
.7 "$(DESTDIR)$(mandir)/man7"
569 $(INSTALL_DATA
) qemu-img
.1 "$(DESTDIR)$(mandir)/man1"
570 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man8"
571 $(INSTALL_DATA
) qemu-nbd
.8 "$(DESTDIR)$(mandir)/man8"
573 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
574 $(INSTALL_DATA
) qemu-ga
.8 "$(DESTDIR)$(mandir)/man8"
575 $(INSTALL_DATA
) docs
/qemu-ga-ref.html
"$(DESTDIR)$(qemu_docdir)"
576 $(INSTALL_DATA
) docs
/qemu-ga-ref.txt
"$(DESTDIR)$(qemu_docdir)"
577 $(INSTALL_DATA
) docs
/qemu-ga-ref
.7 "$(DESTDIR)$(mandir)/man7"
581 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
582 $(INSTALL_DATA
) fsdev
/virtfs-proxy-helper
.1 "$(DESTDIR)$(mandir)/man1"
586 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)"
588 install-localstatedir
:
590 ifneq (,$(findstring qemu-ga
,$(TOOLS
)))
591 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_localstatedir)"/run
596 install: all $(if
$(BUILD_DOCS
),install-doc
) install-datadir install-localstatedir
598 $(call install-prog
,$(subst qemu-ga
,qemu-ga
$(EXESUF
),$(TOOLS
)),$(DESTDIR
)$(bindir))
600 ifneq ($(CONFIG_MODULES
),)
601 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_moddir)"
602 for s in
$(modules-m
:.mo
=$(DSOSUF
)); do \
603 t
="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
604 $(INSTALL_LIB
) $$s "$$t"; \
605 test -z
"$(STRIP)" ||
$(STRIP
) "$$t"; \
608 ifneq ($(HELPERS-y
),)
609 $(call install-prog
,$(HELPERS-y
),$(DESTDIR
)$(libexecdir
))
612 set
-e
; for x in
$(BLOBS
); do \
613 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/$$x "$(DESTDIR)$(qemu_datadir)"; \
616 ifeq ($(CONFIG_GTK
),y
)
619 $(INSTALL_DIR
) "$(DESTDIR)$(qemu_datadir)/keymaps"
620 set
-e
; for x in
$(KEYMAPS
); do \
621 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/keymaps
/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
623 $(INSTALL_DATA
) $(BUILD_DIR
)/trace-events-all
"$(DESTDIR)$(qemu_datadir)/trace-events-all"
624 for d in
$(TARGET_DIRS
); do \
625 $(MAKE
) $(SUBDIR_MAKEFLAGS
) TARGET_DIR
=$$d/ -C
$$d $@ || exit
1 ; \
628 # various test targets
630 $(MAKE
) -C tests
/tcg
$@
635 find
"$(SRC_PATH)" -name
'*.[hc]' -exec ctags
--append
{} +
640 find
"$(SRC_PATH)" -name
'*.[hc]' -exec etags
--append
{} +
643 rm -f
"$(SRC_PATH)"/cscope.
*
644 find
"$(SRC_PATH)/" -name
"*.[chsS]" -print | sed
's,^\./,,' > "$(SRC_PATH)/cscope.files"
645 cscope
-b
-i
"$(SRC_PATH)/cscope.files"
647 # opengl shader programs
648 ui
/shader
/%-vert.h
: $(SRC_PATH
)/ui
/shader
/%.vert
$(SRC_PATH
)/scripts
/shaderinclude.pl
650 $(call quiet-command
,\
651 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
654 ui
/shader
/%-frag.h
: $(SRC_PATH
)/ui
/shader
/%.frag
$(SRC_PATH
)/scripts
/shaderinclude.pl
656 $(call quiet-command
,\
657 perl
$(SRC_PATH
)/scripts
/shaderinclude.pl
$< > $@
,\
660 ui
/console-gl.o
: $(SRC_PATH
)/ui
/console-gl.c \
661 ui
/shader
/texture-blit-vert.h ui
/shader
/texture-blit-frag.h
665 MAKEINFOFLAGS
=--no-split
--number-sections
666 TEXIFLAG
=$(if
$(V
),,--quiet
)
668 version.texi
: $(SRC_PATH
)/VERSION
669 $(call quiet-command
,echo
"@set VERSION $(VERSION)" > $@
,"GEN","$@")
671 %.html
: %.texi version.texi
672 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
673 --html
$< -o
$@
,"GEN","$@")
675 %.
info: %.texi version.texi
676 $(call quiet-command
,$(MAKEINFO
) $(MAKEINFOFLAGS
) $< -o
$@
,"GEN","$@")
678 %.txt
: %.texi version.texi
679 $(call quiet-command
,LC_ALL
=C
$(MAKEINFO
) $(MAKEINFOFLAGS
) --no-headers \
680 --plaintext
$< -o
$@
,"GEN","$@")
682 %.pdf
: %.texi version.texi
683 $(call quiet-command
,texi2pdf
$(TEXIFLAG
) -I
$(SRC_PATH
) -I .
$< -o
$@
,"GEN","$@")
685 qemu-options.texi
: $(SRC_PATH
)/qemu-options.hx
$(SRC_PATH
)/scripts
/hxtool
686 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
688 qemu-monitor.texi
: $(SRC_PATH
)/hmp-commands.hx
$(SRC_PATH
)/scripts
/hxtool
689 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
691 qemu-monitor-info.texi
: $(SRC_PATH
)/hmp-commands-info.hx
$(SRC_PATH
)/scripts
/hxtool
692 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
694 qemu-img-cmds.texi
: $(SRC_PATH
)/qemu-img-cmds.hx
$(SRC_PATH
)/scripts
/hxtool
695 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
,"GEN","$@")
697 qemu-qapi.texi
: $(qapi-modules
) $(qapi-py
)
698 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi2texi.py
$< > $@
,"GEN","$@")
700 qemu-ga-qapi.texi
: $(SRC_PATH
)/qga
/qapi-schema.json
$(qapi-py
)
701 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/qapi2texi.py
$< > $@
,"GEN","$@")
703 qemu
.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
704 qemu
.1: qemu-option-trace.texi
705 qemu-img
.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
706 fsdev
/virtfs-proxy-helper
.1: fsdev
/virtfs-proxy-helper.texi
707 qemu-nbd
.8: qemu-nbd.texi qemu-option-trace.texi
708 qemu-ga
.8: qemu-ga.texi
710 html
: qemu-doc.html docs
/qemu-qmp-ref.html docs
/qemu-ga-ref.html
711 info: qemu-doc.
info docs
/qemu-qmp-ref.
info docs
/qemu-ga-ref.
info
712 pdf
: qemu-doc.pdf docs
/qemu-qmp-ref.pdf docs
/qemu-ga-ref.pdf
713 txt
: qemu-doc.txt docs
/qemu-qmp-ref.txt docs
/qemu-ga-ref.txt
715 qemu-doc.html qemu-doc.
info qemu-doc.pdf qemu-doc.txt
: \
716 qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \
717 qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
718 qemu-monitor-info.texi
720 docs
/qemu-ga-ref.
dvi docs
/qemu-ga-ref.html docs
/qemu-ga-ref.
info docs
/qemu-ga-ref.pdf docs
/qemu-ga-ref.txt docs
/qemu-ga-ref
.7: \
721 docs
/qemu-ga-ref.texi qemu-ga-qapi.texi
723 docs
/qemu-qmp-ref.
dvi docs
/qemu-qmp-ref.html docs
/qemu-qmp-ref.
info docs
/qemu-qmp-ref.pdf docs
/qemu-qmp-ref.txt docs
/qemu-qmp-ref
.7: \
724 docs
/qemu-qmp-ref.texi qemu-qapi.texi
729 INSTALLER
= qemu-setup-
$(VERSION
)$(EXESUF
)
731 nsisflags
= -V2
-NOCD
733 ifneq ($(wildcard $(SRC_PATH
)/dll
),)
734 ifeq ($(ARCH
),x86_64
)
736 DLL_PATH
= $(SRC_PATH
)/dll
/w64
740 DLL_PATH
= $(SRC_PATH
)/dll
/w32
745 installer
: $(INSTALLER
)
747 INSTDIR
=/tmp
/qemu-nsis
749 $(INSTALLER
): $(SRC_PATH
)/qemu.nsi
750 $(MAKE
) install prefix=${INSTDIR}
759 for i in qemu-system-
*.exe
; do \
761 arch
=$${arch
#qemu-system-}; \
762 echo Section
\"$$arch\" Section_
$$arch; \
763 echo SetOutPath
\"\
$$INSTDIR\"; \
764 echo File
\"\
$${BINDIR}\\$$i\"; \
767 ) >${INSTDIR}/system-emulations.nsh
768 makensis
$(nsisflags
) \
769 $(if
$(BUILD_DOCS
),-DCONFIG_DOCUMENTATION
="y") \
770 $(if
$(CONFIG_GTK
),-DCONFIG_GTK
="y") \
771 -DBINDIR
="${INSTDIR}" \
772 $(if
$(DLL_PATH
),-DDLLDIR
="$(DLL_PATH)") \
773 -DSRCDIR
="$(SRC_PATH)" \
774 -DOUTFILE
="$(INSTALLER)" \
775 -DDISPLAYVERSION
="$(VERSION)" \
779 $(SIGNCODE
) $(INSTALLER
)
783 # Add a dependency on the generated files, so that they are always
784 # rebuilt before other object files
785 ifneq ($(filter-out $(UNCHECKED_GOALS
),$(MAKECMDGOALS
)),$(if
$(MAKECMDGOALS
),,fail
))
786 Makefile
: $(GENERATED_FILES
)
789 .SECONDARY
: $(TRACE_HEADERS
) $(TRACE_HEADERS
:%=%-timestamp
) \
790 $(TRACE_SOURCES
) $(TRACE_SOURCES
:%=%-timestamp
) \
791 $(TRACE_DTRACE
) $(TRACE_DTRACE
:%=%-timestamp
)
793 # Include automatically generated dependency files
794 # Dependencies in Makefile.objs files come from our recursive subdir rules
795 -include $(wildcard *.d tests
/*.d
)
797 include $(SRC_PATH
)/tests
/docker
/Makefile.
include
801 @echo
'Generic targets:'
802 @echo
' all - Build all'
803 @echo
' dir/file.o - Build specified target only'
804 @echo
' install - Install QEMU, documentation and tools'
805 @echo
' ctags/TAGS - Generate tags file for editors'
806 @echo
' cscope - Generate cscope index'
808 @
$(if
$(TARGET_DIRS
), \
809 echo
'Architecture specific targets:'; \
810 $(foreach t
, $(TARGET_DIRS
), \
811 printf
" %-30s - Build for %s\\n" $(patsubst %,subdir-
%,$(t
)) $(t
);) \
813 @echo
'Cleaning targets:'
814 @echo
' clean - Remove most generated files but keep the config'
815 @echo
' distclean - Remove all generated files'
816 @echo
' dist - Build a distributable tarball'
818 @echo
'Test targets:'
819 @echo
' check - Run all tests (check-help for details)'
820 @echo
' docker - Help about targets running tests inside Docker containers'
822 @echo
'Documentation targets:'
823 @echo
' html info pdf txt'
824 @echo
' - Build documentation in specified format'
827 @echo
'Windows targets:'
828 @echo
' installer - Build NSIS-based installer for QEMU'
829 ifdef QEMU_GA_MSI_ENABLED
830 @echo
' msi - Build MSI-based installer for qemu-ga'
834 @echo
' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'