Statistics
| Branch: | Revision:

root / Makefile @ 8c462f8f

History | View | Annotate | Download (7.5 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 87ecb68b pbrook
OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o
60 87ecb68b pbrook
61 4fb240a4 bellard
ifdef CONFIG_WIN32
62 4fb240a4 bellard
OBJS+=tap-win32.o
63 4fb240a4 bellard
endif
64 4fb240a4 bellard
65 4fb240a4 bellard
AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
66 4fb240a4 bellard
ifdef CONFIG_SDL
67 4fb240a4 bellard
AUDIO_OBJS += sdlaudio.o
68 4fb240a4 bellard
endif
69 4fb240a4 bellard
ifdef CONFIG_OSS
70 4fb240a4 bellard
AUDIO_OBJS += ossaudio.o
71 4fb240a4 bellard
endif
72 4fb240a4 bellard
ifdef CONFIG_COREAUDIO
73 4fb240a4 bellard
AUDIO_OBJS += coreaudio.o
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 4fb240a4 bellard
AUDIO_OBJS+= wavcapture.o
86 4fb240a4 bellard
OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
87 4fb240a4 bellard
88 4fb240a4 bellard
ifdef CONFIG_SDL
89 4fb240a4 bellard
OBJS+=sdl.o x_keymap.o
90 4fb240a4 bellard
endif
91 4fb240a4 bellard
OBJS+=vnc.o d3des.o
92 4fb240a4 bellard
93 4fb240a4 bellard
ifdef CONFIG_COCOA
94 4fb240a4 bellard
OBJS+=cocoa.o
95 4fb240a4 bellard
endif
96 4fb240a4 bellard
97 4fb240a4 bellard
ifdef CONFIG_SLIRP
98 4fb240a4 bellard
CPPFLAGS+=-I$(SRC_PATH)/slirp
99 4fb240a4 bellard
SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
100 4fb240a4 bellard
slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
101 4fb240a4 bellard
tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
102 4fb240a4 bellard
OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
103 4fb240a4 bellard
endif
104 4fb240a4 bellard
105 4fb240a4 bellard
cocoa.o: cocoa.m
106 4fb240a4 bellard
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
107 4fb240a4 bellard
108 4fb240a4 bellard
sdl.o: sdl.c keymaps.c sdl_keysym.h
109 4fb240a4 bellard
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
110 4fb240a4 bellard
111 4fb240a4 bellard
vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
112 4fb240a4 bellard
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
113 4fb240a4 bellard
114 4fb240a4 bellard
audio/sdlaudio.o: audio/sdlaudio.c
115 4fb240a4 bellard
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
116 4fb240a4 bellard
117 4fb240a4 bellard
libqemu_common.a: $(OBJS)
118 4fb240a4 bellard
	rm -f $@ 
119 4fb240a4 bellard
	$(AR) rcs $@ $(OBJS)
120 4fb240a4 bellard
121 4fb240a4 bellard
######################################################################
122 4fb240a4 bellard
123 faf07963 pbrook
qemu-img$(EXESUF): qemu-img.o qemu-img-block.o qemu-img-block-raw.o $(BLOCK_OBJS)
124 4fb240a4 bellard
	$(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
125 4fb240a4 bellard
126 faf07963 pbrook
qemu-img-%.o: %.c
127 faf07963 pbrook
	$(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG $(BASE_CFLAGS) -c -o $@ $<
128 faf07963 pbrook
129 4fb240a4 bellard
%.o: %.c
130 4fb240a4 bellard
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
131 4fb240a4 bellard
132 4fb240a4 bellard
# dyngen host tool
133 11d9f695 bellard
dyngen$(EXESUF): dyngen.c
134 6f30fa85 ths
	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
135 31e31b8a bellard
136 31e31b8a bellard
clean:
137 2d80ae89 bellard
# avoid old build problems by removing potentially incorrect old files
138 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
139 4fb240a4 bellard
	rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~
140 4fb240a4 bellard
	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
141 7d3505c5 bellard
	$(MAKE) -C tests clean
142 626df76a bellard
	for d in $(TARGET_DIRS); do \
143 7d3505c5 bellard
	$(MAKE) -C $$d $@ || exit 1 ; \
144 626df76a bellard
        done
145 31e31b8a bellard
146 7d13299d bellard
distclean: clean
147 cc8ae6de pbrook
	rm -f config-host.mak config-host.h $(DOCS)
148 0cb3fb1e pbrook
	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
149 76bc6838 bellard
	for d in $(TARGET_DIRS); do \
150 bc1b050d bellard
	rm -rf $$d || exit 1 ; \
151 76bc6838 bellard
        done
152 7d13299d bellard
153 fed4a9ad bellard
KEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
154 fed4a9ad bellard
ar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
155 fed4a9ad bellard
common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
156 fed4a9ad bellard
157 38954dca pbrook
install-doc: $(DOCS)
158 38954dca pbrook
	mkdir -p "$(DESTDIR)$(docdir)"
159 38954dca pbrook
	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
160 38954dca pbrook
ifndef CONFIG_WIN32
161 38954dca pbrook
	mkdir -p "$(DESTDIR)$(mandir)/man1"
162 38954dca pbrook
	$(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
163 38954dca pbrook
endif
164 38954dca pbrook
165 38954dca pbrook
install: all $(if $(BUILD_DOCS),install-doc)
166 1236cab7 pbrook
	mkdir -p "$(DESTDIR)$(bindir)"
167 932a79df ths
ifneq ($(TOOLS),)
168 6a882643 pbrook
	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
169 932a79df ths
endif
170 1236cab7 pbrook
	mkdir -p "$(DESTDIR)$(datadir)"
171 ad064840 pbrook
	for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
172 860c6c52 ths
		video.x openbios-sparc32 pxe-ne2k_pci.bin \
173 eec85c2a ths
		pxe-rtl8139.bin pxe-pcnet.bin; do \
174 6a882643 pbrook
		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
175 ad064840 pbrook
	done
176 11d9f695 bellard
ifndef CONFIG_WIN32
177 1236cab7 pbrook
	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
178 ad064840 pbrook
	for x in $(KEYMAPS); do \
179 6a882643 pbrook
		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
180 ad064840 pbrook
	done
181 11d9f695 bellard
endif
182 626df76a bellard
	for d in $(TARGET_DIRS); do \
183 7d3505c5 bellard
	$(MAKE) -C $$d $@ || exit 1 ; \
184 626df76a bellard
        done
185 612384d7 bellard
186 367e86e8 bellard
# various test targets
187 9b0b8203 bellard
test speed: all
188 7d3505c5 bellard
	$(MAKE) -C tests $@
189 31e31b8a bellard
190 5fafdf24 ths
TAGS:
191 b9adb4a6 bellard
	etags *.[ch] tests/*.[ch]
192 31e31b8a bellard
193 6688bc6d bellard
cscope:
194 6688bc6d bellard
	rm -f ./cscope.*
195 6688bc6d bellard
	find . -name "*.[ch]" -print > ./cscope.files
196 6688bc6d bellard
	cscope -b
197 6688bc6d bellard
198 3ef693a0 bellard
# documentation
199 1f673135 bellard
%.html: %.texi
200 3ef693a0 bellard
	texi2html -monolithic -number $<
201 3ef693a0 bellard
202 f3548328 bellard
%.info: %.texi
203 f3548328 bellard
	makeinfo $< -o $@
204 f3548328 bellard
205 f3548328 bellard
%.dvi: %.texi
206 f3548328 bellard
	texi2dvi $<
207 f3548328 bellard
208 5a67135a bellard
qemu.1: qemu-doc.texi
209 ad064840 pbrook
	$(SRC_PATH)/texi2pod.pl $< qemu.pod
210 5a67135a bellard
	pod2man --section=1 --center=" " --release=" " qemu.pod > $@
211 5a67135a bellard
212 acd935ef bellard
qemu-img.1: qemu-img.texi
213 ad064840 pbrook
	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
214 acd935ef bellard
	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
215 acd935ef bellard
216 0cb3fb1e pbrook
info: qemu-doc.info qemu-tech.info
217 0cb3fb1e pbrook
218 0cb3fb1e pbrook
dvi: qemu-doc.dvi qemu-tech.dvi
219 0cb3fb1e pbrook
220 0cb3fb1e pbrook
html: qemu-doc.html qemu-tech.html
221 0cb3fb1e pbrook
222 df5cf721 ths
VERSION ?= $(shell cat VERSION)
223 df5cf721 ths
FILE = qemu-$(VERSION)
224 586314f2 bellard
225 1e43adfc bellard
# tar release (use 'make -k tar' on a checkouted tree)
226 586314f2 bellard
tar:
227 586314f2 bellard
	rm -rf /tmp/$(FILE)
228 1e43adfc bellard
	cp -r . /tmp/$(FILE)
229 76b62fd0 bellard
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
230 586314f2 bellard
	rm -rf /tmp/$(FILE)
231 586314f2 bellard
232 76b62fd0 bellard
# generate a binary distribution
233 d691f669 bellard
tarbin:
234 4887d78b ths
	( cd / ; tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
235 43095f31 bellard
	$(bindir)/qemu \
236 7efa4387 bellard
	$(bindir)/qemu-system-ppc \
237 d4082e95 j_mayer
	$(bindir)/qemu-system-ppc64 \
238 d4082e95 j_mayer
	$(bindir)/qemu-system-ppcemb \
239 acd935ef bellard
	$(bindir)/qemu-system-sparc \
240 43095f31 bellard
	$(bindir)/qemu-system-x86_64 \
241 93856aac bellard
	$(bindir)/qemu-system-mips \
242 38260998 pbrook
	$(bindir)/qemu-system-mipsel \
243 fbe4f65b ths
	$(bindir)/qemu-system-mips64 \
244 fbe4f65b ths
	$(bindir)/qemu-system-mips64el \
245 ea31eb5b bellard
	$(bindir)/qemu-system-arm \
246 ff1aaf65 ths
	$(bindir)/qemu-system-m68k \
247 ff1aaf65 ths
	$(bindir)/qemu-system-sh4 \
248 7efa4387 bellard
	$(bindir)/qemu-i386 \
249 7efa4387 bellard
        $(bindir)/qemu-arm \
250 ea31eb5b bellard
        $(bindir)/qemu-armeb \
251 7efa4387 bellard
        $(bindir)/qemu-sparc \
252 7efa4387 bellard
        $(bindir)/qemu-ppc \
253 d4082e95 j_mayer
        $(bindir)/qemu-ppc64 \
254 ea31eb5b bellard
        $(bindir)/qemu-mips \
255 ea31eb5b bellard
        $(bindir)/qemu-mipsel \
256 540635ba ths
        $(bindir)/qemu-mipsn32 \
257 540635ba ths
        $(bindir)/qemu-mipsn32el \
258 540635ba ths
        $(bindir)/qemu-mips64 \
259 540635ba ths
        $(bindir)/qemu-mips64el \
260 cf6c1b16 j_mayer
        $(bindir)/qemu-alpha \
261 ff1aaf65 ths
        $(bindir)/qemu-m68k \
262 ff1aaf65 ths
        $(bindir)/qemu-sh4 \
263 b932caba bellard
        $(bindir)/qemu-img \
264 7efa4387 bellard
	$(datadir)/bios.bin \
265 7efa4387 bellard
	$(datadir)/vgabios.bin \
266 de9258a8 bellard
	$(datadir)/vgabios-cirrus.bin \
267 637f6cd7 bellard
	$(datadir)/ppc_rom.bin \
268 d5295253 bellard
	$(datadir)/video.x \
269 0986ac3b bellard
	$(datadir)/openbios-sparc32 \
270 19c80e50 bellard
        $(datadir)/pxe-ne2k_pci.bin \
271 19c80e50 bellard
	$(datadir)/pxe-rtl8139.bin \
272 19c80e50 bellard
        $(datadir)/pxe-pcnet.bin \
273 1f50f8d1 bellard
	$(docdir)/qemu-doc.html \
274 1f50f8d1 bellard
	$(docdir)/qemu-tech.html \
275 acd935ef bellard
	$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
276 d691f669 bellard
277 31e31b8a bellard
ifneq ($(wildcard .depend),)
278 31e31b8a bellard
include .depend
279 31e31b8a bellard
endif
280 4fb240a4 bellard
281 4fb240a4 bellard
# Include automatically generated dependency files
282 4fb240a4 bellard
-include $(wildcard *.d audio/*.d slirp/*.d)