|
1 # Makefile for QEMU. |
|
2 |
|
3 include config-host.mak |
|
4 |
|
5 .PHONY: all clean cscope distclean dvi html info install install-doc \ |
|
6 recurse-all speed tar tarbin test |
|
7 |
|
8 VPATH=$(SRC_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/libfdt |
|
9 |
|
10 CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS) |
|
11 LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS) |
|
12 |
|
13 CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@ |
|
14 CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
|
15 LIBS= |
|
16 ifdef CONFIG_STATIC |
|
17 LDFLAGS += -static |
|
18 endif |
|
19 ifdef BUILD_DOCS |
|
20 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 |
|
21 else |
|
22 DOCS= |
|
23 endif |
|
24 |
|
25 LIBS+=$(AIOLIBS) |
|
26 |
|
27 ifdef CONFIG_SOLARIS |
|
28 LIBS+=-lsocket -lnsl -lresolv |
|
29 endif |
|
30 |
|
31 ifdef CONFIG_WIN32 |
|
32 LIBS+=-lwinmm -lws2_32 -liphlpapi |
|
33 endif |
|
34 |
|
35 all: $(TOOLS) $(DOCS) recurse-all |
|
36 |
|
37 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS)) |
|
38 |
|
39 subdir-%: |
|
40 $(MAKE) -C $(subst subdir-,,$@) all |
|
41 |
|
42 $(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a |
|
43 $(filter %-user,$(SUBDIR_RULES)): libqemu_user.a |
|
44 |
|
45 recurse-all: $(SUBDIR_RULES) |
|
46 |
|
47 ####################################################################### |
|
48 # BLOCK_OBJS is code used by both qemu system emulation and qemu-img |
|
49 |
|
50 BLOCK_OBJS=cutils.o qemu-malloc.o |
|
51 BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o |
|
52 BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o |
|
53 BLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o |
|
54 BLOCK_OBJS+=nbd.o block.o aio.o |
|
55 |
|
56 ifdef CONFIG_WIN32 |
|
57 BLOCK_OBJS += block-raw-win32.o |
|
58 else |
|
59 ifdef CONFIG_AIO |
|
60 BLOCK_OBJS += posix-aio-compat.o |
|
61 endif |
|
62 BLOCK_OBJS += block-raw-posix.o |
|
63 endif |
|
64 |
|
65 ###################################################################### |
|
66 # libqemu_common.a: Target independent part of system emulation. The |
|
67 # long term path is to suppress *all* target specific code in case of |
|
68 # system emulation, i.e. a single QEMU executable should support all |
|
69 # CPUs and machines. |
|
70 |
|
71 include $(SRC_PATH)/libfdt/Makefile.libfdt |
|
72 $(LIBFDT_OBJS): CPPFLAGS += -I$(SRC_PATH)/libfdt |
|
73 |
|
74 OBJS=$(BLOCK_OBJS) |
|
75 OBJS+=$(LIBFDT_OBJS) |
|
76 OBJS+=readline.o console.o gui.o gui_parser.o gui_png.o |
|
77 |
|
78 OBJS+=irq.o |
|
79 OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o |
|
80 OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o |
|
81 OBJS+=tmp105.o lm832x.o |
|
82 OBJS+=scsi-disk.o cdrom.o |
|
83 OBJS+=scsi-generic.o |
|
84 OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o |
|
85 OBJS+=usb-serial.o usb-net.o |
|
86 OBJS+=sd.o ssi-sd.o |
|
87 OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o |
|
88 OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o |
|
89 OBJS+=qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o |
|
90 |
|
91 ifdef CONFIG_BRLAPI |
|
92 OBJS+= baum.o |
|
93 LIBS+=-lbrlapi |
|
94 endif |
|
95 |
|
96 ifdef CONFIG_WIN32 |
|
97 OBJS+=tap-win32.o |
|
98 else |
|
99 OBJS+=migration-exec.o |
|
100 endif |
|
101 |
|
102 AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o |
|
103 ifdef CONFIG_SDL |
|
104 AUDIO_OBJS += sdlaudio.o |
|
105 endif |
|
106 ifdef CONFIG_OSS |
|
107 AUDIO_OBJS += ossaudio.o |
|
108 endif |
|
109 ifdef CONFIG_COREAUDIO |
|
110 AUDIO_OBJS += coreaudio.o |
|
111 AUDIO_PT = yes |
|
112 endif |
|
113 ifdef CONFIG_ALSA |
|
114 AUDIO_OBJS += alsaaudio.o |
|
115 endif |
|
116 ifdef CONFIG_DSOUND |
|
117 AUDIO_OBJS += dsoundaudio.o |
|
118 endif |
|
119 ifdef CONFIG_FMOD |
|
120 AUDIO_OBJS += fmodaudio.o |
|
121 audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS) |
|
122 endif |
|
123 ifdef CONFIG_ESD |
|
124 AUDIO_PT = yes |
|
125 AUDIO_PT_INT = yes |
|
126 AUDIO_OBJS += esdaudio.o |
|
127 endif |
|
128 ifdef CONFIG_PA |
|
129 AUDIO_PT = yes |
|
130 AUDIO_PT_INT = yes |
|
131 AUDIO_OBJS += paaudio.o |
|
132 endif |
|
133 ifdef AUDIO_PT |
|
134 LDFLAGS += -pthread |
|
135 endif |
|
136 ifdef AUDIO_PT_INT |
|
137 AUDIO_OBJS += audio_pt_int.o |
|
138 endif |
|
139 AUDIO_OBJS+= wavcapture.o |
|
140 OBJS+=$(addprefix audio/, $(AUDIO_OBJS)) |
|
141 |
|
142 ifdef CONFIG_SDL |
|
143 OBJS+=sdl.o x_keymap.o |
|
144 endif |
|
145 ifdef CONFIG_CURSES |
|
146 OBJS+=curses.o |
|
147 endif |
|
148 OBJS+=vnc.o d3des.o |
|
149 |
|
150 ifdef CONFIG_COCOA |
|
151 OBJS+=cocoa.o |
|
152 endif |
|
153 |
|
154 ifdef CONFIG_SLIRP |
|
155 CPPFLAGS+=-I$(SRC_PATH)/slirp |
|
156 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ |
|
157 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ |
|
158 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o |
|
159 OBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) |
|
160 endif |
|
161 |
|
162 LIBS+=$(VDE_LIBS) |
|
163 |
|
164 cocoa.o: cocoa.m |
|
165 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< |
|
166 |
|
167 sdl.o: sdl.c keymaps.c sdl_keysym.h |
|
168 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $< |
|
169 |
|
170 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h |
|
171 $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_VNC_TLS_CFLAGS) -c -o $@ $< |
|
172 |
|
173 curses.o: curses.c keymaps.c curses_keys.h |
|
174 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< |
|
175 |
|
176 bt-host.o: bt-host.c |
|
177 $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_BLUEZ_CFLAGS) -c -o $@ $< |
|
178 |
|
179 audio/sdlaudio.o: audio/sdlaudio.c |
|
180 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $< |
|
181 |
|
182 libqemu_common.a: $(OBJS) |
|
183 rm -f $@ |
|
184 $(AR) rcs $@ $(OBJS) |
|
185 |
|
186 ####################################################################### |
|
187 # USER_OBJS is code used by qemu userspace emulation |
|
188 USER_OBJS=cutils.o cache-utils.o |
|
189 |
|
190 libqemu_user.a: $(USER_OBJS) |
|
191 rm -f $@ |
|
192 $(AR) rcs $@ $(USER_OBJS) |
|
193 |
|
194 ###################################################################### |
|
195 |
|
196 qemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS) |
|
197 $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) |
|
198 |
|
199 %.o: %.c |
|
200 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< |
|
201 |
|
202 qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS) |
|
203 $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) |
|
204 |
|
205 clean: |
|
206 # avoid old build problems by removing potentially incorrect old files |
|
207 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 |
|
208 rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~ |
|
209 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d |
|
210 $(MAKE) -C tests clean |
|
211 for d in $(TARGET_DIRS); do \ |
|
212 $(MAKE) -C $$d $@ || exit 1 ; \ |
|
213 done |
|
214 |
|
215 distclean: clean |
|
216 rm -f config-host.mak config-host.h $(DOCS) |
|
217 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} |
|
218 for d in $(TARGET_DIRS); do \ |
|
219 rm -rf $$d || exit 1 ; \ |
|
220 done |
|
221 |
|
222 KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ |
|
223 ar de en-us fi fr-be hr it lv nl pl ru th \ |
|
224 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr |
|
225 |
|
226 ifdef INSTALL_BLOBS |
|
227 BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ |
|
228 video.x openbios-sparc32 openbios-sparc64 pxe-ne2k_pci.bin \ |
|
229 pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin bamboo.dtb |
|
230 else |
|
231 BLOBS= |
|
232 endif |
|
233 |
|
234 install-doc: $(DOCS) |
|
235 mkdir -p "$(DESTDIR)$(docdir)" |
|
236 $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" |
|
237 ifndef CONFIG_WIN32 |
|
238 mkdir -p "$(DESTDIR)$(mandir)/man1" |
|
239 $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" |
|
240 mkdir -p "$(DESTDIR)$(mandir)/man8" |
|
241 $(INSTALL) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" |
|
242 endif |
|
243 |
|
244 install: all $(if $(BUILD_DOCS),install-doc) |
|
245 mkdir -p "$(DESTDIR)$(bindir)" |
|
246 ifneq ($(TOOLS),) |
|
247 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" |
|
248 endif |
|
249 ifneq ($(BLOBS),) |
|
250 mkdir -p "$(DESTDIR)$(datadir)" |
|
251 set -e; for x in $(BLOBS); do \ |
|
252 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ |
|
253 done |
|
254 endif |
|
255 ifndef CONFIG_WIN32 |
|
256 mkdir -p "$(DESTDIR)$(datadir)/keymaps" |
|
257 set -e; for x in $(KEYMAPS); do \ |
|
258 $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ |
|
259 done |
|
260 endif |
|
261 for d in $(TARGET_DIRS); do \ |
|
262 $(MAKE) -C $$d $@ || exit 1 ; \ |
|
263 done |
|
264 |
|
265 # various test targets |
|
266 test speed: all |
|
267 $(MAKE) -C tests $@ |
|
268 |
|
269 TAGS: |
|
270 etags *.[ch] tests/*.[ch] |
|
271 |
|
272 cscope: |
|
273 rm -f ./cscope.* |
|
274 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files |
|
275 cscope -b |
|
276 |
|
277 # documentation |
|
278 %.html: %.texi |
|
279 texi2html -monolithic -number $< |
|
280 |
|
281 %.info: %.texi |
|
282 makeinfo $< -o $@ |
|
283 |
|
284 %.dvi: %.texi |
|
285 texi2dvi $< |
|
286 |
|
287 qemu.1: qemu-doc.texi |
|
288 $(SRC_PATH)/texi2pod.pl $< qemu.pod |
|
289 pod2man --section=1 --center=" " --release=" " qemu.pod > $@ |
|
290 |
|
291 qemu-img.1: qemu-img.texi |
|
292 $(SRC_PATH)/texi2pod.pl $< qemu-img.pod |
|
293 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ |
|
294 |
|
295 qemu-nbd.8: qemu-nbd.texi |
|
296 $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod |
|
297 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@ |
|
298 |
|
299 info: qemu-doc.info qemu-tech.info |
|
300 |
|
301 dvi: qemu-doc.dvi qemu-tech.dvi |
|
302 |
|
303 html: qemu-doc.html qemu-tech.html |
|
304 |
|
305 qemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi |
|
306 |
|
307 VERSION ?= $(shell cat VERSION) |
|
308 FILE = qemu-$(VERSION) |
|
309 |
|
310 # tar release (use 'make -k tar' on a checkouted tree) |
|
311 tar: |
|
312 rm -rf /tmp/$(FILE) |
|
313 cp -r . /tmp/$(FILE) |
|
314 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn |
|
315 rm -rf /tmp/$(FILE) |
|
316 |
|
317 # generate a binary distribution |
|
318 tarbin: |
|
319 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \ |
|
320 $(bindir)/qemu \ |
|
321 $(bindir)/qemu-system-ppc \ |
|
322 $(bindir)/qemu-system-ppc64 \ |
|
323 $(bindir)/qemu-system-ppcemb \ |
|
324 $(bindir)/qemu-system-sparc \ |
|
325 $(bindir)/qemu-system-x86_64 \ |
|
326 $(bindir)/qemu-system-mips \ |
|
327 $(bindir)/qemu-system-mipsel \ |
|
328 $(bindir)/qemu-system-mips64 \ |
|
329 $(bindir)/qemu-system-mips64el \ |
|
330 $(bindir)/qemu-system-arm \ |
|
331 $(bindir)/qemu-system-m68k \ |
|
332 $(bindir)/qemu-system-sh4 \ |
|
333 $(bindir)/qemu-system-sh4eb \ |
|
334 $(bindir)/qemu-system-cris \ |
|
335 $(bindir)/qemu-i386 \ |
|
336 $(bindir)/qemu-x86_64 \ |
|
337 $(bindir)/qemu-arm \ |
|
338 $(bindir)/qemu-armeb \ |
|
339 $(bindir)/qemu-sparc \ |
|
340 $(bindir)/qemu-sparc32plus \ |
|
341 $(bindir)/qemu-sparc64 \ |
|
342 $(bindir)/qemu-ppc \ |
|
343 $(bindir)/qemu-ppc64 \ |
|
344 $(bindir)/qemu-ppc64abi32 \ |
|
345 $(bindir)/qemu-mips \ |
|
346 $(bindir)/qemu-mipsel \ |
|
347 $(bindir)/qemu-alpha \ |
|
348 $(bindir)/qemu-m68k \ |
|
349 $(bindir)/qemu-sh4 \ |
|
350 $(bindir)/qemu-sh4eb \ |
|
351 $(bindir)/qemu-cris \ |
|
352 $(bindir)/qemu-img \ |
|
353 $(bindir)/qemu-nbd \ |
|
354 $(datadir)/bios.bin \ |
|
355 $(datadir)/vgabios.bin \ |
|
356 $(datadir)/vgabios-cirrus.bin \ |
|
357 $(datadir)/ppc_rom.bin \ |
|
358 $(datadir)/video.x \ |
|
359 $(datadir)/openbios-sparc32 \ |
|
360 $(datadir)/openbios-sparc64 \ |
|
361 $(datadir)/pxe-ne2k_pci.bin \ |
|
362 $(datadir)/pxe-rtl8139.bin \ |
|
363 $(datadir)/pxe-pcnet.bin \ |
|
364 $(datadir)/pxe-e1000.bin \ |
|
365 $(docdir)/qemu-doc.html \ |
|
366 $(docdir)/qemu-tech.html \ |
|
367 $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 |
|
368 $(mandir)/man8/qemu-nbd.8 |
|
369 |
|
370 # Include automatically generated dependency files |
|
371 -include $(wildcard *.d audio/*.d slirp/*.d) |