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 116f30fa85SthsBASE_CFLAGS += $(OS_CFLAGS) 12fdbb4691Sbellardifeq ($(ARCH),sparc) 136f30fa85SthsBASE_CFLAGS += -mcpu=ultrasparc 14fdbb4691Sbellardendif 156f30fa85SthsCPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 16766a487aSbellardLIBS= 17e35c55feSbellardTOOLS=qemu-img$(EXESUF) 181f50f8d1Sbellardifdef CONFIG_STATIC 196f30fa85SthsBASE_LDFLAGS += -static 201f50f8d1Sbellardendif 21cc8ae6deSpbrookifdef BUILD_DOCS 22acd935efSbellardDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 23cc8ae6deSpbrookelse 24cc8ae6deSpbrookDOCS= 25cc8ae6deSpbrookendif 267d13299dSbellard 2783f64091Sbellardifndef CONFIG_DARWIN 2883f64091Sbellardifndef CONFIG_WIN32 2983f64091Sbellardifndef CONFIG_SOLARIS 3083f64091SbellardLIBS+=-lrt 3183f64091Sbellardendif 3283f64091Sbellardendif 3383f64091Sbellardendif 3483f64091Sbellard 35b9dea4fbSpbrookall: $(TOOLS) $(DOCS) recurse-all 36b9dea4fbSpbrook 374aa42531Spbrooksubdir-%: dyngen$(EXESUF) 384aa42531Spbrook $(MAKE) -C $(subst subdir-,,$@) all 394aa42531Spbrook 404aa42531Spbrookrecurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) 414aa42531Spbrook 4242ca6388Sbellardqemu-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 block-qcow2.c 436f30fa85Sths $(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) 4447cea614Sbellard 4511d9f695Sbellarddyngen$(EXESUF): dyngen.c 466f30fa85Sths $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^ 4731e31b8aSbellard 4831e31b8aSbellardclean: 492d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files 502d80ae89Sbellard 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 51acd935efSbellard rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~ 527d3505c5Sbellard $(MAKE) -C tests clean 53626df76aSbellard for d in $(TARGET_DIRS); do \ 547d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 55626df76aSbellard done 5631e31b8aSbellard 577d13299dSbellarddistclean: clean 58cc8ae6deSpbrook rm -f config-host.mak config-host.h $(DOCS) 590cb3fb1eSpbrook rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} 6076bc6838Sbellard for d in $(TARGET_DIRS); do \ 61bc1b050dSbellard rm -rf $$d || exit 1 ; \ 6276bc6838Sbellard done 637d13299dSbellard 64fed4a9adSbellardKEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ 65fed4a9adSbellardar de en-us fi fr-be hr it lv nl pl ru th \ 66fed4a9adSbellardcommon de-ch es fo fr-ca hu ja mk nl-be pt sl tr 67fed4a9adSbellard 6838954dcaSpbrookinstall-doc: $(DOCS) 6938954dcaSpbrook mkdir -p "$(DESTDIR)$(docdir)" 7038954dcaSpbrook $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" 7138954dcaSpbrookifndef CONFIG_WIN32 7238954dcaSpbrook mkdir -p "$(DESTDIR)$(mandir)/man1" 7338954dcaSpbrook $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" 7438954dcaSpbrookendif 7538954dcaSpbrook 7638954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc) 771236cab7Spbrook mkdir -p "$(DESTDIR)$(bindir)" 786a882643Spbrook $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" 791236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)" 80ad064840Spbrook for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ 81*eec85c2aSths video.x openbios-sparc32 linux_boot.bin pxe-ne2k_pci.bin \ 82*eec85c2aSths pxe-rtl8139.bin pxe-pcnet.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