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 8ad064840SpbrookCFLAGS=-Wall -O2 -g -fno-strict-aliasing -I. 983fb7adfSbellardifdef CONFIG_DARWIN 1083fb7adfSbellardCFLAGS+= -mdynamic-no-pic 1183fb7adfSbellardendif 12fdbb4691Sbellardifeq ($(ARCH),sparc) 13fdbb4691SbellardCFLAGS+=-mcpu=ultrasparc 14fdbb4691Sbellardendif 1531e31b8aSbellardLDFLAGS=-g 16766a487aSbellardLIBS= 17d5249393SbellardDEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 18e35c55feSbellardTOOLS=qemu-img$(EXESUF) 191f50f8d1Sbellardifdef CONFIG_STATIC 201f50f8d1SbellardLDFLAGS+=-static 211f50f8d1Sbellardendif 22cc8ae6deSpbrookifdef BUILD_DOCS 23acd935efSbellardDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 24cc8ae6deSpbrookelse 25cc8ae6deSpbrookDOCS= 26cc8ae6deSpbrookendif 277d13299dSbellard 28*83f64091Sbellardifndef CONFIG_DARWIN 29*83f64091Sbellardifndef CONFIG_WIN32 30*83f64091Sbellardifndef CONFIG_SOLARIS 31*83f64091SbellardLIBS+=-lrt 32*83f64091Sbellardendif 33*83f64091Sbellardendif 34*83f64091Sbellardendif 35*83f64091Sbellard 36b9dea4fbSpbrookall: $(TOOLS) $(DOCS) recurse-all 37b9dea4fbSpbrook 384aa42531Spbrooksubdir-%: dyngen$(EXESUF) 394aa42531Spbrook $(MAKE) -C $(subst subdir-,,$@) all 404aa42531Spbrook 414aa42531Spbrookrecurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) 424aa42531Spbrook 43*83f64091Sbellardqemu-img$(EXESUF): qemu-img.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 44b932cabaSbellard $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS) 4547cea614Sbellard 4611d9f695Sbellarddyngen$(EXESUF): dyngen.c 4711d9f695Sbellard $(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^ 4831e31b8aSbellard 4931e31b8aSbellardclean: 502d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files 512d80ae89Sbellard 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 52acd935efSbellard rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~ 537d3505c5Sbellard $(MAKE) -C tests clean 54626df76aSbellard for d in $(TARGET_DIRS); do \ 557d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 56626df76aSbellard done 5731e31b8aSbellard 587d13299dSbellarddistclean: clean 59cc8ae6deSpbrook rm -f config-host.mak config-host.h $(DOCS) 600cb3fb1eSpbrook rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} 6176bc6838Sbellard for d in $(TARGET_DIRS); do \ 62bc1b050dSbellard rm -rf $$d || exit 1 ; \ 6376bc6838Sbellard done 647d13299dSbellard 65fed4a9adSbellardKEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ 66fed4a9adSbellardar de en-us fi fr-be hr it lv nl pl ru th \ 67fed4a9adSbellardcommon de-ch es fo fr-ca hu ja mk nl-be pt sl tr 68fed4a9adSbellard 6938954dcaSpbrookinstall-doc: $(DOCS) 7038954dcaSpbrook mkdir -p "$(DESTDIR)$(docdir)" 7138954dcaSpbrook $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" 7238954dcaSpbrookifndef CONFIG_WIN32 7338954dcaSpbrook mkdir -p "$(DESTDIR)$(mandir)/man1" 7438954dcaSpbrook $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" 7538954dcaSpbrookendif 7638954dcaSpbrook 7738954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc) 781236cab7Spbrook mkdir -p "$(DESTDIR)$(bindir)" 796a882643Spbrook $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" 801236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)" 81ad064840Spbrook for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ 820986ac3bSbellard video.x openbios-sparc32 linux_boot.bin; do \ 836a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ 84ad064840Spbrook done 8511d9f695Sbellardifndef CONFIG_WIN32 861236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)/keymaps" 87ad064840Spbrook for x in $(KEYMAPS); do \ 886a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ 89ad064840Spbrook done 9011d9f695Sbellardendif 91626df76aSbellard for d in $(TARGET_DIRS); do \ 927d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 93626df76aSbellard done 94612384d7Sbellard 95367e86e8Sbellard# various test targets 9682c7e2a4Sbellardtest speed test2: all 977d3505c5Sbellard $(MAKE) -C tests $@ 9831e31b8aSbellard 99367e86e8SbellardTAGS: 100b9adb4a6Sbellard etags *.[ch] tests/*.[ch] 10131e31b8aSbellard 1026688bc6dSbellardcscope: 1036688bc6dSbellard rm -f ./cscope.* 1046688bc6dSbellard find . -name "*.[ch]" -print > ./cscope.files 1056688bc6dSbellard cscope -b 1066688bc6dSbellard 1073ef693a0Sbellard# documentation 1081f673135Sbellard%.html: %.texi 1093ef693a0Sbellard texi2html -monolithic -number $< 1103ef693a0Sbellard 111f3548328Sbellard%.info: %.texi 112f3548328Sbellard makeinfo $< -o $@ 113f3548328Sbellard 114f3548328Sbellard%.dvi: %.texi 115f3548328Sbellard texi2dvi $< 116f3548328Sbellard 1175a67135aSbellardqemu.1: qemu-doc.texi 118ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu.pod 1195a67135aSbellard pod2man --section=1 --center=" " --release=" " qemu.pod > $@ 1205a67135aSbellard 121acd935efSbellardqemu-img.1: qemu-img.texi 122ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu-img.pod 123acd935efSbellard pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ 124acd935efSbellard 1250cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info 1260cb3fb1eSpbrook 1270cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi 1280cb3fb1eSpbrook 1290cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html 1300cb3fb1eSpbrook 1311e43adfcSbellardFILE=qemu-$(shell cat VERSION) 132586314f2Sbellard 1331e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree) 134586314f2Sbellardtar: 135586314f2Sbellard rm -rf /tmp/$(FILE) 1361e43adfcSbellard cp -r . /tmp/$(FILE) 13776b62fd0Sbellard ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS ) 138586314f2Sbellard rm -rf /tmp/$(FILE) 139586314f2Sbellard 14076b62fd0Sbellard# generate a binary distribution 141d691f669Sbellardtarbin: 14276b62fd0Sbellard ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \ 14343095f31Sbellard $(bindir)/qemu \ 1447efa4387Sbellard $(bindir)/qemu-system-ppc \ 145acd935efSbellard $(bindir)/qemu-system-sparc \ 14643095f31Sbellard $(bindir)/qemu-system-x86_64 \ 14793856aacSbellard $(bindir)/qemu-system-mips \ 14838260998Spbrook $(bindir)/qemu-system-mipsel \ 149ea31eb5bSbellard $(bindir)/qemu-system-arm \ 1507efa4387Sbellard $(bindir)/qemu-i386 \ 1517efa4387Sbellard $(bindir)/qemu-arm \ 152ea31eb5bSbellard $(bindir)/qemu-armeb \ 1537efa4387Sbellard $(bindir)/qemu-sparc \ 1547efa4387Sbellard $(bindir)/qemu-ppc \ 155ea31eb5bSbellard $(bindir)/qemu-mips \ 156ea31eb5bSbellard $(bindir)/qemu-mipsel \ 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 \ 1647efa4387Sbellard $(datadir)/linux_boot.bin \ 1651f50f8d1Sbellard $(docdir)/qemu-doc.html \ 1661f50f8d1Sbellard $(docdir)/qemu-tech.html \ 167acd935efSbellard $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 ) 168d691f669Sbellard 16931e31b8aSbellardifneq ($(wildcard .depend),) 17031e31b8aSbellardinclude .depend 17131e31b8aSbellardendif 172