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