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