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 134fb240a4SbellardCPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP 144fb240a4SbellardCPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 15766a487aSbellardLIBS= 161f50f8d1Sbellardifdef CONFIG_STATIC 1740293e58SbellardLDFLAGS += -static 181f50f8d1Sbellardendif 19cc8ae6deSpbrookifdef BUILD_DOCS 20*7a5ca864SbellardDOCS=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 29da0b0df8Spbrooksubdir-%: dyngen$(EXESUF) libqemu_common.a 304aa42531Spbrook $(MAKE) -C $(subst subdir-,,$@) all 314aa42531Spbrook 324aa42531Spbrookrecurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) 334aa42531Spbrook 34faf07963Spbrook####################################################################### 35faf07963Spbrook# BLOCK_OBJS is code used by both qemu system emulation and qemu-img 36faf07963Spbrook 37faf07963SpbrookBLOCK_OBJS=cutils.o 38faf07963SpbrookBLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o 39faf07963SpbrookBLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o 40faf07963SpbrookBLOCK_OBJS+=block-qcow2.o block-parallels.o 41faf07963Spbrook 424fb240a4Sbellard###################################################################### 432e2ea909Sbellard# libqemu_common.a: Target independent part of system emulation. The 444fb240a4Sbellard# long term path is to suppress *all* target specific code in case of 454fb240a4Sbellard# system emulation, i.e. a single QEMU executable should support all 464fb240a4Sbellard# CPUs and machines. 4747cea614Sbellard 48faf07963SpbrookOBJS=$(BLOCK_OBJS) 49faf07963SpbrookOBJS+=readline.o console.o 50faf07963SpbrookOBJS+=block.o 514fb240a4Sbellard 5287ecb68bSpbrookOBJS+=irq.o 5387ecb68bSpbrookOBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o 547e7c5e4cSbalrogOBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o 551d4e547bSbalrogOBJS+=tmp105.o lm832x.o 5687ecb68bSpbrookOBJS+=scsi-disk.o cdrom.o 57985a03b0SthsOBJS+=scsi-generic.o 58a7954218SbalrogOBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o usb-serial.o 59775616c3SpbrookOBJS+=sd.o ssi-sd.o 6087ecb68bSpbrook 612e4d9fb1Saurel32ifdef CONFIG_BRLAPI 622e4d9fb1Saurel32OBJS+= baum.o 632e4d9fb1Saurel32LIBS+=-lbrlapi 642e4d9fb1Saurel32endif 652e4d9fb1Saurel32 664fb240a4Sbellardifdef CONFIG_WIN32 674fb240a4SbellardOBJS+=tap-win32.o 684fb240a4Sbellardendif 694fb240a4Sbellard 704fb240a4SbellardAUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o 714fb240a4Sbellardifdef CONFIG_SDL 724fb240a4SbellardAUDIO_OBJS += sdlaudio.o 734fb240a4Sbellardendif 744fb240a4Sbellardifdef CONFIG_OSS 754fb240a4SbellardAUDIO_OBJS += ossaudio.o 764fb240a4Sbellardendif 774fb240a4Sbellardifdef CONFIG_COREAUDIO 784fb240a4SbellardAUDIO_OBJS += coreaudio.o 79ca9cc28cSbalrogAUDIO_PT = yes 804fb240a4Sbellardendif 814fb240a4Sbellardifdef CONFIG_ALSA 824fb240a4SbellardAUDIO_OBJS += alsaaudio.o 834fb240a4Sbellardendif 844fb240a4Sbellardifdef CONFIG_DSOUND 854fb240a4SbellardAUDIO_OBJS += dsoundaudio.o 864fb240a4Sbellardendif 874fb240a4Sbellardifdef CONFIG_FMOD 884fb240a4SbellardAUDIO_OBJS += fmodaudio.o 894fb240a4Sbellardaudio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS) 904fb240a4Sbellardendif 91ca9cc28cSbalrogifdef CONFIG_ESD 92ca9cc28cSbalrogAUDIO_PT = yes 93ca9cc28cSbalrogAUDIO_PT_INT = yes 94ca9cc28cSbalrogAUDIO_OBJS += esdaudio.o 95ca9cc28cSbalrogendif 96ca9cc28cSbalrogifdef AUDIO_PT 97ca9cc28cSbalrogLDFLAGS += -pthread 98ca9cc28cSbalrogendif 99ca9cc28cSbalrogifdef AUDIO_PT_INT 100ca9cc28cSbalrogAUDIO_OBJS += audio_pt_int.o 101ca9cc28cSbalrogendif 1024fb240a4SbellardAUDIO_OBJS+= wavcapture.o 1034fb240a4SbellardOBJS+=$(addprefix audio/, $(AUDIO_OBJS)) 1044fb240a4Sbellard 1054fb240a4Sbellardifdef CONFIG_SDL 1064fb240a4SbellardOBJS+=sdl.o x_keymap.o 1074fb240a4Sbellardendif 1084d3b6f6eSbalrogifdef CONFIG_CURSES 1094d3b6f6eSbalrogOBJS+=curses.o 1104d3b6f6eSbalrogendif 1114fb240a4SbellardOBJS+=vnc.o d3des.o 1124fb240a4Sbellard 1134fb240a4Sbellardifdef CONFIG_COCOA 1144fb240a4SbellardOBJS+=cocoa.o 1154fb240a4Sbellardendif 1164fb240a4Sbellard 1174fb240a4Sbellardifdef CONFIG_SLIRP 1184fb240a4SbellardCPPFLAGS+=-I$(SRC_PATH)/slirp 1194fb240a4SbellardSLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ 1204fb240a4Sbellardslirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ 1214fb240a4Sbellardtcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o 1224fb240a4SbellardOBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) 1234fb240a4Sbellardendif 1244fb240a4Sbellard 1254fb240a4Sbellardcocoa.o: cocoa.m 12640293e58Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< 1274fb240a4Sbellard 1284fb240a4Sbellardsdl.o: sdl.c keymaps.c sdl_keysym.h 12940293e58Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $< 1304fb240a4Sbellard 1314fb240a4Sbellardvnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h 13240293e58Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_VNC_TLS_CFLAGS) -c -o $@ $< 1334fb240a4Sbellard 1344d3b6f6eSbalrogcurses.o: curses.c keymaps.c curses_keys.h 135f5d28393Spbrook $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< 1364d3b6f6eSbalrog 1374fb240a4Sbellardaudio/sdlaudio.o: audio/sdlaudio.c 13840293e58Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $< 1394fb240a4Sbellard 1404fb240a4Sbellardlibqemu_common.a: $(OBJS) 1414fb240a4Sbellard rm -f $@ 1424fb240a4Sbellard $(AR) rcs $@ $(OBJS) 1434fb240a4Sbellard 144223d4670SthsQEMU_IMG_BLOCK_OBJS = $(BLOCK_OBJS) 145223d4670Sthsifdef CONFIG_WIN32 146223d4670SthsQEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-win32.o 147223d4670Sthselse 148223d4670SthsQEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-posix.o 149223d4670Sthsendif 150223d4670Sths 1514fb240a4Sbellard###################################################################### 1524fb240a4Sbellard 153223d4670Sthsqemu-img$(EXESUF): qemu-img.o qemu-img-block.o $(QEMU_IMG_BLOCK_OBJS) 15440293e58Sbellard $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) 1554fb240a4Sbellard 156faf07963Spbrookqemu-img-%.o: %.c 15740293e58Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG -c -o $@ $< 158faf07963Spbrook 1594fb240a4Sbellard%.o: %.c 16040293e58Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< 1614fb240a4Sbellard 162*7a5ca864Sbellardqemu-nbd$(EXESUF): qemu-nbd.o nbd.o qemu-img-block.o \ 163*7a5ca864Sbellard $(QEMU_IMG_BLOCK_OBJS) 164*7a5ca864Sbellard $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) 165*7a5ca864Sbellard 1664fb240a4Sbellard# dyngen host tool 16711d9f695Sbellarddyngen$(EXESUF): dyngen.c 16840293e58Sbellard $(HOST_CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^ 16931e31b8aSbellard 17031e31b8aSbellardclean: 1712d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files 1722d80ae89Sbellard 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 1734fb240a4Sbellard rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~ 174b94ec3ecSbalrog rm -rf dyngen.dSYM 1754fb240a4Sbellard rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d 1767d3505c5Sbellard $(MAKE) -C tests clean 177626df76aSbellard for d in $(TARGET_DIRS); do \ 1787d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 179626df76aSbellard done 18031e31b8aSbellard 1817d13299dSbellarddistclean: clean 182cc8ae6deSpbrook rm -f config-host.mak config-host.h $(DOCS) 1830cb3fb1eSpbrook rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} 18476bc6838Sbellard for d in $(TARGET_DIRS); do \ 185bc1b050dSbellard rm -rf $$d || exit 1 ; \ 18676bc6838Sbellard done 1877d13299dSbellard 188fed4a9adSbellardKEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ 189fed4a9adSbellardar de en-us fi fr-be hr it lv nl pl ru th \ 190fed4a9adSbellardcommon de-ch es fo fr-ca hu ja mk nl-be pt sl tr 191fed4a9adSbellard 19238954dcaSpbrookinstall-doc: $(DOCS) 19338954dcaSpbrook mkdir -p "$(DESTDIR)$(docdir)" 19438954dcaSpbrook $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" 19538954dcaSpbrookifndef CONFIG_WIN32 19638954dcaSpbrook mkdir -p "$(DESTDIR)$(mandir)/man1" 19738954dcaSpbrook $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" 198*7a5ca864Sbellard mkdir -p "$(DESTDIR)$(mandir)/man8" 199*7a5ca864Sbellard $(INSTALL) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" 20038954dcaSpbrookendif 20138954dcaSpbrook 20238954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc) 2031236cab7Spbrook mkdir -p "$(DESTDIR)$(bindir)" 204932a79dfSthsifneq ($(TOOLS),) 2056a882643Spbrook $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" 206932a79dfSthsendif 2071236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)" 20818be8d77Sblueswir1 set -e; for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ 209938255d2Sblueswir1 video.x openbios-sparc32 openbios-sparc64 pxe-ne2k_pci.bin \ 210eec85c2aSths pxe-rtl8139.bin pxe-pcnet.bin; do \ 2116a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ 212ad064840Spbrook done 21311d9f695Sbellardifndef CONFIG_WIN32 2141236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)/keymaps" 21518be8d77Sblueswir1 set -e; for x in $(KEYMAPS); do \ 2166a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ 217ad064840Spbrook done 21811d9f695Sbellardendif 219626df76aSbellard for d in $(TARGET_DIRS); do \ 2207d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 221626df76aSbellard done 222612384d7Sbellard 223367e86e8Sbellard# various test targets 2249b0b8203Sbellardtest speed: all 2257d3505c5Sbellard $(MAKE) -C tests $@ 22631e31b8aSbellard 227367e86e8SbellardTAGS: 228b9adb4a6Sbellard etags *.[ch] tests/*.[ch] 22931e31b8aSbellard 2306688bc6dSbellardcscope: 2316688bc6dSbellard rm -f ./cscope.* 2326688bc6dSbellard find . -name "*.[ch]" -print > ./cscope.files 2336688bc6dSbellard cscope -b 2346688bc6dSbellard 2353ef693a0Sbellard# documentation 2361f673135Sbellard%.html: %.texi 2373ef693a0Sbellard texi2html -monolithic -number $< 2383ef693a0Sbellard 239f3548328Sbellard%.info: %.texi 240f3548328Sbellard makeinfo $< -o $@ 241f3548328Sbellard 242f3548328Sbellard%.dvi: %.texi 243f3548328Sbellard texi2dvi $< 244f3548328Sbellard 2455a67135aSbellardqemu.1: qemu-doc.texi 246ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu.pod 2475a67135aSbellard pod2man --section=1 --center=" " --release=" " qemu.pod > $@ 2485a67135aSbellard 249acd935efSbellardqemu-img.1: qemu-img.texi 250ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu-img.pod 251acd935efSbellard pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ 252acd935efSbellard 253*7a5ca864Sbellardqemu-nbd.8: qemu-nbd.texi 254*7a5ca864Sbellard $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod 255*7a5ca864Sbellard pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@ 256*7a5ca864Sbellard 2570cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info 2580cb3fb1eSpbrook 2590cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi 2600cb3fb1eSpbrook 2610cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html 2620cb3fb1eSpbrook 263df5cf721SthsVERSION ?= $(shell cat VERSION) 264df5cf721SthsFILE = qemu-$(VERSION) 265586314f2Sbellard 2661e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree) 267586314f2Sbellardtar: 268586314f2Sbellard rm -rf /tmp/$(FILE) 2691e43adfcSbellard cp -r . /tmp/$(FILE) 27099c6c082Saurel32 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn 271586314f2Sbellard rm -rf /tmp/$(FILE) 272586314f2Sbellard 27376b62fd0Sbellard# generate a binary distribution 274d691f669Sbellardtarbin: 27518be8d77Sblueswir1 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \ 27643095f31Sbellard $(bindir)/qemu \ 2777efa4387Sbellard $(bindir)/qemu-system-ppc \ 278d4082e95Sj_mayer $(bindir)/qemu-system-ppc64 \ 279d4082e95Sj_mayer $(bindir)/qemu-system-ppcemb \ 280acd935efSbellard $(bindir)/qemu-system-sparc \ 28143095f31Sbellard $(bindir)/qemu-system-x86_64 \ 28293856aacSbellard $(bindir)/qemu-system-mips \ 28338260998Spbrook $(bindir)/qemu-system-mipsel \ 284fbe4f65bSths $(bindir)/qemu-system-mips64 \ 285fbe4f65bSths $(bindir)/qemu-system-mips64el \ 286ea31eb5bSbellard $(bindir)/qemu-system-arm \ 287ff1aaf65Sths $(bindir)/qemu-system-m68k \ 288ff1aaf65Sths $(bindir)/qemu-system-sh4 \ 28985ffbdfcSths $(bindir)/qemu-system-sh4eb \ 290f0403c03Sbellard $(bindir)/qemu-system-cris \ 2917efa4387Sbellard $(bindir)/qemu-i386 \ 292f0403c03Sbellard $(bindir)/qemu-x86_64 \ 2937efa4387Sbellard $(bindir)/qemu-arm \ 294ea31eb5bSbellard $(bindir)/qemu-armeb \ 2957efa4387Sbellard $(bindir)/qemu-sparc \ 296f0403c03Sbellard $(bindir)/qemu-sparc32plus \ 297f0403c03Sbellard $(bindir)/qemu-sparc64 \ 2987efa4387Sbellard $(bindir)/qemu-ppc \ 299d4082e95Sj_mayer $(bindir)/qemu-ppc64 \ 300f0403c03Sbellard $(bindir)/qemu-ppc64abi32 \ 301ea31eb5bSbellard $(bindir)/qemu-mips \ 302ea31eb5bSbellard $(bindir)/qemu-mipsel \ 303cf6c1b16Sj_mayer $(bindir)/qemu-alpha \ 304ff1aaf65Sths $(bindir)/qemu-m68k \ 305ff1aaf65Sths $(bindir)/qemu-sh4 \ 30685ffbdfcSths $(bindir)/qemu-sh4eb \ 307f0403c03Sbellard $(bindir)/qemu-cris \ 308b932cabaSbellard $(bindir)/qemu-img \ 309*7a5ca864Sbellard $(bindir)/qemu-nbd \ 3107efa4387Sbellard $(datadir)/bios.bin \ 3117efa4387Sbellard $(datadir)/vgabios.bin \ 312de9258a8Sbellard $(datadir)/vgabios-cirrus.bin \ 313637f6cd7Sbellard $(datadir)/ppc_rom.bin \ 314d5295253Sbellard $(datadir)/video.x \ 3150986ac3bSbellard $(datadir)/openbios-sparc32 \ 316938255d2Sblueswir1 $(datadir)/openbios-sparc64 \ 31719c80e50Sbellard $(datadir)/pxe-ne2k_pci.bin \ 31819c80e50Sbellard $(datadir)/pxe-rtl8139.bin \ 31919c80e50Sbellard $(datadir)/pxe-pcnet.bin \ 3201f50f8d1Sbellard $(docdir)/qemu-doc.html \ 3211f50f8d1Sbellard $(docdir)/qemu-tech.html \ 32218be8d77Sblueswir1 $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 323*7a5ca864Sbellard $(mandir)/man8/qemu-nbd.8 324d691f669Sbellard 3254fb240a4Sbellard# Include automatically generated dependency files 3264fb240a4Sbellard-include $(wildcard *.d audio/*.d slirp/*.d) 327