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