Statistics
| Branch: | Revision:

root / Makefile @ 4b0c7aa3

History | View | Annotate | Download (11 kB)

1
# Makefile for QEMU.
2

    
3
ifneq ($(wildcard config-host.mak),)
4
# Put the all: rule here so that config-host.mak can contain dependencies.
5
all: build-all
6
include config-host.mak
7
include $(SRC_PATH)/rules.mak
8
else
9
config-host.mak:
10
	@echo "Please call configure before running make!"
11
	@exit 1
12
endif
13

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

    
17
VPATH=$(SRC_PATH):$(SRC_PATH)/hw
18

    
19

    
20
CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
21
LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
22

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

    
35
LIBS+=$(PTHREADLIBS)
36
LIBS+=$(CLOCKLIBS)
37

    
38
ifdef CONFIG_SOLARIS
39
LIBS+=-lsocket -lnsl -lresolv
40
endif
41

    
42
ifdef CONFIG_WIN32
43
LIBS+=-lwinmm -lws2_32 -liphlpapi
44
endif
45

    
46
build-all: $(TOOLS) $(DOCS) recurse-all
47

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

    
54
SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
55
SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
56

    
57
subdir-%:
58
	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
59

    
60
$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
61
$(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
62

    
63
recurse-all: $(SUBDIR_RULES)
64

    
65
#######################################################################
66
# BLOCK_OBJS is code used by both qemu system emulation and qemu-img
67

    
68
BLOCK_OBJS=cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o
69
BLOCK_OBJS+=block/cow.o block/qcow.o aes.o block/vmdk.o block/cloop.o
70
BLOCK_OBJS+=block/dmg.o block/bochs.o block/vpc.o block/vvfat.o
71
BLOCK_OBJS+=block/qcow2.o block/parallels.o block/nbd.o
72
BLOCK_OBJS+=nbd.o block.o aio.o
73

    
74
ifdef CONFIG_WIN32
75
BLOCK_OBJS += block/raw-win32.o
76
else
77
ifdef CONFIG_AIO
78
BLOCK_OBJS += posix-aio-compat.o
79
endif
80
BLOCK_OBJS += block/raw-posix.o
81
endif
82

    
83
ifdef CONFIG_CURL
84
BLOCK_OBJS += block/curl.o
85
endif
86

    
87
######################################################################
88
# libqemu_common.a: Target independent part of system emulation. The
89
# long term path is to suppress *all* target specific code in case of
90
# system emulation, i.e. a single QEMU executable should support all
91
# CPUs and machines.
92

    
93
OBJS=$(BLOCK_OBJS)
94
OBJS+=readline.o console.o
95

    
96
OBJS+=irq.o ptimer.o
97
OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
98
OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
99
OBJS+=tmp105.o lm832x.o eeprom93xx.o tsc2005.o
100
OBJS+=scsi-disk.o cdrom.o
101
OBJS+=scsi-generic.o
102
OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
103
OBJS+=usb-serial.o usb-net.o
104
OBJS+=sd.o ssi-sd.o
105
OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
106
OBJS+=bt-hci-csr.o
107
OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
108
OBJS+=qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o
109
OBJS+=msmouse.o ps2.o
110
OBJS+=qdev.o ssi.o
111

    
112
ifdef CONFIG_BRLAPI
113
OBJS+= baum.o
114
LIBS+=-lbrlapi
115
endif
116

    
117
ifdef CONFIG_WIN32
118
OBJS+=tap-win32.o
119
else
120
OBJS+=migration-exec.o
121
endif
122

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

    
163
OBJS+=keymaps.o
164
ifdef CONFIG_SDL
165
OBJS+=sdl.o x_keymap.o
166
endif
167
ifdef CONFIG_CURSES
168
OBJS+=curses.o
169
endif
170
OBJS+=vnc.o acl.o d3des.o
171
ifdef CONFIG_VNC_TLS
172
OBJS+=vnc-tls.o vnc-auth-vencrypt.o
173
endif
174
ifdef CONFIG_VNC_SASL
175
OBJS+=vnc-auth-sasl.o
176
endif
177

    
178
ifdef CONFIG_COCOA
179
OBJS+=cocoa.o
180
endif
181

    
182
ifdef CONFIG_IOTHREAD
183
OBJS+=qemu-thread.o
184
endif
185

    
186
ifdef CONFIG_SLIRP
187
CPPFLAGS+=-I$(SRC_PATH)/slirp
188
SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
189
slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
190
tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
191
OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
192
endif
193

    
194
LIBS+=$(VDE_LIBS)
195

    
196
# xen backend driver support
197
XEN_OBJS := xen_backend.o xen_devconfig.o
198
XEN_OBJS += xen_console.o xenfb.o xen_disk.o xen_nic.o
199
ifdef CONFIG_XEN
200
  OBJS += $(XEN_OBJS)
201
endif
202

    
203
LIBS+=$(CURL_LIBS)
204

    
205
cocoa.o: cocoa.m
206

    
207
keymaps.o: keymaps.c keymaps.h
208

    
209
sdl.o: sdl.c keymaps.h sdl_keysym.h
210

    
211
sdl.o audio/sdlaudio.o: CFLAGS += $(SDL_CFLAGS)
212

    
213
acl.o: acl.h acl.c
214

    
215
vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
216

    
217
vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h
218

    
219
vnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
220

    
221
vnc-tls.o: vnc-tls.c vnc.h
222

    
223
vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h
224

    
225
vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h
226

    
227
curses.o: curses.c keymaps.h curses_keys.h
228

    
229
bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)
230

    
231
libqemu_common.a: $(OBJS)
232

    
233
#######################################################################
234
# USER_OBJS is code used by qemu userspace emulation
235
USER_OBJS=cutils.o  cache-utils.o
236

    
237
libqemu_user.a: $(USER_OBJS)
238

    
239
######################################################################
240

    
241
qemu-img$(EXESUF): qemu-img.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
242

    
243
qemu-nbd$(EXESUF):  qemu-nbd.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
244

    
245
qemu-io$(EXESUF):  qemu-io.o qemu-tool.o tool-osdep.o cmd.o $(BLOCK_OBJS)
246

    
247
qemu-img$(EXESUF) qemu-nbd$(EXESUF) qemu-io$(EXESUF): LIBS += -lz
248

    
249
clean:
250
# avoid old build problems by removing potentially incorrect old files
251
	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
