]> git.proxmox.com Git - qemu.git/blame - Makefile
Introduce is_default field for QEMUMachine
[qemu.git] / Makefile
CommitLineData
0cb3fb1e
PB
1# Makefile for QEMU.
2
55d7e8f6 3ifneq ($(wildcard config-host.mak),)
1ad2134f
PB
4# Put the all: rule here so that config-host.mak can contain dependencies.
5all: build-all
ad064840 6include config-host.mak
17759187 7include $(SRC_PATH)/rules.mak
55d7e8f6
AJ
8else
9config-host.mak:
10 @echo "Please call configure before running make!"
11 @exit 1
12endif
766a487a 13
818220f5
AL
14.PHONY: all clean cscope distclean dvi html info install install-doc \
15 recurse-all speed tar tarbin test
0cb3fb1e 16
8c462f8f
PB
17VPATH=$(SRC_PATH):$(SRC_PATH)/hw
18
17759187 19
40293e58
FB
20CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
21LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
3142255c 22
96935aa4 23CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
4fb240a4 24CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
766a487a 25LIBS=
1f50f8d1 26ifdef CONFIG_STATIC
40293e58 27LDFLAGS += -static
1f50f8d1 28endif
cc8ae6de 29ifdef BUILD_DOCS
7a5ca864 30DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
cc8ae6de
PB
31else
32DOCS=
33endif
aa05ae6f 34
e5d355d1
AL
35LIBS+=$(PTHREADLIBS)
36LIBS+=$(CLOCKLIBS)
83f64091 37
7e00eb9b
AL
38ifdef CONFIG_SOLARIS
39LIBS+=-lsocket -lnsl -lresolv
40endif
41
03ff3ca3
AL
42ifdef CONFIG_WIN32
43LIBS+=-lwinmm -lws2_32 -liphlpapi
44endif
45
1ad2134f 46build-all: $(TOOLS) $(DOCS) recurse-all
b9dea4fb 47
55d7e8f6
AJ
48config-host.mak: configure
49ifneq ($(wildcard config-host.mak),)
50 @echo $@ is out-of-date, running configure
052ff921 51 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
55d7e8f6
AJ
52endif
53
0087375e 54SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
cec7d0b6
PB
55SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
56
86e840ee 57subdir-%:
0087375e 58 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
4aa42531 59
cec7d0b6
PB
60$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
61$(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
62
63recurse-all: $(SUBDIR_RULES)
83f64091 64
faf07963
PB
65#######################################################################
66# BLOCK_OBJS is code used by both qemu system emulation and qemu-img
67
0bfe3ca5 68BLOCK_OBJS=cutils.o cache-utils.o qemu-malloc.o module.o
019d6b8f
AL
69BLOCK_OBJS+=block/cow.o block/qcow.o aes.o block/vmdk.o block/cloop.o
70BLOCK_OBJS+=block/dmg.o block/bochs.o block/vpc.o block/vvfat.o
71BLOCK_OBJS+=block/qcow2.o block/parallels.o block/nbd.o
a76bab49 72BLOCK_OBJS+=nbd.o block.o aio.o
03ff3ca3
AL
73
74ifdef CONFIG_WIN32
019d6b8f 75BLOCK_OBJS += block/raw-win32.o
03ff3ca3 76else
3c529d93
AL
77ifdef CONFIG_AIO
78BLOCK_OBJS += posix-aio-compat.o
79endif
019d6b8f 80BLOCK_OBJS += block/raw-posix.o
03ff3ca3
AL
81endif
82
4fb240a4 83######################################################################
2e2ea909 84# libqemu_common.a: Target independent part of system emulation. The
4fb240a4
FB
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.
47cea614 88
cd01b4a3 89OBJS=$(BLOCK_OBJS)
87ecb68b 90OBJS+=readline.o console.o
cd01b4a3 91
e9c28334 92OBJS+=irq.o ptimer.o
87ecb68b 93OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
7e7c5e4c 94OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
e9c28334 95OBJS+=tmp105.o lm832x.o eeprom93xx.o tsc2005.o
87ecb68b 96OBJS+=scsi-disk.o cdrom.o
985a03b0 97OBJS+=scsi-generic.o
68063649 98OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
6c9f886c 99OBJS+=usb-serial.o usb-net.o
775616c3 100OBJS+=sd.o ssi-sd.o
e6a6d5ab 101OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
e9c28334 102OBJS+=bt-hci-csr.o
559b90fb 103OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
902b3d5c 104OBJS+=qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o
e9c28334 105OBJS+=msmouse.o ps2.o
90d37239 106OBJS+=qdev.o ssi.o
87ecb68b 107
2e4d9fb1
AJ
108ifdef CONFIG_BRLAPI
109OBJS+= baum.o
110LIBS+=-lbrlapi
111endif
112
4fb240a4
FB
113ifdef CONFIG_WIN32
114OBJS+=tap-win32.o
559b90fb
AL
115else
116OBJS+=migration-exec.o
4fb240a4
FB
117endif
118
119AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
120ifdef CONFIG_SDL
121AUDIO_OBJS += sdlaudio.o
122endif
123ifdef CONFIG_OSS
124AUDIO_OBJS += ossaudio.o
125endif
126ifdef CONFIG_COREAUDIO
127AUDIO_OBJS += coreaudio.o
ca9cc28c 128AUDIO_PT = yes
4fb240a4
FB
129endif
130ifdef CONFIG_ALSA
131AUDIO_OBJS += alsaaudio.o
132endif
133ifdef CONFIG_DSOUND
134AUDIO_OBJS += dsoundaudio.o
135endif
136ifdef CONFIG_FMOD
137AUDIO_OBJS += fmodaudio.o
138audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
139endif
ca9cc28c
AZ
140ifdef CONFIG_ESD
141AUDIO_PT = yes
142AUDIO_PT_INT = yes
143AUDIO_OBJS += esdaudio.o
144endif
b8e59f18 145ifdef CONFIG_PA
146AUDIO_PT = yes
147AUDIO_PT_INT = yes
148AUDIO_OBJS += paaudio.o
149endif
ca9cc28c
AZ
150ifdef AUDIO_PT
151LDFLAGS += -pthread
152endif
153ifdef AUDIO_PT_INT
154AUDIO_OBJS += audio_pt_int.o
155endif
4fb240a4
FB
156AUDIO_OBJS+= wavcapture.o
157OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
158
0483755a 159OBJS+=keymaps.o
4fb240a4
FB
160ifdef CONFIG_SDL
161OBJS+=sdl.o x_keymap.o
162endif
4d3b6f6e
AZ
163ifdef CONFIG_CURSES
164OBJS+=curses.o
165endif
76655d6d 166OBJS+=vnc.o acl.o d3des.o
5fb6c7a8
AL
167ifdef CONFIG_VNC_TLS
168OBJS+=vnc-tls.o vnc-auth-vencrypt.o
169endif
2f9606b3
AL
170ifdef CONFIG_VNC_SASL
171OBJS+=vnc-auth-sasl.o
172endif
4fb240a4
FB
173
174ifdef CONFIG_COCOA
175OBJS+=cocoa.o
176endif
177
e5d355d1
AL
178ifdef CONFIG_IOTHREAD
179OBJS+=qemu-thread.o
180endif
181
4fb240a4
FB
182ifdef CONFIG_SLIRP
183CPPFLAGS+=-I$(SRC_PATH)/slirp
184SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
185slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
186tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
187OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
188endif
189
8a16d273
TS
190LIBS+=$(VDE_LIBS)
191
2567f579
BS
192# xen backend driver support
193XEN_OBJS := xen_backend.o xen_devconfig.o
194XEN_OBJS += xen_console.o xenfb.o xen_disk.o xen_nic.o
195ifdef CONFIG_XEN
196 OBJS += $(XEN_OBJS)
197endif
198
4fb240a4 199cocoa.o: cocoa.m
4fb240a4 200
0483755a
AL
201keymaps.o: keymaps.c keymaps.h
202
203sdl.o: sdl.c keymaps.h sdl_keysym.h
807544e2
AL
204
205sdl.o audio/sdlaudio.o: CFLAGS += $(SDL_CFLAGS)
4fb240a4 206
76655d6d
AL
207acl.o: acl.h acl.c
208
2f9606b3 209vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
5fb6c7a8 210
76655d6d 211vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h
4fb240a4 212
807544e2 213vnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
4d3b6f6e 214
5fb6c7a8
AL
215vnc-tls.o: vnc-tls.c vnc.h
216
217vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h
218
2f9606b3
AL
219vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h
220
0483755a 221curses.o: curses.c keymaps.h curses_keys.h
fb599c9a 222
807544e2 223bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)
4fb240a4
FB
224
225libqemu_common.a: $(OBJS)
4fb240a4 226
cec7d0b6
PB
227#######################################################################
228# USER_OBJS is code used by qemu userspace emulation
902b3d5c 229USER_OBJS=cutils.o cache-utils.o
cec7d0b6
PB
230
231libqemu_user.a: $(USER_OBJS)
cec7d0b6 232
4fb240a4
FB
233######################################################################
234
88ca2a59 235qemu-img$(EXESUF): qemu-img.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
4fb240a4 236
88ca2a59 237qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
3aa892d7 238
88ca2a59 239qemu-io$(EXESUF): qemu-io.o qemu-tool.o tool-osdep.o cmd.o $(BLOCK_OBJS)
0a8e1acd
AL
240
241qemu-img$(EXESUF) qemu-nbd$(EXESUF) qemu-io$(EXESUF): LIBS += -lz
7a5ca864 242
31e31b8a 243clean:
2d80ae89 244# avoid old build problems by removing potentially incorrect old files
5fafdf24 245 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
86e840ee 246 rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
019d6b8f 247 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d
7d3505c5 248 $(MAKE) -C tests clean
1ad2134f 249 for d in $(TARGET_DIRS) libhw32 libhw64; do \
7d3505c5 250 $(MAKE) -C $$d $@ || exit 1 ; \
626df76a 251 done
31e31b8a 252
7d13299d 253distclean: clean
016c62c8 254 rm -f config-host.mak config-host.h $(DOCS) qemu-options.texi
0cb3fb1e 255 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
1ad2134f 256 for d in $(TARGET_DIRS) libhw32 libhw64; do \
bc1b050d 257 rm -rf $$d || exit 1 ; \
76bc6838 258 done
7d13299d 259
fed4a9ad
FB
260KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
261ar de en-us fi fr-be hr it lv nl pl ru th \
262common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
263
77755340
TS
264ifdef INSTALL_BLOBS
265BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
e5d01b06
AJ
266video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
267pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
268bamboo.dtb
77755340
TS
269else
270BLOBS=
271endif
272
38954dca 273install-doc: $(DOCS)
58f8aead
AL
274 $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
275 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
38954dca 276ifndef CONFIG_WIN32
58f8aead
AL
277 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
278 $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
279 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
280 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
38954dca
PB
281endif
282
283install: all $(if $(BUILD_DOCS),install-doc)
58f8aead 284 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
932a79df 285ifneq ($(TOOLS),)
58f8aead 286 $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
932a79df 287endif
77755340 288ifneq ($(BLOBS),)
58f8aead 289 $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
77755340 290 set -e; for x in $(BLOBS); do \
58f8aead 291 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
ad064840 292 done
77755340 293endif
11d9f695 294ifndef CONFIG_WIN32
58f8aead 295 $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
18be8d77 296 set -e; for x in $(KEYMAPS); do \
58f8aead 297 $(INSTALL_DATA) $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
ad064840 298 done
11d9f695 299endif
626df76a 300 for d in $(TARGET_DIRS); do \
7d3505c5 301 $(MAKE) -C $$d $@ || exit 1 ; \
626df76a 302 done
612384d7 303
367e86e8 304# various test targets
9b0b8203 305test speed: all
7d3505c5 306 $(MAKE) -C tests $@
31e31b8a 307
5fafdf24 308TAGS:
b9adb4a6 309 etags *.[ch] tests/*.[ch]
31e31b8a 310
6688bc6d
FB
311cscope:
312 rm -f ./cscope.*
ede46085 313 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
6688bc6d
FB
314 cscope -b
315
3ef693a0 316# documentation
1f673135 317%.html: %.texi
0d00e563 318 $(call quiet-command,texi2html -I=. -monolithic -number $<," GEN $@")
3ef693a0 319
f3548328 320%.info: %.texi
0d00e563 321 $(call quiet-command,makeinfo -I . $< -o $@," GEN $@")
f3548328
FB
322
323%.dvi: %.texi
0d00e563 324 $(call quiet-command,texi2dvi -I . $<," GEN $@")
5824d651
BS
325
326qemu-options.texi: $(SRC_PATH)/qemu-options.hx
0d00e563 327 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
f3548328 328
7545668b 329qemu.1: qemu-doc.texi qemu-options.texi
0d00e563
AL
330 $(call quiet-command, \
331 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu.pod && \
332 pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
333 " GEN $@")
5a67135a 334
acd935ef 335qemu-img.1: qemu-img.texi
0d00e563
AL
336 $(call quiet-command, \
337 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \
338 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
339 " GEN $@")
acd935ef 340
7a5ca864 341qemu-nbd.8: qemu-nbd.texi
0d00e563
AL
342 $(call quiet-command, \
343 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \
344 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
345 " GEN $@")
7a5ca864 346
0cb3fb1e
PB
347info: qemu-doc.info qemu-tech.info
348
349dvi: qemu-doc.dvi qemu-tech.dvi
350
351html: qemu-doc.html qemu-tech.html
352
5824d651 353qemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi qemu-options.texi
818220f5 354
df5cf721
TS
355VERSION ?= $(shell cat VERSION)
356FILE = qemu-$(VERSION)
586314f2 357
1e43adfc 358# tar release (use 'make -k tar' on a checkouted tree)
586314f2
FB
359tar:
360 rm -rf /tmp/$(FILE)
1e43adfc 361 cp -r . /tmp/$(FILE)
99c6c082 362 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
586314f2
FB
363 rm -rf /tmp/$(FILE)
364
76b62fd0 365# generate a binary distribution
d691f669 366tarbin:
18be8d77 367 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
43095f31 368 $(bindir)/qemu \
43095f31 369 $(bindir)/qemu-system-x86_64 \
40e8a53b
AJ
370 $(bindir)/qemu-system-arm \
371 $(bindir)/qemu-system-cris \
372 $(bindir)/qemu-system-m68k \
93856aac 373 $(bindir)/qemu-system-mips \
38260998 374 $(bindir)/qemu-system-mipsel \
fbe4f65b
TS
375 $(bindir)/qemu-system-mips64 \
376 $(bindir)/qemu-system-mips64el \
40e8a53b
AJ
377 $(bindir)/qemu-system-ppc \
378 $(bindir)/qemu-system-ppcemb \
379 $(bindir)/qemu-system-ppc64 \
ff1aaf65 380 $(bindir)/qemu-system-sh4 \
85ffbdfc 381 $(bindir)/qemu-system-sh4eb \
40e8a53b 382 $(bindir)/qemu-system-sparc \
7efa4387 383 $(bindir)/qemu-i386 \
f0403c03 384 $(bindir)/qemu-x86_64 \
40e8a53b
AJ
385 $(bindir)/qemu-alpha \
386 $(bindir)/qemu-arm \
387 $(bindir)/qemu-armeb \
388 $(bindir)/qemu-cris \
389 $(bindir)/qemu-m68k \
390 $(bindir)/qemu-mips \
391 $(bindir)/qemu-mipsel \
392 $(bindir)/qemu-ppc \
393 $(bindir)/qemu-ppc64 \
394 $(bindir)/qemu-ppc64abi32 \
395 $(bindir)/qemu-sh4 \
396 $(bindir)/qemu-sh4eb \
397 $(bindir)/qemu-sparc \
398 $(bindir)/qemu-sparc64 \
399 $(bindir)/qemu-sparc32plus \
400 $(bindir)/qemu-img \
401 $(bindir)/qemu-nbd \
7efa4387
FB
402 $(datadir)/bios.bin \
403 $(datadir)/vgabios.bin \
de9258a8 404 $(datadir)/vgabios-cirrus.bin \
637f6cd7 405 $(datadir)/ppc_rom.bin \
d5295253 406 $(datadir)/video.x \
0986ac3b 407 $(datadir)/openbios-sparc32 \
938255d2 408 $(datadir)/openbios-sparc64 \
e5d01b06 409 $(datadir)/openbios-ppc \
40e8a53b 410 $(datadir)/pxe-ne2k_pci.bin \
19c80e50 411 $(datadir)/pxe-rtl8139.bin \
40e8a53b 412 $(datadir)/pxe-pcnet.bin \
2991990b 413 $(datadir)/pxe-e1000.bin \
1f50f8d1
FB
414 $(docdir)/qemu-doc.html \
415 $(docdir)/qemu-tech.html \
40e8a53b
AJ
416 $(mandir)/man1/qemu.1 \
417 $(mandir)/man1/qemu-img.1 \
7a5ca864 418 $(mandir)/man8/qemu-nbd.8
d691f669 419
4fb240a4 420# Include automatically generated dependency files
019d6b8f 421-include $(wildcard *.d audio/*.d slirp/*.d block/*.d)