Statistics
| Branch: | Revision:

root / Makefile @ faf07963

History | View | Annotate | Download (7.2 kB)

1
# Makefile for QEMU.
2

    
3
include config-host.mak
4

    
5
.PHONY: all clean distclean dvi info install install-doc tar tarbin \
6
	speed test test2 html dvi info
7

    
8
BASE_CFLAGS=
9
BASE_LDFLAGS=
10

    
11
BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
12
BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
13

    
14
CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP
15
CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
16
LIBS=
17
ifdef CONFIG_STATIC
18
BASE_LDFLAGS += -static
19
endif
20
ifdef BUILD_DOCS
21
DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
22
else
23
DOCS=
24
endif
25

    
26
LIBS+=$(AIOLIBS)
27

    
28
all: $(TOOLS) $(DOCS) recurse-all 
29

    
30
subdir-%: dyngen$(EXESUF) libqemu_common.a
31
	$(MAKE) -C $(subst subdir-,,$@) all
32

    
33
recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
34

    
35
#######################################################################
36
# BLOCK_OBJS is code used by both qemu system emulation and qemu-img
37

    
38
BLOCK_OBJS=cutils.o
39
BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
40
BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
41
BLOCK_OBJS+=block-qcow2.o block-parallels.o
42

    
43
######################################################################
44
# libqemu_common.a: Target indepedent part of system emulation. The
45
# long term path is to suppress *all* target specific code in case of
46
# system emulation, i.e. a single QEMU executable should support all
47
# CPUs and machines.
48

    
49
OBJS=$(BLOCK_OBJS)
50
OBJS+=readline.o console.o 
51
OBJS+=block.o
52

    
53
ifdef CONFIG_WIN32
54
OBJS+=tap-win32.o
55
endif
56

    
57
AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
58
ifdef CONFIG_SDL
59
AUDIO_OBJS += sdlaudio.o
60
endif
61
ifdef CONFIG_OSS
62
AUDIO_OBJS += ossaudio.o
63
endif
64
ifdef CONFIG_COREAUDIO
65
AUDIO_OBJS += coreaudio.o
66
endif
67
ifdef CONFIG_ALSA
68
AUDIO_OBJS += alsaaudio.o
69
endif
70
ifdef CONFIG_DSOUND
71
AUDIO_OBJS += dsoundaudio.o
72
endif
73
ifdef CONFIG_FMOD
74
AUDIO_OBJS += fmodaudio.o
75
audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
76
endif
77
AUDIO_OBJS+= wavcapture.o
78
OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
79

    
80
ifdef CONFIG_SDL
81
OBJS+=sdl.o x_keymap.o
82
endif
83
OBJS+=vnc.o d3des.o
84

    
85
ifdef CONFIG_COCOA
86
OBJS+=cocoa.o
87
endif
88

    
89
ifdef CONFIG_SLIRP
90
CPPFLAGS+=-I$(SRC_PATH)/slirp
91
SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
92
slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
93
tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
94
OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
95
endif
96

    
97
cocoa.o: cocoa.m
98
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
99

    
100
sdl.o: sdl.c keymaps.c sdl_keysym.h
101
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
102

    
103
vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
104
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
105

    
106
audio/sdlaudio.o: audio/sdlaudio.c
107
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
108

    
109
libqemu_common.a: $(OBJS)
110
	rm -f $@ 
111
	$(AR) rcs $@ $(OBJS)
