Init pci_option_rom_offset for VGA BIOS absence
[qemu-kvm/fedora.git] / Makefile
blob61ca07fae7b5ace59323c4eb8d4f31ab2553ad8c
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 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_AIO
96 BLOCK_OBJS += compatfd.o
97 endif
99 ######################################################################
100 # libqemu_common.a: Target independent part of system emulation. The
101 # long term path is to suppress *all* target specific code in case of
102 # system emulation, i.e. a single QEMU executable should support all
103 # CPUs and machines.
105 OBJS=$(BLOCK_OBJS)
106 OBJS+=readline.o console.o
108 OBJS+=irq.o ptimer.o
109 OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
110 OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
111 OBJS+=tmp105.o lm832x.o eeprom93xx.o tsc2005.o
112 OBJS+=scsi-disk.o cdrom.o
113 OBJS+=scsi-generic.o
114 OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
115 OBJS+=usb-serial.o usb-net.o
116 OBJS+=sd.o ssi-sd.o
117 OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
118 OBJS+=bt-hci-csr.o
119 OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
120 OBJS+=qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o
121 OBJS+=msmouse.o ps2.o
122 OBJS+=qdev.o ssi.o
124 ifdef CONFIG_BRLAPI
125 OBJS+= baum.o
126 LIBS+=-lbrlapi
127 endif
129 ifdef CONFIG_WIN32
130 OBJS+=tap-win32.o
131 else
132 OBJS+=migration-exec.o
133 endif
135 AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
136 ifdef CONFIG_SDL
137 AUDIO_OBJS += sdlaudio.o
138 endif
139 ifdef CONFIG_OSS
140 AUDIO_OBJS += ossaudio.o
141 endif
142 ifdef CONFIG_COREAUDIO
143 AUDIO_OBJS += coreaudio.o
144 AUDIO_PT = yes
145 endif
146 ifdef CONFIG_ALSA
147 AUDIO_OBJS += alsaaudio.o
148 endif
149 ifdef CONFIG_DSOUND
150 AUDIO_OBJS += dsoundaudio.o
151 endif
152 ifdef CONFIG_FMOD
153 AUDIO_OBJS += fmodaudio.o
154 audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
155 endif
156 ifdef CONFIG_ESD
157 AUDIO_PT = yes
158 AUDIO_PT_INT = yes
159 AUDIO_OBJS += esdaudio.o
160 endif
161 ifdef CONFIG_PA
162 AUDIO_PT = yes
163 AUDIO_PT_INT = yes
164 AUDIO_OBJS += paaudio.o
165 endif
166 ifdef AUDIO_PT
167 LDFLAGS += -pthread
168 endif
169 ifdef AUDIO_PT_INT
170 AUDIO_OBJS += audio_pt_int.o
171 endif
172 AUDIO_OBJS+= wavcapture.o
173 OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
175 OBJS+=keymaps.o
176 ifdef CONFIG_SDL
177 OBJS+=sdl.o x_keymap.o
178 endif
179 ifdef CONFIG_CURSES
180 OBJS+=curses.o
181 endif
182 OBJS+=vnc.o acl.o d3des.o
183 ifdef CONFIG_VNC_TLS
184 OBJS+=vnc-tls.o vnc-auth-vencrypt.o
185 endif
186 ifdef CONFIG_VNC_SASL
187 OBJS+=vnc-auth-sasl.o
188 endif
190 ifdef CONFIG_COCOA
191 OBJS+=cocoa.o
192 endif
194 ifdef CONFIG_IOTHREAD
195 OBJS+=qemu-thread.o
196 endif
198 ifdef CONFIG_SLIRP
199 CPPFLAGS+=-I$(SRC_PATH)/slirp
200 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
201 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
202 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
203 OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
204 endif
206 LIBS+=$(VDE_LIBS)
208 cocoa.o: cocoa.m
210 keymaps.o: keymaps.c keymaps.h
212 sdl.o: sdl.c keymaps.h sdl_keysym.h
214 sdl.o audio/sdlaudio.o: CFLAGS += $(SDL_CFLAGS)
216 acl.o: acl.h acl.c
218 vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
220 vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h
222 vnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
224 vnc-tls.o: vnc-tls.c vnc.h
226 vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h
228 vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h
230 curses.o: curses.c keymaps.h curses_keys.h
232 bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)
234 libqemu_common.a: $(OBJS)
236 #######################################################################
237 # USER_OBJS is code used by qemu userspace emulation
238 USER_OBJS=cutils.o cache-utils.o
240 libqemu_user.a: $(USER_OBJS)
242 ######################################################################
244 qemu-img$(EXESUF): qemu-img.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
246 qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
248 qemu-io$(EXESUF): qemu-io.o qemu-tool.o tool-osdep.o cmd.o $(BLOCK_OBJS)
250 qemu-img$(EXESUF) qemu-nbd$(EXESUF) qemu-io$(EXESUF): LIBS += -lz
252 clean:
253 # avoid old build problems by removing potentially incorrect old files
254 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
255 rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
256 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d
257 $(MAKE) -C tests clean
258 for d in $(TARGET_DIRS) libhw32 libhw64; do \
259 $(MAKE) -C $$d $@ || exit 1 ; \
260 done
262 distclean: clean
263 rm -f config-host.mak config-host.h $(DOCS) qemu-options.texi
264 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
265 for d in $(TARGET_DIRS) libhw32 libhw64; do \
266 rm -rf $$d || exit 1 ; \
267 done
269 KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
270 ar de en-us fi fr-be hr it lv nl pl ru th \
271 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
273 ifdef INSTALL_BLOBS
274 BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
275 video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
276 pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
277 bamboo.dtb
278 BLOBS += extboot.bin
279 else
280 BLOBS=
281 endif
283 install-doc: $(DOCS)
284 $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
285 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
286 ifndef CONFIG_WIN32
287 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
288 $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
289 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
290 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
291 endif
293 install: all $(if $(BUILD_DOCS),install-doc)
294 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
295 ifneq ($(TOOLS),)
296 $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
297 endif
298 ifneq ($(BLOBS),)
299 $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
300 set -e; for x in $(BLOBS); do \
301 if [ -f $(SRC_PATH)/pc-bios/$$x ];then \
302 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
303 fi \
304 done
305 endif
306 ifndef CONFIG_WIN32
307 $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
308 set -e; for x in $(KEYMAPS); do \
309 $(INSTALL_DATA) $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
310 done
311 endif
312 for d in $(TARGET_DIRS); do \
313 $(MAKE) -C $$d $@ || exit 1 ; \
314 done
315 ifeq ($(KVM_KMOD),yes)
316 $(MAKE) -C kvm/kernel $@
317 endif
319 # various test targets
320 test speed: all
321 $(MAKE) -C tests $@
323 TAGS:
324 etags *.[ch] tests/*.[ch]
326 cscope:
327 rm -f ./cscope.*
328 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
329 cscope -b
331 # documentation
332 %.html: %.texi
333 $(call quiet-command,texi2html -I=. -monolithic -number $<," GEN $@")
335 %.info: %.texi
336 $(call quiet-command,makeinfo -I . $< -o $@," GEN $@")
338 %.dvi: %.texi
339 $(call quiet-command,texi2dvi -I . $<," GEN $@")
341 qemu-options.texi: $(SRC_PATH)/qemu-options.hx
342 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
344 qemu.1: qemu-doc.texi qemu-options.texi
345 $(call quiet-command, \
346 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu.pod && \
347 pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
348 " GEN $@")
350 qemu-img.1: qemu-img.texi
351 $(call quiet-command, \
352 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \
353 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
354 " GEN $@")
356 qemu-nbd.8: qemu-nbd.texi
357 $(call quiet-command, \
358 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \
359 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
360 " GEN $@")
362 info: qemu-doc.info qemu-tech.info
364 dvi: qemu-doc.dvi qemu-tech.dvi
366 html: qemu-doc.html qemu-tech.html
368 qemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi qemu-options.texi
370 VERSION ?= $(shell cat VERSION)
371 FILE = qemu-$(VERSION)
373 # tar release (use 'make -k tar' on a checkouted tree)
374 tar:
375 rm -rf /tmp/$(FILE)
376 cp -r . /tmp/$(FILE)
377 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
378 rm -rf /tmp/$(FILE)
380 # generate a binary distribution
381 tarbin:
382 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
383 $(bindir)/qemu \
384 $(bindir)/qemu-system-x86_64 \
385 $(bindir)/qemu-system-arm \
386 $(bindir)/qemu-system-cris \
387 $(bindir)/qemu-system-m68k \
388 $(bindir)/qemu-system-mips \
389 $(bindir)/qemu-system-mipsel \
390 $(bindir)/qemu-system-mips64 \
391 $(bindir)/qemu-system-mips64el \
392 $(bindir)/qemu-system-ppc \
393 $(bindir)/qemu-system-ppcemb \
394 $(bindir)/qemu-system-ppc64 \
395 $(bindir)/qemu-system-sh4 \
396 $(bindir)/qemu-system-sh4eb \
397 $(bindir)/qemu-system-sparc \
398 $(bindir)/qemu-i386 \
399 $(bindir)/qemu-x86_64 \
400 $(bindir)/qemu-alpha \
401 $(bindir)/qemu-arm \
402 $(bindir)/qemu-armeb \
403 $(bindir)/qemu-cris \
404 $(bindir)/qemu-m68k \
405 $(bindir)/qemu-mips \
406 $(bindir)/qemu-mipsel \
407 $(bindir)/qemu-ppc \
408 $(bindir)/qemu-ppc64 \
409 $(bindir)/qemu-ppc64abi32 \
410 $(bindir)/qemu-sh4 \
411 $(bindir)/qemu-sh4eb \
412 $(bindir)/qemu-sparc \
413 $(bindir)/qemu-sparc64 \
414 $(bindir)/qemu-sparc32plus \
415 $(bindir)/qemu-img \
416 $(bindir)/qemu-nbd \
417 $(datadir)/bios.bin \
418 $(datadir)/vgabios.bin \
419 $(datadir)/vgabios-cirrus.bin \
420 $(datadir)/ppc_rom.bin \
421 $(datadir)/video.x \
422 $(datadir)/openbios-sparc32 \
423 $(datadir)/openbios-sparc64 \
424 $(datadir)/openbios-ppc \
425 $(datadir)/pxe-ne2k_pci.bin \
426 $(datadir)/pxe-rtl8139.bin \
427 $(datadir)/pxe-pcnet.bin \
428 $(datadir)/pxe-e1000.bin \
429 $(datadir)/extboot.bin \
430 $(docdir)/qemu-doc.html \
431 $(docdir)/qemu-tech.html \
432 $(mandir)/man1/qemu.1 \
433 $(mandir)/man1/qemu-img.1 \
434 $(mandir)/man8/qemu-nbd.8
436 # Include automatically generated dependency files
437 -include $(wildcard *.d audio/*.d slirp/*.d block/*.d)
439 .PHONY: kvm/extboot
441 build-targets-i386 = $(build-targets-x86)
442 build-targets-x86_64 = $(build-targets-x86)
443 build-targets-x86 = kvm/extboot
444 build-targets-ia64 =
446 all: $(build-targets-$(ARCH))
448 kvm/extboot:
449 $(MAKE) -C $@
450 if ! [ -f pc-bios/extboot.bin ] \
451 || ! cmp -s pc-bios/extboot.bin $@/extboot.bin; then \
452 cp $@/extboot.bin pc-bios/extboot.bin; \