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