10cb3fb1eSpbrook# Makefile for QEMU. 20cb3fb1eSpbrook 3ad064840Spbrookinclude config-host.mak 4766a487aSbellard 50cb3fb1eSpbrook.PHONY: all clean distclean dvi info install install-doc tar tarbin \ 6*9b0b8203Sbellard speed test html dvi info 70cb3fb1eSpbrook 86f30fa85SthsBASE_CFLAGS= 96f30fa85SthsBASE_LDFLAGS= 106f30fa85Sths 113142255cSblueswir1BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS) 123142255cSblueswir1BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS) 133142255cSblueswir1 144fb240a4SbellardCPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP 154fb240a4SbellardCPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 16766a487aSbellardLIBS= 171f50f8d1Sbellardifdef CONFIG_STATIC 186f30fa85SthsBASE_LDFLAGS += -static 191f50f8d1Sbellardendif 20cc8ae6deSpbrookifdef BUILD_DOCS 21acd935efSbellardDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 22cc8ae6deSpbrookelse 23cc8ae6deSpbrookDOCS= 24cc8ae6deSpbrookendif 257d13299dSbellard 2670956b77SthsLIBS+=$(AIOLIBS) 2783f64091Sbellard 28da0b0df8Spbrookall: $(TOOLS) $(DOCS) recurse-all 29b9dea4fbSpbrook 30da0b0df8Spbrooksubdir-%: dyngen$(EXESUF) libqemu_common.a 314aa42531Spbrook $(MAKE) -C $(subst subdir-,,$@) all 324aa42531Spbrook 334aa42531Spbrookrecurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) 344aa42531Spbrook 35faf07963Spbrook####################################################################### 36faf07963Spbrook# BLOCK_OBJS is code used by both qemu system emulation and qemu-img 37faf07963Spbrook 38faf07963SpbrookBLOCK_OBJS=cutils.o 39faf07963SpbrookBLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o 40faf07963SpbrookBLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o 41faf07963SpbrookBLOCK_OBJS+=block-qcow2.o block-parallels.o 42faf07963Spbrook 434fb240a4Sbellard###################################################################### 44faf07963Spbrook# libqemu_common.a: Target indepedent part of system emulation. The 454fb240a4Sbellard# long term path is to suppress *all* target specific code in case of 464fb240a4Sbellard# system emulation, i.e. a single QEMU executable should support all 474fb240a4Sbellard# CPUs and machines. 4847cea614Sbellard 49faf07963SpbrookOBJS=$(BLOCK_OBJS) 50faf07963SpbrookOBJS+=readline.o console.o 51faf07963SpbrookOBJS+=block.o 524fb240a4Sbellard 534fb240a4Sbellardifdef CONFIG_WIN32 544fb240a4SbellardOBJS+=tap-win32.o 554fb240a4Sbellardendif 564fb240a4Sbellard 574fb240a4SbellardAUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o 584fb240a4Sbellardifdef CONFIG_SDL 594fb240a4SbellardAUDIO_OBJS += sdlaudio.o 604fb240a4Sbellardendif 614fb240a4Sbellardifdef CONFIG_OSS 624fb240a4SbellardAUDIO_OBJS += ossaudio.o 634fb240a4Sbellardendif 644fb240a4Sbellardifdef CONFIG_COREAUDIO 654fb240a4SbellardAUDIO_OBJS += coreaudio.o 664fb240a4Sbellardendif 674fb240a4Sbellardifdef CONFIG_ALSA 684fb240a4SbellardAUDIO_OBJS += alsaaudio.o 694fb240a4Sbellardendif 704fb240a4Sbellardifdef CONFIG_DSOUND 714fb240a4SbellardAUDIO_OBJS += dsoundaudio.o 724fb240a4Sbellardendif 734fb240a4Sbellardifdef CONFIG_FMOD 744fb240a4SbellardAUDIO_OBJS += fmodaudio.o 754fb240a4Sbellardaudio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS) 764fb240a4Sbellardendif 774fb240a4SbellardAUDIO_OBJS+= wavcapture.o 784fb240a4SbellardOBJS+=$(addprefix audio/, $(AUDIO_OBJS)) 794fb240a4Sbellard 804fb240a4Sbellardifdef CONFIG_SDL 814fb240a4SbellardOBJS+=sdl.o x_keymap.o 824fb240a4Sbellardendif 834fb240a4SbellardOBJS+=vnc.o d3des.o 844fb240a4Sbellard 854fb240a4Sbellardifdef CONFIG_COCOA 864fb240a4SbellardOBJS+=cocoa.o 874fb240a4Sbellardendif 884fb240a4Sbellard 894fb240a4Sbellardifdef CONFIG_SLIRP 904fb240a4SbellardCPPFLAGS+=-I$(SRC_PATH)/slirp 914fb240a4SbellardSLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ 924fb240a4Sbellardslirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ 934fb240a4Sbellardtcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o 944fb240a4SbellardOBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) 954fb240a4Sbellardendif 964fb240a4Sbellard 974fb240a4Sbellardcocoa.o: cocoa.m 984fb240a4Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< 994fb240a4Sbellard 1004fb240a4Sbellardsdl.o: sdl.c keymaps.c sdl_keysym.h 1014fb240a4Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $< 1024fb240a4Sbellard 1034fb240a4Sbellardvnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h 1044fb240a4Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< 1054fb240a4Sbellard 1064fb240a4Sbellardaudio/sdlaudio.o: audio/sdlaudio.c 1074fb240a4Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $< 1084fb240a4Sbellard 1094fb240a4Sbellardlibqemu_common.a: $(OBJS) 1104fb240a4Sbellard rm -f $@ 1114fb240a4Sbellard $(AR) rcs $@ $(OBJS) 1124fb240a4Sbellard 1134fb240a4Sbellard###################################################################### 1144fb240a4Sbellard 115faf07963Spbrookqemu-img$(EXESUF): qemu-img.o qemu-img-block.o qemu-img-block-raw.o $(BLOCK_OBJS) 1164fb240a4Sbellard $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) 1174fb240a4Sbellard 118faf07963Spbrookqemu-img-%.o: %.c 119faf07963Spbrook $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG $(BASE_CFLAGS) -c -o $@ $< 120faf07963Spbrook 1214fb240a4Sbellard%.o: %.c 1224fb240a4Sbellard $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< 1234fb240a4Sbellard 1244fb240a4Sbellard# dyngen host tool 12511d9f695Sbellarddyngen$(EXESUF): dyngen.c 1266f30fa85Sths $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^ 12731e31b8aSbellard 12831e31b8aSbellardclean: 1292d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files 1302d80ae89Sbellard 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 1314fb240a4Sbellard rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~ 1324fb240a4Sbellard rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d 1337d3505c5Sbellard $(MAKE) -C tests clean 134626df76aSbellard for d in $(TARGET_DIRS); do \ 1357d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 136626df76aSbellard done 13731e31b8aSbellard 1387d13299dSbellarddistclean: clean 139cc8ae6deSpbrook rm -f config-host.mak config-host.h $(DOCS) 1400cb3fb1eSpbrook rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} 14176bc6838Sbellard for d in $(TARGET_DIRS); do \ 142bc1b050dSbellard rm -rf $$d || exit 1 ; \ 14376bc6838Sbellard done 1447d13299dSbellard 145fed4a9adSbellardKEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ 146fed4a9adSbellardar de en-us fi fr-be hr it lv nl pl ru th \ 147fed4a9adSbellardcommon de-ch es fo fr-ca hu ja mk nl-be pt sl tr 148fed4a9adSbellard 14938954dcaSpbrookinstall-doc: $(DOCS) 15038954dcaSpbrook mkdir -p "$(DESTDIR)$(docdir)" 15138954dcaSpbrook $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" 15238954dcaSpbrookifndef CONFIG_WIN32 15338954dcaSpbrook mkdir -p "$(DESTDIR)$(mandir)/man1" 15438954dcaSpbrook $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" 15538954dcaSpbrookendif 15638954dcaSpbrook 15738954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc) 1581236cab7Spbrook mkdir -p "$(DESTDIR)$(bindir)" 159932a79dfSthsifneq ($(TOOLS),) 1606a882643Spbrook $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" 161932a79dfSthsendif 1621236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)" 163ad064840Spbrook for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ 164860c6c52Sths video.x openbios-sparc32 pxe-ne2k_pci.bin \ 165eec85c2aSths pxe-rtl8139.bin pxe-pcnet.bin; do \ 1666a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ 167ad064840Spbrook done 16811d9f695Sbellardifndef CONFIG_WIN32 1691236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)/keymaps" 170ad064840Spbrook for x in $(KEYMAPS); do \ 1716a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ 172ad064840Spbrook done 17311d9f695Sbellardendif 174626df76aSbellard for d in $(TARGET_DIRS); do \ 1757d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 176626df76aSbellard done 177612384d7Sbellard 178367e86e8Sbellard# various test targets 179*9b0b8203Sbellardtest speed: all 1807d3505c5Sbellard $(MAKE) -C tests $@ 18131e31b8aSbellard 182367e86e8SbellardTAGS: 183b9adb4a6Sbellard etags *.[ch] tests/*.[ch] 18431e31b8aSbellard 1856688bc6dSbellardcscope: 1866688bc6dSbellard rm -f ./cscope.* 1876688bc6dSbellard find . -name "*.[ch]" -print > ./cscope.files 1886688bc6dSbellard cscope -b 1896688bc6dSbellard 1903ef693a0Sbellard# documentation 1911f673135Sbellard%.html: %.texi 1923ef693a0Sbellard texi2html -monolithic -number $< 1933ef693a0Sbellard 194f3548328Sbellard%.info: %.texi 195f3548328Sbellard makeinfo $< -o $@ 196f3548328Sbellard 197f3548328Sbellard%.dvi: %.texi 198f3548328Sbellard texi2dvi $< 199f3548328Sbellard 2005a67135aSbellardqemu.1: qemu-doc.texi 201ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu.pod 2025a67135aSbellard pod2man --section=1 --center=" " --release=" " qemu.pod > $@ 2035a67135aSbellard 204acd935efSbellardqemu-img.1: qemu-img.texi 205ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu-img.pod 206acd935efSbellard pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ 207acd935efSbellard 2080cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info 2090cb3fb1eSpbrook 2100cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi 2110cb3fb1eSpbrook 2120cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html 2130cb3fb1eSpbrook 214df5cf721SthsVERSION ?= $(shell cat VERSION) 215df5cf721SthsFILE = qemu-$(VERSION) 216586314f2Sbellard 2171e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree) 218586314f2Sbellardtar: 219586314f2Sbellard rm -rf /tmp/$(FILE) 2201e43adfcSbellard cp -r . /tmp/$(FILE) 22176b62fd0Sbellard ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS ) 222586314f2Sbellard rm -rf /tmp/$(FILE) 223586314f2Sbellard 22476b62fd0Sbellard# generate a binary distribution 225d691f669Sbellardtarbin: 2264887d78bSths ( cd / ; tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \ 22743095f31Sbellard $(bindir)/qemu \ 2287efa4387Sbellard $(bindir)/qemu-system-ppc \ 229d4082e95Sj_mayer $(bindir)/qemu-system-ppc64 \ 230d4082e95Sj_mayer $(bindir)/qemu-system-ppcemb \ 231acd935efSbellard $(bindir)/qemu-system-sparc \ 23243095f31Sbellard $(bindir)/qemu-system-x86_64 \ 23393856aacSbellard $(bindir)/qemu-system-mips \ 23438260998Spbrook $(bindir)/qemu-system-mipsel \ 235fbe4f65bSths $(bindir)/qemu-system-mips64 \ 236fbe4f65bSths $(bindir)/qemu-system-mips64el \ 237ea31eb5bSbellard $(bindir)/qemu-system-arm \ 238ff1aaf65Sths $(bindir)/qemu-system-m68k \ 239ff1aaf65Sths $(bindir)/qemu-system-sh4 \ 2407efa4387Sbellard $(bindir)/qemu-i386 \ 2417efa4387Sbellard $(bindir)/qemu-arm \ 242ea31eb5bSbellard $(bindir)/qemu-armeb \ 2437efa4387Sbellard $(bindir)/qemu-sparc \ 2447efa4387Sbellard $(bindir)/qemu-ppc \ 245d4082e95Sj_mayer $(bindir)/qemu-ppc64 \ 246ea31eb5bSbellard $(bindir)/qemu-mips \ 247ea31eb5bSbellard $(bindir)/qemu-mipsel \ 248540635baSths $(bindir)/qemu-mipsn32 \ 249540635baSths $(bindir)/qemu-mipsn32el \ 250540635baSths $(bindir)/qemu-mips64 \ 251540635baSths $(bindir)/qemu-mips64el \ 252cf6c1b16Sj_mayer $(bindir)/qemu-alpha \ 253ff1aaf65Sths $(bindir)/qemu-m68k \ 254ff1aaf65Sths $(bindir)/qemu-sh4 \ 255b932cabaSbellard $(bindir)/qemu-img \ 2567efa4387Sbellard $(datadir)/bios.bin \ 2577efa4387Sbellard $(datadir)/vgabios.bin \ 258de9258a8Sbellard $(datadir)/vgabios-cirrus.bin \ 259637f6cd7Sbellard $(datadir)/ppc_rom.bin \ 260d5295253Sbellard $(datadir)/video.x \ 2610986ac3bSbellard $(datadir)/openbios-sparc32 \ 26219c80e50Sbellard $(datadir)/pxe-ne2k_pci.bin \ 26319c80e50Sbellard $(datadir)/pxe-rtl8139.bin \ 26419c80e50Sbellard $(datadir)/pxe-pcnet.bin \ 2651f50f8d1Sbellard $(docdir)/qemu-doc.html \ 2661f50f8d1Sbellard $(docdir)/qemu-tech.html \ 267acd935efSbellard $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 ) 268d691f669Sbellard 26931e31b8aSbellardifneq ($(wildcard .depend),) 27031e31b8aSbellardinclude .depend 27131e31b8aSbellardendif 2724fb240a4Sbellard 2734fb240a4Sbellard# Include automatically generated dependency files 2744fb240a4Sbellard-include $(wildcard *.d audio/*.d slirp/*.d) 275