Statistics
| Branch: | Revision:

root / Makefile @ 03acab66

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