Merge commit '253d0942fac33c5c15c9a7f8657f55f125dc5816' into upstream-merge
[qemu-kvm/fedora.git] / Makefile
blobce482e1f7172f06826af4c7f756902d3616f1c92
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 CPPFLAGS += -U_FORTIFY_SOURCE
26 LIBS=
27 ifdef CONFIG_STATIC
28 LDFLAGS += -static
29 endif
30 ifdef BUILD_DOCS
31 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
32 else
33 DOCS=
34 endif
36 LIBS+=$(PTHREADLIBS)
37 LIBS+=$(CLOCKLIBS)
39 ifdef CONFIG_SOLARIS
40 LIBS+=-lsocket -lnsl -lresolv
41 endif
43 ifdef CONFIG_WIN32
44 LIBS+=-lwinmm -lws2_32 -liphlpapi
45 endif
47 build-all: $(TOOLS) $(DOCS) roms recurse-all
49 config-host.mak: configure
50 ifneq ($(wildcard config-host.mak),)
51 @echo $@ is out-of-date, running configure
52 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
53 endif
55 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
56 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
58 ifeq ($(KVM_KMOD),yes)
60 .PHONEY: kvm-kmod
62 all: kvm-kmod
64 kvm-kmod:
65 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C kvm/kernel V="$(V)" )
68 endif
70 subdir-%:
71 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
73 $(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
74 $(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
76 recurse-all: $(SUBDIR_RULES)
78 #######################################################################
79 # BLOCK_OBJS is code used by both qemu system emulation and qemu-img
81 BLOCK_OBJS=cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o
82 BLOCK_OBJS+=block/cow.o block/qcow.o aes.o block/vmdk.o block/cloop.o
83 BLOCK_OBJS+=block/dmg.o block/bochs.o block/vpc.o block/vvfat.o
84 BLOCK_OBJS+=block/qcow2.o block/qcow2-refcount.o block/qcow2-cluster.o
85 BLOCK_OBJS+=block/qcow2-snapshot.o
86 BLOCK_OBJS+=block/parallels.o block/nbd.o
87 BLOCK_OBJS+=nbd.o block.o aio.o
89 ifdef CONFIG_WIN32
90 BLOCK_OBJS += block/raw-win32.o
91 else
92 ifdef CONFIG_AIO
93 BLOCK_OBJS += posix-aio-compat.o
94 endif
95 BLOCK_OBJS += block/raw-posix.o
96 endif
98 ifdef CONFIG_CURL
99 BLOCK_OBJS += block/curl.o
100 endif
102 ifdef CONFIG_AIO
103 BLOCK_OBJS += compatfd.o
104 endif
106 ######################################################################
107 # libqemu_common.a: Target independent part of system emulation. The
108 # long term path is to suppress *all* target specific code in case of
109 # system emulation, i.e. a single QEMU executable should support all
110 # CPUs and machines.
112 OBJS=$(BLOCK_OBJS)
113 OBJS+=readline.o console.o
115 OBJS+=irq.o ptimer.o
116 OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
117 OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
118 OBJS+=tmp105.o lm832x.o eeprom93xx.o tsc2005.o
119 OBJS+=scsi-disk.o cdrom.o
120 OBJS+=scsi-generic.o
121 OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
122 OBJS+=usb-serial.o usb-net.o
123 OBJS+=sd.o ssi-sd.o
124 OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
125 OBJS+=bt-hci-csr.o
126 OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
127 OBJS+=qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o
128 OBJS+=msmouse.o ps2.o
129 OBJS+=qdev.o ssi.o
131 ifdef CONFIG_BRLAPI
132 OBJS+= baum.o
133 LIBS+=-lbrlapi
134 endif
136 ifdef CONFIG_WIN32
137 OBJS+=tap-win32.o
138 else
139 OBJS+=migration-exec.o
140 endif
142 AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
143 ifdef CONFIG_SDL
144 AUDIO_OBJS += sdlaudio.o
145 endif
146 ifdef CONFIG_OSS
147 AUDIO_OBJS += ossaudio.o
148 endif
149 ifdef CONFIG_COREAUDIO
150 AUDIO_OBJS += coreaudio.o
151 AUDIO_PT = yes
152 endif
153 ifdef CONFIG_ALSA
154 AUDIO_OBJS += alsaaudio.o
155 endif
156 ifdef CONFIG_DSOUND
157 AUDIO_OBJS += dsoundaudio.o
158 endif
159 ifdef CONFIG_FMOD
160 AUDIO_OBJS += fmodaudio.o
161 audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
162 endif
163 ifdef CONFIG_ESD
164 AUDIO_PT = yes
165 AUDIO_PT_INT = yes
166 AUDIO_OBJS += esdaudio.o
167 endif
168 ifdef CONFIG_PA
169 AUDIO_PT = yes
170 AUDIO_PT_INT = yes
171 AUDIO_OBJS += paaudio.o
172 endif
173 ifdef AUDIO_PT
174 LDFLAGS += -pthread
175 endif
176 ifdef AUDIO_PT_INT
177 AUDIO_OBJS += audio_pt_int.o
178 endif
179 AUDIO_OBJS+= wavcapture.o
180 OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
182 OBJS+=keymaps.o
183 ifdef CONFIG_SDL
184 OBJS+=sdl.o sdl_zoom.o x_keymap.o
185 endif
186 ifdef CONFIG_CURSES
187 OBJS+=curses.o
188 endif
189 OBJS+=vnc.o acl.o d3des.o
190 ifdef CONFIG_VNC_TLS
191 OBJS+=vnc-tls.o vnc-auth-vencrypt.o
192 endif
193 ifdef CONFIG_VNC_SASL
194 OBJS+=vnc-auth-sasl.o
195 endif
197 ifdef CONFIG_COCOA
198 OBJS+=cocoa.o
199 endif
201 ifdef CONFIG_IOTHREAD
202 OBJS+=qemu-thread.o
203 endif
205 ifdef CONFIG_SLIRP
206 CPPFLAGS+=-I$(SRC_PATH)/slirp
207 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
208 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
209 tcp_subr.o tcp_timer.o udp.o bootp.o tftp.o
210 OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
211 endif
213 LIBS+=$(VDE_LIBS)
215 # xen backend driver support
216 XEN_OBJS := xen_backend.o xen_devconfig.o
217 XEN_OBJS += xen_console.o xenfb.o xen_disk.o xen_nic.o
218 ifdef CONFIG_XEN
219 OBJS += $(XEN_OBJS)
220 endif
222 LIBS+=$(CURL_LIBS)
224 cocoa.o: cocoa.m
226 keymaps.o: keymaps.c keymaps.h
228 sdl_zoom.o: sdl_zoom.c sdl_zoom.h sdl_zoom_template.h
230 sdl.o: sdl.c keymaps.h sdl_keysym.h sdl_zoom.h
232 sdl.o audio/sdlaudio.o baum.o: CFLAGS += $(SDL_CFLAGS)
234 acl.o: acl.h acl.c
236 vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
238 vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h
240 vnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
242 vnc-tls.o: vnc-tls.c vnc.h
244 vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h
246 vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h
248 curses.o: curses.c keymaps.h curses_keys.h
250 bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)
252 libqemu_common.a: $(OBJS)
254 #######################################################################
255 # USER_OBJS is code used by qemu userspace emulation
256 USER_OBJS=cutils.o cache-utils.o
258 libqemu_user.a: $(USER_OBJS)
260 ######################################################################
262 qemu-img.o: qemu-img-cmds.h
264 qemu-img$(EXESUF): qemu-img.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
266 qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
268 qemu-io$(EXESUF): qemu-io.o qemu-tool.o tool-osdep.o cmd.o $(BLOCK_OBJS)
270 qemu-img$(EXESUF) qemu-nbd$(EXESUF) qemu-io$(EXESUF): LIBS += -lz
272 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
273 $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $@")
275 clean:
276 # avoid old build problems by removing potentially incorrect old files
277 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
278 rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
279 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d
280 rm -f qemu-img-cmds.h
281 $(MAKE) -C tests clean
282 for d in $(TARGET_DIRS) $(ROMS) libhw32 libhw64; do \
283 $(MAKE) -C $$d $@ || exit 1 ; \
284 done
286 distclean: clean
287 rm -f config-host.mak config-host.h $(DOCS) qemu-options.texi qemu-img-cmds.texi
288 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
289 for d in $(TARGET_DIRS) libhw32 libhw64; do \
290 rm -rf $$d || exit 1 ; \
291 done
293 KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
294 ar de en-us fi fr-be hr it lv nl pl ru th \
295 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
297 ifdef INSTALL_BLOBS
298 BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
299 video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
300 pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
301 bamboo.dtb petalogix-s3adsp1800.dtb \
302 multiboot.bin
303 BLOBS += extboot.bin
304 else
305 BLOBS=
306 endif
308 roms:
309 for d in $(ROMS); do \
310 $(MAKE) -C $$d || exit 1 ; \
311 done
313 install-doc: $(DOCS)
314 $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
315 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
316 ifndef CONFIG_WIN32
317 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
318 $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
319 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
320 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
321 endif
323 install: all $(if $(BUILD_DOCS),install-doc)
324 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
325 ifneq ($(TOOLS),)
326 $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
327 endif
328 ifneq ($(BLOBS),)
329 $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
330 set -e; for x in $(BLOBS); do \
331 if [ -f $(SRC_PATH)/pc-bios/$$x ];then \
332 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
333 fi \
334 done
335 endif
336 $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
337 set -e; for x in $(KEYMAPS); do \
338 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
339 done
340 for d in $(TARGET_DIRS); do \
341 $(MAKE) -C $$d $@ || exit 1 ; \
342 done
343 ifeq ($(KVM_KMOD),yes)
344 $(MAKE) -C kvm/kernel $@
345 endif
347 # various test targets
348 test speed: all
349 $(MAKE) -C tests $@
351 TAGS:
352 etags *.[ch] tests/*.[ch]
354 cscope:
355 rm -f ./cscope.*
356 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
357 cscope -b
359 # documentation
360 %.html: %.texi
361 $(call quiet-command,texi2html -I=. -monolithic -number $<," GEN $@")
363 %.info: %.texi
364 $(call quiet-command,makeinfo -I . $< -o $@," GEN $@")
366 %.dvi: %.texi
367 $(call quiet-command,texi2dvi -I . $<," GEN $@")
369 qemu-options.texi: $(SRC_PATH)/qemu-options.hx
370 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
372 qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
373 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
375 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
376 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
378 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
379 $(call quiet-command, \
380 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu.pod && \
381 pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
382 " GEN $@")
384 qemu-img.1: qemu-img.texi qemu-img-cmds.texi
385 $(call quiet-command, \
386 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \
387 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
388 " GEN $@")
390 qemu-nbd.8: qemu-nbd.texi
391 $(call quiet-command, \
392 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \
393 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
394 " GEN $@")
396 info: qemu-doc.info qemu-tech.info
398 dvi: qemu-doc.dvi qemu-tech.dvi
400 html: qemu-doc.html qemu-tech.html
402 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
404 VERSION ?= $(shell cat VERSION)
405 FILE = qemu-$(VERSION)
407 # tar release (use 'make -k tar' on a checkouted tree)
408 tar:
409 rm -rf /tmp/$(FILE)
410 cp -r . /tmp/$(FILE)
411 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
412 rm -rf /tmp/$(FILE)
414 # generate a binary distribution
415 tarbin:
416 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
417 $(bindir)/qemu \
418 $(bindir)/qemu-system-x86_64 \
419 $(bindir)/qemu-system-arm \
420 $(bindir)/qemu-system-cris \
421 $(bindir)/qemu-system-m68k \
422 $(bindir)/qemu-system-mips \
423 $(bindir)/qemu-system-mipsel \
424 $(bindir)/qemu-system-mips64 \
425 $(bindir)/qemu-system-mips64el \
426 $(bindir)/qemu-system-ppc \
427 $(bindir)/qemu-system-ppcemb \
428 $(bindir)/qemu-system-ppc64 \
429 $(bindir)/qemu-system-sh4 \
430 $(bindir)/qemu-system-sh4eb \
431 $(bindir)/qemu-system-sparc \
432 $(bindir)/qemu-i386 \
433 $(bindir)/qemu-x86_64 \
434 $(bindir)/qemu-alpha \
435 $(bindir)/qemu-arm \
436 $(bindir)/qemu-armeb \
437 $(bindir)/qemu-cris \
438 $(bindir)/qemu-m68k \
439 $(bindir)/qemu-mips \
440 $(bindir)/qemu-mipsel \
441 $(bindir)/qemu-ppc \
442 $(bindir)/qemu-ppc64 \
443 $(bindir)/qemu-ppc64abi32 \
444 $(bindir)/qemu-sh4 \
445 $(bindir)/qemu-sh4eb \
446 $(bindir)/qemu-sparc \
447 $(bindir)/qemu-sparc64 \
448 $(bindir)/qemu-sparc32plus \
449 $(bindir)/qemu-img \
450 $(bindir)/qemu-nbd \
451 $(datadir)/bios.bin \
452 $(datadir)/vgabios.bin \
453 $(datadir)/vgabios-cirrus.bin \
454 $(datadir)/ppc_rom.bin \
455 $(datadir)/video.x \
456 $(datadir)/openbios-sparc32 \
457 $(datadir)/openbios-sparc64 \
458 $(datadir)/openbios-ppc \
459 $(datadir)/pxe-ne2k_pci.bin \
460 $(datadir)/pxe-rtl8139.bin \
461 $(datadir)/pxe-pcnet.bin \
462 $(datadir)/pxe-e1000.bin \
463 $(datadir)/extboot.bin \
464 $(docdir)/qemu-doc.html \
465 $(docdir)/qemu-tech.html \
466 $(mandir)/man1/qemu.1 \
467 $(mandir)/man1/qemu-img.1 \
468 $(mandir)/man8/qemu-nbd.8
470 # Include automatically generated dependency files
471 -include $(wildcard *.d audio/*.d slirp/*.d block/*.d)
473 .PHONY: kvm/extboot
475 build-targets-i386 = $(build-targets-x86)
476 build-targets-x86_64 = $(build-targets-x86)
477 build-targets-x86 = kvm/extboot
478 build-targets-ia64 =
480 all: $(build-targets-$(ARCH))
482 kvm/extboot:
483 $(MAKE) -C $@
484 if ! [ -f pc-bios/extboot.bin ] \
485 || ! cmp -s pc-bios/extboot.bin $@/extboot.bin; then \
486 cp $@/extboot.bin pc-bios/extboot.bin; \