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