10cb3fb1eSpbrook# Makefile for QEMU. 20cb3fb1eSpbrook 3ad064840Spbrookinclude config-host.mak 4766a487aSbellard 50cb3fb1eSpbrook.PHONY: all clean distclean dvi info install install-doc tar tarbin \ 60cb3fb1eSpbrook speed test test2 html dvi info 70cb3fb1eSpbrook 86f30fa85SthsBASE_CFLAGS= 96f30fa85SthsBASE_LDFLAGS= 106f30fa85Sths 113142255cSblueswir1BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS) 123142255cSblueswir1BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS) 133142255cSblueswir1 146f30fa85SthsCPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 15766a487aSbellardLIBS= 16e35c55feSbellardTOOLS=qemu-img$(EXESUF) 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 28b9dea4fbSpbrookall: $(TOOLS) $(DOCS) recurse-all 29b9dea4fbSpbrook 304aa42531Spbrooksubdir-%: dyngen$(EXESUF) 314aa42531Spbrook $(MAKE) -C $(subst subdir-,,$@) all 324aa42531Spbrook 334aa42531Spbrookrecurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) 344aa42531Spbrook 3518607dcbSbellardqemu-img$(EXESUF): qemu-img.c cutils.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c 366f30fa85Sths $(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) 3747cea614Sbellard 3811d9f695Sbellarddyngen$(EXESUF): dyngen.c 396f30fa85Sths $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^ 4031e31b8aSbellard 4131e31b8aSbellardclean: 422d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files 432d80ae89Sbellard 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 44acd935efSbellard rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~ 457d3505c5Sbellard $(MAKE) -C tests clean 46626df76aSbellard for d in $(TARGET_DIRS); do \ 477d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 48626df76aSbellard done 4931e31b8aSbellard 507d13299dSbellarddistclean: clean 51cc8ae6deSpbrook rm -f config-host.mak config-host.h $(DOCS) 520cb3fb1eSpbrook rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} 5376bc6838Sbellard for d in $(TARGET_DIRS); do \ 54bc1b050dSbellard rm -rf $$d || exit 1 ; \ 5576bc6838Sbellard done 567d13299dSbellard 57fed4a9adSbellardKEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ 58fed4a9adSbellardar de en-us fi fr-be hr it lv nl pl ru th \ 59fed4a9adSbellardcommon de-ch es fo fr-ca hu ja mk nl-be pt sl tr 60fed4a9adSbellard 6138954dcaSpbrookinstall-doc: $(DOCS) 6238954dcaSpbrook mkdir -p "$(DESTDIR)$(docdir)" 6338954dcaSpbrook $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" 6438954dcaSpbrookifndef CONFIG_WIN32 6538954dcaSpbrook mkdir -p "$(DESTDIR)$(mandir)/man1" 6638954dcaSpbrook $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" 6738954dcaSpbrookendif 6838954dcaSpbrook 6938954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc) 701236cab7Spbrook mkdir -p "$(DESTDIR)$(bindir)" 716a882643Spbrook $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" 721236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)" 73ad064840Spbrook for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ 74*860c6c52Sths video.x openbios-sparc32 pxe-ne2k_pci.bin \ 75eec85c2aSths pxe-rtl8139.bin pxe-pcnet.bin; do \ 766a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ 77ad064840Spbrook done 7811d9f695Sbellardifndef CONFIG_WIN32 791236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)/keymaps" 80ad064840Spbrook for x in $(KEYMAPS); do \ 816a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ 82ad064840Spbrook done 8311d9f695Sbellardendif 84626df76aSbellard for d in $(TARGET_DIRS); do \ 857d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 86626df76aSbellard done 87612384d7Sbellard 88367e86e8Sbellard# various test targets 8982c7e2a4Sbellardtest speed test2: all 907d3505c5Sbellard $(MAKE) -C tests $@ 9131e31b8aSbellard 92367e86e8SbellardTAGS: 93b9adb4a6Sbellard etags *.[ch] tests/*.[ch] 9431e31b8aSbellard 956688bc6dSbellardcscope: 966688bc6dSbellard rm -f ./cscope.* 976688bc6dSbellard find . -name "*.[ch]" -print > ./cscope.files 986688bc6dSbellard cscope -b 996688bc6dSbellard 1003ef693a0Sbellard# documentation 1011f673135Sbellard%.html: %.texi 1023ef693a0Sbellard texi2html -monolithic -number $< 1033ef693a0Sbellard 104f3548328Sbellard%.info: %.texi 105f3548328Sbellard makeinfo $< -o $@ 106f3548328Sbellard 107f3548328Sbellard%.dvi: %.texi 108f3548328Sbellard texi2dvi $< 109f3548328Sbellard 1105a67135aSbellardqemu.1: qemu-doc.texi 111ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu.pod 1125a67135aSbellard pod2man --section=1 --center=" " --release=" " qemu.pod > $@ 1135a67135aSbellard 114acd935efSbellardqemu-img.1: qemu-img.texi 115ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu-img.pod 116acd935efSbellard pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ 117acd935efSbellard 1180cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info 1190cb3fb1eSpbrook 1200cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi 1210cb3fb1eSpbrook 1220cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html 1230cb3fb1eSpbrook 124df5cf721SthsVERSION ?= $(shell cat VERSION) 125df5cf721SthsFILE = qemu-$(VERSION) 126586314f2Sbellard 1271e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree) 128586314f2Sbellardtar: 129586314f2Sbellard rm -rf /tmp/$(FILE) 1301e43adfcSbellard cp -r . /tmp/$(FILE) 13176b62fd0Sbellard ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS ) 132586314f2Sbellard rm -rf /tmp/$(FILE) 133586314f2Sbellard 13476b62fd0Sbellard# generate a binary distribution 135d691f669Sbellardtarbin: 13676b62fd0Sbellard ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \ 13743095f31Sbellard $(bindir)/qemu \ 1387efa4387Sbellard $(bindir)/qemu-system-ppc \ 139d4082e95Sj_mayer $(bindir)/qemu-system-ppc64 \ 140d4082e95Sj_mayer $(bindir)/qemu-system-ppcemb \ 141acd935efSbellard $(bindir)/qemu-system-sparc \ 14243095f31Sbellard $(bindir)/qemu-system-x86_64 \ 14393856aacSbellard $(bindir)/qemu-system-mips \ 14438260998Spbrook $(bindir)/qemu-system-mipsel \ 145fbe4f65bSths $(bindir)/qemu-system-mips64 \ 146fbe4f65bSths $(bindir)/qemu-system-mips64el \ 147ea31eb5bSbellard $(bindir)/qemu-system-arm \ 1487efa4387Sbellard $(bindir)/qemu-i386 \ 1497efa4387Sbellard $(bindir)/qemu-arm \ 150ea31eb5bSbellard $(bindir)/qemu-armeb \ 1517efa4387Sbellard $(bindir)/qemu-sparc \ 1527efa4387Sbellard $(bindir)/qemu-ppc \ 153d4082e95Sj_mayer $(bindir)/qemu-ppc64 \ 154ea31eb5bSbellard $(bindir)/qemu-mips \ 155ea31eb5bSbellard $(bindir)/qemu-mipsel \ 156cf6c1b16Sj_mayer $(bindir)/qemu-alpha \ 157b932cabaSbellard $(bindir)/qemu-img \ 1587efa4387Sbellard $(datadir)/bios.bin \ 1597efa4387Sbellard $(datadir)/vgabios.bin \ 160de9258a8Sbellard $(datadir)/vgabios-cirrus.bin \ 161637f6cd7Sbellard $(datadir)/ppc_rom.bin \ 162d5295253Sbellard $(datadir)/video.x \ 1630986ac3bSbellard $(datadir)/openbios-sparc32 \ 16419c80e50Sbellard $(datadir)/pxe-ne2k_pci.bin \ 16519c80e50Sbellard $(datadir)/pxe-rtl8139.bin \ 16619c80e50Sbellard $(datadir)/pxe-pcnet.bin \ 1671f50f8d1Sbellard $(docdir)/qemu-doc.html \ 1681f50f8d1Sbellard $(docdir)/qemu-tech.html \ 169acd935efSbellard $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 ) 170d691f669Sbellard 17131e31b8aSbellardifneq ($(wildcard .depend),) 17231e31b8aSbellardinclude .depend 17331e31b8aSbellardendif 174