blob: 6716ccf37bc87417efa3b329332de1ac4525f61a [file] [log] [blame]
pbrook0cb3fb12006-05-14 12:07:53 +00001# Makefile for QEMU.
2
pbrookad064842006-04-16 12:41:07 +00003include config-host.mak
bellard766a4872003-02-18 23:35:48 +00004
pbrook0cb3fb12006-05-14 12:07:53 +00005.PHONY: all clean distclean dvi info install install-doc tar tarbin \
6 speed test test2 html dvi info
7
pbrookad064842006-04-16 12:41:07 +00008CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I.
bellard83fb7ad2004-07-05 21:25:26 +00009ifdef CONFIG_DARWIN
10CFLAGS+= -mdynamic-no-pic
11endif
bellard31e31b82003-02-18 22:55:36 +000012LDFLAGS=-g
bellard766a4872003-02-18 23:35:48 +000013LIBS=
bellardd5249392004-08-03 21:14:23 +000014DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
bellarde35c55f2004-11-16 01:44:03 +000015TOOLS=qemu-img$(EXESUF)
bellard1f50f8d2004-05-08 14:44:43 +000016ifdef CONFIG_STATIC
17LDFLAGS+=-static
18endif
pbrookcc8ae6d2006-04-23 17:57:59 +000019ifdef BUILD_DOCS
bellardacd935e2004-11-15 22:57:26 +000020DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
pbrookcc8ae6d2006-04-23 17:57:59 +000021else
22DOCS=
23endif
bellard7d132992003-03-06 23:23:54 +000024
pbrookb9dea4f2006-05-13 16:54:03 +000025all: $(TOOLS) $(DOCS) recurse-all
26
pbrook4aa42532006-05-13 13:55:08 +000027subdir-%: dyngen$(EXESUF)
28 $(MAKE) -C $(subst subdir-,,$@) all
29
30recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
31
bellardde167e42005-04-28 21:15:08 +000032qemu-img$(EXESUF): qemu-img.c block.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
bellardb932cab2004-08-01 21:46:49 +000033 $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
bellard47cea612004-05-17 20:06:42 +000034
bellard11d9f692004-04-02 20:55:59 +000035dyngen$(EXESUF): dyngen.c
36 $(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
bellard31e31b82003-02-18 22:55:36 +000037
38clean:
bellard2d80ae82003-08-11 23:01:33 +000039# avoid old build problems by removing potentially incorrect old files
40 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
bellardacd935e2004-11-15 22:57:26 +000041 rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
bellard7d3505c2004-05-12 19:32:15 +000042 $(MAKE) -C tests clean
bellard626df762003-08-10 21:39:31 +000043 for d in $(TARGET_DIRS); do \
bellard7d3505c2004-05-12 19:32:15 +000044 $(MAKE) -C $$d $@ || exit 1 ; \
bellard626df762003-08-10 21:39:31 +000045 done
bellard31e31b82003-02-18 22:55:36 +000046
bellard7d132992003-03-06 23:23:54 +000047distclean: clean
pbrookcc8ae6d2006-04-23 17:57:59 +000048 rm -f config-host.mak config-host.h $(DOCS)
pbrook0cb3fb12006-05-14 12:07:53 +000049 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
bellard76bc6832003-08-10 23:41:46 +000050 for d in $(TARGET_DIRS); do \
bellardbc1b0502003-10-28 00:12:52 +000051 rm -rf $$d || exit 1 ; \
bellard76bc6832003-08-10 23:41:46 +000052 done
bellard7d132992003-03-06 23:23:54 +000053
bellardfed4a9a2004-12-12 22:18:34 +000054KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
55ar de en-us fi fr-be hr it lv nl pl ru th \
56common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
57
pbrook38954dc2006-04-30 23:54:18 +000058install-doc: $(DOCS)
59 mkdir -p "$(DESTDIR)$(docdir)"
60 $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
61ifndef CONFIG_WIN32
62 mkdir -p "$(DESTDIR)$(mandir)/man1"
63 $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
64endif
65
66install: all $(if $(BUILD_DOCS),install-doc)
pbrook1236cab2006-04-09 20:47:35 +000067 mkdir -p "$(DESTDIR)$(bindir)"
pbrook6a882642006-04-17 13:57:12 +000068 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
pbrook1236cab2006-04-09 20:47:35 +000069 mkdir -p "$(DESTDIR)$(datadir)"
pbrookad064842006-04-16 12:41:07 +000070 for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
bellard0986ac32006-06-14 12:36:32 +000071 video.x openbios-sparc32 linux_boot.bin; do \
pbrook6a882642006-04-17 13:57:12 +000072 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
pbrookad064842006-04-16 12:41:07 +000073 done
bellard11d9f692004-04-02 20:55:59 +000074ifndef CONFIG_WIN32
pbrook1236cab2006-04-09 20:47:35 +000075 mkdir -p "$(DESTDIR)$(datadir)/keymaps"
pbrookad064842006-04-16 12:41:07 +000076 for x in $(KEYMAPS); do \
pbrook6a882642006-04-17 13:57:12 +000077 $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
pbrookad064842006-04-16 12:41:07 +000078 done
bellard11d9f692004-04-02 20:55:59 +000079endif
bellard626df762003-08-10 21:39:31 +000080 for d in $(TARGET_DIRS); do \
bellard7d3505c2004-05-12 19:32:15 +000081 $(MAKE) -C $$d $@ || exit 1 ; \
bellard626df762003-08-10 21:39:31 +000082 done
bellard612384d2003-03-22 17:31:19 +000083
bellard367e86e2003-03-01 17:13:26 +000084# various test targets
bellard82c7e2a2004-01-04 16:10:33 +000085test speed test2: all
bellard7d3505c2004-05-12 19:32:15 +000086 $(MAKE) -C tests $@
bellard31e31b82003-02-18 22:55:36 +000087
bellard367e86e2003-03-01 17:13:26 +000088TAGS:
bellardb9adb4a2003-04-29 20:41:16 +000089 etags *.[ch] tests/*.[ch]
bellard31e31b82003-02-18 22:55:36 +000090
bellard6688bc62005-08-21 09:23:39 +000091cscope:
92 rm -f ./cscope.*
93 find . -name "*.[ch]" -print > ./cscope.files
94 cscope -b
95
bellard3ef693a2003-03-23 20:17:16 +000096# documentation
bellard1f673132004-04-04 15:21:17 +000097%.html: %.texi
bellard3ef693a2003-03-23 20:17:16 +000098 texi2html -monolithic -number $<
99
bellardf3548322006-04-30 22:51:54 +0000100%.info: %.texi
101 makeinfo $< -o $@
102
103%.dvi: %.texi
104 texi2dvi $<
105
bellard5a671352003-10-01 00:13:48 +0000106qemu.1: qemu-doc.texi
pbrookad064842006-04-16 12:41:07 +0000107 $(SRC_PATH)/texi2pod.pl $< qemu.pod
bellard5a671352003-10-01 00:13:48 +0000108 pod2man --section=1 --center=" " --release=" " qemu.pod > $@
109
bellardacd935e2004-11-15 22:57:26 +0000110qemu-img.1: qemu-img.texi
pbrookad064842006-04-16 12:41:07 +0000111 $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
bellardacd935e2004-11-15 22:57:26 +0000112 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
113
pbrook0cb3fb12006-05-14 12:07:53 +0000114info: qemu-doc.info qemu-tech.info
115
116dvi: qemu-doc.dvi qemu-tech.dvi
117
118html: qemu-doc.html qemu-tech.html
119
bellard1e43adf2003-09-30 20:54:24 +0000120FILE=qemu-$(shell cat VERSION)
bellard586314f2003-03-03 15:02:29 +0000121
bellard1e43adf2003-09-30 20:54:24 +0000122# tar release (use 'make -k tar' on a checkouted tree)
bellard586314f2003-03-03 15:02:29 +0000123tar:
124 rm -rf /tmp/$(FILE)
bellard1e43adf2003-09-30 20:54:24 +0000125 cp -r . /tmp/$(FILE)
bellard76b62fd2003-10-28 00:47:44 +0000126 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
bellard586314f2003-03-03 15:02:29 +0000127 rm -rf /tmp/$(FILE)
128
bellard76b62fd2003-10-28 00:47:44 +0000129# generate a binary distribution
bellardd691f662003-03-24 21:58:34 +0000130tarbin:
bellard76b62fd2003-10-28 00:47:44 +0000131 ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
bellard43095f32005-04-27 20:49:23 +0000132 $(bindir)/qemu \
bellard7efa4382004-05-12 18:54:06 +0000133 $(bindir)/qemu-system-ppc \
bellardacd935e2004-11-15 22:57:26 +0000134 $(bindir)/qemu-system-sparc \
bellard43095f32005-04-27 20:49:23 +0000135 $(bindir)/qemu-system-x86_64 \
bellard93856aa2005-07-24 18:44:35 +0000136 $(bindir)/qemu-system-mips \
pbrook38260992006-03-11 14:51:13 +0000137 $(bindir)/qemu-system-mipsel \
bellardea31eb52005-12-06 21:42:03 +0000138 $(bindir)/qemu-system-arm \
bellard7efa4382004-05-12 18:54:06 +0000139 $(bindir)/qemu-i386 \
140 $(bindir)/qemu-arm \
bellardea31eb52005-12-06 21:42:03 +0000141 $(bindir)/qemu-armeb \
bellard7efa4382004-05-12 18:54:06 +0000142 $(bindir)/qemu-sparc \
143 $(bindir)/qemu-ppc \
bellardea31eb52005-12-06 21:42:03 +0000144 $(bindir)/qemu-mips \
145 $(bindir)/qemu-mipsel \
bellardb932cab2004-08-01 21:46:49 +0000146 $(bindir)/qemu-img \
bellard7efa4382004-05-12 18:54:06 +0000147 $(datadir)/bios.bin \
148 $(datadir)/vgabios.bin \
bellardde9258a2004-06-06 15:50:03 +0000149 $(datadir)/vgabios-cirrus.bin \
bellard637f6cd2004-06-21 19:54:47 +0000150 $(datadir)/ppc_rom.bin \
bellardd5295252005-07-03 14:00:51 +0000151 $(datadir)/video.x \
bellard0986ac32006-06-14 12:36:32 +0000152 $(datadir)/openbios-sparc32 \
bellard7efa4382004-05-12 18:54:06 +0000153 $(datadir)/linux_boot.bin \
bellard1f50f8d2004-05-08 14:44:43 +0000154 $(docdir)/qemu-doc.html \
155 $(docdir)/qemu-tech.html \
bellardacd935e2004-11-15 22:57:26 +0000156 $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
bellardd691f662003-03-24 21:58:34 +0000157
bellard31e31b82003-02-18 22:55:36 +0000158ifneq ($(wildcard .depend),)
159include .depend
160endif