]> git.proxmox.com Git - mirror_qemu.git/blame - Makefile
Native FreeBSD parallel port (Juergen Lock)
[mirror_qemu.git] / Makefile
CommitLineData
0cb3fb1e
PB
1# Makefile for QEMU.
2
ad064840 3include config-host.mak
766a487a 4
818220f5
AL
5.PHONY: all clean cscope distclean dvi html info install install-doc \
6 recurse-all speed tar tarbin test
0cb3fb1e 7
8c462f8f
PB
8VPATH=$(SRC_PATH):$(SRC_PATH)/hw
9
40293e58
FB
10CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
11LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
3142255c 12
96935aa4 13CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
4fb240a4 14CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
766a487a 15LIBS=
1f50f8d1 16ifdef CONFIG_STATIC
40293e58 17LDFLAGS += -static
1f50f8d1 18endif
cc8ae6de 19ifdef BUILD_DOCS
7a5ca864 20DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
cc8ae6de
PB
21else
22DOCS=
23endif
aa05ae6f 24
70956b77 25LIBS+=$(AIOLIBS)
83f64091 26
7e00eb9b
AL
27ifdef CONFIG_SOLARIS
28LIBS+=-lsocket -lnsl -lresolv
29endif
30
03ff3ca3
AL
31ifdef CONFIG_WIN32
32LIBS+=-lwinmm -lws2_32 -liphlpapi
33endif
34
818220f5 35all: $(TOOLS) $(DOCS) recurse-all
b9dea4fb 36
cec7d0b6
PB
37SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
38
39subdir-%: dyngen$(EXESUF)
4aa42531
PB
40 $(MAKE) -C $(subst subdir-,,$@) all
41
cec7d0b6
PB
42$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
43$(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
44
45recurse-all: $(SUBDIR_RULES)
83f64091 46
faf07963
PB
47#######################################################################
48# BLOCK_OBJS is code used by both qemu system emulation and qemu-img
49
17e2377a 50BLOCK_OBJS=cutils.o qemu-malloc.o
faf07963
PB
51BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
52BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
03ff3ca3 53BLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o
a76bab49 54BLOCK_OBJS+=nbd.o block.o aio.o
03ff3ca3
AL
55
56ifdef CONFIG_WIN32
57BLOCK_OBJS += block-raw-win32.o
58else
59BLOCK_OBJS += block-raw-posix.o
60endif
61
4fb240a4 62######################################################################
2e2ea909 63# libqemu_common.a: Target independent part of system emulation. The
4fb240a4
FB
64# long term path is to suppress *all* target specific code in case of
65# system emulation, i.e. a single QEMU executable should support all
66# CPUs and machines.
47cea614 67
cd01b4a3 68OBJS=$(BLOCK_OBJS)
87ecb68b 69OBJS+=readline.o console.o
cd01b4a3 70
87ecb68b
PB
71OBJS+=irq.o
72OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
7e7c5e4c 73OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
1d4e547b 74OBJS+=tmp105.o lm832x.o
87ecb68b 75OBJS+=scsi-disk.o cdrom.o
985a03b0 76OBJS+=scsi-generic.o
6c9f886c
AZ
77OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o
78OBJS+=usb-serial.o usb-net.o
775616c3 79OBJS+=sd.o ssi-sd.o
e6a6d5ab 80OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
559b90fb 81OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
a672b469 82OBJS+=qemu-char.o aio.o net-checksum.o savevm.o
87ecb68b 83
2e4d9fb1
AJ
84ifdef CONFIG_BRLAPI
85OBJS+= baum.o
86LIBS+=-lbrlapi
87endif
88
4fb240a4
FB
89ifdef CONFIG_WIN32
90OBJS+=tap-win32.o
559b90fb
AL
91else
92OBJS+=migration-exec.o
4fb240a4
FB
93endif
94
95AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
96ifdef CONFIG_SDL
97AUDIO_OBJS += sdlaudio.o
98endif
99ifdef CONFIG_OSS
100AUDIO_OBJS += ossaudio.o
101endif
102ifdef CONFIG_COREAUDIO
103AUDIO_OBJS += coreaudio.o
ca9cc28c 104AUDIO_PT = yes
4fb240a4
FB
105endif
106ifdef CONFIG_ALSA
107AUDIO_OBJS += alsaaudio.o
108endif
109ifdef CONFIG_DSOUND
110AUDIO_OBJS += dsoundaudio.o
111endif
112ifdef CONFIG_FMOD
113AUDIO_OBJS += fmodaudio.o
114audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
115endif
ca9cc28c
AZ
116ifdef CONFIG_ESD
117AUDIO_PT = yes
118AUDIO_PT_INT = yes
119AUDIO_OBJS += esdaudio.o
120endif
b8e59f18 121ifdef CONFIG_PA
122AUDIO_PT = yes
123AUDIO_PT_INT = yes
124AUDIO_OBJS += paaudio.o
125endif
ca9cc28c
AZ
126ifdef AUDIO_PT
127LDFLAGS += -pthread
128endif
129ifdef AUDIO_PT_INT
130AUDIO_OBJS += audio_pt_int.o
131endif
4fb240a4
FB
132AUDIO_OBJS+= wavcapture.o
133OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
134
135ifdef CONFIG_SDL
136OBJS+=sdl.o x_keymap.o
137endif
4d3b6f6e
AZ
138ifdef CONFIG_CURSES
139OBJS+=curses.o
140endif
4fb240a4
FB
141OBJS+=vnc.o d3des.o
142
143ifdef CONFIG_COCOA
144OBJS+=cocoa.o
145endif
146
147ifdef CONFIG_SLIRP
148CPPFLAGS+=-I$(SRC_PATH)/slirp
149SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
150slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
151tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
152OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
153endif
154
8a16d273
TS
155LIBS+=$(VDE_LIBS)
156
4fb240a4 157cocoa.o: cocoa.m
40293e58 158 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
4fb240a4
FB
159
160sdl.o: sdl.c keymaps.c sdl_keysym.h
40293e58 161 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
4fb240a4
FB
162
163vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
40293e58 164 $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_VNC_TLS_CFLAGS) -c -o $@ $<
4fb240a4 165
4d3b6f6e 166curses.o: curses.c keymaps.c curses_keys.h
f5d28393 167 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
4d3b6f6e 168
fb599c9a
AZ
169bt-host.o: bt-host.c
170 $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_BLUEZ_CFLAGS) -c -o $@ $<
171
4fb240a4 172audio/sdlaudio.o: audio/sdlaudio.c
40293e58 173 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
4fb240a4
FB
174
175libqemu_common.a: $(OBJS)
176 rm -f $@
177 $(AR) rcs $@ $(OBJS)
178
cec7d0b6
PB
179#######################################################################
180# USER_OBJS is code used by qemu userspace emulation
181USER_OBJS=cutils.o
182
183libqemu_user.a: $(USER_OBJS)
184 rm -f $@
185 $(AR) rcs $@ $(USER_OBJS)
186
4fb240a4
FB
187######################################################################
188
03ff3ca3 189qemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS)
40293e58 190 $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
4fb240a4
FB
191
192%.o: %.c
40293e58 193 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
4fb240a4 194
03ff3ca3 195qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS)
7a5ca864
FB
196 $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
197
4fb240a4 198# dyngen host tool
11d9f695 199dyngen$(EXESUF): dyngen.c
40293e58 200 $(HOST_CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
31e31b8a
FB
201
202clean:
2d80ae89 203# avoid old build problems by removing potentially incorrect old files
5fafdf24 204 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
4fb240a4 205 rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~
b94ec3ec 206 rm -rf dyngen.dSYM
4fb240a4 207 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
7d3505c5 208 $(MAKE) -C tests clean
626df76a 209 for d in $(TARGET_DIRS); do \
7d3505c5 210 $(MAKE) -C $$d $@ || exit 1 ; \
626df76a 211 done
31e31b8a 212
7d13299d 213distclean: clean
cc8ae6de 214 rm -f config-host.mak config-host.h $(DOCS)
0cb3fb1e 215 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
76bc6838 216 for d in $(TARGET_DIRS); do \
bc1b050d 217 rm -rf $$d || exit 1 ; \
76bc6838 218 done
7d13299d 219
fed4a9ad
FB
220KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
221ar de en-us fi fr-be hr it lv nl pl ru th \
222common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
223
38954dca
PB
224install-doc: $(DOCS)
225 mkdir -p "$(DESTDIR)$(docdir)"
226 $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
227ifndef CONFIG_WIN32
228 mkdir -p "$(DESTDIR)$(mandir)/man1"
229 $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
7a5ca864
FB
230 mkdir -p "$(DESTDIR)$(mandir)/man8"
231 $(INSTALL) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
38954dca
PB
232endif
233
234install: all $(if $(BUILD_DOCS),install-doc)
1236cab7 235 mkdir -p "$(DESTDIR)$(bindir)"
932a79df 236ifneq ($(TOOLS),)
6a882643 237 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
932a79df 238endif
1236cab7 239 mkdir -p "$(DESTDIR)$(datadir)"
18be8d77 240 set -e; for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
938255d2 241 video.x openbios-sparc32 openbios-sparc64 pxe-ne2k_pci.bin \
2991990b 242 pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin; do \
6a882643 243 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
ad064840 244 done
11d9f695 245ifndef CONFIG_WIN32
1236cab7 246 mkdir -p "$(DESTDIR)$(datadir)/keymaps"
18be8d77 247 set -e; for x in $(KEYMAPS); do \
6a882643 248 $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
ad064840 249 done
11d9f695 250endif
626df76a 251 for d in $(TARGET_DIRS); do \
7d3505c5 252 $(MAKE) -C $$d $@ || exit 1 ; \
626df76a 253 done
612384d7 254
367e86e8 255# various test targets
9b0b8203 256test speed: all
7d3505c5 257 $(MAKE) -C tests $@
31e31b8a 258
5fafdf24 259TAGS:
b9adb4a6 260 etags *.[ch] tests/*.[ch]
31e31b8a 261
6688bc6d
FB
262cscope:
263 rm -f ./cscope.*
ede46085 264 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
6688bc6d
FB
265 cscope -b
266
3ef693a0 267# documentation
1f673135 268%.html: %.texi
3ef693a0
FB
269 texi2html -monolithic -number $<
270
f3548328
FB
271%.info: %.texi
272 makeinfo $< -o $@
273
274%.dvi: %.texi
275 texi2dvi $<
276
5a67135a 277qemu.1: qemu-doc.texi
ad064840 278 $(SRC_PATH)/texi2pod.pl $< qemu.pod
5a67135a
FB
279 pod2man --section=1 --center=" " --release=" " qemu.pod > $@
280
acd935ef 281qemu-img.1: qemu-img.texi
ad064840 282 $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
acd935ef
FB
283 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
284
7a5ca864
FB
285qemu-nbd.8: qemu-nbd.texi
286 $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod
287 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@
288
0cb3fb1e
PB
289info: qemu-doc.info qemu-tech.info
290
291dvi: qemu-doc.dvi qemu-tech.dvi
292
293html: qemu-doc.html qemu-tech.html
294
818220f5
AL
295qemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi
296
df5cf721
TS
297VERSION ?= $(shell cat VERSION)
298FILE = qemu-$(VERSION)
586314f2 299
1e43adfc 300# tar release (use 'make -k tar' on a checkouted tree)
586314f2
FB
301tar:
302 rm -rf /tmp/$(FILE)
1e43adfc 303 cp -r . /tmp/$(FILE)
99c6c082 304 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
586314f2
FB
305 rm -rf /tmp/$(FILE)
306
76b62fd0 307# generate a binary distribution
d691f669 308tarbin:
18be8d77 309 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
43095f31 310 $(bindir)/qemu \
7efa4387 311 $(bindir)/qemu-system-ppc \
d4082e95
JM
312 $(bindir)/qemu-system-ppc64 \
313 $(bindir)/qemu-system-ppcemb \
acd935ef 314 $(bindir)/qemu-system-sparc \
43095f31 315 $(bindir)/qemu-system-x86_64 \
93856aac 316 $(bindir)/qemu-system-mips \
38260998 317 $(bindir)/qemu-system-mipsel \
fbe4f65b
TS
318 $(bindir)/qemu-system-mips64 \
319 $(bindir)/qemu-system-mips64el \
ea31eb5b 320 $(bindir)/qemu-system-arm \
ff1aaf65
TS
321 $(bindir)/qemu-system-m68k \
322 $(bindir)/qemu-system-sh4 \
85ffbdfc 323 $(bindir)/qemu-system-sh4eb \
f0403c03 324 $(bindir)/qemu-system-cris \
7efa4387 325 $(bindir)/qemu-i386 \
f0403c03 326 $(bindir)/qemu-x86_64 \
7efa4387 327 $(bindir)/qemu-arm \
ea31eb5b 328 $(bindir)/qemu-armeb \
7efa4387 329 $(bindir)/qemu-sparc \
f0403c03
FB
330 $(bindir)/qemu-sparc32plus \
331 $(bindir)/qemu-sparc64 \
7efa4387 332 $(bindir)/qemu-ppc \
d4082e95 333 $(bindir)/qemu-ppc64 \
f0403c03 334 $(bindir)/qemu-ppc64abi32 \
ea31eb5b
FB
335 $(bindir)/qemu-mips \
336 $(bindir)/qemu-mipsel \
cf6c1b16 337 $(bindir)/qemu-alpha \
ff1aaf65
TS
338 $(bindir)/qemu-m68k \
339 $(bindir)/qemu-sh4 \
85ffbdfc 340 $(bindir)/qemu-sh4eb \
f0403c03 341 $(bindir)/qemu-cris \
b932caba 342 $(bindir)/qemu-img \
7a5ca864 343 $(bindir)/qemu-nbd \
7efa4387
FB
344 $(datadir)/bios.bin \
345 $(datadir)/vgabios.bin \
de9258a8 346 $(datadir)/vgabios-cirrus.bin \
637f6cd7 347 $(datadir)/ppc_rom.bin \
d5295253 348 $(datadir)/video.x \
0986ac3b 349 $(datadir)/openbios-sparc32 \
938255d2 350 $(datadir)/openbios-sparc64 \
19c80e50
FB
351 $(datadir)/pxe-ne2k_pci.bin \
352 $(datadir)/pxe-rtl8139.bin \
353 $(datadir)/pxe-pcnet.bin \
2991990b 354 $(datadir)/pxe-e1000.bin \
1f50f8d1
FB
355 $(docdir)/qemu-doc.html \
356 $(docdir)/qemu-tech.html \
18be8d77 357 $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1
7a5ca864 358 $(mandir)/man8/qemu-nbd.8
d691f669 359
4fb240a4
FB
360# Include automatically generated dependency files
361-include $(wildcard *.d audio/*.d slirp/*.d)