112

    
113
######################################################################
114

    
115
qemu-img$(EXESUF): qemu-img.o qemu-img-block.o qemu-img-block-raw.o $(BLOCK_OBJS)
116
	$(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
117

    
118
qemu-img-%.o: %.c
119
	$(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG $(BASE_CFLAGS) -c -o $@ $<
120

    
121
%.o: %.c
122
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
123

    
124
# dyngen host tool
125
dyngen$(EXESUF): dyngen.c
126
	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
127

    
128
clean:
129
# avoid old build problems by removing potentially incorrect old files
130
	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
	rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~
132
	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
133
	$(MAKE) -C tests clean
134
	for d in $(TARGET_DIRS); do \
135
	$(MAKE) -C $$d $@ || exit 1 ; \
136
        done
137

    
138
distclean: clean
139
	rm -f config-host.mak config-host.h $(DOCS)
140
	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
141
	for d in $(TARGET_DIRS); do \
142
	rm -rf $$d || exit 1 ; \
143
        done
144

    
145
KEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
146
ar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
147
common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
148

    
149
install-doc: $(DOCS)
150
	mkdir -p "$(DESTDIR)$(docdir)"
151
	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
152
ifndef CONFIG_WIN32
153
	mkdir -p "$(DESTDIR)$(mandir)/man1"
154
	$(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
155
endif
156

    
157
install: all $(if $(BUILD_DOCS),install-doc)
158
	mkdir -p "$(DESTDIR)$(bindir)"
159
ifneq ($(TOOLS),)
160
	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
161
endif
162
	mkdir -p "$(DESTDIR)$(datadir)"
163
	for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
164
		video.x openbios-sparc32 pxe-ne2k_pci.bin \
165
		pxe-rtl8139.bin pxe-pcnet.bin; do \
166
		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
167
	done
168
ifndef CONFIG_WIN32
169
	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
170
	for x in $(KEYMAPS); do \
171
		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
172
	done
173
endif
174
	for d in $(TARGET_DIRS); do \
175
	$(MAKE) -C $$d $@ || exit 1 ; \
176
        done
177

    
178
# various test targets
179
test speed test2: all
180
	$(MAKE) -C tests $@
181

    
182
TAGS:
183
	etags *.[ch] tests/*.[ch]
184

    
185
cscope:
186
	rm -f ./cscope.*
187
	find . -name "*.[ch]" -print > ./cscope.files
188
	cscope -b
189

    
190
# documentation
191
%.html: %.texi
192
	texi2html -monolithic -number $<
193

    
194
%.info: %.texi
195
	makeinfo $< -o $@
196

    
197
%.dvi: %.texi
198
	texi2dvi $<
199

    
200
qemu.1: qemu-doc.texi
201
	$(SRC_PATH)/texi2pod.pl $< qemu.pod
202
	pod2man --section=1 --center=" " --release=" " qemu.pod > $@
203

    
204
qemu-img.1: qemu-img.texi
205
	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
206
	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
207

    
208
info: qemu-doc.info qemu-tech.info
209

    
210
dvi: qemu-doc.dvi qemu-tech.dvi
211

    
212
html: qemu-doc.html qemu-tech.html
213

    
214
VERSION ?= $(shell cat VERSION)
215
FILE = qemu-$(VERSION)
216

    
217
# tar release (use 'make -k tar' on a checkouted tree)
218
tar:
219
	rm -rf /tmp/$(FILE)
220
	cp -r . /tmp/$(FILE)
221
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
222
	rm -rf /tmp/$(FILE)
223

    
224
# generate a binary distribution
225
tarbin:
226
	( cd / ; tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
227
	$(bindir)/qemu \
228
	$(bindir)/qemu-system-ppc \
229
	$(bindir)/qemu-system-ppc64 \
230
	$(bindir)/qemu-system-ppcemb \
231
	$(bindir)/qemu-system-sparc \
232
	$(bindir)/qemu-system-x86_64 \
233
	$(bindir)/qemu-system-mips \
234
	$(bindir)/qemu-system-mipsel \
235
	$(bindir)/qemu-system-mips64 \
236
	$(bindir)/qemu-system-mips64el \
237
	$(bindir)/qemu-system-arm \
238
	$(bindir)/qemu-system-m68k \
239
	$(bindir)/qemu-system-sh4 \
240
	$(bindir)/qemu-i386 \
241
        $(bindir)/qemu-arm \
242
        $(bindir)/qemu-armeb \
243
        $(bindir)/qemu-sparc \
244
        $(bindir)/qemu-ppc \
245
        $(bindir)/qemu-ppc64 \
246
        $(bindir)/qemu-mips \
247
        $(bindir)/qemu-mipsel \
248
        $(bindir)/qemu-mipsn32 \
249
        $(bindir)/qemu-mipsn32el \
250
        $(bindir)/qemu-mips64 \
251
        $(bindir)/qemu-mips64el \
252
        $(bindir)/qemu-alpha \
253
        $(bindir)/qemu-m68k \
254
        $(bindir)/qemu-sh4 \
255
        $(bindir)/qemu-img \
256
	$(datadir)/bios.bin \
257
	$(datadir)/vgabios.bin \
258
	$(datadir)/vgabios-cirrus.bin \
259
	$(datadir)/ppc_rom.bin \
260
	$(datadir)/video.x \
261
	$(datadir)/openbios-sparc32 \
262
        $(datadir)/pxe-ne2k_pci.bin \
263
	$(datadir)/pxe-rtl8139.bin \
264
        $(datadir)/pxe-pcnet.bin \
265
	$(docdir)/qemu-doc.html \
266
	$(docdir)/qemu-tech.html \
267
	$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
268

    
269
ifneq ($(wildcard .depend),)
270
include .depend
271
endif
272

    
273
# Include automatically generated dependency files
274
-include $(wildcard *.d audio/*.d slirp/*.d)