]> git.proxmox.com Git - mirror_qemu.git/blame - Makefile
added lock_user() in target_strlen()
[mirror_qemu.git] / Makefile
CommitLineData
0cb3fb1e
PB
1# Makefile for QEMU.
2
ad064840 3include config-host.mak
766a487a 4
0cb3fb1e
PB
5.PHONY: all clean distclean dvi info install install-doc tar tarbin \
6 speed test test2 html dvi info
7
6f30fa85
TS
8BASE_CFLAGS=
9BASE_LDFLAGS=
10
3142255c
BS
11BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
12BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
13
4fb240a4
FB
14CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP
15CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
766a487a 16LIBS=
1f50f8d1 17ifdef CONFIG_STATIC
6f30fa85 18BASE_LDFLAGS += -static
1f50f8d1 19endif
cc8ae6de 20ifdef BUILD_DOCS
acd935ef 21DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
cc8ae6de
PB
22else
23DOCS=
24endif
aa05ae6f 25
70956b77 26LIBS+=$(AIOLIBS)
83f64091 27
da0b0df8 28all: $(TOOLS) $(DOCS) recurse-all
b9dea4fb 29
da0b0df8 30subdir-%: dyngen$(EXESUF) libqemu_common.a
4aa42531
PB
31 $(MAKE) -C $(subst subdir-,,$@) all
32
33recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
83f64091 34
faf07963
PB
35#######################################################################
36# BLOCK_OBJS is code used by both qemu system emulation and qemu-img
37
38BLOCK_OBJS=cutils.o
39BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
40BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
41BLOCK_OBJS+=block-qcow2.o block-parallels.o
42
4fb240a4 43######################################################################
faf07963 44# libqemu_common.a: Target indepedent part of system emulation. The
4fb240a4
FB
45# long term path is to suppress *all* target specific code in case of
46# system emulation, i.e. a single QEMU executable should support all
47# CPUs and machines.
47cea614 48
faf07963
PB
49OBJS=$(BLOCK_OBJS)
50OBJS+=readline.o console.o
51OBJS+=block.o
4fb240a4
FB
52
53ifdef CONFIG_WIN32
54OBJS+=tap-win32.o
55endif
56
57AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
58ifdef CONFIG_SDL
59AUDIO_OBJS += sdlaudio.o
60endif
61ifdef CONFIG_OSS
62AUDIO_OBJS += ossaudio.o
63endif
64ifdef CONFIG_COREAUDIO
65AUDIO_OBJS += coreaudio.o
66endif
67ifdef CONFIG_ALSA
68AUDIO_OBJS += alsaaudio.o
69endif
70ifdef CONFIG_DSOUND
71AUDIO_OBJS += dsoundaudio.o
72endif
73ifdef CONFIG_FMOD
74AUDIO_OBJS += fmodaudio.o
75audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
76endif
77AUDIO_OBJS+= wavcapture.o
78OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
79
80ifdef CONFIG_SDL
81OBJS+=sdl.o x_keymap.o
82endif
83OBJS+=vnc.o d3des.o
84
85ifdef CONFIG_COCOA
86OBJS+=cocoa.o
87endif
88
89ifdef CONFIG_SLIRP
90CPPFLAGS+=-I$(SRC_PATH)/slirp
91SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
92slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
93tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
94OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
95endif
96
97cocoa.o: cocoa.m
98 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
99
100sdl.o: sdl.c keymaps.c sdl_keysym.h
101 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
102
103vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
104 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
105
106audio/sdlaudio.o: audio/sdlaudio.c
107 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
108
109libqemu_common.a: $(OBJS)
110 rm -f $@
111 $(AR) rcs $@ $(OBJS)
112
113######################################################################
114
faf07963 115qemu-img$(EXESUF): qemu-img.o qemu-img-block.o qemu-img-block-raw.o $(BLOCK_OBJS)
4fb240a4
FB
116 $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
117
faf07963
PB
118qemu-img-%.o: %.c
119 $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG $(BASE_CFLAGS) -c -o $@ $<
120
4fb240a4
FB
121%.o: %.c
122 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
123
124# dyngen host tool
11d9f695 125dyngen$(EXESUF): dyngen.c
6f30fa85 126 $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
31e31b8a
FB
127
128clean:
2d80ae89 129# avoid old build problems by removing potentially incorrect old files
5fafdf24 130 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
FB
131 rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~
132 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
7d3505c5 133 $(MAKE) -C tests clean
626df76a 134 for d in $(TARGET_DIRS); do \
7d3505c5 135 $(MAKE) -C $$d $@ || exit 1 ; \
626df76a 136 done
31e31b8a 137
7d13299d 138distclean: clean
cc8ae6de 139 rm -f config-host.mak config-host.h $(DOCS)
0cb3fb1e 140 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
76bc6838 141 for d in $(TARGET_DIRS); do \
bc1b050d 142 rm -rf $$d || exit 1 ; \
76bc6838 143 done
7d13299d 144
fed4a9ad
FB
145KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
146ar de en-us fi fr-be hr it lv nl pl ru th \
147common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
148
38954dca
PB
149install-doc: $(DOCS)
150 mkdir -p "$(DESTDIR)$(docdir)"
151 $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
152ifndef CONFIG_WIN32
153 mkdir -p "$(DESTDIR)$(mandir)/man1"
154 $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
155endif
156
157install: all $(if $(BUILD_DOCS),install-doc)
1236cab7 158 mkdir -p "$(DESTDIR)$(bindir)"
932a79df 159ifneq ($(TOOLS),)
6a882643 160 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
932a79df 161endif
1236cab7 162 mkdir -p "$(DESTDIR)$(datadir)"
ad064840 163 for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
860c6c52 164 video.x openbios-sparc32 pxe-ne2k_pci.bin \
eec85c2a 165 pxe-rtl8139.bin pxe-pcnet.bin; do \
6a882643 166 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
ad064840 167 done
11d9f695 168ifndef CONFIG_WIN32
1236cab7 169 mkdir -p "$(DESTDIR)$(datadir)/keymaps"
ad064840 170 for x in $(KEYMAPS); do \
6a882643 171 $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
ad064840 172 done
11d9f695 173endif
626df76a 174 for d in $(TARGET_DIRS); do \
7d3505c5 175 $(MAKE) -C $$d $@ || exit 1 ; \
626df76a 176 done
612384d7 177
367e86e8 178# various test targets
82c7e2a4 179test speed test2: all
7d3505c5 180 $(MAKE) -C tests $@
31e31b8a 181
5fafdf24 182TAGS:
b9adb4a6 183 etags *.[ch] tests/*.[ch]
31e31b8a 184
6688bc6d
FB
185cscope:
186 rm -f ./cscope.*
187 find . -name "*.[ch]" -print > ./cscope.files
188 cscope -b
189
3ef693a0 190# documentation
1f673135 191%.html: %.texi
3ef693a0
FB
192 texi2html -monolithic -number $<
193
f3548328
FB
194%.info: %.texi
195 makeinfo $< -o $@
196
197%.dvi: %.texi
198 texi2dvi $<
199
5a67135a 200qemu.1: qemu-doc.texi
ad064840 201 $(SRC_PATH)/texi2pod.pl $< qemu.pod
5a67135a
FB
202 pod2man --section=1 --center=" " --release=" " qemu.pod > $@
203
acd935ef 204qemu-img.1: qemu-img.texi
ad064840 205 $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
acd935ef
FB
206 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
207
0cb3fb1e
PB
208info: qemu-doc.info qemu-tech.info
209
210dvi: qemu-doc.dvi qemu-tech.dvi
211
212html: qemu-doc.html qemu-tech.html
213
df5cf721
TS
214VERSION ?= $(shell cat VERSION)
215FILE = qemu-$(VERSION)
586314f2 216
1e43adfc 217# tar release (use 'make -k tar' on a checkouted tree)
586314f2
FB
218tar:
219 rm -rf /tmp/$(FILE)
1e43adfc 220 cp -r . /tmp/$(FILE)
76b62fd0 221 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
586314f2
FB
222 rm -rf /tmp/$(FILE)
223
76b62fd0 224# generate a binary distribution
d691f669 225tarbin:
4887d78b 226 ( cd / ; tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
43095f31 227 $(bindir)/qemu \
7efa4387 228 $(bindir)/qemu-system-ppc \
d4082e95
JM
229 $(bindir)/qemu-system-ppc64 \
230 $(bindir)/qemu-system-ppcemb \
acd935ef 231 $(bindir)/qemu-system-sparc \
43095f31 232 $(bindir)/qemu-system-x86_64 \
93856aac 233 $(bindir)/qemu-system-mips \
38260998 234 $(bindir)/qemu-system-mipsel \
fbe4f65b
TS
235 $(bindir)/qemu-system-mips64 \
236 $(bindir)/qemu-system-mips64el \
ea31eb5b 237 $(bindir)/qemu-system-arm \
ff1aaf65
TS
238 $(bindir)/qemu-system-m68k \
239 $(bindir)/qemu-system-sh4 \
7efa4387
FB
240 $(bindir)/qemu-i386 \
241 $(bindir)/qemu-arm \
ea31eb5b 242 $(bindir)/qemu-armeb \
7efa4387
FB
243 $(bindir)/qemu-sparc \
244 $(bindir)/qemu-ppc \
d4082e95 245 $(bindir)/qemu-ppc64 \
ea31eb5b
FB
246 $(bindir)/qemu-mips \
247 $(bindir)/qemu-mipsel \
540635ba
TS
248 $(bindir)/qemu-mipsn32 \
249 $(bindir)/qemu-mipsn32el \
250 $(bindir)/qemu-mips64 \
251 $(bindir)/qemu-mips64el \
cf6c1b16 252 $(bindir)/qemu-alpha \
ff1aaf65
TS
253 $(bindir)/qemu-m68k \
254 $(bindir)/qemu-sh4 \
b932caba 255 $(bindir)/qemu-img \
7efa4387
FB
256 $(datadir)/bios.bin \
257 $(datadir)/vgabios.bin \
de9258a8 258 $(datadir)/vgabios-cirrus.bin \
637f6cd7 259 $(datadir)/ppc_rom.bin \
d5295253 260 $(datadir)/video.x \
0986ac3b 261 $(datadir)/openbios-sparc32 \
19c80e50
FB
262 $(datadir)/pxe-ne2k_pci.bin \
263 $(datadir)/pxe-rtl8139.bin \
264 $(datadir)/pxe-pcnet.bin \
1f50f8d1
FB
265 $(docdir)/qemu-doc.html \
266 $(docdir)/qemu-tech.html \
acd935ef 267 $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
d691f669 268
31e31b8a
FB
269ifneq ($(wildcard .depend),)
270include .depend
271endif
4fb240a4
FB
272
273# Include automatically generated dependency files
274-include $(wildcard *.d audio/*.d slirp/*.d)