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