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