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 8*6f30fa85SthsBASE_CFLAGS= 9*6f30fa85SthsBASE_LDFLAGS= 10*6f30fa85Sths 11*6f30fa85SthsBASE_CFLAGS += $(OS_CFLAGS) 12fdbb4691Sbellardifeq ($(ARCH),sparc) 13*6f30fa85SthsBASE_CFLAGS += -mcpu=ultrasparc 14fdbb4691Sbellardendif 15*6f30fa85SthsCPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 16766a487aSbellardLIBS= 17e35c55feSbellardTOOLS=qemu-img$(EXESUF) 181f50f8d1Sbellardifdef CONFIG_STATIC 19*6f30fa85SthsBASE_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 43*6f30fa85Sths $(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) 4447cea614Sbellard 4511d9f695Sbellarddyngen$(EXESUF): dyngen.c 46*6f30fa85Sths $(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 \ 810986ac3bSbellard video.x openbios-sparc32 linux_boot.bin; do \ 826a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ 83ad064840Spbrook done 8411d9f695Sbellardifndef CONFIG_WIN32 851236cab7Spbrook mkdir -p "$(DESTDIR)$(datadir)/keymaps" 86ad064840Spbrook for x in $(KEYMAPS); do \ 876a882643Spbrook $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ 88ad064840Spbrook done 8911d9f695Sbellardendif 90626df76aSbellard for d in $(TARGET_DIRS); do \ 917d3505c5Sbellard $(MAKE) -C $$d $@ || exit 1 ; \ 92626df76aSbellard done 93612384d7Sbellard 94367e86e8Sbellard# various test targets 9582c7e2a4Sbellardtest speed test2: all 967d3505c5Sbellard $(MAKE) -C tests $@ 9731e31b8aSbellard 98367e86e8SbellardTAGS: 99b9adb4a6Sbellard etags *.[ch] tests/*.[ch] 10031e31b8aSbellard 1016688bc6dSbellardcscope: 1026688bc6dSbellard rm -f ./cscope.* 1036688bc6dSbellard find . -name "*.[ch]" -print > ./cscope.files 1046688bc6dSbellard cscope -b 1056688bc6dSbellard 1063ef693a0Sbellard# documentation 1071f673135Sbellard%.html: %.texi 1083ef693a0Sbellard texi2html -monolithic -number $< 1093ef693a0Sbellard 110f3548328Sbellard%.info: %.texi 111f3548328Sbellard makeinfo $< -o $@ 112f3548328Sbellard 113f3548328Sbellard%.dvi: %.texi 114f3548328Sbellard texi2dvi $< 115f3548328Sbellard 1165a67135aSbellardqemu.1: qemu-doc.texi 117ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu.pod 1185a67135aSbellard pod2man --section=1 --center=" " --release=" " qemu.pod > $@ 1195a67135aSbellard 120acd935efSbellardqemu-img.1: qemu-img.texi 121ad064840Spbrook $(SRC_PATH)/texi2pod.pl $< qemu-img.pod 122acd935efSbellard pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ 123acd935efSbellard 1240cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info 1250cb3fb1eSpbrook 1260cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi 1270cb3fb1eSpbrook 1280cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html 1290cb3fb1eSpbrook 1301e43adfcSbellardFILE=qemu-$(shell cat VERSION) 131586314f2Sbellard 1321e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree) 133586314f2Sbellardtar: 134586314f2Sbellard rm -rf /tmp/$(FILE) 1351e43adfcSbellard cp -r . /tmp/$(FILE) 13676b62fd0Sbellard ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS ) 137586314f2Sbellard rm -rf /tmp/$(FILE) 138586314f2Sbellard 13976b62fd0Sbellard# generate a binary distribution 140d691f669Sbellardtarbin: 14176b62fd0Sbellard ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \ 14243095f31Sbellard $(bindir)/qemu \ 1437efa4387Sbellard $(bindir)/qemu-system-ppc \ 144acd935efSbellard $(bindir)/qemu-system-sparc \ 14543095f31Sbellard $(bindir)/qemu-system-x86_64 \ 14693856aacSbellard $(bindir)/qemu-system-mips \ 14738260998Spbrook $(bindir)/qemu-system-mipsel \ 148ea31eb5bSbellard $(bindir)/qemu-system-arm \ 1497efa4387Sbellard $(bindir)/qemu-i386 \ 1507efa4387Sbellard $(bindir)/qemu-arm \ 151ea31eb5bSbellard $(bindir)/qemu-armeb \ 1527efa4387Sbellard $(bindir)/qemu-sparc \ 1537efa4387Sbellard $(bindir)/qemu-ppc \ 154ea31eb5bSbellard $(bindir)/qemu-mips \ 155ea31eb5bSbellard $(bindir)/qemu-mipsel \ 156b932cabaSbellard $(bindir)/qemu-img \ 1577efa4387Sbellard $(datadir)/bios.bin \ 1587efa4387Sbellard $(datadir)/vgabios.bin \ 159de9258a8Sbellard $(datadir)/vgabios-cirrus.bin \ 160637f6cd7Sbellard $(datadir)/ppc_rom.bin \ 161d5295253Sbellard $(datadir)/video.x \ 1620986ac3bSbellard $(datadir)/openbios-sparc32 \ 1637efa4387Sbellard $(datadir)/linux_boot.bin \ 1641f50f8d1Sbellard $(docdir)/qemu-doc.html \ 1651f50f8d1Sbellard $(docdir)/qemu-tech.html \ 166acd935efSbellard $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 ) 167d691f669Sbellard 16831e31b8aSbellardifneq ($(wildcard .depend),) 16931e31b8aSbellardinclude .depend 17031e31b8aSbellardendif 171