3 GENERATED_HEADERS
= config-host.h trace.h qemu-options.def
4 ifeq ($(TRACE_BACKEND
),dtrace
)
5 GENERATED_HEADERS
+= trace-dtrace.h
8 QEMU_CFLAGS
+=-I
$(SRC_PATH
)/include
10 ifneq ($(wildcard config-host.mak
),)
11 # Put the all: rule here so that config-host.mak can contain dependencies.
13 include config-host.mak
14 include $(SRC_PATH
)/rules.mak
15 config-host.mak
: $(SRC_PATH
)/configure
16 @echo
$@ is out-of-date
, running configure
17 @sed
-n
"/.*Configured with/s/[^:]*: //p" $@ | sh
20 @echo
"Please call configure before running make!"
24 # Don't try to regenerate Makefile or configure
25 # We don't generate any of them
29 .PHONY
: all clean cscope
distclean dvi html
info install install-doc \
30 pdf recurse-all speed
tar tarbin
test build-all
32 $(call set-vpath
, $(SRC_PATH
):$(SRC_PATH
)/hw
)
34 LIBS
+=-lz
$(LIBS_TOOLS
)
37 DOCS
=qemu-doc.html qemu-tech.html qemu
.1 qemu-img
.1 qemu-nbd
.8 QMP
/qmp-commands.txt
42 SUBDIR_MAKEFLAGS
=$(if
$(V
),,--no-print-directory
)
43 SUBDIR_DEVICES_MAK
=$(patsubst %, %/config-devices.mak
, $(TARGET_DIRS
))
44 SUBDIR_DEVICES_MAK_DEP
=$(patsubst %, %/config-devices.mak.d
, $(TARGET_DIRS
))
46 config-all-devices.mak
: $(SUBDIR_DEVICES_MAK
)
47 $(call quiet-command
,cat
$(SUBDIR_DEVICES_MAK
) | grep
=y |
sort -u
> $@
," GEN $@")
49 -include $(SUBDIR_DEVICES_MAK_DEP
)
51 %/config-devices.mak
: default-configs
/%.mak
52 $(call quiet-command
,$(SHELL
) $(SRC_PATH
)/scripts
/make_device_config.sh
$@
$<, " GEN $@")
53 @if
test -f
$@
; then \
54 if cmp
-s
$@.old
$@
; then \
58 if
test -f
$@.old
; then \
59 echo
"WARNING: $@ (user modified) out of date.";\
61 echo
"WARNING: $@ out of date.";\
63 echo
"Run \"make defconfig\" to regenerate."; \
72 rm -f config-all-devices.mak
$(SUBDIR_DEVICES_MAK
)
74 -include config-all-devices.mak
76 build-all
: $(DOCS
) $(TOOLS
) recurse-all
78 config-host.h
: config-host.h-timestamp
79 config-host.h-timestamp
: config-host.mak
80 qemu-options.def
: $(SRC_PATH
)/qemu-options.hx
81 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
," GEN $@")
83 SUBDIR_RULES
=$(patsubst %,subdir-
%, $(TARGET_DIRS
))
85 subdir-
%: $(GENERATED_HEADERS
)
86 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C
$* V
="$(V)" TARGET_DIR
="$*/" all,)
88 ifneq ($(wildcard config-host.mak
),)
89 include $(SRC_PATH
)/Makefile.objs
92 $(common-obj-y
): $(GENERATED_HEADERS
)
93 subdir-libcacard
: $(oslib-obj-y
) $(trace-obj-y
) qemu-malloc.o qemu-timer-common.o
95 $(filter %-softmmu
,$(SUBDIR_RULES
)): $(trace-obj-y
) $(common-obj-y
) subdir-libdis
97 $(filter %-user
,$(SUBDIR_RULES
)): $(GENERATED_HEADERS
) $(trace-obj-y
) subdir-libdis-user subdir-libuser
99 ROMSUBDIR_RULES
=$(patsubst %,romsubdir-
%, $(ROMS
))
101 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C pc-bios
/$* V
="$(V)" TARGET_DIR
="$*/",)
103 ALL_SUBDIRS
=$(TARGET_DIRS
) $(patsubst %,pc-bios
/%, $(ROMS
))
105 recurse-all
: $(SUBDIR_RULES
) $(ROMSUBDIR_RULES
)
107 audio
/audio.o audio
/fmodaudio.o
: QEMU_CFLAGS
+= $(FMOD_CFLAGS
)
109 QEMU_CFLAGS
+=$(CURL_CFLAGS
)
111 QEMU_CFLAGS
+=$(GLIB_CFLAGS
)
113 ui
/cocoa.o
: ui
/cocoa.m
115 ui
/sdl.o audio
/sdlaudio.o ui
/sdl_zoom.o baum.o
: QEMU_CFLAGS
+= $(SDL_CFLAGS
)
117 ui
/vnc.o
: QEMU_CFLAGS
+= $(VNC_TLS_CFLAGS
)
119 bt-host.o
: QEMU_CFLAGS
+= $(BLUEZ_CFLAGS
)
121 version.o
: $(SRC_PATH
)/version.rc config-host.mak
122 $(call quiet-command
,$(WINDRES
) -I.
-o
$@
$<," RC $(TARGET_DIR)$@")
124 version-obj-
$(CONFIG_WIN32
) += version.o
125 ######################################################################
126 # Support building shared library libcacard
128 .PHONY
: libcacard.la install-libcacard
131 @echo
"libtool is missing, please install and rerun configure"; exit
1
134 @echo
"libtool is missing, please install and rerun configure"; exit
1
136 libcacard.la
: $(GENERATED_HEADERS
) $(oslib-obj-y
) qemu-malloc.o qemu-timer-common.o
$(addsuffix .lo
, $(basename $(trace-obj-y
)))
137 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C libcacard V
="$(V)" TARGET_DIR
="$*/" libcacard.la
,)
139 install-libcacard
: libcacard.la
140 $(call quiet-command
,$(MAKE
) $(SUBDIR_MAKEFLAGS
) -C libcacard V
="$(V)" TARGET_DIR
="$*/" install-libcacard
,)
143 ######################################################################
145 dev-obj-y
:= type.o plug-proptypes.o plug.o
147 qapi-obj-y
:= qapi
/qapi-visit-core.o error.o qapi
/qmp-output-visitor.o
148 qapi-obj-y
+= qapi
/qmp-input-visitor.o qdict.o qstring.o qint.o qbool.o
149 qapi-obj-y
+= qlist.o qjson.o qfloat.o qjson.o json-streamer.o json-parser.o
150 qapi-obj-y
+= json-lexer.o string-visitor.o cutils.o
152 test-type-obj-y
:= qemu-malloc.o
$(oslib-obj-y
)
153 test-type-obj-y
+= $(addprefix devices
/,$(dev-obj-y
)) $(qapi-obj-y
)
154 test-type-obj-y
+= test-type-stub.o
156 test-type
$(EXESUF
): test-type.o qemu-malloc.o type.o
$(oslib-obj-y
)
157 test-variant
$(EXESUF
): test-variant.o qemu-malloc.o type.o
$(oslib-obj-y
)
158 test-i440fx
$(EXESUF
): test-i440fx.o
$(addprefix devices
/,device.o pci_bus.o pci_device.o rom.o
pc/i440fx.o
) $(test-type-obj-y
)
160 chrdrv
/test-mem
$(EXESUF
): chrdrv
/test-mem.o chrdrv
/chrdrv.o chrdrv
/mem.o
$(test-type-obj-y
)
161 chrdrv
/test-tcp
$(EXESUF
): chrdrv
/test-tcp.o chrdrv
/chrdrv.o chrdrv
/socket.o chrdrv
/tcp.o
$(test-type-obj-y
)
164 ######################################################################
166 qemu-img.o
: qemu-img-cmds.h
167 qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o cmd.o
: $(GENERATED_HEADERS
)
169 qemu-img
$(EXESUF
): qemu-img.o qemu-tool.o qemu-error.o
$(oslib-obj-y
) $(trace-obj-y
) $(block-obj-y
) $(qobject-obj-y
) $(version-obj-y
) qemu-timer-common.o
171 qemu-nbd
$(EXESUF
): qemu-nbd.o qemu-tool.o qemu-error.o
$(oslib-obj-y
) $(trace-obj-y
) $(block-obj-y
) $(qobject-obj-y
) $(version-obj-y
) qemu-timer-common.o
173 qemu-io
$(EXESUF
): qemu-io.o cmd.o qemu-tool.o qemu-error.o
$(oslib-obj-y
) $(trace-obj-y
) $(block-obj-y
) $(qobject-obj-y
) $(version-obj-y
) qemu-timer-common.o
175 qemu-img-cmds.h
: $(SRC_PATH
)/qemu-img-cmds.hx
176 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-h
< $< > $@
," GEN $@")
178 check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o
: $(GENERATED_HEADERS
)
180 CHECK_PROG_DEPS
= qemu-malloc.o
$(oslib-obj-y
) $(trace-obj-y
) qemu-tool.o
182 check-qint
: check-qint.o qint.o
$(CHECK_PROG_DEPS
)
183 check-qstring
: check-qstring.o qstring.o
$(CHECK_PROG_DEPS
)
184 check-qdict
: check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o
$(CHECK_PROG_DEPS
)
185 check-qlist
: check-qlist.o qlist.o qint.o
$(CHECK_PROG_DEPS
)
186 check-qfloat
: check-qfloat.o qfloat.o
$(CHECK_PROG_DEPS
)
187 check-qjson
: check-qjson.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o qjson.o json-streamer.o json-lexer.o json-parser.o error.o qerror.o qemu-error.o
$(CHECK_PROG_DEPS
)
189 qapi-dir
:= qapi-generated
190 $(qapi-obj-y
) test-visitor.o test-qmp-commands.o
: QEMU_CFLAGS
+= -I
$(qapi-dir
)
192 $(qapi-dir
)/test-qapi-types.c
: $(qapi-dir
)/test-qapi-types.h
193 $(qapi-dir
)/test-qapi-types.h
: $(SRC_PATH
)/qapi-schema-test.json
$(SRC_PATH
)/scripts
/qapi-types.py
194 $(call quiet-command
,python
$(SRC_PATH
)/scripts
/qapi-types.py
-o
"$(qapi-dir)" -p
"test-" < $<, " GEN $@")
195 $(qapi-dir
)/test-qapi-visit.c
: $(qapi-dir
)/test-qapi-visit.h
196 $(qapi-dir
)/test-qapi-visit.h
: $(SRC_PATH
)/qapi-schema-test.json
$(SRC_PATH
)/scripts
/qapi-visit.py
197 $(call quiet-command
,python
$(SRC_PATH
)/scripts
/qapi-visit.py
-o
"$(qapi-dir)" -p
"test-" < $<, " GEN $@")
198 $(qapi-dir
)/test-qmp-commands.h
: $(qapi-dir
)/test-qmp-marshal.c
199 $(qapi-dir
)/test-qmp-marshal.c
: $(SRC_PATH
)/qapi-schema-test.json
$(SRC_PATH
)/scripts
/qapi-commands.py
200 $(call quiet-command
,python
$(SRC_PATH
)/scripts
/qapi-commands.py
-o
"$(qapi-dir)" -p
"test-" < $<, " GEN $@")
202 qobject-obj-y
= qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o error.o qjson.o json-streamer.o json-lexer.o json-parser.o qerror.o qemu-error.o
203 test-visitor.o
: $(addprefix $(qapi-dir
)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h
)
204 test-visitor
: test-visitor.o
$(qapi-obj-y
) $(qobject-obj-y
) osdep.o qemu-malloc.o
$(oslib-obj-y
) qjson.o json-streamer.o json-lexer.o json-parser.o qerror.o qemu-error.o qemu-tool.o
$(qapi-dir
)/test-qapi-visit.o
$(qapi-dir
)/test-qapi-types.o
206 test-qmp-commands.o
: $(addprefix $(qapi-dir
)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h test-qmp-marshal.c test-qmp-commands.h
)
207 test-qmp-commands
: test-qmp-commands.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o
$(qapi-obj-y
) error.o osdep.o qemu-malloc.o
$(oslib-obj-y
) qjson.o json-streamer.o json-lexer.o json-parser.o qerror.o qemu-error.o qemu-tool.o
$(qapi-dir
)/test-qapi-visit.o
$(qapi-dir
)/test-qapi-types.o
$(qapi-dir
)/test-qmp-marshal.o module.o
209 test-plug
$(EXESUF
): test-plug.o qemu-malloc.o plug.o plug-proptypes.o type.o
$(oslib-obj-y
) qapi
/qapi-visit-core.o
$(qobject-obj-y
) qjson.o qemu-tool.o
211 test-device
$(EXESUF
): test-device.o qemu-malloc.o device.o plug.o plug-proptypes.o type.o
$(oslib-obj-y
) qapi
/qapi-visit-core.o
$(qobject-obj-y
) qjson.o qemu-tool.o
213 QEMULIBS
=libhw32 libhw64 libuser libdis libdis-user
216 # avoid old build problems by removing potentially incorrect old files
217 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
218 rm -f qemu-options.def
219 rm -f
*.o
*.d
*.a
*.lo
$(TOOLS
) TAGS cscope.
* *.pod
*~
*/*~
221 rm -f slirp
/*.o slirp
/*.d audio
/*.o audio
/*.d block
/*.o block
/*.d net
/*.o net
/*.d fsdev
/*.o fsdev
/*.d ui
/*.o ui
/*.d qapi
/*.o qapi
/*.d
222 rm -f qemu-img-cmds.h
223 rm -f trace.c trace.h trace.c-timestamp trace.h-timestamp
224 rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
225 rm -f trace-dtrace.h trace-dtrace.h-timestamp
227 $(MAKE
) -C tests
clean
228 for d in
$(ALL_SUBDIRS
) $(QEMULIBS
) libcacard
; do \
229 if
test -d
$$d; then
$(MAKE
) -C
$$d $@ || exit
1; fi
; \
230 rm -f
$$d/qemu-options.def
; \
234 rm -f config-host.mak config-host.h
* config-host.
ld $(DOCS
) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
235 rm -f config-all-devices.mak
236 rm -f roms
/seabios
/config.mak roms
/vgabios
/config.mak
237 rm -f qemu-doc.
info qemu-doc.aux qemu-doc.cp qemu-doc.cps qemu-doc.
dvi
238 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.
info qemu-doc.ky qemu-doc.kys
239 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
241 rm -f qemu-tech.
info qemu-tech.aux qemu-tech.cp qemu-tech.
dvi qemu-tech.fn qemu-tech.
info qemu-tech.ky qemu-tech.log qemu-tech.pdf qemu-tech.pg qemu-tech.toc qemu-tech.tp qemu-tech.vr
242 for d in
$(TARGET_DIRS
) $(QEMULIBS
); do \
243 rm -rf
$$d || exit
1 ; \
246 KEYMAPS
=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
247 ar de en-us fi fr-be hr it lv nl pl ru th \
248 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
251 BLOBS
=bios.bin vgabios.bin vgabios-cirrus.bin \
252 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \
253 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc \
254 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
255 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
256 bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
258 multiboot.bin linuxboot.bin \
260 spapr-rtas.bin slof.bin
266 $(INSTALL_DIR
) "$(DESTDIR)$(docdir)"
267 $(INSTALL_DATA
) qemu-doc.html qemu-tech.html
"$(DESTDIR)$(docdir)"
269 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man1"
270 $(INSTALL_DATA
) qemu
.1 qemu-img
.1 "$(DESTDIR)$(mandir)/man1"
271 $(INSTALL_DIR
) "$(DESTDIR)$(mandir)/man8"
272 $(INSTALL_DATA
) qemu-nbd
.8 "$(DESTDIR)$(mandir)/man8"
276 $(INSTALL_DIR
) "$(DESTDIR)$(sysconfdir)/qemu"
277 $(INSTALL_DATA
) $(SRC_PATH
)/sysconfigs
/target
/target-x86_64.conf
"$(DESTDIR)$(sysconfdir)/qemu"
279 install: all $(if
$(BUILD_DOCS
),install-doc
) install-sysconfig
280 $(INSTALL_DIR
) "$(DESTDIR)$(bindir)"
282 $(INSTALL_PROG
) $(STRIP_OPT
) $(TOOLS
) "$(DESTDIR)$(bindir)"
285 $(INSTALL_DIR
) "$(DESTDIR)$(datadir)"
286 set
-e
; for x in
$(BLOBS
); do \
287 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/$$x "$(DESTDIR)$(datadir)"; \
290 $(INSTALL_DIR
) "$(DESTDIR)$(datadir)/keymaps"
291 set
-e
; for x in
$(KEYMAPS
); do \
292 $(INSTALL_DATA
) $(SRC_PATH
)/pc-bios
/keymaps
/$$x "$(DESTDIR)$(datadir)/keymaps"; \
294 for d in
$(TARGET_DIRS
); do \
295 $(MAKE
) -C
$$d $@ || exit
1 ; \
298 # various test targets
304 find
"$(SRC_PATH)" -name
'*.[hc]' -print0 | xargs
-0 etags
308 find .
-name
"*.[ch]" -print | sed
's,^\./,,' > .
/cscope.files
313 MAKEINFOFLAGS
=--no-headers
--no-split
--number-sections
314 TEXIFLAG
=$(if
$(V
),,--quiet
)
316 $(call quiet-command
,texi2dvi $(TEXIFLAG
) -I .
$<," GEN $@")
319 $(call quiet-command
,$(MAKEINFO
) $(MAKEINFOFLAGS
) --html
$< -o
$@
, \
323 $(call quiet-command
,$(MAKEINFO
) $< -o
$@
," GEN $@")
326 $(call quiet-command
,texi2pdf
$(TEXIFLAG
) -I .
$<," GEN $@")
328 qemu-options.texi
: $(SRC_PATH
)/qemu-options.hx
329 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
," GEN $@")
331 qemu-monitor.texi
: $(SRC_PATH
)/hmp-commands.hx
332 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
," GEN $@")
334 QMP
/qmp-commands.txt
: $(SRC_PATH
)/qmp-commands.hx
335 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-q
< $< > $@
," GEN $@")
337 qemu-img-cmds.texi
: $(SRC_PATH
)/qemu-img-cmds.hx
338 $(call quiet-command
,sh
$(SRC_PATH
)/scripts
/hxtool
-t
< $< > $@
," GEN $@")
340 qemu
.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
341 $(call quiet-command
, \
342 perl
-Ww
-- $(SRC_PATH
)/scripts
/texi2pod.pl
$< qemu.pod
&& \
343 pod2man
--section
=1 --center
=" " --release
=" " qemu.pod
> $@
, \
346 qemu-img
.1: qemu-img.texi qemu-img-cmds.texi
347 $(call quiet-command
, \
348 perl
-Ww
-- $(SRC_PATH
)/scripts
/texi2pod.pl
$< qemu-img.pod
&& \
349 pod2man
--section
=1 --center
=" " --release
=" " qemu-img.pod
> $@
, \
352 qemu-nbd
.8: qemu-nbd.texi
353 $(call quiet-command
, \
354 perl
-Ww
-- $(SRC_PATH
)/scripts
/texi2pod.pl
$< qemu-nbd.pod
&& \
355 pod2man
--section
=8 --center
=" " --release
=" " qemu-nbd.pod
> $@
, \
358 dvi: qemu-doc.
dvi qemu-tech.
dvi
359 html
: qemu-doc.html qemu-tech.html
360 info: qemu-doc.
info qemu-tech.
info
361 pdf
: qemu-doc.pdf qemu-tech.pdf
363 qemu-doc.
dvi qemu-doc.html qemu-doc.
info qemu-doc.pdf
: \
364 qemu-img.texi qemu-nbd.texi qemu-options.texi \
365 qemu-monitor.texi qemu-img-cmds.texi
367 VERSION ?
= $(shell cat VERSION
)
368 FILE
= qemu-
$(VERSION
)
370 # tar release (use 'make -k tar' on a checkouted tree)
374 cd
/tmp
&& tar zcvf ~
/$(FILE
).
tar.gz
$(FILE
) --exclude CVS
--exclude .git
--exclude .svn
377 SYSTEM_TARGETS
=$(filter %-softmmu
,$(TARGET_DIRS
))
378 SYSTEM_PROGS
=$(patsubst qemu-system-i386
,qemu
, \
379 $(patsubst %-softmmu
,qemu-system-
%, \
382 USER_TARGETS
=$(filter %-user
,$(TARGET_DIRS
))
383 USER_PROGS
=$(patsubst %-bsd-user
,qemu-
%, \
384 $(patsubst %-darwin-user
,qemu-
%, \
385 $(patsubst %-linux-user
,qemu-
%, \
388 # generate a binary distribution
390 cd
/ && tar zcvf ~
/qemu-
$(VERSION
)-$(ARCH
).
tar.gz \
391 $(patsubst %,$(bindir)/%, $(SYSTEM_PROGS
)) \
392 $(patsubst %,$(bindir)/%, $(USER_PROGS
)) \
395 $(datadir)/bios.bin \
396 $(datadir)/vgabios.bin \
397 $(datadir)/vgabios-cirrus.bin \
398 $(datadir)/ppc_rom.bin \
399 $(datadir)/openbios-sparc32 \
400 $(datadir)/openbios-sparc64 \
401 $(datadir)/openbios-ppc \
402 $(datadir)/pxe-e1000.rom \
403 $(datadir)/pxe-eepro100.rom \
404 $(datadir)/pxe-ne2k_pci.rom \
405 $(datadir)/pxe-pcnet.rom \
406 $(datadir)/pxe-rtl8139.rom \
407 $(datadir)/pxe-virtio.rom \
408 $(docdir
)/qemu-doc.html \
409 $(docdir
)/qemu-tech.html \
410 $(mandir)/man1
/qemu
.1 \
411 $(mandir)/man1
/qemu-img
.1 \
412 $(mandir)/man8
/qemu-nbd
.8
414 # Include automatically generated dependency files
415 -include $(wildcard *.d audio
/*.d slirp
/*.d block
/*.d net
/*.d ui
/*.d qapi
/*.d
)