]> git.proxmox.com Git - qemu.git/blame - Makefile
qcow2: Split out snapshot functions
[qemu.git] / Makefile
CommitLineData
0cb3fb1e
PB
1# Makefile for QEMU.
2
55d7e8f6 3ifneq ($(wildcard config-host.mak),)
1ad2134f
PB
4# Put the all: rule here so that config-host.mak can contain dependencies.
5all: build-all
ad064840 6include config-host.mak
17759187 7include $(SRC_PATH)/rules.mak
55d7e8f6
AJ
8else
9config-host.mak:
10 @echo "Please call configure before running make!"
11 @exit 1
12endif
766a487a 13
818220f5
AL
14.PHONY: all clean cscope distclean dvi html info install install-doc \
15 recurse-all speed tar tarbin test
0cb3fb1e 16
8c462f8f
PB
17VPATH=$(SRC_PATH):$(SRC_PATH)/hw
18
17759187 19
40293e58
FB
20CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
21LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
3142255c 22
96935aa4 23CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
4fb240a4 24CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
766a487a 25LIBS=
1f50f8d1 26ifdef CONFIG_STATIC
40293e58 27LDFLAGS += -static
1f50f8d1 28endif
cc8ae6de 29ifdef BUILD_DOCS
7a5ca864 30DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
cc8ae6de
PB
31else
32DOCS=
33endif
aa05ae6f 34
e5d355d1
AL
35LIBS+=$(PTHREADLIBS)
36LIBS+=$(CLOCKLIBS)
83f64091 37
7e00eb9b
AL
38ifdef CONFIG_SOLARIS
39LIBS+=-lsocket -lnsl -lresolv
40endif
41
03ff3ca3
AL
42ifdef CONFIG_WIN32
43LIBS+=-lwinmm -lws2_32 -liphlpapi
44endif
45
1ad2134f 46build-all: $(TOOLS) $(DOCS) recurse-all
b9dea4fb 47
55d7e8f6
AJ
48config-host.mak: configure
49ifneq ($(wildcard config-host.mak),)
50 @echo $@ is out-of-date, running configure
052ff921 51 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
55d7e8f6
AJ
52endif
53
0087375e 54SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
cec7d0b6
PB
55SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
56
86e840ee 57subdir-%:
0087375e 58 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
4aa42531 59
cec7d0b6
PB
60$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
61$(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
62
63recurse-all: $(SUBDIR_RULES)
83f64091 64
faf07963
PB
65#######################################################################
66# BLOCK_OBJS is code used by both qemu system emulation and qemu-img
67
d3f24367 68BLOCK_OBJS=cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o
019d6b8f
AL
69BLOCK_OBJS+=block/cow.o block/qcow.o aes.o block/vmdk.o block/cloop.o
70BLOCK_OBJS+=block/dmg.o block/bochs.o block/vpc.o block/vvfat.o
45aba42f 71BLOCK_OBJS+=block/qcow2.o block/qcow2-refcount.o block/qcow2-cluster.o
c142442b 72BLOCK_OBJS+=block/qcow2-snapshot.o
f7d0fe02 73BLOCK_OBJS+=block/parallels.o block/nbd.o
a76bab49 74BLOCK_OBJS+=nbd.o block.o aio.o
03ff3ca3
AL
75
76ifdef CONFIG_WIN32
019d6b8f 77BLOCK_OBJS += block/raw-win32.o
03ff3ca3 78else
3c529d93
AL
79ifdef CONFIG_AIO
80BLOCK_OBJS += posix-aio-compat.o
81endif
019d6b8f 82BLOCK_OBJS += block/raw-posix.o
03ff3ca3
AL
83endif
84
769ce76d
AG
85ifdef CONFIG_CURL
86BLOCK_OBJS += block/curl.o
87endif
88
4fb240a4 89######################################################################
2e2ea909 90# libqemu_common.a: Target independent part of system emulation. The
4fb240a4
FB
91# long term path is to suppress *all* target specific code in case of
92# system emulation, i.e. a single QEMU executable should support all
93# CPUs and machines.
47cea614 94
cd01b4a3 95OBJS=$(BLOCK_OBJS)
87ecb68b 96OBJS+=readline.o console.o
cd01b4a3 97
e9c28334 98OBJS+=irq.o ptimer.o
87ecb68b 99OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
7e7c5e4c 100OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
e9c28334 101OBJS+=tmp105.o lm832x.o eeprom93xx.o tsc2005.o
87ecb68b 102OBJS+=scsi-disk.o cdrom.o
985a03b0 103OBJS+=scsi-generic.o
68063649 104OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
6c9f886c 105OBJS+=usb-serial.o usb-net.o
775616c3 106OBJS+=sd.o ssi-sd.o
e6a6d5ab 107OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
e9c28334 108OBJS+=bt-hci-csr.o
559b90fb 109OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
902b3d5c 110OBJS+=qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o
e9c28334 111OBJS+=msmouse.o ps2.o
90d37239 112OBJS+=qdev.o ssi.o
87ecb68b 113
2e4d9fb1
AJ
114ifdef CONFIG_BRLAPI
115OBJS+= baum.o
116LIBS+=-lbrlapi
117endif
118
4fb240a4
FB
119ifdef CONFIG_WIN32
120OBJS+=tap-win32.o
559b90fb
AL
121else
122OBJS+=migration-exec.o
4fb240a4
FB
123endif
124
125AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
126ifdef CONFIG_SDL
127AUDIO_OBJS += sdlaudio.o
128endif
129ifdef CONFIG_OSS
130AUDIO_OBJS += ossaudio.o
131endif
132ifdef CONFIG_COREAUDIO
133AUDIO_OBJS += coreaudio.o
ca9cc28c 134AUDIO_PT = yes
4fb240a4
FB
135endif
136ifdef CONFIG_ALSA
137AUDIO_OBJS += alsaaudio.o
138endif
139ifdef CONFIG_DSOUND
140AUDIO_OBJS += dsoundaudio.o
141endif
142ifdef CONFIG_FMOD
143AUDIO_OBJS += fmodaudio.o
144audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
145endif
ca9cc28c
AZ
146ifdef CONFIG_ESD
147AUDIO_PT = yes
148AUDIO_PT_INT = yes
149AUDIO_OBJS += esdaudio.o
150endif
b8e59f18 151ifdef CONFIG_PA
152AUDIO_PT = yes
153AUDIO_PT_INT = yes
154AUDIO_OBJS += paaudio.o
155endif
ca9cc28c
AZ
156ifdef AUDIO_PT
157LDFLAGS += -pthread
158endif
159ifdef AUDIO_PT_INT
160AUDIO_OBJS += audio_pt_int.o
161endif
4fb240a4
FB
162AUDIO_OBJS+= wavcapture.o
163OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
164
0483755a 165OBJS+=keymaps.o
4fb240a4
FB
166ifdef CONFIG_SDL
167OBJS+=sdl.o x_keymap.o
168endif
4d3b6f6e
AZ
169ifdef CONFIG_CURSES
170OBJS+=curses.o
171endif
76655d6d 172OBJS+=vnc.o acl.o d3des.o
5fb6c7a8
AL
173ifdef CONFIG_VNC_TLS
174OBJS+=vnc-tls.o vnc-auth-vencrypt.o
175endif
2f9606b3
AL
176ifdef CONFIG_VNC_SASL
177OBJS+=vnc-auth-sasl.o
178endif
4fb240a4
FB
179
180ifdef CONFIG_COCOA
181OBJS+=cocoa.o
182endif
183
e5d355d1
AL
184ifdef CONFIG_IOTHREAD
185OBJS+=qemu-thread.o
186endif
187
4fb240a4
FB
188ifdef CONFIG_SLIRP
189CPPFLAGS+=-I$(SRC_PATH)/slirp
190SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
191slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
192tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
193OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
194endif
195
8a16d273
TS
196LIBS+=$(VDE_LIBS)
197
2567f579
BS
198# xen backend driver support
199XEN_OBJS := xen_backend.o xen_devconfig.o
200XEN_OBJS += xen_console.o xenfb.o xen_disk.o xen_nic.o
201ifdef CONFIG_XEN
202 OBJS += $(XEN_OBJS)
203endif
204
769ce76d
AG
205LIBS+=$(CURL_LIBS)
206
4fb240a4 207cocoa.o: cocoa.m
4fb240a4 208
0483755a
AL
209keymaps.o: keymaps.c keymaps.h
210
211sdl.o: sdl.c keymaps.h sdl_keysym.h
807544e2 212
537fe2d6 213sdl.o audio/sdlaudio.o baum.o: CFLAGS += $(SDL_CFLAGS)
4fb240a4 214
76655d6d
AL
215acl.o: acl.h acl.c
216
2f9606b3 217vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
5fb6c7a8 218
76655d6d 219vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h
4fb240a4 220
807544e2 221vnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
4d3b6f6e 222
5fb6c7a8
AL
223vnc-tls.o: vnc-tls.c vnc.h
224
225vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h
226
2f9606b3
AL
227vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h
228
0483755a 229curses.o: curses.c keymaps.h curses_keys.h
fb599c9a 230
807544e2 231bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)
4fb240a4
FB
232
233libqemu_common.a: $(OBJS)
4fb240a4 234
cec7d0b6
PB
235#######################################################################
236# USER_OBJS is code used by qemu userspace emulation
902b3d5c 237USER_OBJS=cutils.o cache-utils.o
cec7d0b6
PB
238
239libqemu_user.a: $(USER_OBJS)
cec7d0b6 240
4fb240a4
FB
241######################################################################
242
153859be
SB
243qemu-img.o: qemu-img-cmds.h
244
88ca2a59 245qemu-img$(EXESUF): qemu-img.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
4fb240a4 246
88ca2a59 247qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
3aa892d7 248
88ca2a59 249qemu-io$(EXESUF): qemu-io.o qemu-tool.o tool-osdep.o cmd.o $(BLOCK_OBJS)
0a8e1acd
AL
250
251qemu-img$(EXESUF) qemu-nbd$(EXESUF) qemu-io$(EXESUF): LIBS += -lz
7a5ca864 252
153859be
SB
253qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
254 $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $@")
255
31e31b8a 256clean:
2d80ae89 257# avoid old build problems by removing potentially incorrect old files
5fafdf24 258 rm -f config.mak config.h op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
86e840ee 259 rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
019d6b8f 260 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d
07b44ce9 261 rm -f qemu-img-cmds.h
7d3505c5 262 $(MAKE) -C tests clean
1ad2134f 263 for d in $(TARGET_DIRS) libhw32 libhw64; do \
7d3505c5 264 $(MAKE) -C $$d $@ || exit 1 ; \
626df76a 265 done
31e31b8a 266
7d13299d 267distclean: clean
153859be 268 rm -f config-host.mak config-host.h $(DOCS) qemu-options.texi qemu-img-cmds.texi
0cb3fb1e 269 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
1ad2134f 270 for d in $(TARGET_DIRS) libhw32 libhw64; do \
bc1b050d 271 rm -rf $$d || exit 1 ; \
76bc6838 272 done
7d13299d 273
fed4a9ad
FB
274KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
275ar de en-us fi fr-be hr it lv nl pl ru th \
276common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
277
77755340
TS
278ifdef INSTALL_BLOBS
279BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
e5d01b06
AJ
280video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
281pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
4b0c7aa3 282bamboo.dtb petalogix-s3adsp1800.dtb
77755340
TS
283else
284BLOBS=
285endif
286
38954dca 287install-doc: $(DOCS)
58f8aead
AL
288 $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
289 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
38954dca 290ifndef CONFIG_WIN32
58f8aead
AL
291 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
292 $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
293 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
294 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
38954dca
PB
295endif
296
297install: all $(if $(BUILD_DOCS),install-doc)
58f8aead 298 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
932a79df 299ifneq ($(TOOLS),)
58f8aead 300 $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
932a79df 301endif
77755340 302ifneq ($(BLOBS),)
58f8aead 303 $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
77755340 304 set -e; for x in $(BLOBS); do \
58f8aead 305 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
ad064840 306 done
77755340 307endif
11d9f695 308ifndef CONFIG_WIN32
58f8aead 309 $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
18be8d77 310 set -e; for x in $(KEYMAPS); do \
79fd42aa 311 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
ad064840 312 done
11d9f695 313endif
626df76a 314 for d in $(TARGET_DIRS); do \
7d3505c5 315 $(MAKE) -C $$d $@ || exit 1 ; \
626df76a 316 done
612384d7 317
367e86e8 318# various test targets
9b0b8203 319test speed: all
7d3505c5 320 $(MAKE) -C tests $@
31e31b8a 321
5fafdf24 322TAGS:
b9adb4a6 323 etags *.[ch] tests/*.[ch]
31e31b8a 324
6688bc6d
FB
325cscope:
326 rm -f ./cscope.*
ede46085 327 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
6688bc6d
FB
328 cscope -b
329
3ef693a0 330# documentation
1f673135 331%.html: %.texi
0d00e563 332 $(call quiet-command,texi2html -I=. -monolithic -number $<," GEN $@")
3ef693a0 333
f3548328 334%.info: %.texi
0d00e563 335 $(call quiet-command,makeinfo -I . $< -o $@," GEN $@")
f3548328
FB
336
337%.dvi: %.texi
0d00e563 338 $(call quiet-command,texi2dvi -I . $<," GEN $@")
5824d651
BS
339
340qemu-options.texi: $(SRC_PATH)/qemu-options.hx
0d00e563 341 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
f3548328 342
2313086a
BS
343qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
344 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
345
153859be
SB
346qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
347 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
348
2313086a 349qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
0d00e563
AL
350 $(call quiet-command, \
351 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu.pod && \
352 pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
353 " GEN $@")
5a67135a 354
153859be 355qemu-img.1: qemu-img.texi qemu-img-cmds.texi
0d00e563
AL
356 $(call quiet-command, \
357 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \
358 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
359 " GEN $@")
acd935ef 360
7a5ca864 361qemu-nbd.8: qemu-nbd.texi
0d00e563
AL
362 $(call quiet-command, \
363 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \
364 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
365 " GEN $@")
7a5ca864 366
0cb3fb1e
PB
367info: qemu-doc.info qemu-tech.info
368
369dvi: qemu-doc.dvi qemu-tech.dvi
370
371html: qemu-doc.html qemu-tech.html
372
153859be 373qemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-monitor.texi qemu-img-cmds.texi
818220f5 374
df5cf721
TS
375VERSION ?= $(shell cat VERSION)
376FILE = qemu-$(VERSION)
586314f2 377
1e43adfc 378# tar release (use 'make -k tar' on a checkouted tree)
586314f2
FB
379tar:
380 rm -rf /tmp/$(FILE)
1e43adfc 381 cp -r . /tmp/$(FILE)
99c6c082 382 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
586314f2
FB
383 rm -rf /tmp/$(FILE)
384
76b62fd0 385# generate a binary distribution
d691f669 386tarbin:
18be8d77 387 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
43095f31 388 $(bindir)/qemu \
43095f31 389 $(bindir)/qemu-system-x86_64 \
40e8a53b
AJ
390 $(bindir)/qemu-system-arm \
391 $(bindir)/qemu-system-cris \
392 $(bindir)/qemu-system-m68k \
93856aac 393 $(bindir)/qemu-system-mips \
38260998 394 $(bindir)/qemu-system-mipsel \
fbe4f65b
TS
395 $(bindir)/qemu-system-mips64 \
396 $(bindir)/qemu-system-mips64el \
40e8a53b
AJ
397 $(bindir)/qemu-system-ppc \
398 $(bindir)/qemu-system-ppcemb \
399 $(bindir)/qemu-system-ppc64 \
ff1aaf65 400 $(bindir)/qemu-system-sh4 \
85ffbdfc 401 $(bindir)/qemu-system-sh4eb \
40e8a53b 402 $(bindir)/qemu-system-sparc \
7efa4387 403 $(bindir)/qemu-i386 \
f0403c03 404 $(bindir)/qemu-x86_64 \
40e8a53b
AJ
405 $(bindir)/qemu-alpha \
406 $(bindir)/qemu-arm \
407 $(bindir)/qemu-armeb \
408 $(bindir)/qemu-cris \
409 $(bindir)/qemu-m68k \
410 $(bindir)/qemu-mips \
411 $(bindir)/qemu-mipsel \
412 $(bindir)/qemu-ppc \
413 $(bindir)/qemu-ppc64 \
414 $(bindir)/qemu-ppc64abi32 \
415 $(bindir)/qemu-sh4 \
416 $(bindir)/qemu-sh4eb \
417 $(bindir)/qemu-sparc \
418 $(bindir)/qemu-sparc64 \
419 $(bindir)/qemu-sparc32plus \
420 $(bindir)/qemu-img \
421 $(bindir)/qemu-nbd \
7efa4387
FB
422 $(datadir)/bios.bin \
423 $(datadir)/vgabios.bin \
de9258a8 424 $(datadir)/vgabios-cirrus.bin \
637f6cd7 425 $(datadir)/ppc_rom.bin \
d5295253 426 $(datadir)/video.x \
0986ac3b 427 $(datadir)/openbios-sparc32 \
938255d2 428 $(datadir)/openbios-sparc64 \
e5d01b06 429 $(datadir)/openbios-ppc \
40e8a53b 430 $(datadir)/pxe-ne2k_pci.bin \
19c80e50 431 $(datadir)/pxe-rtl8139.bin \
40e8a53b 432 $(datadir)/pxe-pcnet.bin \
2991990b 433 $(datadir)/pxe-e1000.bin \
1f50f8d1
FB
434 $(docdir)/qemu-doc.html \
435 $(docdir)/qemu-tech.html \
40e8a53b
AJ
436 $(mandir)/man1/qemu.1 \
437 $(mandir)/man1/qemu-img.1 \
7a5ca864 438 $(mandir)/man8/qemu-nbd.8
d691f669 439
4fb240a4 440# Include automatically generated dependency files
019d6b8f 441-include $(wildcard *.d audio/*.d slirp/*.d block/*.d)