Only call kvm_set_irqfd() if CONFIG_KVM is defined
[qemu/qemu-dev-zwu.git] / Makefile
blob2cd87be1d09fb9f909773d9de1cc23d520680bb9
1 # Makefile for QEMU.
3 GENERATED_HEADERS = config-host.h
5 ifneq ($(wildcard config-host.mak),)
6 # Put the all: rule here so that config-host.mak can contain dependencies.
7 all: build-all
8 include config-host.mak
9 include $(SRC_PATH)/rules.mak
10 config-host.mak: $(SRC_PATH)/configure
11 @echo $@ is out-of-date, running configure
12 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
13 else
14 config-host.mak:
15 @echo "Please call configure before running make!"
16 @exit 1
17 endif
19 # Don't try to regenerate Makefile or configure
20 # We don't generate any of them
21 Makefile: ;
22 configure: ;
24 .PHONY: all clean cscope distclean dvi html info install install-doc \
25 pdf recurse-all speed tar tarbin test build-all
27 $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
29 LIBS+=-lz $(LIBS_TOOLS)
31 ifdef BUILD_DOCS
32 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
33 else
34 DOCS=
35 endif
37 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
38 SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
40 config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
41 $(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u > $@," GEN $@")
43 %/config-devices.mak: default-configs/%.mak
44 $(call quiet-command,cat $< > $@.tmp, " GEN $@")
45 @if test -f $@; then \
46 if cmp -s $@.old $@ || cmp -s $@ $@.tmp; then \
47 mv $@.tmp $@; \
48 cp -p $@ $@.old; \
49 else \
50 if test -f $@.old; then \
51 echo "WARNING: $@ (user modified) out of date.";\
52 else \
53 echo "WARNING: $@ out of date.";\
54 fi; \
55 echo "Run \"make defconfig\" to regenerate."; \
56 rm $@.tmp; \
57 fi; \
58 else \
59 mv $@.tmp $@; \
60 cp -p $@ $@.old; \
63 defconfig:
64 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
66 -include config-all-devices.mak
68 build-all: $(DOCS) $(TOOLS) recurse-all
70 config-host.h: config-host.h-timestamp
71 config-host.h-timestamp: config-host.mak
73 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
75 ifeq ($(KVM_KMOD),yes)
77 .PHONEY: kvm-kmod
79 all: kvm-kmod
81 kvm-kmod:
82 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C kvm/kernel V="$(V)" )
85 endif
87 subdir-%: $(GENERATED_HEADERS)
88 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
90 ifneq ($(wildcard config-host.mak),)
91 include $(SRC_PATH)/Makefile.objs
92 endif
94 $(common-obj-y): $(GENERATED_HEADERS)
95 $(filter %-softmmu,$(SUBDIR_RULES)): $(common-obj-y) subdir-libdis
97 $(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) subdir-libdis-user subdir-libuser
99 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
100 romsubdir-%:
101 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
103 ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
105 recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
107 audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
109 QEMU_CFLAGS+=$(CURL_CFLAGS)
111 cocoa.o: cocoa.m
113 keymaps.o: keymaps.c keymaps.h
115 sdl_zoom.o: sdl_zoom.c sdl_zoom.h sdl_zoom_template.h
117 sdl.o: sdl.c keymaps.h sdl_keysym.h sdl_zoom.h
119 sdl.o audio/sdlaudio.o sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
121 acl.o: acl.h acl.c
123 vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
125 vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h
127 vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
129 vnc-tls.o: vnc-tls.c vnc.h
131 vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h
133 vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h
135 vnc-encoding-zlib.o: vnc-encoding-zlib.c vnc.h
137 vnc-encoding-hextile.o: vnc-encoding-hextile.c vnc.h
139 vnc-encoding-tight.o: vnc-encoding-tight.c vnc.h vnc-encoding-tight.h
141 curses.o: curses.c keymaps.h curses_keys.h
143 bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
145 iov.o: iov.c iov.h
147 ######################################################################
149 qemu-img.o: qemu-img-cmds.h
150 qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o: $(GENERATED_HEADERS)
152 qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
154 qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
156 qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
158 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
159 $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $@")
161 check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o: $(GENERATED_HEADERS)
163 check-qint: check-qint.o qint.o qemu-malloc.o
164 check-qstring: check-qstring.o qstring.o qemu-malloc.o
165 check-qdict: check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qemu-malloc.o qlist.o
166 check-qlist: check-qlist.o qlist.o qint.o qemu-malloc.o
167 check-qfloat: check-qfloat.o qfloat.o qemu-malloc.o
168 check-qjson: check-qjson.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o qjson.o json-streamer.o json-lexer.o json-parser.o qemu-malloc.o
170 clean:
171 # avoid old build problems by removing potentially incorrect old files
172 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
173 rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
174 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d
175 rm -f qemu-img-cmds.h
176 $(MAKE) -C tests clean
177 for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser libdis libdis-user; do \
178 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
179 done
181 distclean: clean
182 rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
183 rm -f config-all-devices.mak
184 rm -f roms/seabios/config.mak roms/vgabios/config.mak
185 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pdf,pg,toc,tp,vr}
186 for d in $(TARGET_DIRS) libhw32 libhw64 libuser libdis libdis-user; do \
187 rm -rf $$d || exit 1 ; \
188 done
190 KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
191 ar de en-us fi fr-be hr it lv nl pl ru th \
192 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
194 ifdef INSTALL_BLOBS
195 BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
196 video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
197 gpxe-eepro100-80861209.rom \
198 gpxe-eepro100-80861229.rom \
199 pxe-e1000.bin \
200 pxe-ne2k_pci.bin pxe-pcnet.bin \
201 pxe-rtl8139.bin pxe-virtio.bin \
202 bamboo.dtb petalogix-s3adsp1800.dtb \
203 multiboot.bin linuxboot.bin \
204 s390-zipl.rom
205 BLOBS += extboot.bin
206 BLOBS += vapic.bin
207 else
208 BLOBS=
209 endif
211 install-doc: $(DOCS)
212 $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
213 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
214 ifdef CONFIG_POSIX
215 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
216 $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
217 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
218 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
219 endif
221 install-sysconfig:
222 $(INSTALL_DIR) "$(DESTDIR)$(sysconfdir)/qemu"
223 $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(sysconfdir)/qemu"
225 install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig
226 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
227 ifneq ($(TOOLS),)
228 $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
229 endif
230 ifneq ($(BLOBS),)
231 $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
232 set -e; for x in $(BLOBS); do \
233 if [ -f $(SRC_PATH)/pc-bios/$$x ];then \
234 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
235 fi \
236 ; if [ -f pc-bios/optionrom/$$x ];then \
237 $(INSTALL_DATA) pc-bios/optionrom/$$x "$(DESTDIR)$(datadir)"; \
238 fi \
239 done
240 endif
241 $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
242 set -e; for x in $(KEYMAPS); do \
243 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
244 done
245 for d in $(TARGET_DIRS); do \
246 $(MAKE) -C $$d $@ || exit 1 ; \
247 done
248 ifeq ($(KVM_KMOD),yes)
249 $(MAKE) -C kvm/kernel $@
250 endif
252 # various test targets
253 test speed: all
254 $(MAKE) -C tests $@
256 .PHONY: TAGS
257 TAGS:
258 find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
260 cscope:
261 rm -f ./cscope.*
262 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
263 cscope -b
265 # documentation
266 MAKEINFO=makeinfo
267 MAKEINFOFLAGS=--no-headers --no-split --number-sections
268 TEXIFLAG=$(if $(V),,--quiet)
269 %.dvi: %.texi
270 $(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<," GEN $@")
272 %.html: %.texi
273 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \
274 " GEN $@")
276 %.info: %.texi
277 $(call quiet-command,$(MAKEINFO) $< -o $@," GEN $@")
279 %.pdf: %.texi
280 $(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<," GEN $@")
282 qemu-options.texi: $(SRC_PATH)/qemu-options.hx
283 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
285 qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
286 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
288 QMP/qmp-commands.txt: $(SRC_PATH)/qemu-monitor.hx
289 $(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@," GEN $@")
291 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
292 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
294 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
295 $(call quiet-command, \
296 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu.pod && \
297 pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
298 " GEN $@")
300 qemu-img.1: qemu-img.texi qemu-img-cmds.texi
301 $(call quiet-command, \
302 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \
303 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
304 " GEN $@")
306 qemu-nbd.8: qemu-nbd.texi
307 $(call quiet-command, \
308 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \
309 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
310 " GEN $@")
312 dvi: qemu-doc.dvi qemu-tech.dvi
313 html: qemu-doc.html qemu-tech.html
314 info: qemu-doc.info qemu-tech.info
315 pdf: qemu-doc.pdf qemu-tech.pdf
317 qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
318 qemu-img.texi qemu-nbd.texi qemu-options.texi \
319 qemu-monitor.texi qemu-img-cmds.texi
321 VERSION ?= $(shell cat VERSION)
322 FILE = qemu-$(VERSION)
324 # tar release (use 'make -k tar' on a checkouted tree)
325 tar:
326 rm -rf /tmp/$(FILE)
327 cp -r . /tmp/$(FILE)
328 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
329 rm -rf /tmp/$(FILE)
331 SYSTEM_TARGETS=$(filter %-softmmu,$(TARGET_DIRS))
332 SYSTEM_PROGS=$(patsubst qemu-system-i386,qemu, \
333 $(patsubst %-softmmu,qemu-system-%, \
334 $(SYSTEM_TARGETS)))
336 USER_TARGETS=$(filter %-user,$(TARGET_DIRS))
337 USER_PROGS=$(patsubst %-bsd-user,qemu-%, \
338 $(patsubst %-darwin-user,qemu-%, \
339 $(patsubst %-linux-user,qemu-%, \
340 $(USER_TARGETS))))
342 # generate a binary distribution
343 tarbin:
344 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
345 $(patsubst %,$(bindir)/%, $(SYSTEM_PROGS)) \
346 $(patsubst %,$(bindir)/%, $(USER_PROGS)) \
347 $(bindir)/qemu-img \
348 $(bindir)/qemu-nbd \
349 $(datadir)/bios.bin \
350 $(datadir)/vgabios.bin \
351 $(datadir)/vgabios-cirrus.bin \
352 $(datadir)/ppc_rom.bin \
353 $(datadir)/video.x \
354 $(datadir)/openbios-sparc32 \
355 $(datadir)/openbios-sparc64 \
356 $(datadir)/openbios-ppc \
357 $(datadir)/pxe-ne2k_pci.bin \
358 $(datadir)/pxe-rtl8139.bin \
359 $(datadir)/pxe-pcnet.bin \
360 $(datadir)/pxe-e1000.bin \
361 $(datadir)/extboot.bin \
362 $(docdir)/qemu-doc.html \
363 $(docdir)/qemu-tech.html \
364 $(mandir)/man1/qemu.1 \
365 $(mandir)/man1/qemu-img.1 \
366 $(mandir)/man8/qemu-nbd.8
368 # Include automatically generated dependency files
369 -include $(wildcard *.d audio/*.d slirp/*.d block/*.d net/*.d)