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 106f30fa85SthsBASE_CFLAGS= 116f30fa85SthsBASE_LDFLAGS= 126f30fa85Sths 133142255cSblueswir1BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS) 143142255cSblueswir1BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS) 153142255cSblueswir1 164fb240a4SbellardCPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP 174fb240a4SbellardCPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 18766a487aSbellardLIBS= 191f50f8d1Sbellardifdef CONFIG_STATIC 206f30fa85SthsBASE_LDFLAGS += -static 211f50f8d1Sbellardendif 22cc8ae6deSpbrookifdef BUILD_DOCS 23acd935efSbellardDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 24cc8ae6deSpbrookelse 25cc8ae6deSpbrookDOCS= 26cc8ae6deSpbrookendif 277d13299dSbellard 2870956b77SthsLIBS+=$(AIOLIBS) 2983f64091Sbellard 30da0b0df8Spbrookall: $(TOOLS) $(DOCS) recurse-all 31b9dea4fbSpbrook 32da0b0df8Spbrooksubdir-%: dyngen$(EXESUF) libqemu_common.a 334aa42531Spbrook $(MAKE) -C $(subst subdir-,,$@) all 344aa42531Spbrook 354aa42531Spbrookrecurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) 364aa42531Spbrook 37faf07963Spbrook####################################################################### 38faf07963Spbrook# BLOCK_OBJS is code used by both qemu system emulation and qemu-img 39faf07963Spbrook 40faf07963SpbrookBLOCK_OBJS=cutils.o 41faf07963SpbrookBLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o 42faf07963SpbrookBLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o 43faf07963SpbrookBLOCK_OBJS+=block-qcow2.o block-parallels.o 44faf07963Spbrook 454fb240a4Sbellard###################################################################### 46faf07963Spbrook# libqemu_common.a: Target indepedent part of system emulation. The 474fb240a4Sbellard# long term path is to suppress *all* target specific code in case of 484fb240a4Sbellard# system emulation, i.e. a single QEMU executable should support all 494fb240a4Sbellard# CPUs and machines. 5047cea614Sbellard 51faf07963SpbrookOBJS=$(BLOCK_OBJS) 52faf07963SpbrookOBJS+=readline.o console.o 53faf07963SpbrookOBJS+=block.o 544fb240a4Sbellard 5587ecb68bSpbrookOBJS+=irq.o 5687ecb68bSpbrookOBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o 57cf0dbb21SpbrookOBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o 5887ecb68bSpbrookOBJS+=scsi-disk.o cdrom.o 59985a03b0SthsOBJS+=scsi-generic.o 6087ecb68bSpbrookOBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o 61775616c3SpbrookOBJS+=sd.o ssi-sd.o 6287ecb68bSpbrook 634fb240a4Sbellardifdef CONFIG_WIN32 644fb240a4SbellardOBJS+=tap-win32.o 654fb240a4Sbellardendif 664fb240a4Sbellard 674fb240a4SbellardAUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o 684fb240a4Sbellardifdef CONFIG_SDL 694fb240a4SbellardAUDIO_OBJS += sdlaudio.o 704fb240a4Sbellardendif 714fb240a4Sbellardifdef CONFIG_OSS 724fb240a4SbellardAUDIO_OBJS += ossaudio.o 734fb240a4Sbellardendif 744fb240a4Sbellardifdef CONFIG_COREAUDIO 754fb240a4SbellardAUDIO_OBJS += coreaudio.o 764fb240a4Sbellardendif 774fb240a4Sbellardifdef CONFIG_ALSA 784fb240a4SbellardAUDIO_OBJS += alsaaudio.o 794fb240a4Sbellardendif 804fb240a4Sbellardifdef CONFIG_DSOUND 814fb240a4SbellardAUDIO_OBJS += dsoundaudio.o 824fb240a4Sbellardendif 834fb240a4Sbellardifdef CONFIG_FMOD 844fb240a4SbellardAUDIO_OBJS += fmodaudio.o 854fb240a4Sbellardaudio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS) 864fb240a4Sbellardendif 874fb240a4SbellardAUDIO_OBJS+= wavcapture.o 884fb240a4SbellardOBJS+=$(addprefix audio/, $(AUDIO_OBJS)) 894fb240a4Sbellard 904fb240a4Sbellardifdef CONFIG_SDL 914fb240a4SbellardOBJS+=sdl.o x_keymap.o 924fb240a4Sbellardendif 934fb240a4SbellardOBJS+=vnc.o d3des.o 944fb240a4Sbellard 954fb240a4Sbellardifdef CONFIG_COCOA 964fb240a4SbellardOBJS+=cocoa.o 974fb240a4Sbellardendif 984fb240a4Sbellard 994fb240a4Sbellardifdef CONFIG_SLIRP 1004fb240a4SbellardCPPFLAGS+=-I$(SRC_PATH)/slirp 1014fb240a4SbellardSLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ 1024fb240a4Sbellardslirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ 1034fb240a4Sbellardtcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o 1044fb240a4SbellardOBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) 1054fb240a4Sbellardendif 1064fb240a4Sbellard 1074fb240a4Sbellardcocoa.o: cocoa.m 1084fb240a4Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< 1094fb240a4Sbellard 1104fb240a4Sbellardsdl.o: sdl.c keymaps.c sdl_keysym.h 1114fb240a4Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $< 1124fb240a4Sbellard 1134fb240a4Sbellardvnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h 114d5db4246Sths $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(CONFIG_VNC_TLS_CFLAGS) -c -o $@ $< 1154fb240a4Sbellard 1164fb240a4Sbellardaudio/sdlaudio.o: audio/sdlaudio.c 1174fb240a4Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $< 1184fb240a4Sbellard 1194fb240a4Sbellardlibqemu_common.a: $(OBJS) 1204fb240a4Sbellard rm -f $@ 1214fb240a4Sbellard $(AR) rcs $@ $(OBJS) 1224fb240a4Sbellard 123223d4670SthsQEMU_IMG_BLOCK_OBJS = $(BLOCK_OBJS) 124223d4670Sthsifdef CONFIG_WIN32 125223d4670SthsQEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-win32.o 126223d4670Sthselse 127223d4670SthsQEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-posix.o 128223d4670Sthsendif 129223d4670Sths 1304fb240a4Sbellard###################################################################### 1314fb240a4Sbellard 132223d4670Sthsqemu-img$(EXESUF): qemu-img.o qemu-img-block.o $(QEMU_IMG_BLOCK_OBJS) 1334fb240a4Sbellard $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) 1344fb240a4Sbellard 135faf07963Spbrookqemu-img-%.o: %.c 136faf07963Spbrook $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG $(BASE_CFLAGS) -c -o $@ $< 137faf07963Spbrook 1384fb240a4Sbellard%.o: %.c 1394fb240a4Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< 1404fb240a4Sbellard 1414fb240a4Sbellard# dyngen host tool 14211d9f695Sbellarddyngen$(EXESUF): dyngen.c 1436f30fa85Sths $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^ 14431e31b8aSbellard 14531e31b8aSbellardclean: 1462d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files 1472d80ae89Sbellard 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 1484fb240a4Sbellard rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~ 1494fb240a4Sbellard rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d 1507d3505c5Sbellard $(MAKE) -C tests clean 151626df76aSbellard for d in $(TARGET_DIRS); do \ 1527d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 153626df76aSbellard done 15431e31b8aSbellard 1557d13299dSbellarddistclean: clean 156cc8ae6deSpbrook rm -f config-host.mak config-host.h $(DOCS) 1570cb3fb1eSpbrook rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} 15876bc6838Sbellard for d in $(TARGET_DIRS); do \ 159bc1b050dSbellard rm -rf $$d || exit 1 ; \ 16076bc6838Sbellard done 1617d13299dSbellard 162fed4a9adSbellardKEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ 163fed4a9adSbellardar de en-us fi fr-be hr it lv nl pl ru th \ 164fed4a9adSbellardcommon de-ch es fo fr-ca hu ja mk nl-be pt sl tr 165fed4a9adSbellard 16638954dcaSpbrookinstall-doc: $(DOCS) 16738954dcaSpbrook mkdir -p "$(DESTDIR)$(docdir)" 16838954dcaSpbrook $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" 16938954dcaSpbrookifndef CONFIG_WIN32 17038954dcaSpbrook mkdir -p "$(DESTDIR)$(mandir)/man1" 17138954dcaSpbrook $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" 17238954dcaSpbrookendif 17338954dcaSpbrook 17438954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc) 1751236cab7Spbrook mkdir -p "$(DESTDIR)$(bindir)" 176932a79dfSthsifneq ($(TOOLS),) 1776a882643Spbrook $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" 178932a79dfSthsendif 1791236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)" 180ad064840Spbrook for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ 181860c6c52Sths video.x openbios-sparc32 pxe-ne2k_pci.bin \ 182eec85c2aSths pxe-rtl8139.bin pxe-pcnet.bin; do \ 1836a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ 184ad064840Spbrook done 18511d9f695Sbellardifndef CONFIG_WIN32 1861236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)/keymaps" 187ad064840Spbrook for x in $(KEYMAPS); do \ 1886a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ 189ad064840Spbrook done 19011d9f695Sbellardendif 191626df76aSbellard for d in $(TARGET_DIRS); do \ 1927d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 193626df76aSbellard done 194612384d7Sbellard 195367e86e8Sbellard# various test targets 1969b0b8203Sbellardtest speed: all 1977d3505c5Sbellard $(MAKE) -C tests $@ 19831e31b8aSbellard 199367e86e8SbellardTAGS: 200b9adb4a6Sbellard etags *.[ch] tests/*.[ch] 20131e31b8aSbellard 2026688bc6dSbellardcscope: 2036688bc6dSbellard rm -f ./cscope.* 2046688bc6dSbellard find . -name "*.[ch]" -print > ./cscope.files 2056688bc6dSbellard cscope -b 2066688bc6dSbellard 2073ef693a0Sbellard# documentation 2081f673135Sbellard%.html: %.texi 2093ef693a0Sbellard texi2html -monolithic -number $< 2103ef693a0Sbellard 211f3548328Sbellard%.info: %.texi 212f3548328Sbellard makeinfo $< -o $@ 213f3548328Sbellard 214f3548328Sbellard%.dvi: %.texi 215f3548328Sbellard texi2dvi $< 216f3548328Sbellard 2175a67135aSbellardqemu.1: qemu-doc.texi 218ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu.pod 2195a67135aSbellard pod2man --section=1 --center=" " --release=" " qemu.pod > $@ 2205a67135aSbellard 221acd935efSbellardqemu-img.1: qemu-img.texi 222ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu-img.pod 223acd935efSbellard pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ 224acd935efSbellard 2250cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info 2260cb3fb1eSpbrook 2270cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi 2280cb3fb1eSpbrook 2290cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html 2300cb3fb1eSpbrook 231df5cf721SthsVERSION ?= $(shell cat VERSION) 232df5cf721SthsFILE = qemu-$(VERSION) 233586314f2Sbellard 2341e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree) 235586314f2Sbellardtar: 236586314f2Sbellard rm -rf /tmp/$(FILE) 2371e43adfcSbellard cp -r . /tmp/$(FILE) 23876b62fd0Sbellard ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS ) 239586314f2Sbellard rm -rf /tmp/$(FILE) 240586314f2Sbellard 24176b62fd0Sbellard# generate a binary distribution 242d691f669Sbellardtarbin: 2434887d78bSths ( cd / ; tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \ 24443095f31Sbellard $(bindir)/qemu \ 2457efa4387Sbellard $(bindir)/qemu-system-ppc \ 246d4082e95Sj_mayer $(bindir)/qemu-system-ppc64 \ 247d4082e95Sj_mayer $(bindir)/qemu-system-ppcemb \ 248acd935efSbellard $(bindir)/qemu-system-sparc \ 24943095f31Sbellard $(bindir)/qemu-system-x86_64 \ 25093856aacSbellard $(bindir)/qemu-system-mips \ 25138260998Spbrook $(bindir)/qemu-system-mipsel \ 252fbe4f65bSths $(bindir)/qemu-system-mips64 \ 253fbe4f65bSths $(bindir)/qemu-system-mips64el \ 254ea31eb5bSbellard $(bindir)/qemu-system-arm \ 255ff1aaf65Sths $(bindir)/qemu-system-m68k \ 256ff1aaf65Sths $(bindir)/qemu-system-sh4 \ 25785ffbdfcSths $(bindir)/qemu-system-sh4eb \ 258*f0403c03Sbellard $(bindir)/qemu-system-cris \ 2597efa4387Sbellard $(bindir)/qemu-i386 \ 260*f0403c03Sbellard $(bindir)/qemu-x86_64 \ 2617efa4387Sbellard $(bindir)/qemu-arm \ 262ea31eb5bSbellard $(bindir)/qemu-armeb \ 2637efa4387Sbellard $(bindir)/qemu-sparc \ 264*f0403c03Sbellard $(bindir)/qemu-sparc32plus \ 265*f0403c03Sbellard $(bindir)/qemu-sparc64 \ 2667efa4387Sbellard $(bindir)/qemu-ppc \ 267d4082e95Sj_mayer $(bindir)/qemu-ppc64 \ 268*f0403c03Sbellard $(bindir)/qemu-ppc64abi32 \ 269ea31eb5bSbellard $(bindir)/qemu-mips \ 270ea31eb5bSbellard $(bindir)/qemu-mipsel \ 271cf6c1b16Sj_mayer $(bindir)/qemu-alpha \ 272ff1aaf65Sths $(bindir)/qemu-m68k \ 273ff1aaf65Sths $(bindir)/qemu-sh4 \ 27485ffbdfcSths $(bindir)/qemu-sh4eb \ 275*f0403c03Sbellard $(bindir)/qemu-cris \ 276b932cabaSbellard $(bindir)/qemu-img \ 2777efa4387Sbellard $(datadir)/bios.bin \ 2787efa4387Sbellard $(datadir)/vgabios.bin \ 279de9258a8Sbellard $(datadir)/vgabios-cirrus.bin \ 280637f6cd7Sbellard $(datadir)/ppc_rom.bin \ 281d5295253Sbellard $(datadir)/video.x \ 2820986ac3bSbellard $(datadir)/openbios-sparc32 \ 28319c80e50Sbellard $(datadir)/pxe-ne2k_pci.bin \ 28419c80e50Sbellard $(datadir)/pxe-rtl8139.bin \ 28519c80e50Sbellard $(datadir)/pxe-pcnet.bin \ 2861f50f8d1Sbellard $(docdir)/qemu-doc.html \ 2871f50f8d1Sbellard $(docdir)/qemu-tech.html \ 288acd935efSbellard $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 ) 289d691f669Sbellard 29031e31b8aSbellardifneq ($(wildcard .depend),) 29131e31b8aSbellardinclude .depend 29231e31b8aSbellardendif 2934fb240a4Sbellard 2944fb240a4Sbellard# Include automatically generated dependency files 2954fb240a4Sbellard-include $(wildcard *.d audio/*.d slirp/*.d) 296