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