Statistics
| Branch: | Revision:

root / Makefile @ 58f8aead

History | View | Annotate | Download (10.3 kB)

1
# Makefile for QEMU.
2

    
3
ifneq ($(wildcard config-host.mak),)
4
include config-host.mak
5
include $(SRC_PATH)/rules.mak
6
else
7
config-host.mak:
8
	@echo "Please call configure before running make!"
9
	@exit 1
10
endif
11

    
12
.PHONY: all clean cscope distclean dvi html info install install-doc \
13
	recurse-all speed tar tarbin test
14

    
15
VPATH=$(SRC_PATH):$(SRC_PATH)/hw
16

    
17

    
18
CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
19
LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
20

    
21
CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
22
CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
23
LIBS=
24
ifdef CONFIG_STATIC
25
LDFLAGS += -static
26
endif
27
ifdef BUILD_DOCS
28
DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
29
else
30
DOCS=
31
endif
32

    
33
LIBS+=$(AIOLIBS)
34

    
35
ifdef CONFIG_SOLARIS
36
LIBS+=-lsocket -lnsl -lresolv
37
endif
38

    
39
ifdef CONFIG_WIN32
40
LIBS+=-lwinmm -lws2_32 -liphlpapi
41
endif
42

    
43
all: $(TOOLS) $(DOCS) recurse-all
44

    
45
config-host.mak: configure
46
ifneq ($(wildcard config-host.mak),)
47
	@echo $@ is out-of-date, running configure
48
	@sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
49
endif
50

    
51
SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
52

    
53
subdir-%:
54
	$(call quiet-command,$(MAKE) -C $* V="$(V)" TARGET_DIR="$*/" all,)
55

    
56
$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
57
$(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
58

    
59
recurse-all: $(SUBDIR_RULES)
60

    
61
#######################################################################
62
# BLOCK_OBJS is code used by both qemu system emulation and qemu-img
63

    
64
BLOCK_OBJS=cutils.o qemu-malloc.o
65
BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
66
BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
67
BLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o
68
BLOCK_OBJS+=nbd.o block.o aio.o
69

    
70
ifdef CONFIG_WIN32
71
BLOCK_OBJS += block-raw-win32.o
72
else
73
ifdef CONFIG_AIO
74
BLOCK_OBJS += posix-aio-compat.o
75
endif
76
BLOCK_OBJS += block-raw-posix.o
77
endif
78

    
79
######################################################################
80
# libqemu_common.a: Target independent part of system emulation. The
81
# long term path is to suppress *all* target specific code in case of
82
# system emulation, i.e. a single QEMU executable should support all
83
# CPUs and machines.
84

    
85
OBJS=$(BLOCK_OBJS)
86
OBJS+=readline.o console.o
87

    
88
OBJS+=irq.o ptimer.o
89
OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
90
OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
91
OBJS+=tmp105.o lm832x.o eeprom93xx.o tsc2005.o
92
OBJS+=scsi-disk.o cdrom.o
93
OBJS+=scsi-generic.o
94
OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
95
OBJS+=usb-serial.o usb-net.o
96
OBJS+=sd.o ssi-sd.o
97
OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
98
OBJS+=bt-hci-csr.o
99
OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
100
OBJS+=qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o
101
OBJS+=msmouse.o ps2.o
102

    
103
ifdef CONFIG_BRLAPI
104
OBJS+= baum.o
105
LIBS+=-lbrlapi
106
endif
107

    
108
ifdef CONFIG_WIN32
109
OBJS+=tap-win32.o
110
else
111
OBJS+=migration-exec.o
112
endif
113

    
114
AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
115
ifdef CONFIG_SDL
116
AUDIO_OBJS += sdlaudio.o
117
endif
118
ifdef CONFIG_OSS
119
AUDIO_OBJS += ossaudio.o
120
endif
121
ifdef CONFIG_COREAUDIO
122
AUDIO_OBJS += coreaudio.o
123
AUDIO_PT = yes
124
endif
125
ifdef CONFIG_ALSA
126
AUDIO_OBJS += alsaaudio.o
127
endif
128
ifdef CONFIG_DSOUND
129
AUDIO_OBJS += dsoundaudio.o
130
endif
131
ifdef CONFIG_FMOD
132
AUDIO_OBJS += fmodaudio.o
133
audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
134
endif
135
ifdef CONFIG_ESD
136
AUDIO_PT = yes
137
AUDIO_PT_INT = yes
138
AUDIO_OBJS += esdaudio.o
139
endif
140
ifdef CONFIG_PA
141
AUDIO_PT = yes
142
AUDIO_PT_INT = yes
143
AUDIO_OBJS += paaudio.o
144
endif
145
ifdef AUDIO_PT
146
LDFLAGS += -pthread
147
endif
148
ifdef AUDIO_PT_INT
149
AUDIO_OBJS += audio_pt_int.o
150
endif
151
AUDIO_OBJS+= wavcapture.o
152
OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
153

    
154
OBJS+=keymaps.o
155
ifdef CONFIG_SDL
156
OBJS+=sdl.o x_keymap.o
157
endif
158
ifdef CONFIG_CURSES
159
OBJS+=curses.o
160
endif
161
OBJS+=vnc.o acl.o d3des.o
162
ifdef CONFIG_VNC_TLS
163
OBJS+=vnc-tls.o vnc-auth-vencrypt.o
164
endif
165
ifdef CONFIG_VNC_SASL
166
OBJS+=vnc-auth-sasl.o
167
endif
168

    
169
ifdef CONFIG_COCOA
170
OBJS+=cocoa.o
171
endif
172

    
173
ifdef CONFIG_SLIRP
174
CPPFLAGS+=-I$(SRC_PATH)/slirp
175
SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
176
slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
177
tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
178
OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
179
endif
180

    
181
LIBS+=$(VDE_LIBS)
182

    
183
cocoa.o: cocoa.m
184

    
185
keymaps.o: keymaps.c keymaps.h
186

    
187
sdl.o: sdl.c keymaps.h sdl_keysym.h
188

    
189
sdl.o audio/sdlaudio.o: CFLAGS += $(SDL_CFLAGS)
190

    
191
acl.o: acl.h acl.c
192

    
193
vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
194

    
195
vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h
196

    
197
vnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
198

    
199
vnc-tls.o: vnc-tls.c vnc.h
200

    
201
vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h
202

    
203
vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h
204

    
205
curses.o: curses.c keymaps.h curses_keys.h
206

    
207
bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)
208

    
209
libqemu_common.a: $(OBJS)
210

    
211
#######################################################################
212
# USER_OBJS is code used by qemu userspace emulation
213
USER_OBJS=cutils.o  cache-utils.o
214

    
215
libqemu_user.a: $(USER_OBJS)
216

    
217
######################################################################
218

    
219
qemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS)
220

    
221
qemu-nbd$(EXESUF):  qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS)
222

    
223
qemu-io$(EXESUF):  qemu-io.o qemu-tool.o osdep.o cmd.o $(BLOCK_OBJS)
224

    
225
qemu-img$(EXESUF) qemu-nbd$(EXESUF) qemu-io$(EXESUF): LIBS += -lz
226

    
227
clean:
228
# avoid old build problems by removing potentially incorrect old files
229
	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
