10cb3fb1eSpbrook# Makefile for QEMU. 20cb3fb1eSpbrook 3ad064840Spbrookinclude config-host.mak 4*17759187Saliguoriinclude $(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 11*17759187Saliguori 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-%: 424aa42531Spbrook $(MAKE) -C $(subst subdir-,,$@) 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 1404fb240a4Sbellardifdef CONFIG_SDL 1414fb240a4SbellardOBJS+=sdl.o x_keymap.o 1424fb240a4Sbellardendif 1434d3b6f6eSbalrogifdef CONFIG_CURSES 1444d3b6f6eSbalrogOBJS+=curses.o 1454d3b6f6eSbalrogendif 1464fb240a4SbellardOBJS+=vnc.o d3des.o 1474fb240a4Sbellard 1484fb240a4Sbellardifdef CONFIG_COCOA 1494fb240a4SbellardOBJS+=cocoa.o 1504fb240a4Sbellardendif 1514fb240a4Sbellard 1524fb240a4Sbellardifdef CONFIG_SLIRP 1534fb240a4SbellardCPPFLAGS+=-I$(SRC_PATH)/slirp 1544fb240a4SbellardSLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ 1554fb240a4Sbellardslirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ 1564fb240a4Sbellardtcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o 1574fb240a4SbellardOBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) 1584fb240a4Sbellardendif 1594fb240a4Sbellard 1608a16d273SthsLIBS+=$(VDE_LIBS) 1618a16d273Sths 1624fb240a4Sbellardcocoa.o: cocoa.m 1634fb240a4Sbellard 1644fb240a4Sbellardsdl.o: sdl.c keymaps.c sdl_keysym.h 165807544e2Saliguori 166807544e2Saliguorisdl.o audio/sdlaudio.o: CFLAGS += $(SDL_CFLAGS) 1674fb240a4Sbellard 1684fb240a4Sbellardvnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h 169807544e2Saliguori 170807544e2Saliguorivnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS) 1714fb240a4Sbellard 1724d3b6f6eSbalrogcurses.o: curses.c keymaps.c curses_keys.h 1734d3b6f6eSbalrog 174807544e2Saliguoribt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS) 1754fb240a4Sbellard 1764fb240a4Sbellardlibqemu_common.a: $(OBJS) 1774fb240a4Sbellard rm -f $@ 1784fb240a4Sbellard $(AR) rcs $@ $(OBJS) 1794fb240a4Sbellard 180cec7d0b6Spbrook####################################################################### 181cec7d0b6Spbrook# USER_OBJS is code used by qemu userspace emulation 182902b3d5cSmalcUSER_OBJS=cutils.o cache-utils.o 183cec7d0b6Spbrook 184cec7d0b6Spbrooklibqemu_user.a: $(USER_OBJS) 185cec7d0b6Spbrook rm -f $@ 186cec7d0b6Spbrook $(AR) rcs $@ $(USER_OBJS) 187cec7d0b6Spbrook 1884fb240a4Sbellard###################################################################### 1894fb240a4Sbellard 19003ff3ca3Saliguoriqemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS) 19140293e58Sbellard $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) 1924fb240a4Sbellard 19303ff3ca3Saliguoriqemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS) 1947a5ca864Sbellard $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) 1957a5ca864Sbellard 19631e31b8aSbellardclean: 1972d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files 1982d80ae89Sbellard 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 19986e840eeSaurel32 rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~ 2004fb240a4Sbellard rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d 2017d3505c5Sbellard $(MAKE) -C tests clean 202626df76aSbellard for d in $(TARGET_DIRS); do \ 2037d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 204626df76aSbellard done 20531e31b8aSbellard 2067d13299dSbellarddistclean: clean 207cc8ae6deSpbrook rm -f config-host.mak config-host.h $(DOCS) 2080cb3fb1eSpbrook rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} 20976bc6838Sbellard for d in $(TARGET_DIRS); do \ 210bc1b050dSbellard rm -rf $$d || exit 1 ; \ 21176bc6838Sbellard done 2127d13299dSbellard 213fed4a9adSbellardKEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ 214fed4a9adSbellardar de en-us fi fr-be hr it lv nl pl ru th \ 215fed4a9adSbellardcommon de-ch es fo fr-ca hu ja mk nl-be pt sl tr 216fed4a9adSbellard 21777755340Sthsifdef INSTALL_BLOBS 21877755340SthsBLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ 219e5d01b06Saurel32video.x openbios-sparc32 openbios-sparc64 openbios-ppc \ 220e5d01b06Saurel32pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \ 221e5d01b06Saurel32bamboo.dtb 22277755340Sthselse 22377755340SthsBLOBS= 22477755340Sthsendif 22577755340Sths 22638954dcaSpbrookinstall-doc: $(DOCS) 22738954dcaSpbrook mkdir -p "$(DESTDIR)$(docdir)" 22838954dcaSpbrook $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" 22938954dcaSpbrookifndef CONFIG_WIN32 23038954dcaSpbrook mkdir -p "$(DESTDIR)$(mandir)/man1" 23138954dcaSpbrook $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" 2327a5ca864Sbellard mkdir -p "$(DESTDIR)$(mandir)/man8" 2337a5ca864Sbellard $(INSTALL) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" 23438954dcaSpbrookendif 23538954dcaSpbrook 23638954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc) 2371236cab7Spbrook mkdir -p "$(DESTDIR)$(bindir)" 238932a79dfSthsifneq ($(TOOLS),) 2396a882643Spbrook $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" 240932a79dfSthsendif 24177755340Sthsifneq ($(BLOBS),) 2421236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)" 24377755340Sths set -e; for x in $(BLOBS); do \ 2446a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ 245ad064840Spbrook done 24677755340Sthsendif 24711d9f695Sbellardifndef CONFIG_WIN32 2481236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)/keymaps" 24918be8d77Sblueswir1 set -e; for x in $(KEYMAPS); do \ 2506a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ 251ad064840Spbrook done 25211d9f695Sbellardendif 253626df76aSbellard for d in $(TARGET_DIRS); do \ 2547d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 255626df76aSbellard done 256612384d7Sbellard 257367e86e8Sbellard# various test targets 2589b0b8203Sbellardtest speed: all 2597d3505c5Sbellard $(MAKE) -C tests $@ 26031e31b8aSbellard 261367e86e8SbellardTAGS: 262b9adb4a6Sbellard etags *.[ch] tests/*.[ch] 26331e31b8aSbellard 2646688bc6dSbellardcscope: 2656688bc6dSbellard rm -f ./cscope.* 266ede46085Saurel32 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files 2676688bc6dSbellard cscope -b 2686688bc6dSbellard 2693ef693a0Sbellard# documentation 2701f673135Sbellard%.html: %.texi 2713ef693a0Sbellard texi2html -monolithic -number $< 2723ef693a0Sbellard 273f3548328Sbellard%.info: %.texi 274f3548328Sbellard makeinfo $< -o $@ 275f3548328Sbellard 276f3548328Sbellard%.dvi: %.texi 277f3548328Sbellard texi2dvi $< 278f3548328Sbellard 2795a67135aSbellardqemu.1: qemu-doc.texi 280ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu.pod 2815a67135aSbellard pod2man --section=1 --center=" " --release=" " qemu.pod > $@ 2825a67135aSbellard 283acd935efSbellardqemu-img.1: qemu-img.texi 284ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu-img.pod 285acd935efSbellard pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ 286acd935efSbellard 2877a5ca864Sbellardqemu-nbd.8: qemu-nbd.texi 2887a5ca864Sbellard $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod 2897a5ca864Sbellard pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@ 2907a5ca864Sbellard 2910cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info 2920cb3fb1eSpbrook 2930cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi 2940cb3fb1eSpbrook 2950cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html 2960cb3fb1eSpbrook 297818220f5Saliguoriqemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi 298818220f5Saliguori 299df5cf721SthsVERSION ?= $(shell cat VERSION) 300df5cf721SthsFILE = qemu-$(VERSION) 301586314f2Sbellard 3021e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree) 303586314f2Sbellardtar: 304586314f2Sbellard rm -rf /tmp/$(FILE) 3051e43adfcSbellard cp -r . /tmp/$(FILE) 30699c6c082Saurel32 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn 307586314f2Sbellard rm -rf /tmp/$(FILE) 308586314f2Sbellard 30976b62fd0Sbellard# generate a binary distribution 310d691f669Sbellardtarbin: 31118be8d77Sblueswir1 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \ 31243095f31Sbellard $(bindir)/qemu \ 31343095f31Sbellard $(bindir)/qemu-system-x86_64 \ 31440e8a53bSaurel32 $(bindir)/qemu-system-arm \ 31540e8a53bSaurel32 $(bindir)/qemu-system-cris \ 31640e8a53bSaurel32 $(bindir)/qemu-system-m68k \ 31793856aacSbellard $(bindir)/qemu-system-mips \ 31838260998Spbrook $(bindir)/qemu-system-mipsel \ 319fbe4f65bSths $(bindir)/qemu-system-mips64 \ 320fbe4f65bSths $(bindir)/qemu-system-mips64el \ 32140e8a53bSaurel32 $(bindir)/qemu-system-ppc \ 32240e8a53bSaurel32 $(bindir)/qemu-system-ppcemb \ 32340e8a53bSaurel32 $(bindir)/qemu-system-ppc64 \ 324ff1aaf65Sths $(bindir)/qemu-system-sh4 \ 32585ffbdfcSths $(bindir)/qemu-system-sh4eb \ 32640e8a53bSaurel32 $(bindir)/qemu-system-sparc \ 3277efa4387Sbellard $(bindir)/qemu-i386 \ 328f0403c03Sbellard $(bindir)/qemu-x86_64 \ 32940e8a53bSaurel32 $(bindir)/qemu-alpha \ 3307efa4387Sbellard $(bindir)/qemu-arm \ 331ea31eb5bSbellard $(bindir)/qemu-armeb \ 33240e8a53bSaurel32 $(bindir)/qemu-cris \ 33340e8a53bSaurel32 $(bindir)/qemu-m68k \ 33440e8a53bSaurel32 $(bindir)/qemu-mips \ 33540e8a53bSaurel32 $(bindir)/qemu-mipsel \ 3367efa4387Sbellard $(bindir)/qemu-ppc \ 337d4082e95Sj_mayer $(bindir)/qemu-ppc64 \ 338f0403c03Sbellard $(bindir)/qemu-ppc64abi32 \ 339ff1aaf65Sths $(bindir)/qemu-sh4 \ 34085ffbdfcSths $(bindir)/qemu-sh4eb \ 34140e8a53bSaurel32 $(bindir)/qemu-sparc \ 34240e8a53bSaurel32 $(bindir)/qemu-sparc64 \ 34340e8a53bSaurel32 $(bindir)/qemu-sparc32plus \ 344b932cabaSbellard $(bindir)/qemu-img \ 3457a5ca864Sbellard $(bindir)/qemu-nbd \ 3467efa4387Sbellard $(datadir)/bios.bin \ 3477efa4387Sbellard $(datadir)/vgabios.bin \ 348de9258a8Sbellard $(datadir)/vgabios-cirrus.bin \ 349637f6cd7Sbellard $(datadir)/ppc_rom.bin \ 350d5295253Sbellard $(datadir)/video.x \ 3510986ac3bSbellard $(datadir)/openbios-sparc32 \ 352938255d2Sblueswir1 $(datadir)/openbios-sparc64 \ 353e5d01b06Saurel32 $(datadir)/openbios-ppc \ 35419c80e50Sbellard $(datadir)/pxe-ne2k_pci.bin \ 35519c80e50Sbellard $(datadir)/pxe-rtl8139.bin \ 35619c80e50Sbellard $(datadir)/pxe-pcnet.bin \ 3572991990bSaliguori $(datadir)/pxe-e1000.bin \ 3581f50f8d1Sbellard $(docdir)/qemu-doc.html \ 3591f50f8d1Sbellard $(docdir)/qemu-tech.html \ 36040e8a53bSaurel32 $(mandir)/man1/qemu.1 \ 36140e8a53bSaurel32 $(mandir)/man1/qemu-img.1 \ 3627a5ca864Sbellard $(mandir)/man8/qemu-nbd.8 363d691f669Sbellard 3644fb240a4Sbellard# Include automatically generated dependency files 3654fb240a4Sbellard-include $(wildcard *.d audio/*.d slirp/*.d) 366