252
	rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
253
	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d
254
	$(MAKE) -C tests clean
255
	for d in $(TARGET_DIRS) libhw32 libhw64; do \
256
	$(MAKE) -C $$d $@ || exit 1 ; \
257
        done
258

    
259
distclean: clean
260
	rm -f config-host.mak config-host.h $(DOCS) qemu-options.texi
261
	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
262
	for d in $(TARGET_DIRS) libhw32 libhw64; do \
263
	rm -rf $$d || exit 1 ; \
264
        done
265

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

    
270
ifdef INSTALL_BLOBS
271
BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
272
video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
273
pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
274
bamboo.dtb petalogix-s3adsp1800.dtb
275
else
276
BLOBS=
277
endif
278

    
279
install-doc: $(DOCS)
280
	$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
281
	$(INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
282
ifndef CONFIG_WIN32
283
	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
284
	$(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
285
	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
286
	$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
287
endif
288

    
289
install: all $(if $(BUILD_DOCS),install-doc)
290
	$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
291
ifneq ($(TOOLS),)
292
	$(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
293
endif
294
ifneq ($(BLOBS),)
295
	$(INSTALL_DIR) "$(DESTDIR)$(datadir)"
296
	set -e; for x in $(BLOBS); do \
297
		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
298
	done
299
endif
300
ifndef CONFIG_WIN32
301
	$(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
302
	set -e; for x in $(KEYMAPS); do \
303
		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
304
	done
305
endif
306
	for d in $(TARGET_DIRS); do \
307
	$(MAKE) -C $$d $@ || exit 1 ; \
308
        done
309

    
310
# various test targets
311
test speed: all
312
	$(MAKE) -C tests $@
313

    
314
TAGS:
315
	etags *.[ch] tests/*.[ch]
316

    
317
cscope:
318
	rm -f ./cscope.*
319
	find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
320
	cscope -b
321

    
322
# documentation
323
%.html: %.texi
324
	$(call quiet-command,texi2html -I=. -monolithic -number $<,"  GEN   $@")
325

    
326
%.info: %.texi
327
	$(call quiet-command,makeinfo -I . $< -o $@,"  GEN   $@")
328

    
329
%.dvi: %.texi
330
	$(call quiet-command,texi2dvi -I . $<,"  GEN   $@")
331

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

    
335
qemu.1: qemu-doc.texi qemu-options.texi
336
	$(call quiet-command, \
337
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu.pod && \
338
	  pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
339
	  "  GEN   $@")
340

    
341
qemu-img.1: qemu-img.texi
342
	$(call quiet-command, \
343
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \
344
	  pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
345
	  "  GEN   $@")
346

    
347
qemu-nbd.8: qemu-nbd.texi
348
	$(call quiet-command, \
349
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \
350
	  pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
351
	  "  GEN   $@")
352

    
353
info: qemu-doc.info qemu-tech.info
354

    
355
dvi: qemu-doc.dvi qemu-tech.dvi
356

    
357
html: qemu-doc.html qemu-tech.html
358

    
359
qemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi qemu-options.texi
360

    
361
VERSION ?= $(shell cat VERSION)
362
FILE = qemu-$(VERSION)
363

    
364
# tar release (use 'make -k tar' on a checkouted tree)
365
tar:
366
	rm -rf /tmp/$(FILE)
367
	cp -r . /tmp/$(FILE)
368
	cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
369
	rm -rf /tmp/$(FILE)
370

    
371
# generate a binary distribution
372
tarbin:
373
	cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
374
	$(bindir)/qemu \
375
	$(bindir)/qemu-system-x86_64 \
376
	$(bindir)/qemu-system-arm \
377
	$(bindir)/qemu-system-cris \
378
	$(bindir)/qemu-system-m68k \
379
	$(bindir)/qemu-system-mips \
380
	$(bindir)/qemu-system-mipsel \
381
	$(bindir)/qemu-system-mips64 \
382
	$(bindir)/qemu-system-mips64el \
383
	$(bindir)/qemu-system-ppc \
384
	$(bindir)/qemu-system-ppcemb \
385
	$(bindir)/qemu-system-ppc64 \
386
	$(bindir)/qemu-system-sh4 \
387
	$(bindir)/qemu-system-sh4eb \
388
	$(bindir)/qemu-system-sparc \
389
	$(bindir)/qemu-i386 \
390
	$(bindir)/qemu-x86_64 \
391
	$(bindir)/qemu-alpha \
392
	$(bindir)/qemu-arm \
393
	$(bindir)/qemu-armeb \
394
	$(bindir)/qemu-cris \
395
	$(bindir)/qemu-m68k \
396
	$(bindir)/qemu-mips \
397
	$(bindir)/qemu-mipsel \
398
	$(bindir)/qemu-ppc \
399
	$(bindir)/qemu-ppc64 \
400
	$(bindir)/qemu-ppc64abi32 \
401
	$(bindir)/qemu-sh4 \
402
	$(bindir)/qemu-sh4eb \
403
	$(bindir)/qemu-sparc \
404
	$(bindir)/qemu-sparc64 \
405
	$(bindir)/qemu-sparc32plus \
406
	$(bindir)/qemu-img \
407
	$(bindir)/qemu-nbd \
408
	$(datadir)/bios.bin \
409
	$(datadir)/vgabios.bin \
410
	$(datadir)/vgabios-cirrus.bin \
411
	$(datadir)/ppc_rom.bin \
412
	$(datadir)/video.x \
413
	$(datadir)/openbios-sparc32 \
414
	$(datadir)/openbios-sparc64 \
415
	$(datadir)/openbios-ppc \
416
	$(datadir)/pxe-ne2k_pci.bin \
417
	$(datadir)/pxe-rtl8139.bin \
418
	$(datadir)/pxe-pcnet.bin \
419
	$(datadir)/pxe-e1000.bin \
420
	$(docdir)/qemu-doc.html \
421
	$(docdir)/qemu-tech.html \
422
	$(mandir)/man1/qemu.1 \
423
	$(mandir)/man1/qemu-img.1 \
424
	$(mandir)/man8/qemu-nbd.8
425

    
426
# Include automatically generated dependency files
427
-include $(wildcard *.d audio/*.d slirp/*.d block/*.d)