]>
Commit | Line | Data |
---|---|---|
0cb3fb1e PB |
1 | # Makefile for QEMU. |
2 | ||
ad064840 | 3 | include config-host.mak |
766a487a | 4 | |
0cb3fb1e | 5 | .PHONY: all clean distclean dvi info install install-doc tar tarbin \ |
9b0b8203 | 6 | speed test html dvi info |
0cb3fb1e | 7 | |
6f30fa85 TS |
8 | BASE_CFLAGS= |
9 | BASE_LDFLAGS= | |
10 | ||
3142255c BS |
11 | BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS) |
12 | BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS) | |
13 | ||
4fb240a4 FB |
14 | CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP |
15 | CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE | |
766a487a | 16 | LIBS= |
1f50f8d1 | 17 | ifdef CONFIG_STATIC |
6f30fa85 | 18 | BASE_LDFLAGS += -static |
1f50f8d1 | 19 | endif |
cc8ae6de | 20 | ifdef BUILD_DOCS |
acd935ef | 21 | DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 |
cc8ae6de PB |
22 | else |
23 | DOCS= | |
24 | endif | |
aa05ae6f | 25 | |
70956b77 | 26 | LIBS+=$(AIOLIBS) |
83f64091 | 27 | |
da0b0df8 | 28 | all: $(TOOLS) $(DOCS) recurse-all |
b9dea4fb | 29 | |
da0b0df8 | 30 | subdir-%: dyngen$(EXESUF) libqemu_common.a |
4aa42531 PB |
31 | $(MAKE) -C $(subst subdir-,,$@) all |
32 | ||
33 | recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) | |
83f64091 | 34 | |
faf07963 PB |
35 | ####################################################################### |
36 | # BLOCK_OBJS is code used by both qemu system emulation and qemu-img | |
37 | ||
38 | BLOCK_OBJS=cutils.o | |
39 | BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o | |
40 | BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o | |
41 | BLOCK_OBJS+=block-qcow2.o block-parallels.o | |
42 | ||
4fb240a4 | 43 | ###################################################################### |
faf07963 | 44 | # libqemu_common.a: Target indepedent part of system emulation. The |
4fb240a4 FB |
45 | # long term path is to suppress *all* target specific code in case of |
46 | # system emulation, i.e. a single QEMU executable should support all | |
47 | # CPUs and machines. | |
47cea614 | 48 | |
faf07963 PB |
49 | OBJS=$(BLOCK_OBJS) |
50 | OBJS+=readline.o console.o | |
51 | OBJS+=block.o | |
4fb240a4 FB |
52 | |
53 | ifdef CONFIG_WIN32 | |
54 | OBJS+=tap-win32.o | |
55 | endif | |
56 | ||
57 | AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o | |
58 | ifdef CONFIG_SDL | |
59 | AUDIO_OBJS += sdlaudio.o | |
60 | endif | |
61 | ifdef CONFIG_OSS | |
62 | AUDIO_OBJS += ossaudio.o | |
63 | endif | |
64 | ifdef CONFIG_COREAUDIO | |
65 | AUDIO_OBJS += coreaudio.o | |
66 | endif | |
67 | ifdef CONFIG_ALSA | |
68 | AUDIO_OBJS += alsaaudio.o | |
69 | endif | |
70 | ifdef CONFIG_DSOUND | |
71 | AUDIO_OBJS += dsoundaudio.o | |
72 | endif | |
73 | ifdef CONFIG_FMOD | |
74 | AUDIO_OBJS += fmodaudio.o | |
75 | audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS) | |
76 | endif | |
77 | AUDIO_OBJS+= wavcapture.o | |
78 | OBJS+=$(addprefix audio/, $(AUDIO_OBJS)) | |
79 | ||
80 | ifdef CONFIG_SDL | |
81 | OBJS+=sdl.o x_keymap.o | |
82 | endif | |
83 | OBJS+=vnc.o d3des.o | |
84 | ||
85 | ifdef CONFIG_COCOA | |
86 | OBJS+=cocoa.o | |
87 | endif | |
88 | ||
89 | ifdef CONFIG_SLIRP | |
90 | CPPFLAGS+=-I$(SRC_PATH)/slirp | |
91 | SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ | |
92 | slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ | |
93 | tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o | |
94 | OBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) | |
95 | endif | |
96 | ||
97 | cocoa.o: cocoa.m | |
98 | $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | |
99 | ||
100 | sdl.o: sdl.c keymaps.c sdl_keysym.h | |
101 | $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $< | |
102 | ||
103 | vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h | |
104 | $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | |
105 | ||
106 | audio/sdlaudio.o: audio/sdlaudio.c | |
107 | $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $< | |
108 | ||
109 | libqemu_common.a: $(OBJS) | |
110 | rm -f $@ | |
111 | $(AR) rcs $@ $(OBJS) | |
112 | ||
113 | ###################################################################### | |
114 | ||
faf07963 | 115 | qemu-img$(EXESUF): qemu-img.o qemu-img-block.o qemu-img-block-raw.o $(BLOCK_OBJS) |
4fb240a4 FB |
116 | $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) |
117 | ||
faf07963 PB |
118 | qemu-img-%.o: %.c |
119 | $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG $(BASE_CFLAGS) -c -o $@ $< | |
120 | ||
4fb240a4 FB |
121 | %.o: %.c |
122 | $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< | |
123 | ||
124 | # dyngen host tool | |
11d9f695 | 125 | dyngen$(EXESUF): dyngen.c |
6f30fa85 | 126 | $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^ |
31e31b8a FB |
127 | |
128 | clean: | |
2d80ae89 | 129 | # avoid old build problems by removing potentially incorrect old files |
5fafdf24 | 130 | 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 |
4fb240a4 FB |
131 | rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~ |
132 | rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d | |
7d3505c5 | 133 | $(MAKE) -C tests clean |
626df76a | 134 | for d in $(TARGET_DIRS); do \ |
7d3505c5 | 135 | $(MAKE) -C $$d $@ || exit 1 ; \ |
626df76a | 136 | done |
31e31b8a | 137 | |
7d13299d | 138 | distclean: clean |
cc8ae6de | 139 | rm -f config-host.mak config-host.h $(DOCS) |
0cb3fb1e | 140 | rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} |
76bc6838 | 141 | for d in $(TARGET_DIRS); do \ |
bc1b050d | 142 | rm -rf $$d || exit 1 ; \ |
76bc6838 | 143 | done |
7d13299d | 144 | |
fed4a9ad FB |
145 | KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ |
146 | ar de en-us fi fr-be hr it lv nl pl ru th \ | |
147 | common de-ch es fo fr-ca hu ja mk nl-be pt sl tr | |
148 | ||
38954dca PB |
149 | install-doc: $(DOCS) |
150 | mkdir -p "$(DESTDIR)$(docdir)" | |
151 | $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" | |
152 | ifndef CONFIG_WIN32 | |
153 | mkdir -p "$(DESTDIR)$(mandir)/man1" | |
154 | $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" | |
155 | endif | |
156 | ||
157 | install: all $(if $(BUILD_DOCS),install-doc) | |
1236cab7 | 158 | mkdir -p "$(DESTDIR)$(bindir)" |
932a79df | 159 | ifneq ($(TOOLS),) |
6a882643 | 160 | $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" |
932a79df | 161 | endif |
1236cab7 | 162 | mkdir -p "$(DESTDIR)$(datadir)" |
ad064840 | 163 | for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ |
860c6c52 | 164 | video.x openbios-sparc32 pxe-ne2k_pci.bin \ |
eec85c2a | 165 | pxe-rtl8139.bin pxe-pcnet.bin; do \ |
6a882643 | 166 | $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ |
ad064840 | 167 | done |
11d9f695 | 168 | ifndef CONFIG_WIN32 |
1236cab7 | 169 | mkdir -p "$(DESTDIR)$(datadir)/keymaps" |
ad064840 | 170 | for x in $(KEYMAPS); do \ |
6a882643 | 171 | $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ |
ad064840 | 172 | done |
11d9f695 | 173 | endif |
626df76a | 174 | for d in $(TARGET_DIRS); do \ |
7d3505c5 | 175 | $(MAKE) -C $$d $@ || exit 1 ; \ |
626df76a | 176 | done |
612384d7 | 177 | |
367e86e8 | 178 | # various test targets |
9b0b8203 | 179 | test speed: all |
7d3505c5 | 180 | $(MAKE) -C tests $@ |
31e31b8a | 181 | |
5fafdf24 | 182 | TAGS: |
b9adb4a6 | 183 | etags *.[ch] tests/*.[ch] |
31e31b8a | 184 | |
6688bc6d FB |
185 | cscope: |
186 | rm -f ./cscope.* | |
187 | find . -name "*.[ch]" -print > ./cscope.files | |
188 | cscope -b | |
189 | ||
3ef693a0 | 190 | # documentation |
1f673135 | 191 | %.html: %.texi |
3ef693a0 FB |
192 | texi2html -monolithic -number $< |
193 | ||
f3548328 FB |
194 | %.info: %.texi |
195 | makeinfo $< -o $@ | |
196 | ||
197 | %.dvi: %.texi | |
198 | texi2dvi $< | |
199 | ||
5a67135a | 200 | qemu.1: qemu-doc.texi |
ad064840 | 201 | $(SRC_PATH)/texi2pod.pl $< qemu.pod |
5a67135a FB |
202 | pod2man --section=1 --center=" " --release=" " qemu.pod > $@ |
203 | ||
acd935ef | 204 | qemu-img.1: qemu-img.texi |
ad064840 | 205 | $(SRC_PATH)/texi2pod.pl $< qemu-img.pod |
acd935ef FB |
206 | pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ |
207 | ||
0cb3fb1e PB |
208 | info: qemu-doc.info qemu-tech.info |
209 | ||
210 | dvi: qemu-doc.dvi qemu-tech.dvi | |
211 | ||
212 | html: qemu-doc.html qemu-tech.html | |
213 | ||
df5cf721 TS |
214 | VERSION ?= $(shell cat VERSION) |
215 | FILE = qemu-$(VERSION) | |
586314f2 | 216 | |
1e43adfc | 217 | # tar release (use 'make -k tar' on a checkouted tree) |
586314f2 FB |
218 | tar: |
219 | rm -rf /tmp/$(FILE) | |
1e43adfc | 220 | cp -r . /tmp/$(FILE) |
76b62fd0 | 221 | ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS ) |
586314f2 FB |
222 | rm -rf /tmp/$(FILE) |
223 | ||
76b62fd0 | 224 | # generate a binary distribution |
d691f669 | 225 | tarbin: |
4887d78b | 226 | ( cd / ; tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \ |
43095f31 | 227 | $(bindir)/qemu \ |
7efa4387 | 228 | $(bindir)/qemu-system-ppc \ |
d4082e95 JM |
229 | $(bindir)/qemu-system-ppc64 \ |
230 | $(bindir)/qemu-system-ppcemb \ | |
acd935ef | 231 | $(bindir)/qemu-system-sparc \ |
43095f31 | 232 | $(bindir)/qemu-system-x86_64 \ |
93856aac | 233 | $(bindir)/qemu-system-mips \ |
38260998 | 234 | $(bindir)/qemu-system-mipsel \ |
fbe4f65b TS |
235 | $(bindir)/qemu-system-mips64 \ |
236 | $(bindir)/qemu-system-mips64el \ | |
ea31eb5b | 237 | $(bindir)/qemu-system-arm \ |
ff1aaf65 TS |
238 | $(bindir)/qemu-system-m68k \ |
239 | $(bindir)/qemu-system-sh4 \ | |
7efa4387 FB |
240 | $(bindir)/qemu-i386 \ |
241 | $(bindir)/qemu-arm \ | |
ea31eb5b | 242 | $(bindir)/qemu-armeb \ |
7efa4387 FB |
243 | $(bindir)/qemu-sparc \ |
244 | $(bindir)/qemu-ppc \ | |
d4082e95 | 245 | $(bindir)/qemu-ppc64 \ |
ea31eb5b FB |
246 | $(bindir)/qemu-mips \ |
247 | $(bindir)/qemu-mipsel \ | |
540635ba TS |
248 | $(bindir)/qemu-mipsn32 \ |
249 | $(bindir)/qemu-mipsn32el \ | |
250 | $(bindir)/qemu-mips64 \ | |
251 | $(bindir)/qemu-mips64el \ | |
cf6c1b16 | 252 | $(bindir)/qemu-alpha \ |
ff1aaf65 TS |
253 | $(bindir)/qemu-m68k \ |
254 | $(bindir)/qemu-sh4 \ | |
b932caba | 255 | $(bindir)/qemu-img \ |
7efa4387 FB |
256 | $(datadir)/bios.bin \ |
257 | $(datadir)/vgabios.bin \ | |
de9258a8 | 258 | $(datadir)/vgabios-cirrus.bin \ |
637f6cd7 | 259 | $(datadir)/ppc_rom.bin \ |
d5295253 | 260 | $(datadir)/video.x \ |
0986ac3b | 261 | $(datadir)/openbios-sparc32 \ |
19c80e50 FB |
262 | $(datadir)/pxe-ne2k_pci.bin \ |
263 | $(datadir)/pxe-rtl8139.bin \ | |
264 | $(datadir)/pxe-pcnet.bin \ | |
1f50f8d1 FB |
265 | $(docdir)/qemu-doc.html \ |
266 | $(docdir)/qemu-tech.html \ | |
acd935ef | 267 | $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 ) |
d691f669 | 268 | |
31e31b8a FB |
269 | ifneq ($(wildcard .depend),) |
270 | include .depend | |
271 | endif | |
4fb240a4 FB |
272 | |
273 | # Include automatically generated dependency files | |
274 | -include $(wildcard *.d audio/*.d slirp/*.d) |