Statistics
| Branch: | Revision:

root / Makefile @ f7d0fe02

History | View | Annotate | Download (11.5 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/qcow2-refcount.o
72
BLOCK_OBJS+=block/parallels.o block/nbd.o
73
BLOCK_OBJS+=nbd.o block.o aio.o
74

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

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

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

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

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

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

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

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

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

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

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

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

    
195
LIBS+=$(VDE_LIBS)
196

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

    
204
LIBS+=$(CURL_LIBS)
205

    
206
cocoa.o: cocoa.m
207

    
208
keymaps.o: keymaps.c keymaps.h
209

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

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

    
214
acl.o: acl.h acl.c
215

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

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

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

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

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

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

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

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

    
232
libqemu_common.a: $(OBJS)
233

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

    
238
libqemu_user.a: $(USER_OBJS)
239

    
240
######################################################################
241

    
242
qemu-img.o: qemu-img-cmds.h
243

    
244
qemu-img$(EXESUF): qemu-img.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
245

    
246
qemu-nbd$(EXESUF):  qemu-nbd.o qemu-tool.o tool-osdep.o $(BLOCK_OBJS)
247

    
248
qemu-io$(EXESUF):  qemu-io.o qemu-tool.o tool-osdep.o cmd.o $(BLOCK_OBJS)
249

    
250
qemu-img$(EXESUF) qemu-nbd$(EXESUF) qemu-io$(EXESUF): LIBS += -lz
251

    
252
qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
253
	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $@")
254

    
255
clean:
256
# avoid old build problems by removing potentially incorrect old files
257
	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
258
	rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
259
	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d
260
	rm -f qemu-img-cmds.h
261
	$(MAKE) -C tests clean
262
	for d in $(TARGET_DIRS) libhw32 libhw64; do \
263
	$(MAKE) -C $$d $@ || exit 1 ; \
264
        done
265

    
266
distclean: clean
267
	rm -f config-host.mak config-host.h $(DOCS) qemu-options.texi qemu-img-cmds.texi
268
	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
269
	for d in $(TARGET_DIRS) libhw32 libhw64; do \
270
	rm -rf $$d || exit 1 ; \
271
        done
272

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

    
277
ifdef INSTALL_BLOBS
278
BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
279
video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
280
pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
281
bamboo.dtb petalogix-s3adsp1800.dtb
282
else
283
BLOBS=
284
endif
285

    
286
install-doc: $(DOCS)
287
	$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
288
	$(INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
289
ifndef CONFIG_WIN32
290
	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
291
	$(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
292
	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
293
	$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
294
endif
295

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

    
317
# various test targets
318
test speed: all
319
	$(MAKE) -C tests $@
320

    
321
TAGS:
322
	etags *.[ch] tests/*.[ch]
323

    
324
cscope:
325
	rm -f ./cscope.*
326
	find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
327
	cscope -b
328

    
329
# documentation
330
%.html: %.texi
331
	$(call quiet-command,texi2html -I=. -monolithic -number $<,"  GEN   $@")
332

    
333
%.info: %.texi
334
	$(call quiet-command,makeinfo -I . $< -o $@,"  GEN   $@")
335

    
336
%.dvi: %.texi
337
	$(call quiet-command,texi2dvi -I . $<,"  GEN   $@")
338

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

    
342
qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
343
	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
344

    
345
qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
346
	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
347

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

    
354
qemu-img.1: qemu-img.texi qemu-img-cmds.texi
355
	$(call quiet-command, \
356
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \
357
	  pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
358
	  "  GEN   $@")
359

    
360
qemu-nbd.8: qemu-nbd.texi
361
	$(call quiet-command, \
362
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \
363
	  pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
364
	  "  GEN   $@")
365

    
366
info: qemu-doc.info qemu-tech.info
367

    
368
dvi: qemu-doc.dvi qemu-tech.dvi
369

    
370
html: qemu-doc.html qemu-tech.html
371

    
372
qemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-monitor.texi qemu-img-cmds.texi
373

    
374
VERSION ?= $(shell cat VERSION)
375
FILE = qemu-$(VERSION)
376

    
377
# tar release (use 'make -k tar' on a checkouted tree)
378
tar:
379
	rm -rf /tmp/$(FILE)
380
	cp -r . /tmp/$(FILE)
381
	cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
382
	rm -rf /tmp/$(FILE)
383

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

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