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