Statistics
| Branch: | Revision:

root / Makefile @ b94ec3ec

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