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