kvm: external module: backward compatibility for CONFIG_HAVE_KVM_IRQCHIP
[qemu-kvm/fedora.git] / Makefile
blob86f1f3c0b6bb82cd3ea81bbfe3b7ad89b2060b65
1 # Makefile for QEMU.
3 include config-host.mak
5 .PHONY: all clean cscope distclean dvi html info install install-doc \
6 recurse-all speed tar tarbin test
8 VPATH=$(SRC_PATH):$(SRC_PATH)/hw
10 CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
11 LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
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
25 LIBS+=$(AIOLIBS)
27 ifdef CONFIG_SOLARIS
28 LIBS+=-lsocket -lnsl -lresolv
29 endif
31 ifdef CONFIG_WIN32
32 LIBS+=-lwinmm -lws2_32 -liphlpapi
33 endif
35 all: $(TOOLS) $(DOCS) recurse-all
37 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
39 subdir-%:
40 $(MAKE) -C $(subst subdir-,,$@) all
42 $(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
43 $(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
45 recurse-all: $(SUBDIR_RULES)
47 #######################################################################
48 # BLOCK_OBJS is code used by both qemu system emulation and qemu-img
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
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
65 ifdef CONFIG_AIO
66 BLOCK_OBJS += compatfd.o
67 endif
69 ######################################################################
70 # libqemu_common.a: Target independent part of system emulation. The
71 # long term path is to suppress *all* target specific code in case of
72 # system emulation, i.e. a single QEMU executable should support all
73 # CPUs and machines.
75 OBJS=$(BLOCK_OBJS)
76 OBJS+=readline.o console.o
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
91 ifdef CONFIG_BRLAPI
92 OBJS+= baum.o
93 LIBS+=-lbrlapi
94 endif
96 ifdef CONFIG_WIN32
97 OBJS+=tap-win32.o
98 else
99 OBJS+=migration-exec.o
100 endif
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))
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
150 ifdef CONFIG_COCOA
151 OBJS+=cocoa.o
152 endif
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
162 LIBS+=$(VDE_LIBS)
164 cocoa.o: cocoa.m
165 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
167 sdl.o: sdl.c keymaps.c sdl_keysym.h
168 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
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 $@ $<
173 curses.o: curses.c keymaps.c curses_keys.h
174 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
176 bt-host.o: bt-host.c
177 $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_BLUEZ_CFLAGS) -c -o $@ $<
179 audio/sdlaudio.o: audio/sdlaudio.c
180 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
182 libqemu_common.a: $(OBJS)
183 rm -f $@
184 $(AR) rcs $@ $(OBJS)
186 #######################################################################
187 # USER_OBJS is code used by qemu userspace emulation
188 USER_OBJS=cutils.o cache-utils.o
190 libqemu_user.a: $(USER_OBJS)
191 rm -f $@
192 $(AR) rcs $@ $(USER_OBJS)
194 ######################################################################
196 qemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS)
197 $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
199 %.o: %.c
200 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
202 qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS)
203 $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
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
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
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
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 BLOBS += extboot.bin
231 else
232 BLOBS=
233 endif
235 install-doc: $(DOCS)
236 mkdir -p "$(DESTDIR)$(docdir)"
237 $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
238 ifndef CONFIG_WIN32
239 mkdir -p "$(DESTDIR)$(mandir)/man1"
240 $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
241 mkdir -p "$(DESTDIR)$(mandir)/man8"
242 $(INSTALL) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
243 endif
245 install: all $(if $(BUILD_DOCS),install-doc)
246 mkdir -p "$(DESTDIR)$(bindir)"
247 ifneq ($(TOOLS),)
248 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
249 endif
250 ifneq ($(BLOBS),)
251 mkdir -p "$(DESTDIR)$(datadir)"
252 set -e; for x in $(BLOBS); do \
253 [ -f $(SRC_PATH)/pc-bios/$$x ] && \
254 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
255 done
256 endif
257 ifndef CONFIG_WIN32
258 mkdir -p "$(DESTDIR)$(datadir)/keymaps"
259 set -e; for x in $(KEYMAPS); do \
260 $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
261 done
262 endif
263 for d in $(TARGET_DIRS); do \
264 $(MAKE) -C $$d $@ || exit 1 ; \
265 done
267 # various test targets
268 test speed: all
269 $(MAKE) -C tests $@
271 TAGS:
272 etags *.[ch] tests/*.[ch]
274 cscope:
275 rm -f ./cscope.*
276 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
277 cscope -b
279 # documentation
280 %.html: %.texi
281 texi2html -monolithic -number $<
283 %.info: %.texi
284 makeinfo $< -o $@
286 %.dvi: %.texi
287 texi2dvi $<
289 qemu.1: qemu-doc.texi
290 $(SRC_PATH)/texi2pod.pl $< qemu.pod
291 pod2man --section=1 --center=" " --release=" " qemu.pod > $@
293 qemu-img.1: qemu-img.texi
294 $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
295 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
297 qemu-nbd.8: qemu-nbd.texi
298 $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod
299 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@
301 info: qemu-doc.info qemu-tech.info
303 dvi: qemu-doc.dvi qemu-tech.dvi
305 html: qemu-doc.html qemu-tech.html
307 qemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi
309 VERSION ?= $(shell cat VERSION)
310 FILE = qemu-$(VERSION)
312 # tar release (use 'make -k tar' on a checkouted tree)
313 tar:
314 rm -rf /tmp/$(FILE)
315 cp -r . /tmp/$(FILE)
316 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
317 rm -rf /tmp/$(FILE)
319 # generate a binary distribution
320 tarbin:
321 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
322 $(bindir)/qemu \
323 $(bindir)/qemu-system-x86_64 \
324 $(bindir)/qemu-system-arm \
325 $(bindir)/qemu-system-cris \
326 $(bindir)/qemu-system-m68k \
327 $(bindir)/qemu-system-mips \
328 $(bindir)/qemu-system-mipsel \
329 $(bindir)/qemu-system-mips64 \
330 $(bindir)/qemu-system-mips64el \
331 $(bindir)/qemu-system-ppc \
332 $(bindir)/qemu-system-ppcemb \
333 $(bindir)/qemu-system-ppc64 \
334 $(bindir)/qemu-system-sh4 \
335 $(bindir)/qemu-system-sh4eb \
336 $(bindir)/qemu-system-sparc \
337 $(bindir)/qemu-i386 \
338 $(bindir)/qemu-x86_64 \
339 $(bindir)/qemu-alpha \
340 $(bindir)/qemu-arm \
341 $(bindir)/qemu-armeb \
342 $(bindir)/qemu-cris \
343 $(bindir)/qemu-m68k \
344 $(bindir)/qemu-mips \
345 $(bindir)/qemu-mipsel \
346 $(bindir)/qemu-ppc \
347 $(bindir)/qemu-ppc64 \
348 $(bindir)/qemu-ppc64abi32 \
349 $(bindir)/qemu-sh4 \
350 $(bindir)/qemu-sh4eb \
351 $(bindir)/qemu-sparc \
352 $(bindir)/qemu-sparc64 \
353 $(bindir)/qemu-sparc32plus \
354 $(bindir)/qemu-img \
355 $(bindir)/qemu-nbd \
356 $(datadir)/bios.bin \
357 $(datadir)/vgabios.bin \
358 $(datadir)/vgabios-cirrus.bin \
359 $(datadir)/ppc_rom.bin \
360 $(datadir)/video.x \
361 $(datadir)/openbios-sparc32 \
362 $(datadir)/openbios-sparc64 \
363 $(datadir)/pxe-ne2k_pci.bin \
364 $(datadir)/pxe-rtl8139.bin \
365 $(datadir)/pxe-pcnet.bin \
366 $(datadir)/pxe-e1000.bin \
367 $(datadir)/extboot.bin \
368 $(docdir)/qemu-doc.html \
369 $(docdir)/qemu-tech.html \
370 $(mandir)/man1/qemu.1 \
371 $(mandir)/man1/qemu-img.1 \
372 $(mandir)/man8/qemu-nbd.8
374 # Include automatically generated dependency files
375 -include $(wildcard *.d audio/*.d slirp/*.d)