Do not use env->halted to decide where halted state should be handled
[qemu-kvm/fedora.git] / Makefile
blob42fe55b3c96c3f3952023811911ae0c2fde2ff95
1 # Makefile for QEMU.
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
14 .PHONY: all clean cscope distclean dvi html info install install-doc \
15 recurse-all speed tar tarbin test
17 VPATH=$(SRC_PATH):$(SRC_PATH)/hw
20 CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
21 LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
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
35 LIBS+=$(PTHREADLIBS)
36 LIBS+=$(CLOCKLIBS)
38 ifdef CONFIG_SOLARIS
39 LIBS+=-lsocket -lnsl -lresolv
40 endif
42 ifdef CONFIG_WIN32
43 LIBS+=-lwinmm -lws2_32 -liphlpapi
44 endif
46 build-all: $(TOOLS) $(DOCS) recurse-all
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
54 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
55 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
57 ifeq ($(KVM_KMOD),yes)
59 .PHONEY: kvm-kmod
61 all: kvm-kmod
63 kvm-kmod:
64 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C kvm/kernel V="$(V)" )
67 endif
69 subdir-%:
70 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
72 $(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
73 $(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
75 recurse-all: $(SUBDIR_RULES)
77 #######################################################################
78 # BLOCK_OBJS is code used by both qemu system emulation and qemu-img
80 BLOCK_OBJS=cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o
81 BLOCK_OBJS+=block/cow.o block/qcow.o aes.o block/vmdk.o block/cloop.o
82 BLOCK_OBJS+=block/dmg.o block/bochs.o block/vpc.o block/vvfat.o
83 BLOCK_OBJS+=block/qcow2.o block/parallels.o block/nbd.o
84 BLOCK_OBJS+=nbd.o block.o aio.o
86 ifdef CONFIG_WIN32
87 BLOCK_OBJS += block/raw-win32.o
88 else
89 ifdef CONFIG_AIO
90 BLOCK_OBJS += posix-aio-compat.o
91 endif
92 BLOCK_OBJS += block/raw-posix.o
93 endif
95 ifdef CONFIG_CURL
96 BLOCK_OBJS += block/curl.o
97 endif
99 ifdef CONFIG_AIO
100 BLOCK_OBJS += compatfd.o
101 endif
103 ######################################################################
104 # libqemu_common.a: Target independent part of system emulation. The
105 # long term path is to suppress *all* target specific code in case of
106 # system emulation, i.e. a single QEMU executable should support all
107 # CPUs and machines.
109 OBJS=$(BLOCK_OBJS)
110 OBJS+=readline.o console.o
112 OBJS+=irq.o ptimer.o
113 OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
114 OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
115 OBJS+=tmp105.o lm832x.o eeprom93xx.o tsc2005.o
116 OBJS+=scsi-disk.o cdrom.o
117 OBJS+=scsi-generic.o
118 OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
119 OBJS+=usb-serial.o usb-net.o
120 OBJS+=sd.o ssi-sd.o
121 OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
122 OBJS+=bt-hci-csr.o
123 OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
124 OBJS+=qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o
125 OBJS+=msmouse.o ps2.o
126 OBJS+=qdev.o ssi.o
128 ifdef CONFIG_BRLAPI
129 OBJS+= baum.o
130 LIBS+=-lbrlapi
131 endif
133 ifdef CONFIG_WIN32
134 OBJS+=tap-win32.o
135 else
136 OBJS+=migration-exec.o
137 endif
139 AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
140 ifdef CONFIG_SDL
141 AUDIO_OBJS += sdlaudio.o
142 endif
143 ifdef CONFIG_OSS
144 AUDIO_OBJS += ossaudio.o
145 endif
146 ifdef CONFIG_COREAUDIO
147 AUDIO_OBJS += coreaudio.o
148 AUDIO_PT = yes
149 endif
150 ifdef CONFIG_ALSA
151 AUDIO_OBJS += alsaaudio.o
152 endif
153 ifdef CONFIG_DSOUND
154 AUDIO_OBJS += dsoundaudio.o
155 endif
156 ifdef CONFIG_FMOD
157 AUDIO_OBJS += fmodaudio.o
158 audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
159 endif
160 ifdef CONFIG_ESD
161 AUDIO_PT = yes
162 AUDIO_PT_INT = yes
163 AUDIO_OBJS += esdaudio.o
164 endif
165 ifdef CONFIG_PA
166 AUDIO_PT = yes
167 AUDIO_PT_INT = yes
168 AUDIO_OBJS += paaudio.o
169 endif
170 ifdef AUDIO_PT
171 LDFLAGS += -pthread
172 endif
173 ifdef AUDIO_PT_INT
174 AUDIO_OBJS += audio_pt_int.o
175 endif
176 AUDIO_OBJS+= wavcapture.o
177 OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
179 OBJS+=keymaps.o
180 ifdef CONFIG_SDL
181 OBJS+=sdl.o x_keymap.o
182 endif
183 ifdef CONFIG_CURSES
184 OBJS+=curses.o
185 endif
186 OBJS+=vnc.o acl.o d3des.o
187 ifdef CONFIG_VNC_TLS
188 OBJS+=vnc-tls.o vnc-auth-vencrypt.o
189 endif
190 ifdef CONFIG_VNC_SASL
191 OBJS+=vnc-auth-sasl.o
192 endif
194 ifdef CONFIG_COCOA
195 OBJS+=cocoa.o
196 endif
198 ifdef CONFIG_IOTHREAD
199 OBJS+=qemu-thread.o
200 endif
202 ifdef CONFIG_SLIRP
203 CPPFLAGS+=-I$(SRC_PATH)/slirp
204 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
205 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
206 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
207 OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
208 endif
210 LIBS+=$(VDE_LIBS)
212 # xen backend driver support
213 XEN_OBJS := xen_backend.o xen_devconfig.o
214 XEN_OBJS += xen_console.o xenfb.o xen_disk.o xen_nic.o
215 ifdef CONFIG_XEN
216 OBJS += $(XEN_OBJS)
217 endif
219 LIBS+=$(CURL_LIBS)
221 cocoa.o: cocoa.m
223 keymaps.o: keymaps.c keymaps.h
225 sdl.o: sdl.c keymaps.h sdl_keysym.h
227 sdl.o audio/sdlaudio.o: CFLAGS += $(SDL_CFLAGS)
229 acl.o: acl.h acl.c
231 vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
233 vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h
235 vnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
237 vnc-tls.o: vnc-tls.c vnc.h
239 vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h
241 vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h
243 curses.o: curses.c keymaps.h curses_keys.h
245 bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)
247 libqemu_common.a: $(OBJS)
249 #######################################################################
250 # USER_OBJS is code used by qemu userspace emulation
251 USER_OBJS=cutils.o cache-utils.o
253 libqemu_user.a: $(USER_OBJS)
255 ######################################################################
257 qemu-img.o: qemu-img-cmds.h
259 qemu-img$(EXESUF): qemu-img.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
261 qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
263 qemu-io$(EXESUF): qemu-io.o qemu-tool.o tool-osdep.o cmd.o $(BLOCK_OBJS)
265 qemu-img$(EXESUF) qemu-nbd$(EXESUF) qemu-io$(EXESUF): LIBS += -lz
267 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
268 $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $@")
270 clean:
271 # avoid old build problems by removing potentially incorrect old files
272 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
273 rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
274 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d
275 rm -f qemu-img-cmds.h
276 $(MAKE) -C tests clean
277 for d in $(TARGET_DIRS) libhw32 libhw64; do \
278 $(MAKE) -C $$d $@ || exit 1 ; \
279 done
281 distclean: clean
282 rm -f config-host.mak config-host.h $(DOCS) qemu-options.texi qemu-img-cmds.texi
283 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
284 for d in $(TARGET_DIRS) libhw32 libhw64; do \
285 rm -rf $$d || exit 1 ; \
286 done
288 KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
289 ar de en-us fi fr-be hr it lv nl pl ru th \
290 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
292 ifdef INSTALL_BLOBS
293 BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
294 video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
295 pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
296 bamboo.dtb petalogix-s3adsp1800.dtb
297 BLOBS += extboot.bin
298 else
299 BLOBS=
300 endif
302 install-doc: $(DOCS)
303 $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
304 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
305 ifndef CONFIG_WIN32
306 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
307 $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
308 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
309 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
310 endif
312 install: all $(if $(BUILD_DOCS),install-doc)
313 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
314 ifneq ($(TOOLS),)
315 $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
316 endif
317 ifneq ($(BLOBS),)
318 $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
319 set -e; for x in $(BLOBS); do \
320 if [ -f $(SRC_PATH)/pc-bios/$$x ];then \
321 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
322 fi \
323 done
324 endif
325 ifndef CONFIG_WIN32
326 $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
327 set -e; for x in $(KEYMAPS); do \
328 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
329 done
330 endif
331 for d in $(TARGET_DIRS); do \
332 $(MAKE) -C $$d $@ || exit 1 ; \
333 done
334 ifeq ($(KVM_KMOD),yes)
335 $(MAKE) -C kvm/kernel $@
336 endif
338 # various test targets
339 test speed: all
340 $(MAKE) -C tests $@
342 TAGS:
343 etags *.[ch] tests/*.[ch]
345 cscope:
346 rm -f ./cscope.*
347 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
348 cscope -b
350 # documentation
351 %.html: %.texi
352 $(call quiet-command,texi2html -I=. -monolithic -number $<," GEN $@")
354 %.info: %.texi
355 $(call quiet-command,makeinfo -I . $< -o $@," GEN $@")
357 %.dvi: %.texi
358 $(call quiet-command,texi2dvi -I . $<," GEN $@")
360 qemu-options.texi: $(SRC_PATH)/qemu-options.hx
361 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
363 qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
364 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
366 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
367 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
369 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
370 $(call quiet-command, \
371 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu.pod && \
372 pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
373 " GEN $@")
375 qemu-img.1: qemu-img.texi qemu-img-cmds.texi
376 $(call quiet-command, \
377 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \
378 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
379 " GEN $@")
381 qemu-nbd.8: qemu-nbd.texi
382 $(call quiet-command, \
383 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \
384 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
385 " GEN $@")
387 info: qemu-doc.info qemu-tech.info
389 dvi: qemu-doc.dvi qemu-tech.dvi
391 html: qemu-doc.html qemu-tech.html
393 qemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-monitor.texi qemu-img-cmds.texi
395 VERSION ?= $(shell cat VERSION)
396 FILE = qemu-$(VERSION)
398 # tar release (use 'make -k tar' on a checkouted tree)
399 tar:
400 rm -rf /tmp/$(FILE)
401 cp -r . /tmp/$(FILE)
402 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
403 rm -rf /tmp/$(FILE)
405 # generate a binary distribution
406 tarbin:
407 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
408 $(bindir)/qemu \
409 $(bindir)/qemu-system-x86_64 \
410 $(bindir)/qemu-system-arm \
411 $(bindir)/qemu-system-cris \
412 $(bindir)/qemu-system-m68k \
413 $(bindir)/qemu-system-mips \
414 $(bindir)/qemu-system-mipsel \
415 $(bindir)/qemu-system-mips64 \
416 $(bindir)/qemu-system-mips64el \
417 $(bindir)/qemu-system-ppc \
418 $(bindir)/qemu-system-ppcemb \
419 $(bindir)/qemu-system-ppc64 \
420 $(bindir)/qemu-system-sh4 \
421 $(bindir)/qemu-system-sh4eb \
422 $(bindir)/qemu-system-sparc \
423 $(bindir)/qemu-i386 \
424 $(bindir)/qemu-x86_64 \
425 $(bindir)/qemu-alpha \
426 $(bindir)/qemu-arm \
427 $(bindir)/qemu-armeb \
428 $(bindir)/qemu-cris \
429 $(bindir)/qemu-m68k \
430 $(bindir)/qemu-mips \
431 $(bindir)/qemu-mipsel \
432 $(bindir)/qemu-ppc \
433 $(bindir)/qemu-ppc64 \
434 $(bindir)/qemu-ppc64abi32 \
435 $(bindir)/qemu-sh4 \
436 $(bindir)/qemu-sh4eb \
437 $(bindir)/qemu-sparc \
438 $(bindir)/qemu-sparc64 \
439 $(bindir)/qemu-sparc32plus \
440 $(bindir)/qemu-img \
441 $(bindir)/qemu-nbd \
442 $(datadir)/bios.bin \
443 $(datadir)/vgabios.bin \
444 $(datadir)/vgabios-cirrus.bin \
445 $(datadir)/ppc_rom.bin \
446 $(datadir)/video.x \
447 $(datadir)/openbios-sparc32 \
448 $(datadir)/openbios-sparc64 \
449 $(datadir)/openbios-ppc \
450 $(datadir)/pxe-ne2k_pci.bin \
451 $(datadir)/pxe-rtl8139.bin \
452 $(datadir)/pxe-pcnet.bin \
453 $(datadir)/pxe-e1000.bin \
454 $(datadir)/extboot.bin \
455 $(docdir)/qemu-doc.html \
456 $(docdir)/qemu-tech.html \
457 $(mandir)/man1/qemu.1 \
458 $(mandir)/man1/qemu-img.1 \
459 $(mandir)/man8/qemu-nbd.8
461 # Include automatically generated dependency files
462 -include $(wildcard *.d audio/*.d slirp/*.d block/*.d)
464 .PHONY: kvm/extboot
466 build-targets-i386 = $(build-targets-x86)
467 build-targets-x86_64 = $(build-targets-x86)
468 build-targets-x86 = kvm/extboot
469 build-targets-ia64 =
471 all: $(build-targets-$(ARCH))
473 kvm/extboot:
474 $(MAKE) -C $@
475 if ! [ -f pc-bios/extboot.bin ] \
476 || ! cmp -s pc-bios/extboot.bin $@/extboot.bin; then \
477 cp $@/extboot.bin pc-bios/extboot.bin; \