update
[qemu] / Makefile
1 -include config-host.mak
2
3 CFLAGS=-Wall -O2 -g -fno-strict-aliasing 
4 ifdef CONFIG_DARWIN
5 CFLAGS+= -mdynamic-no-pic
6 endif
7 LDFLAGS=-g
8 LIBS=
9 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
10 TOOLS=qemu-img$(EXESUF)
11 ifdef CONFIG_STATIC
12 LDFLAGS+=-static
13 endif
14 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
15
16 all: dyngen$(EXESUF) $(TOOLS) $(DOCS)
17         for d in $(TARGET_DIRS); do \
18         $(MAKE) -C $$d $@ || exit 1 ; \
19         done
20 ifdef CONFIG_KQEMU
21 ifdef CONFIG_WIN32
22         $(MAKE) -C kqemu -f Makefile.winnt
23 else
24         $(MAKE) -C kqemu
25 endif
26 endif
27
28 qemu-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
29         $(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
30
31 dyngen$(EXESUF): dyngen.c
32         $(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
33
34 clean:
35 # avoid old build problems by removing potentially incorrect old files
36         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 
37         rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
38         $(MAKE) -C tests clean
39         for d in $(TARGET_DIRS); do \
40         $(MAKE) -C $$d $@ || exit 1 ; \
41         done
42 ifdef CONFIG_KQEMU
43         $(MAKE) -C kqemu clean
44 endif
45
46 distclean: clean
47         rm -f config-host.mak config-host.h
48         for d in $(TARGET_DIRS); do \
49         rm -rf $$d || exit 1 ; \
50         done
51
52 KEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
53 ar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
54 common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
55
56 install: all 
57         mkdir -p "$(bindir)"
58         install -m 755 -s $(TOOLS) "$(bindir)"
59         mkdir -p "$(datadir)"
60         install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \
61                        pc-bios/vgabios-cirrus.bin \
62                        pc-bios/ppc_rom.bin pc-bios/video.x \
63                        pc-bios/proll.elf \
64                        pc-bios/linux_boot.bin "$(datadir)"
65         mkdir -p "$(docdir)"
66         install -m 644 qemu-doc.html  qemu-tech.html "$(docdir)"
67 ifndef CONFIG_WIN32
68         mkdir -p "$(mandir)/man1"
69         install qemu.1 qemu-img.1 "$(mandir)/man1"
70         mkdir -p "$(datadir)/keymaps"
71         install -m 644 $(addprefix keymaps/,$(KEYMAPS)) "$(datadir)/keymaps"
72 endif
73         for d in $(TARGET_DIRS); do \
74         $(MAKE) -C $$d $@ || exit 1 ; \
75         done
76 ifdef CONFIG_KQEMU
77         cd kqemu ; ./install.sh
78 endif
79
80 # various test targets
81 test speed test2: all
82         $(MAKE) -C tests $@
83
84 TAGS: 
85         etags *.[ch] tests/*.[ch]
86
87 cscope:
88         rm -f ./cscope.*
89         find . -name "*.[ch]" -print > ./cscope.files
90         cscope -b
91
92 # documentation
93 %.html: %.texi
94         texi2html -monolithic -number $<
95
96 qemu.1: qemu-doc.texi
97         ./texi2pod.pl $< qemu.pod
98         pod2man --section=1 --center=" " --release=" " qemu.pod > $@
99
100 qemu-img.1: qemu-img.texi
101         ./texi2pod.pl $< qemu-img.pod
102         pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
103
104 FILE=qemu-$(shell cat VERSION)
105
106 # tar release (use 'make -k tar' on a checkouted tree)
107 tar:
108         rm -rf /tmp/$(FILE)
109         cp -r . /tmp/$(FILE)
110         ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
111         rm -rf /tmp/$(FILE)
112
113 # generate a binary distribution
114 tarbin:
115         ( cd / ; tar zcvf ~/qemu-$(VERSION)-i386.tar.gz \
116         $(bindir)/qemu \
117         $(bindir)/qemu-system-ppc \
118         $(bindir)/qemu-system-sparc \
119         $(bindir)/qemu-system-x86_64 \
120         $(bindir)/qemu-system-mips \
121         $(bindir)/qemu-system-arm \
122         $(bindir)/qemu-i386 \
123         $(bindir)/qemu-arm \
124         $(bindir)/qemu-armeb \
125         $(bindir)/qemu-sparc \
126         $(bindir)/qemu-ppc \
127         $(bindir)/qemu-mips \
128         $(bindir)/qemu-mipsel \
129         $(bindir)/qemu-img \
130         $(datadir)/bios.bin \
131         $(datadir)/vgabios.bin \
132         $(datadir)/vgabios-cirrus.bin \
133         $(datadir)/ppc_rom.bin \
134         $(datadir)/video.x \
135         $(datadir)/proll.elf \
136         $(datadir)/linux_boot.bin \
137         $(docdir)/qemu-doc.html \
138         $(docdir)/qemu-tech.html \
139         $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
140
141 ifneq ($(wildcard .depend),)
142 include .depend
143 endif