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= 161f50f8d1Sbellardifdef CONFIG_STATIC 176f30fa85SthsBASE_LDFLAGS += -static 181f50f8d1Sbellardendif 19cc8ae6deSpbrookifdef BUILD_DOCS 20acd935efSbellardDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 21cc8ae6deSpbrookelse 22cc8ae6deSpbrookDOCS= 23cc8ae6deSpbrookendif 247d13299dSbellard 2570956b77SthsLIBS+=$(AIOLIBS) 2683f64091Sbellard 27b9dea4fbSpbrookall: $(TOOLS) $(DOCS) recurse-all 28b9dea4fbSpbrook 294aa42531Spbrooksubdir-%: dyngen$(EXESUF) 304aa42531Spbrook $(MAKE) -C $(subst subdir-,,$@) all 314aa42531Spbrook 324aa42531Spbrookrecurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) 334aa42531Spbrook 346ada7453Sthsqemu-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 block-parallels.c 356f30fa85Sths $(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) 3647cea614Sbellard 3711d9f695Sbellarddyngen$(EXESUF): dyngen.c 386f30fa85Sths $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^ 3931e31b8aSbellard 4031e31b8aSbellardclean: 412d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files 422d80ae89Sbellard 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 43e5686953Sths rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~ 447d3505c5Sbellard $(MAKE) -C tests clean 45626df76aSbellard for d in $(TARGET_DIRS); do \ 467d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 47626df76aSbellard done 4831e31b8aSbellard 497d13299dSbellarddistclean: clean 50cc8ae6deSpbrook rm -f config-host.mak config-host.h $(DOCS) 510cb3fb1eSpbrook rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} 5276bc6838Sbellard for d in $(TARGET_DIRS); do \ 53bc1b050dSbellard rm -rf $$d || exit 1 ; \ 5476bc6838Sbellard done 557d13299dSbellard 56fed4a9adSbellardKEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ 57fed4a9adSbellardar de en-us fi fr-be hr it lv nl pl ru th \ 58fed4a9adSbellardcommon de-ch es fo fr-ca hu ja mk nl-be pt sl tr 59fed4a9adSbellard 6038954dcaSpbrookinstall-doc: $(DOCS) 6138954dcaSpbrook mkdir -p "$(DESTDIR)$(docdir)" 6238954dcaSpbrook $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" 6338954dcaSpbrookifndef CONFIG_WIN32 6438954dcaSpbrook mkdir -p "$(DESTDIR)$(mandir)/man1" 6538954dcaSpbrook $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" 6638954dcaSpbrookendif 6738954dcaSpbrook 6838954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc) 691236cab7Spbrook mkdir -p "$(DESTDIR)$(bindir)" 706a882643Spbrook $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" 711236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)" 72ad064840Spbrook for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ 73860c6c52Sths video.x openbios-sparc32 pxe-ne2k_pci.bin \ 74eec85c2aSths pxe-rtl8139.bin pxe-pcnet.bin; do \ 756a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ 76ad064840Spbrook done 7711d9f695Sbellardifndef CONFIG_WIN32 781236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)/keymaps" 79ad064840Spbrook for x in $(KEYMAPS); do \ 806a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ 81ad064840Spbrook done 8211d9f695Sbellardendif 83626df76aSbellard for d in $(TARGET_DIRS); do \ 847d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 85626df76aSbellard done 86612384d7Sbellard 87367e86e8Sbellard# various test targets 8882c7e2a4Sbellardtest speed test2: all 897d3505c5Sbellard $(MAKE) -C tests $@ 9031e31b8aSbellard 91367e86e8SbellardTAGS: 92b9adb4a6Sbellard etags *.[ch] tests/*.[ch] 9331e31b8aSbellard 946688bc6dSbellardcscope: 956688bc6dSbellard rm -f ./cscope.* 966688bc6dSbellard find . -name "*.[ch]" -print > ./cscope.files 976688bc6dSbellard cscope -b 986688bc6dSbellard 993ef693a0Sbellard# documentation 1001f673135Sbellard%.html: %.texi 1013ef693a0Sbellard texi2html -monolithic -number $< 1023ef693a0Sbellard 103f3548328Sbellard%.info: %.texi 104f3548328Sbellard makeinfo $< -o $@ 105f3548328Sbellard 106f3548328Sbellard%.dvi: %.texi 107f3548328Sbellard texi2dvi $< 108f3548328Sbellard 1095a67135aSbellardqemu.1: qemu-doc.texi 110ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu.pod 1115a67135aSbellard pod2man --section=1 --center=" " --release=" " qemu.pod > $@ 1125a67135aSbellard 113acd935efSbellardqemu-img.1: qemu-img.texi 114ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu-img.pod 115acd935efSbellard pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ 116acd935efSbellard 1170cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info 1180cb3fb1eSpbrook 1190cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi 1200cb3fb1eSpbrook 1210cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html 1220cb3fb1eSpbrook 123df5cf721SthsVERSION ?= $(shell cat VERSION) 124df5cf721SthsFILE = qemu-$(VERSION) 125586314f2Sbellard 1261e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree) 127586314f2Sbellardtar: 128586314f2Sbellard rm -rf /tmp/$(FILE) 1291e43adfcSbellard cp -r . /tmp/$(FILE) 13076b62fd0Sbellard ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS ) 131586314f2Sbellard rm -rf /tmp/$(FILE) 132586314f2Sbellard 13376b62fd0Sbellard# generate a binary distribution 134d691f669Sbellardtarbin: 135*4887d78bSths ( cd / ; tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \ 13643095f31Sbellard $(bindir)/qemu \ 1377efa4387Sbellard $(bindir)/qemu-system-ppc \ 138d4082e95Sj_mayer $(bindir)/qemu-system-ppc64 \ 139d4082e95Sj_mayer $(bindir)/qemu-system-ppcemb \ 140acd935efSbellard $(bindir)/qemu-system-sparc \ 14143095f31Sbellard $(bindir)/qemu-system-x86_64 \ 14293856aacSbellard $(bindir)/qemu-system-mips \ 14338260998Spbrook $(bindir)/qemu-system-mipsel \ 144fbe4f65bSths $(bindir)/qemu-system-mips64 \ 145fbe4f65bSths $(bindir)/qemu-system-mips64el \ 146ea31eb5bSbellard $(bindir)/qemu-system-arm \ 147ff1aaf65Sths $(bindir)/qemu-system-m68k \ 148ff1aaf65Sths $(bindir)/qemu-system-sh4 \ 1497efa4387Sbellard $(bindir)/qemu-i386 \ 1507efa4387Sbellard $(bindir)/qemu-arm \ 151ea31eb5bSbellard $(bindir)/qemu-armeb \ 1527efa4387Sbellard $(bindir)/qemu-sparc \ 1537efa4387Sbellard $(bindir)/qemu-ppc \ 154d4082e95Sj_mayer $(bindir)/qemu-ppc64 \ 155ea31eb5bSbellard $(bindir)/qemu-mips \ 156ea31eb5bSbellard $(bindir)/qemu-mipsel \ 157cf6c1b16Sj_mayer $(bindir)/qemu-alpha \ 158ff1aaf65Sths $(bindir)/qemu-m68k \ 159ff1aaf65Sths $(bindir)/qemu-sh4 \ 160b932cabaSbellard $(bindir)/qemu-img \ 1617efa4387Sbellard $(datadir)/bios.bin \ 1627efa4387Sbellard $(datadir)/vgabios.bin \ 163de9258a8Sbellard $(datadir)/vgabios-cirrus.bin \ 164637f6cd7Sbellard $(datadir)/ppc_rom.bin \ 165d5295253Sbellard $(datadir)/video.x \ 1660986ac3bSbellard $(datadir)/openbios-sparc32 \ 16719c80e50Sbellard $(datadir)/pxe-ne2k_pci.bin \ 16819c80e50Sbellard $(datadir)/pxe-rtl8139.bin \ 16919c80e50Sbellard $(datadir)/pxe-pcnet.bin \ 1701f50f8d1Sbellard $(docdir)/qemu-doc.html \ 1711f50f8d1Sbellard $(docdir)/qemu-tech.html \ 172acd935efSbellard $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 ) 173d691f669Sbellard 17431e31b8aSbellardifneq ($(wildcard .depend),) 17531e31b8aSbellardinclude .depend 17631e31b8aSbellardendif 177