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