Statistics
| Branch: | Revision:

root / Makefile @ da0b0df8

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