10cb3fb1eSpbrook# Makefile for QEMU. 20cb3fb1eSpbrook 3ad064840Spbrookinclude config-host.mak 4766a487aSbellard 50cb3fb1eSpbrook.PHONY: all clean distclean dvi info install install-doc tar tarbin \ 69b0b8203Sbellard speed test html dvi info 70cb3fb1eSpbrook 88c462f8fSpbrookVPATH=$(SRC_PATH):$(SRC_PATH)/hw 98c462f8fSpbrook 1040293e58SbellardCFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS) 1140293e58SbellardLDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS) 123142255cSblueswir1 1396935aa4SmalcCPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@ 144fb240a4SbellardCPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 15766a487aSbellardLIBS= 161f50f8d1Sbellardifdef CONFIG_STATIC 1740293e58SbellardLDFLAGS += -static 181f50f8d1Sbellardendif 19cc8ae6deSpbrookifdef BUILD_DOCS 207a5ca864SbellardDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 21cc8ae6deSpbrookelse 22cc8ae6deSpbrookDOCS= 23cc8ae6deSpbrookendif 247d13299dSbellard 2570956b77SthsLIBS+=$(AIOLIBS) 2683f64091Sbellard 27da0b0df8Spbrookall: $(TOOLS) $(DOCS) recurse-all 28b9dea4fbSpbrook 29cec7d0b6SpbrookSUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS)) 30cec7d0b6Spbrook 31cec7d0b6Spbrooksubdir-%: dyngen$(EXESUF) 324aa42531Spbrook $(MAKE) -C $(subst subdir-,,$@) all 334aa42531Spbrook 34cec7d0b6Spbrook$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a 35cec7d0b6Spbrook$(filter %-user,$(SUBDIR_RULES)): libqemu_user.a 36cec7d0b6Spbrook 37cec7d0b6Spbrookrecurse-all: $(SUBDIR_RULES) 384aa42531Spbrook 39faf07963Spbrook####################################################################### 40faf07963Spbrook# BLOCK_OBJS is code used by both qemu system emulation and qemu-img 41faf07963Spbrook 4217e2377aSpbrookBLOCK_OBJS=cutils.o qemu-malloc.o 43faf07963SpbrookBLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o 44faf07963SpbrookBLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o 4575818250SthsBLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o 46faf07963Spbrook 474fb240a4Sbellard###################################################################### 482e2ea909Sbellard# libqemu_common.a: Target independent part of system emulation. The 494fb240a4Sbellard# long term path is to suppress *all* target specific code in case of 504fb240a4Sbellard# system emulation, i.e. a single QEMU executable should support all 514fb240a4Sbellard# CPUs and machines. 5247cea614Sbellard 5375818250SthsOBJS=nbd.o $(BLOCK_OBJS) 54faf07963SpbrookOBJS+=readline.o console.o 55faf07963SpbrookOBJS+=block.o 564fb240a4Sbellard 5787ecb68bSpbrookOBJS+=irq.o 5887ecb68bSpbrookOBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o 597e7c5e4cSbalrogOBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o 601d4e547bSbalrogOBJS+=tmp105.o lm832x.o 6187ecb68bSpbrookOBJS+=scsi-disk.o cdrom.o 62985a03b0SthsOBJS+=scsi-generic.o 636c9f886cSbalrogOBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o 646c9f886cSbalrogOBJS+=usb-serial.o usb-net.o 65775616c3SpbrookOBJS+=sd.o ssi-sd.o 6687ecb68bSpbrook 672e4d9fb1Saurel32ifdef CONFIG_BRLAPI 682e4d9fb1Saurel32OBJS+= baum.o 692e4d9fb1Saurel32LIBS+=-lbrlapi 702e4d9fb1Saurel32endif 712e4d9fb1Saurel32 724fb240a4Sbellardifdef CONFIG_WIN32 734fb240a4SbellardOBJS+=tap-win32.o 744fb240a4Sbellardendif 754fb240a4Sbellard 764fb240a4SbellardAUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o 774fb240a4Sbellardifdef CONFIG_SDL 784fb240a4SbellardAUDIO_OBJS += sdlaudio.o 794fb240a4Sbellardendif 804fb240a4Sbellardifdef CONFIG_OSS 814fb240a4SbellardAUDIO_OBJS += ossaudio.o 824fb240a4Sbellardendif 834fb240a4Sbellardifdef CONFIG_COREAUDIO 844fb240a4SbellardAUDIO_OBJS += coreaudio.o 85ca9cc28cSbalrogAUDIO_PT = yes 864fb240a4Sbellardendif 874fb240a4Sbellardifdef CONFIG_ALSA 884fb240a4SbellardAUDIO_OBJS += alsaaudio.o 894fb240a4Sbellardendif 904fb240a4Sbellardifdef CONFIG_DSOUND 914fb240a4SbellardAUDIO_OBJS += dsoundaudio.o 924fb240a4Sbellardendif 934fb240a4Sbellardifdef CONFIG_FMOD 944fb240a4SbellardAUDIO_OBJS += fmodaudio.o 954fb240a4Sbellardaudio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS) 964fb240a4Sbellardendif 97ca9cc28cSbalrogifdef CONFIG_ESD 98ca9cc28cSbalrogAUDIO_PT = yes 99ca9cc28cSbalrogAUDIO_PT_INT = yes 100ca9cc28cSbalrogAUDIO_OBJS += esdaudio.o 101ca9cc28cSbalrogendif 102b8e59f18Smalcifdef CONFIG_PA 103b8e59f18SmalcAUDIO_PT = yes 104b8e59f18SmalcAUDIO_PT_INT = yes 105b8e59f18SmalcAUDIO_OBJS += paaudio.o 106b8e59f18Smalcendif 107ca9cc28cSbalrogifdef AUDIO_PT 108ca9cc28cSbalrogLDFLAGS += -pthread 109ca9cc28cSbalrogendif 110ca9cc28cSbalrogifdef AUDIO_PT_INT 111ca9cc28cSbalrogAUDIO_OBJS += audio_pt_int.o 112ca9cc28cSbalrogendif 1134fb240a4SbellardAUDIO_OBJS+= wavcapture.o 1144fb240a4SbellardOBJS+=$(addprefix audio/, $(AUDIO_OBJS)) 1154fb240a4Sbellard 1164fb240a4Sbellardifdef CONFIG_SDL 1174fb240a4SbellardOBJS+=sdl.o x_keymap.o 1184fb240a4Sbellardendif 1194d3b6f6eSbalrogifdef CONFIG_CURSES 1204d3b6f6eSbalrogOBJS+=curses.o 1214d3b6f6eSbalrogendif 1224fb240a4SbellardOBJS+=vnc.o d3des.o 1234fb240a4Sbellard 1244fb240a4Sbellardifdef CONFIG_COCOA 1254fb240a4SbellardOBJS+=cocoa.o 1264fb240a4Sbellardendif 1274fb240a4Sbellard 1284fb240a4Sbellardifdef CONFIG_SLIRP 1294fb240a4SbellardCPPFLAGS+=-I$(SRC_PATH)/slirp 1304fb240a4SbellardSLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ 1314fb240a4Sbellardslirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ 1324fb240a4Sbellardtcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o 1334fb240a4SbellardOBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) 1344fb240a4Sbellardendif 1354fb240a4Sbellard 136*8a16d273SthsLIBS+=$(VDE_LIBS) 137*8a16d273Sths 1384fb240a4Sbellardcocoa.o: cocoa.m 13940293e58Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< 1404fb240a4Sbellard 1414fb240a4Sbellardsdl.o: sdl.c keymaps.c sdl_keysym.h 14240293e58Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $< 1434fb240a4Sbellard 1444fb240a4Sbellardvnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h 14540293e58Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_VNC_TLS_CFLAGS) -c -o $@ $< 1464fb240a4Sbellard 1474d3b6f6eSbalrogcurses.o: curses.c keymaps.c curses_keys.h 148f5d28393Spbrook $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< 1494d3b6f6eSbalrog 1504fb240a4Sbellardaudio/sdlaudio.o: audio/sdlaudio.c 15140293e58Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $< 1524fb240a4Sbellard 1534fb240a4Sbellardlibqemu_common.a: $(OBJS) 1544fb240a4Sbellard rm -f $@ 1554fb240a4Sbellard $(AR) rcs $@ $(OBJS) 1564fb240a4Sbellard 157cec7d0b6Spbrook####################################################################### 158cec7d0b6Spbrook# USER_OBJS is code used by qemu userspace emulation 159cec7d0b6SpbrookUSER_OBJS=cutils.o 160cec7d0b6Spbrook 161cec7d0b6Spbrooklibqemu_user.a: $(USER_OBJS) 162cec7d0b6Spbrook rm -f $@ 163cec7d0b6Spbrook $(AR) rcs $@ $(USER_OBJS) 164cec7d0b6Spbrook 16575818250SthsQEMU_IMG_BLOCK_OBJS = nbd.o $(BLOCK_OBJS) 166223d4670Sthsifdef CONFIG_WIN32 167223d4670SthsQEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-win32.o 168223d4670Sthselse 169223d4670SthsQEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-posix.o 170223d4670Sthsendif 171223d4670Sths 1724fb240a4Sbellard###################################################################### 1734fb240a4Sbellard 174223d4670Sthsqemu-img$(EXESUF): qemu-img.o qemu-img-block.o $(QEMU_IMG_BLOCK_OBJS) 17540293e58Sbellard $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) 1764fb240a4Sbellard 177faf07963Spbrookqemu-img-%.o: %.c 17840293e58Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG -c -o $@ $< 179faf07963Spbrook 1804fb240a4Sbellard%.o: %.c 18140293e58Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< 1824fb240a4Sbellard 1832f726488Sthsqemu-nbd-%.o: %.c 1842f726488Sths $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_NBD -c -o $@ $< 1852f726488Sths 18675818250Sthsqemu-nbd$(EXESUF): qemu-nbd.o qemu-nbd-nbd.o qemu-img-block.o \ 1872f726488Sths osdep.o qemu-nbd-block-raw-posix.o $(BLOCK_OBJS) 1887a5ca864Sbellard $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) 1897a5ca864Sbellard 1904fb240a4Sbellard# dyngen host tool 19111d9f695Sbellarddyngen$(EXESUF): dyngen.c 19240293e58Sbellard $(HOST_CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^ 19331e31b8aSbellard 19431e31b8aSbellardclean: 1952d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files 1962d80ae89Sbellard 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 1974fb240a4Sbellard rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~ 198b94ec3ecSbalrog rm -rf dyngen.dSYM 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 21638954dcaSpbrookinstall-doc: $(DOCS) 21738954dcaSpbrook mkdir -p "$(DESTDIR)$(docdir)" 21838954dcaSpbrook $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" 21938954dcaSpbrookifndef CONFIG_WIN32 22038954dcaSpbrook mkdir -p "$(DESTDIR)$(mandir)/man1" 22138954dcaSpbrook $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" 2227a5ca864Sbellard mkdir -p "$(DESTDIR)$(mandir)/man8" 2237a5ca864Sbellard $(INSTALL) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" 22438954dcaSpbrookendif 22538954dcaSpbrook 22638954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc) 2271236cab7Spbrook mkdir -p "$(DESTDIR)$(bindir)" 228932a79dfSthsifneq ($(TOOLS),) 2296a882643Spbrook $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" 230932a79dfSthsendif 2311236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)" 23218be8d77Sblueswir1 set -e; for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ 233938255d2Sblueswir1 video.x openbios-sparc32 openbios-sparc64 pxe-ne2k_pci.bin \ 234eec85c2aSths pxe-rtl8139.bin pxe-pcnet.bin; do \ 2356a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ 236ad064840Spbrook done 23711d9f695Sbellardifndef CONFIG_WIN32 2381236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)/keymaps" 23918be8d77Sblueswir1 set -e; for x in $(KEYMAPS); do \ 2406a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ 241ad064840Spbrook done 24211d9f695Sbellardendif 243626df76aSbellard for d in $(TARGET_DIRS); do \ 2447d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 245626df76aSbellard done 246612384d7Sbellard 247367e86e8Sbellard# various test targets 2489b0b8203Sbellardtest speed: all 2497d3505c5Sbellard $(MAKE) -C tests $@ 25031e31b8aSbellard 251367e86e8SbellardTAGS: 252b9adb4a6Sbellard etags *.[ch] tests/*.[ch] 25331e31b8aSbellard 2546688bc6dSbellardcscope: 2556688bc6dSbellard rm -f ./cscope.* 2566688bc6dSbellard find . -name "*.[ch]" -print > ./cscope.files 2576688bc6dSbellard cscope -b 2586688bc6dSbellard 2593ef693a0Sbellard# documentation 2601f673135Sbellard%.html: %.texi 2613ef693a0Sbellard texi2html -monolithic -number $< 2623ef693a0Sbellard 263f3548328Sbellard%.info: %.texi 264f3548328Sbellard makeinfo $< -o $@ 265f3548328Sbellard 266f3548328Sbellard%.dvi: %.texi 267f3548328Sbellard texi2dvi $< 268f3548328Sbellard 2695a67135aSbellardqemu.1: qemu-doc.texi 270ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu.pod 2715a67135aSbellard pod2man --section=1 --center=" " --release=" " qemu.pod > $@ 2725a67135aSbellard 273acd935efSbellardqemu-img.1: qemu-img.texi 274ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu-img.pod 275acd935efSbellard pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ 276acd935efSbellard 2777a5ca864Sbellardqemu-nbd.8: qemu-nbd.texi 2787a5ca864Sbellard $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod 2797a5ca864Sbellard pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@ 2807a5ca864Sbellard 2810cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info 2820cb3fb1eSpbrook 2830cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi 2840cb3fb1eSpbrook 2850cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html 2860cb3fb1eSpbrook 287df5cf721SthsVERSION ?= $(shell cat VERSION) 288df5cf721SthsFILE = qemu-$(VERSION) 289586314f2Sbellard 2901e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree) 291586314f2Sbellardtar: 292586314f2Sbellard rm -rf /tmp/$(FILE) 2931e43adfcSbellard cp -r . /tmp/$(FILE) 29499c6c082Saurel32 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn 295586314f2Sbellard rm -rf /tmp/$(FILE) 296586314f2Sbellard 29776b62fd0Sbellard# generate a binary distribution 298d691f669Sbellardtarbin: 29918be8d77Sblueswir1 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \ 30043095f31Sbellard $(bindir)/qemu \ 3017efa4387Sbellard $(bindir)/qemu-system-ppc \ 302d4082e95Sj_mayer $(bindir)/qemu-system-ppc64 \ 303d4082e95Sj_mayer $(bindir)/qemu-system-ppcemb \ 304acd935efSbellard $(bindir)/qemu-system-sparc \ 30543095f31Sbellard $(bindir)/qemu-system-x86_64 \ 30693856aacSbellard $(bindir)/qemu-system-mips \ 30738260998Spbrook $(bindir)/qemu-system-mipsel \ 308fbe4f65bSths $(bindir)/qemu-system-mips64 \ 309fbe4f65bSths $(bindir)/qemu-system-mips64el \ 310ea31eb5bSbellard $(bindir)/qemu-system-arm \ 311ff1aaf65Sths $(bindir)/qemu-system-m68k \ 312ff1aaf65Sths $(bindir)/qemu-system-sh4 \ 31385ffbdfcSths $(bindir)/qemu-system-sh4eb \ 314f0403c03Sbellard $(bindir)/qemu-system-cris \ 3157efa4387Sbellard $(bindir)/qemu-i386 \ 316f0403c03Sbellard $(bindir)/qemu-x86_64 \ 3177efa4387Sbellard $(bindir)/qemu-arm \ 318ea31eb5bSbellard $(bindir)/qemu-armeb \ 3197efa4387Sbellard $(bindir)/qemu-sparc \ 320f0403c03Sbellard $(bindir)/qemu-sparc32plus \ 321f0403c03Sbellard $(bindir)/qemu-sparc64 \ 3227efa4387Sbellard $(bindir)/qemu-ppc \ 323d4082e95Sj_mayer $(bindir)/qemu-ppc64 \ 324f0403c03Sbellard $(bindir)/qemu-ppc64abi32 \ 325ea31eb5bSbellard $(bindir)/qemu-mips \ 326ea31eb5bSbellard $(bindir)/qemu-mipsel \ 327cf6c1b16Sj_mayer $(bindir)/qemu-alpha \ 328ff1aaf65Sths $(bindir)/qemu-m68k \ 329ff1aaf65Sths $(bindir)/qemu-sh4 \ 33085ffbdfcSths $(bindir)/qemu-sh4eb \ 331f0403c03Sbellard $(bindir)/qemu-cris \ 332b932cabaSbellard $(bindir)/qemu-img \ 3337a5ca864Sbellard $(bindir)/qemu-nbd \ 3347efa4387Sbellard $(datadir)/bios.bin \ 3357efa4387Sbellard $(datadir)/vgabios.bin \ 336de9258a8Sbellard $(datadir)/vgabios-cirrus.bin \ 337637f6cd7Sbellard $(datadir)/ppc_rom.bin \ 338d5295253Sbellard $(datadir)/video.x \ 3390986ac3bSbellard $(datadir)/openbios-sparc32 \ 340938255d2Sblueswir1 $(datadir)/openbios-sparc64 \ 34119c80e50Sbellard $(datadir)/pxe-ne2k_pci.bin \ 34219c80e50Sbellard $(datadir)/pxe-rtl8139.bin \ 34319c80e50Sbellard $(datadir)/pxe-pcnet.bin \ 3441f50f8d1Sbellard $(docdir)/qemu-doc.html \ 3451f50f8d1Sbellard $(docdir)/qemu-tech.html \ 34618be8d77Sblueswir1 $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 3477a5ca864Sbellard $(mandir)/man8/qemu-nbd.8 348d691f669Sbellard 3494fb240a4Sbellard# Include automatically generated dependency files 3504fb240a4Sbellard-include $(wildcard *.d audio/*.d slirp/*.d) 351