230
	rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
231
	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
232
	$(MAKE) -C tests clean
233
	for d in $(TARGET_DIRS); do \
234
	$(MAKE) -C $$d $@ || exit 1 ; \
235
        done
236

    
237
distclean: clean
238
	rm -f config-host.mak config-host.h $(DOCS) qemu-options.texi
239
	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
240
	for d in $(TARGET_DIRS); do \
241
	rm -rf $$d || exit 1 ; \
242
        done
243

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

    
248
ifdef INSTALL_BLOBS
249
BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
250
video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
251
pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
252
bamboo.dtb
253
else
254
BLOBS=
255
endif
256

    
257
install-doc: $(DOCS)
258
	$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
259
	$(INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
260
ifndef CONFIG_WIN32
261
	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
262
	$(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
263
	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
264
	$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
265
endif
266

    
267
install: all $(if $(BUILD_DOCS),install-doc)
268
	$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
269
ifneq ($(TOOLS),)
270
	$(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
271
endif
272
ifneq ($(BLOBS),)
273
	$(INSTALL_DIR) "$(DESTDIR)$(datadir)"
274
	set -e; for x in $(BLOBS); do \
275
		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
276
	done
277
endif
278
ifndef CONFIG_WIN32
279
	$(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
280
	set -e; for x in $(KEYMAPS); do \
281
		$(INSTALL_DATA) $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
282
	done
283
endif
284
	for d in $(TARGET_DIRS); do \
285
	$(MAKE) -C $$d $@ || exit 1 ; \
286
        done
287

    
288
# various test targets
289
test speed: all
290
	$(MAKE) -C tests $@
291

    
292
TAGS:
293
	etags *.[ch] tests/*.[ch]
294

    
295
cscope:
296
	rm -f ./cscope.*
297
	find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
298
	cscope -b
299

    
300
# documentation
301
%.html: %.texi
302
	$(call quiet-command,texi2html -I=. -monolithic -number $<,"  GEN   $@")
303

    
304
%.info: %.texi
305
	$(call quiet-command,makeinfo -I . $< -o $@,"  GEN   $@")
306

    
307
%.dvi: %.texi
308
	$(call quiet-command,texi2dvi -I . $<,"  GEN   $@")
309

    
310
qemu-options.texi: $(SRC_PATH)/qemu-options.hx
311
	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
312

    
313
qemu.1: qemu-doc.texi
314
	$(call quiet-command, \
315
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu.pod && \
316
	  pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
317
	  "  GEN   $@")
318

    
319
qemu-img.1: qemu-img.texi
320
	$(call quiet-command, \
321
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \
322
	  pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
323
	  "  GEN   $@")
324

    
325
qemu-nbd.8: qemu-nbd.texi
326
	$(call quiet-command, \
327
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \
328
	  pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
329
	  "  GEN   $@")
330

    
331
info: qemu-doc.info qemu-tech.info
332

    
333
dvi: qemu-doc.dvi qemu-tech.dvi
334

    
335
html: qemu-doc.html qemu-tech.html
336

    
337
qemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi qemu-options.texi
338

    
339
VERSION ?= $(shell cat VERSION)
340
FILE = qemu-$(VERSION)
341

    
342
# tar release (use 'make -k tar' on a checkouted tree)
343
tar:
344
	rm -rf /tmp/$(FILE)
345
	cp -r . /tmp/$(FILE)
346
	cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
347
	rm -rf /tmp/$(FILE)
348

    
349
# generate a binary distribution
350
tarbin:
351
	cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
352
	$(bindir)/qemu \
353
	$(bindir)/qemu-system-x86_64 \
354
	$(bindir)/qemu-system-arm \
355
	$(bindir)/qemu-system-cris \
356
	$(bindir)/qemu-system-m68k \
357
	$(bindir)/qemu-system-mips \
358
	$(bindir)/qemu-system-mipsel \
359
	$(bindir)/qemu-system-mips64 \
360
	$(bindir)/qemu-system-mips64el \
361
	$(bindir)/qemu-system-ppc \
362
	$(bindir)/qemu-system-ppcemb \
363
	$(bindir)/qemu-system-ppc64 \
364
	$(bindir)/qemu-system-sh4 \
365
	$(bindir)/qemu-system-sh4eb \
366
	$(bindir)/qemu-system-sparc \
367
	$(bindir)/qemu-i386 \
368
	$(bindir)/qemu-x86_64 \
369
	$(bindir)/qemu-alpha \
370
	$(bindir)/qemu-arm \
371
	$(bindir)/qemu-armeb \
372
	$(bindir)/qemu-cris \
373
	$(bindir)/qemu-m68k \
374
	$(bindir)/qemu-mips \
375
	$(bindir)/qemu-mipsel \
376
	$(bindir)/qemu-ppc \
377
	$(bindir)/qemu-ppc64 \
378
	$(bindir)/qemu-ppc64abi32 \
379
	$(bindir)/qemu-sh4 \
380
	$(bindir)/qemu-sh4eb \
381
	$(bindir)/qemu-sparc \
382
	$(bindir)/qemu-sparc64 \
383
	$(bindir)/qemu-sparc32plus \
384
	$(bindir)/qemu-img \
385
	$(bindir)/qemu-nbd \
386
	$(datadir)/bios.bin \
387
	$(datadir)/vgabios.bin \
388
	$(datadir)/vgabios-cirrus.bin \
389
	$(datadir)/ppc_rom.bin \
390
	$(datadir)/video.x \
391
	$(datadir)/openbios-sparc32 \
392
	$(datadir)/openbios-sparc64 \
393
	$(datadir)/openbios-ppc \
394
	$(datadir)/pxe-ne2k_pci.bin \
395
	$(datadir)/pxe-rtl8139.bin \
396
	$(datadir)/pxe-pcnet.bin \
397
	$(datadir)/pxe-e1000.bin \
398
	$(docdir)/qemu-doc.html \
399
	$(docdir)/qemu-tech.html \
400
	$(mandir)/man1/qemu.1 \
401
	$(mandir)/man1/qemu-img.1 \
402
	$(mandir)/man8/qemu-nbd.8
403

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