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