10cb3fb1eSpbrook# Makefile for QEMU. 20cb3fb1eSpbrook 3ad064840Spbrookinclude config-host.mak 417759187Saliguoriinclude $(SRC_PATH)/rules.mak 5766a487aSbellard 6818220f5Saliguori.PHONY: all clean cscope distclean dvi html info install install-doc \ 7818220f5Saliguori recurse-all speed tar tarbin test 80cb3fb1eSpbrook 98c462f8fSpbrookVPATH=$(SRC_PATH):$(SRC_PATH)/hw 108c462f8fSpbrook 1117759187Saliguori 1240293e58SbellardCFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS) 1340293e58SbellardLDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS) 143142255cSblueswir1 1596935aa4SmalcCPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@ 164fb240a4SbellardCPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 17766a487aSbellardLIBS= 181f50f8d1Sbellardifdef CONFIG_STATIC 1940293e58SbellardLDFLAGS += -static 201f50f8d1Sbellardendif 21cc8ae6deSpbrookifdef BUILD_DOCS 227a5ca864SbellardDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 23cc8ae6deSpbrookelse 24cc8ae6deSpbrookDOCS= 25cc8ae6deSpbrookendif 267d13299dSbellard 2770956b77SthsLIBS+=$(AIOLIBS) 2883f64091Sbellard 297e00eb9bSaliguoriifdef CONFIG_SOLARIS 307e00eb9bSaliguoriLIBS+=-lsocket -lnsl -lresolv 317e00eb9bSaliguoriendif 327e00eb9bSaliguori 3303ff3ca3Saliguoriifdef CONFIG_WIN32 3403ff3ca3SaliguoriLIBS+=-lwinmm -lws2_32 -liphlpapi 3503ff3ca3Saliguoriendif 3603ff3ca3Saliguori 37da0b0df8Spbrookall: $(TOOLS) $(DOCS) recurse-all 38b9dea4fbSpbrook 39cec7d0b6SpbrookSUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS)) 40cec7d0b6Spbrook 4186e840eeSaurel32subdir-%: 4228c699a2Saliguori $(call quiet-command,$(MAKE) -C $* V="$(V)" TARGET_DIR="$*/" all,) 434aa42531Spbrook 44cec7d0b6Spbrook$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a 45cec7d0b6Spbrook$(filter %-user,$(SUBDIR_RULES)): libqemu_user.a 46cec7d0b6Spbrook 47cec7d0b6Spbrookrecurse-all: $(SUBDIR_RULES) 484aa42531Spbrook 49faf07963Spbrook####################################################################### 50faf07963Spbrook# BLOCK_OBJS is code used by both qemu system emulation and qemu-img 51faf07963Spbrook 5217e2377aSpbrookBLOCK_OBJS=cutils.o qemu-malloc.o 53faf07963SpbrookBLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o 54faf07963SpbrookBLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o 5503ff3ca3SaliguoriBLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o 56a76bab49SaliguoriBLOCK_OBJS+=nbd.o block.o aio.o 5703ff3ca3Saliguori 5803ff3ca3Saliguoriifdef CONFIG_WIN32 5903ff3ca3SaliguoriBLOCK_OBJS += block-raw-win32.o 6003ff3ca3Saliguorielse 613c529d93Saliguoriifdef CONFIG_AIO 623c529d93SaliguoriBLOCK_OBJS += posix-aio-compat.o 633c529d93Saliguoriendif 6403ff3ca3SaliguoriBLOCK_OBJS += block-raw-posix.o 6503ff3ca3Saliguoriendif 6603ff3ca3Saliguori 674fb240a4Sbellard###################################################################### 682e2ea909Sbellard# libqemu_common.a: Target independent part of system emulation. The 694fb240a4Sbellard# long term path is to suppress *all* target specific code in case of 704fb240a4Sbellard# system emulation, i.e. a single QEMU executable should support all 714fb240a4Sbellard# CPUs and machines. 7247cea614Sbellard 73cd01b4a3SaliguoriOBJS=$(BLOCK_OBJS) 74faf07963SpbrookOBJS+=readline.o console.o 75cd01b4a3Saliguori 7687ecb68bSpbrookOBJS+=irq.o 7787ecb68bSpbrookOBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o 787e7c5e4cSbalrogOBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o 791d4e547bSbalrogOBJS+=tmp105.o lm832x.o 8087ecb68bSpbrookOBJS+=scsi-disk.o cdrom.o 81985a03b0SthsOBJS+=scsi-generic.o 8268063649Sblueswir1OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o 836c9f886cSbalrogOBJS+=usb-serial.o usb-net.o 84775616c3SpbrookOBJS+=sd.o ssi-sd.o 85e6a6d5abSbalrogOBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o 86559b90fbSaliguoriOBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o 87902b3d5cSmalcOBJS+=qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o 8887ecb68bSpbrook 892e4d9fb1Saurel32ifdef CONFIG_BRLAPI 902e4d9fb1Saurel32OBJS+= baum.o 912e4d9fb1Saurel32LIBS+=-lbrlapi 922e4d9fb1Saurel32endif 932e4d9fb1Saurel32 944fb240a4Sbellardifdef CONFIG_WIN32 954fb240a4SbellardOBJS+=tap-win32.o 96559b90fbSaliguorielse 97559b90fbSaliguoriOBJS+=migration-exec.o 984fb240a4Sbellardendif 994fb240a4Sbellard 1004fb240a4SbellardAUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o 1014fb240a4Sbellardifdef CONFIG_SDL 1024fb240a4SbellardAUDIO_OBJS += sdlaudio.o 1034fb240a4Sbellardendif 1044fb240a4Sbellardifdef CONFIG_OSS 1054fb240a4SbellardAUDIO_OBJS += ossaudio.o 1064fb240a4Sbellardendif 1074fb240a4Sbellardifdef CONFIG_COREAUDIO 1084fb240a4SbellardAUDIO_OBJS += coreaudio.o 109ca9cc28cSbalrogAUDIO_PT = yes 1104fb240a4Sbellardendif 1114fb240a4Sbellardifdef CONFIG_ALSA 1124fb240a4SbellardAUDIO_OBJS += alsaaudio.o 1134fb240a4Sbellardendif 1144fb240a4Sbellardifdef CONFIG_DSOUND 1154fb240a4SbellardAUDIO_OBJS += dsoundaudio.o 1164fb240a4Sbellardendif 1174fb240a4Sbellardifdef CONFIG_FMOD 1184fb240a4SbellardAUDIO_OBJS += fmodaudio.o 1194fb240a4Sbellardaudio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS) 1204fb240a4Sbellardendif 121ca9cc28cSbalrogifdef CONFIG_ESD 122ca9cc28cSbalrogAUDIO_PT = yes 123ca9cc28cSbalrogAUDIO_PT_INT = yes 124ca9cc28cSbalrogAUDIO_OBJS += esdaudio.o 125ca9cc28cSbalrogendif 126b8e59f18Smalcifdef CONFIG_PA 127b8e59f18SmalcAUDIO_PT = yes 128b8e59f18SmalcAUDIO_PT_INT = yes 129b8e59f18SmalcAUDIO_OBJS += paaudio.o 130b8e59f18Smalcendif 131ca9cc28cSbalrogifdef AUDIO_PT 132ca9cc28cSbalrogLDFLAGS += -pthread 133ca9cc28cSbalrogendif 134ca9cc28cSbalrogifdef AUDIO_PT_INT 135ca9cc28cSbalrogAUDIO_OBJS += audio_pt_int.o 136ca9cc28cSbalrogendif 1374fb240a4SbellardAUDIO_OBJS+= wavcapture.o 1384fb240a4SbellardOBJS+=$(addprefix audio/, $(AUDIO_OBJS)) 1394fb240a4Sbellard 140*0483755aSaliguoriOBJS+=keymaps.o 1414fb240a4Sbellardifdef CONFIG_SDL 1424fb240a4SbellardOBJS+=sdl.o x_keymap.o 1434fb240a4Sbellardendif 1444d3b6f6eSbalrogifdef CONFIG_CURSES 1454d3b6f6eSbalrogOBJS+=curses.o 1464d3b6f6eSbalrogendif 1474fb240a4SbellardOBJS+=vnc.o d3des.o 1484fb240a4Sbellard 1494fb240a4Sbellardifdef CONFIG_COCOA 1504fb240a4SbellardOBJS+=cocoa.o 1514fb240a4Sbellardendif 1524fb240a4Sbellard 1534fb240a4Sbellardifdef CONFIG_SLIRP 1544fb240a4SbellardCPPFLAGS+=-I$(SRC_PATH)/slirp 1554fb240a4SbellardSLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ 1564fb240a4Sbellardslirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ 1574fb240a4Sbellardtcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o 1584fb240a4SbellardOBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) 1594fb240a4Sbellardendif 1604fb240a4Sbellard 1618a16d273SthsLIBS+=$(VDE_LIBS) 1628a16d273Sths 1634fb240a4Sbellardcocoa.o: cocoa.m 1644fb240a4Sbellard 165*0483755aSaliguorikeymaps.o: keymaps.c keymaps.h 166*0483755aSaliguori 167*0483755aSaliguorisdl.o: sdl.c keymaps.h sdl_keysym.h 168807544e2Saliguori 169807544e2Saliguorisdl.o audio/sdlaudio.o: CFLAGS += $(SDL_CFLAGS) 1704fb240a4Sbellard 171*0483755aSaliguorivnc.o: vnc.c keymaps.h sdl_keysym.h vnchextile.h d3des.c d3des.h 172807544e2Saliguori 173807544e2Saliguorivnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS) 1744fb240a4Sbellard 175*0483755aSaliguoricurses.o: curses.c keymaps.h curses_keys.h 1764d3b6f6eSbalrog 177807544e2Saliguoribt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS) 1784fb240a4Sbellard 1794fb240a4Sbellardlibqemu_common.a: $(OBJS) 1804fb240a4Sbellard 181cec7d0b6Spbrook####################################################################### 182cec7d0b6Spbrook# USER_OBJS is code used by qemu userspace emulation 183902b3d5cSmalcUSER_OBJS=cutils.o cache-utils.o 184cec7d0b6Spbrook 185cec7d0b6Spbrooklibqemu_user.a: $(USER_OBJS) 186cec7d0b6Spbrook 1874fb240a4Sbellard###################################################################### 1884fb240a4Sbellard 18903ff3ca3Saliguoriqemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS) 1904fb240a4Sbellard 19103ff3ca3Saliguoriqemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS) 1923aa892d7Saliguori 1933aa892d7Saliguoriqemu-img$(EXESUF) qemu-nbd$(EXESUF): LIBS += -lz 1947a5ca864Sbellard 19531e31b8aSbellardclean: 1962d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files 1972d80ae89Sbellard 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 19886e840eeSaurel32 rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~ 1994fb240a4Sbellard rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d 2007d3505c5Sbellard $(MAKE) -C tests clean 201626df76aSbellard for d in $(TARGET_DIRS); do \ 2027d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 203626df76aSbellard done 20431e31b8aSbellard 2057d13299dSbellarddistclean: clean 206cc8ae6deSpbrook rm -f config-host.mak config-host.h $(DOCS) 2070cb3fb1eSpbrook rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} 20876bc6838Sbellard for d in $(TARGET_DIRS); do \ 209bc1b050dSbellard rm -rf $$d || exit 1 ; \ 21076bc6838Sbellard done 2117d13299dSbellard 212fed4a9adSbellardKEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ 213fed4a9adSbellardar de en-us fi fr-be hr it lv nl pl ru th \ 214fed4a9adSbellardcommon de-ch es fo fr-ca hu ja mk nl-be pt sl tr 215fed4a9adSbellard 21677755340Sthsifdef INSTALL_BLOBS 21777755340SthsBLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ 218e5d01b06Saurel32video.x openbios-sparc32 openbios-sparc64 openbios-ppc \ 219e5d01b06Saurel32pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \ 220e5d01b06Saurel32bamboo.dtb 22177755340Sthselse 22277755340SthsBLOBS= 22377755340Sthsendif 22477755340Sths 22538954dcaSpbrookinstall-doc: $(DOCS) 22638954dcaSpbrook mkdir -p "$(DESTDIR)$(docdir)" 22738954dcaSpbrook $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" 22838954dcaSpbrookifndef CONFIG_WIN32 22938954dcaSpbrook mkdir -p "$(DESTDIR)$(mandir)/man1" 2306473e68fSaliguori $(INSTALL) -m 644 qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" 2317a5ca864Sbellard mkdir -p "$(DESTDIR)$(mandir)/man8" 2326473e68fSaliguori $(INSTALL) -m 644 qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" 23338954dcaSpbrookendif 23438954dcaSpbrook 23538954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc) 2361236cab7Spbrook mkdir -p "$(DESTDIR)$(bindir)" 237932a79dfSthsifneq ($(TOOLS),) 2386a882643Spbrook $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" 239932a79dfSthsendif 24077755340Sthsifneq ($(BLOBS),) 2411236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)" 24277755340Sths set -e; for x in $(BLOBS); do \ 2436a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ 244ad064840Spbrook done 24577755340Sthsendif 24611d9f695Sbellardifndef CONFIG_WIN32 2471236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)/keymaps" 24818be8d77Sblueswir1 set -e; for x in $(KEYMAPS); do \ 2496a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ 250ad064840Spbrook done 25111d9f695Sbellardendif 252626df76aSbellard for d in $(TARGET_DIRS); do \ 2537d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 254626df76aSbellard done 255612384d7Sbellard 256367e86e8Sbellard# various test targets 2579b0b8203Sbellardtest speed: all 2587d3505c5Sbellard $(MAKE) -C tests $@ 25931e31b8aSbellard 260367e86e8SbellardTAGS: 261b9adb4a6Sbellard etags *.[ch] tests/*.[ch] 26231e31b8aSbellard 2636688bc6dSbellardcscope: 2646688bc6dSbellard rm -f ./cscope.* 265ede46085Saurel32 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files 2666688bc6dSbellard cscope -b 2676688bc6dSbellard 2683ef693a0Sbellard# documentation 2691f673135Sbellard%.html: %.texi 2703ef693a0Sbellard texi2html -monolithic -number $< 2713ef693a0Sbellard 272f3548328Sbellard%.info: %.texi 273f3548328Sbellard makeinfo $< -o $@ 274f3548328Sbellard 275f3548328Sbellard%.dvi: %.texi 276f3548328Sbellard texi2dvi $< 277f3548328Sbellard 2785a67135aSbellardqemu.1: qemu-doc.texi 279ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu.pod 2805a67135aSbellard pod2man --section=1 --center=" " --release=" " qemu.pod > $@ 2815a67135aSbellard 282acd935efSbellardqemu-img.1: qemu-img.texi 283ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu-img.pod 284acd935efSbellard pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ 285acd935efSbellard 2867a5ca864Sbellardqemu-nbd.8: qemu-nbd.texi 2877a5ca864Sbellard $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod 2887a5ca864Sbellard pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@ 2897a5ca864Sbellard 2900cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info 2910cb3fb1eSpbrook 2920cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi 2930cb3fb1eSpbrook 2940cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html 2950cb3fb1eSpbrook 296818220f5Saliguoriqemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi 297818220f5Saliguori 298df5cf721SthsVERSION ?= $(shell cat VERSION) 299df5cf721SthsFILE = qemu-$(VERSION) 300586314f2Sbellard 3011e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree) 302586314f2Sbellardtar: 303586314f2Sbellard rm -rf /tmp/$(FILE) 3041e43adfcSbellard cp -r . /tmp/$(FILE) 30599c6c082Saurel32 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn 306586314f2Sbellard rm -rf /tmp/$(FILE) 307586314f2Sbellard 30876b62fd0Sbellard# generate a binary distribution 309d691f669Sbellardtarbin: 31018be8d77Sblueswir1 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \ 31143095f31Sbellard $(bindir)/qemu \ 31243095f31Sbellard $(bindir)/qemu-system-x86_64 \ 31340e8a53bSaurel32 $(bindir)/qemu-system-arm \ 31440e8a53bSaurel32 $(bindir)/qemu-system-cris \ 31540e8a53bSaurel32 $(bindir)/qemu-system-m68k \ 31693856aacSbellard $(bindir)/qemu-system-mips \ 31738260998Spbrook $(bindir)/qemu-system-mipsel \ 318fbe4f65bSths $(bindir)/qemu-system-mips64 \ 319fbe4f65bSths $(bindir)/qemu-system-mips64el \ 32040e8a53bSaurel32 $(bindir)/qemu-system-ppc \ 32140e8a53bSaurel32 $(bindir)/qemu-system-ppcemb \ 32240e8a53bSaurel32 $(bindir)/qemu-system-ppc64 \ 323ff1aaf65Sths $(bindir)/qemu-system-sh4 \ 32485ffbdfcSths $(bindir)/qemu-system-sh4eb \ 32540e8a53bSaurel32 $(bindir)/qemu-system-sparc \ 3267efa4387Sbellard $(bindir)/qemu-i386 \ 327f0403c03Sbellard $(bindir)/qemu-x86_64 \ 32840e8a53bSaurel32 $(bindir)/qemu-alpha \ 3297efa4387Sbellard $(bindir)/qemu-arm \ 330ea31eb5bSbellard $(bindir)/qemu-armeb \ 33140e8a53bSaurel32 $(bindir)/qemu-cris \ 33240e8a53bSaurel32 $(bindir)/qemu-m68k \ 33340e8a53bSaurel32 $(bindir)/qemu-mips \ 33440e8a53bSaurel32 $(bindir)/qemu-mipsel \ 3357efa4387Sbellard $(bindir)/qemu-ppc \ 336d4082e95Sj_mayer $(bindir)/qemu-ppc64 \ 337f0403c03Sbellard $(bindir)/qemu-ppc64abi32 \ 338ff1aaf65Sths $(bindir)/qemu-sh4 \ 33985ffbdfcSths $(bindir)/qemu-sh4eb \ 34040e8a53bSaurel32 $(bindir)/qemu-sparc \ 34140e8a53bSaurel32 $(bindir)/qemu-sparc64 \ 34240e8a53bSaurel32 $(bindir)/qemu-sparc32plus \ 343b932cabaSbellard $(bindir)/qemu-img \ 3447a5ca864Sbellard $(bindir)/qemu-nbd \ 3457efa4387Sbellard $(datadir)/bios.bin \ 3467efa4387Sbellard $(datadir)/vgabios.bin \ 347de9258a8Sbellard $(datadir)/vgabios-cirrus.bin \ 348637f6cd7Sbellard $(datadir)/ppc_rom.bin \ 349d5295253Sbellard $(datadir)/video.x \ 3500986ac3bSbellard $(datadir)/openbios-sparc32 \ 351938255d2Sblueswir1 $(datadir)/openbios-sparc64 \ 352e5d01b06Saurel32 $(datadir)/openbios-ppc \ 35319c80e50Sbellard $(datadir)/pxe-ne2k_pci.bin \ 35419c80e50Sbellard $(datadir)/pxe-rtl8139.bin \ 35519c80e50Sbellard $(datadir)/pxe-pcnet.bin \ 3562991990bSaliguori $(datadir)/pxe-e1000.bin \ 3571f50f8d1Sbellard $(docdir)/qemu-doc.html \ 3581f50f8d1Sbellard $(docdir)/qemu-tech.html \ 35940e8a53bSaurel32 $(mandir)/man1/qemu.1 \ 36040e8a53bSaurel32 $(mandir)/man1/qemu-img.1 \ 3617a5ca864Sbellard $(mandir)/man8/qemu-nbd.8 362d691f669Sbellard 3634fb240a4Sbellard# Include automatically generated dependency files 3644fb240a4Sbellard-include $(wildcard *.d audio/*.d slirp/*.d) 365