Statistics
| Branch: | Revision:

root / Makefile @ 18be8d77

History | View | Annotate | Download (8 kB)

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