Statistics
| Branch: | Revision:

root / Makefile @ 1f3d3c8f

History | View | Annotate | Download (12 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
config-host.mak: configure
9
	@echo $@ is out-of-date, running configure
10
	@sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
11
else
12
config-host.mak:
13
	@echo "Please call configure before running make!"
14
	@exit 1
15
endif
16

    
17
# Don't try to regenerate Makefile or configure
18
# We don't generate any of them
19
Makefile: ;
20
configure: ;
21

    
22
.PHONY: all clean cscope distclean dvi html info install install-doc \
23
	recurse-all speed tar tarbin test build-all
24

    
25
VPATH=$(SRC_PATH):$(SRC_PATH)/hw
26

    
27
LIBS+=-lz $(LIBS_TOOLS)
28

    
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
SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
36
SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
37

    
38
config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
39
	$(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep "=y$$" | sort -u > $@,"  GEN  $@")
40

    
41
-include config-all-devices.mak
42

    
43
build-all: config-host.h
44
	$(call quiet-command, $(MAKE) $(SUBDIR_MAKEFLAGS) $(TOOLS) $(DOCS) recurse-all,)
45

    
46
config-host.h: config-host.h-timestamp
47
config-host.h-timestamp: config-host.mak
48

    
49
SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
50

    
51
subdir-%: config-host.h
52
	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
53

    
54
$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
55

    
56
$(filter %-user,$(SUBDIR_RULES)): libuser.a
57

    
58
libuser.a:
59
	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libuser V="$(V)" TARGET_DIR="$*/" all,)
60

    
61
ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
62
romsubdir-%:
63
	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
64

    
65
ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
66

    
67
recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
68

    
69
#######################################################################
70
# block-obj-y is code used by both qemu system emulation and qemu-img
71

    
72
block-obj-y = cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o
73
block-obj-y += nbd.o block.o aio.o aes.o osdep.o
74
block-obj-$(CONFIG_POSIX) += posix-aio-compat.o
75
block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
76

    
77
block-nested-y += cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
78
block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o
79
block-nested-y += parallels.o nbd.o
80
block-nested-$(CONFIG_WIN32) += raw-win32.o
81
block-nested-$(CONFIG_POSIX) += raw-posix.o
82
block-nested-$(CONFIG_CURL) += curl.o
83

    
84
block-obj-y +=  $(addprefix block/, $(block-nested-y))
85

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

    
92
obj-y = $(block-obj-y)
93
obj-y += readline.o console.o
94

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

    
113
obj-$(CONFIG_BRLAPI) += baum.o
114
obj-$(CONFIG_WIN32) += tap-win32.o
115
obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o
116

    
117
audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
118

    
119
audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
120
audio-obj-$(CONFIG_SDL) += sdlaudio.o
121
audio-obj-$(CONFIG_OSS) += ossaudio.o
122
audio-obj-$(CONFIG_COREAUDIO) += coreaudio.o
123
audio-obj-$(CONFIG_ALSA) += alsaaudio.o
124
audio-obj-$(CONFIG_DSOUND) += dsoundaudio.o
125
audio-obj-$(CONFIG_FMOD) += fmodaudio.o
126
audio-obj-$(CONFIG_ESD) += esdaudio.o
127
audio-obj-$(CONFIG_PA) += paaudio.o
128
audio-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o
129
audio-obj-y += wavcapture.o
130
obj-y += $(addprefix audio/, $(audio-obj-y))
131

    
132
obj-y += keymaps.o
133
obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o
134
obj-$(CONFIG_CURSES) += curses.o
135
obj-y += vnc.o acl.o d3des.o
136
obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o
137
obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
138
obj-$(CONFIG_COCOA) += cocoa.o
139
obj-$(CONFIG_IOTHREAD) += qemu-thread.o
140

    
141
slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o
142
slirp-obj-y += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o
143
slirp-obj-y += tcp_subr.o tcp_timer.o udp.o bootp.o tftp.o
144
obj-$(CONFIG_SLIRP) += $(addprefix slirp/, $(slirp-obj-y))
145

    
146
# xen backend driver support
147
obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
148
obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
149

    
150
QEMU_CFLAGS+=$(CURL_CFLAGS)
151

    
152
cocoa.o: cocoa.m
153

    
154
keymaps.o: keymaps.c keymaps.h
155

    
156
sdl_zoom.o: sdl_zoom.c sdl_zoom.h sdl_zoom_template.h
157

    
158
sdl.o: sdl.c keymaps.h sdl_keysym.h sdl_zoom.h
159

    
160
sdl.o audio/sdlaudio.o sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
161

    
162
acl.o: acl.h acl.c
163

    
164
vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
165

    
166
vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h
167

    
168
vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
169

    
170
vnc-tls.o: vnc-tls.c vnc.h
171

    
172
vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h
173

    
174
vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h
175

    
176
curses.o: curses.c keymaps.h curses_keys.h
177

    
178
bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
179

    
180
libqemu_common.a: $(obj-y)
181

    
182
######################################################################
183

    
184
qemu-img.o: qemu-img-cmds.h
185

    
186
qemu-img$(EXESUF): qemu-img.o qemu-tool.o $(block-obj-y)
187

    
188
qemu-nbd$(EXESUF):  qemu-nbd.o qemu-tool.o $(block-obj-y)
189

    
190
qemu-io$(EXESUF):  qemu-io.o qemu-tool.o cmd.o $(block-obj-y)
191

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

    
195
check-qint: check-qint.o qint.o qemu-malloc.o
196
check-qstring: check-qstring.o qstring.o qemu-malloc.o
197
check-qdict: check-qdict.o qdict.o qint.o qstring.o qemu-malloc.o
198

    
199
clean:
200
# avoid old build problems by removing potentially incorrect old files
201
	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
202
	rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
203
	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d
204
	rm -f qemu-img-cmds.h
205
	$(MAKE) -C tests clean
206
	for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser; do \
207
	$(MAKE) -C $$d $@ || exit 1 ; \
208
        done
209

    
210
distclean: clean
211
	rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi
212
	rm -f config-all-devices.mak config-all-devices.h*
213
	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
214
	for d in $(TARGET_DIRS) libhw32 libhw64 libuser; do \
215
	rm -rf $$d || exit 1 ; \
216
        done
217

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

    
222
ifdef INSTALL_BLOBS
223
BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
224
video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
225
pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
226
bamboo.dtb petalogix-s3adsp1800.dtb \
227
multiboot.bin
228
else
229
BLOBS=
230
endif
231

    
232
install-doc: $(DOCS)
233
	$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
234
	$(INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
235
ifdef CONFIG_POSIX
236
	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
237
	$(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
238
	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
239
	$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
240
endif
241

    
242
install: all $(if $(BUILD_DOCS),install-doc)
243
	$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
244
ifneq ($(TOOLS),)
245
	$(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
246
endif
247
ifneq ($(BLOBS),)
248
	$(INSTALL_DIR) "$(DESTDIR)$(datadir)"
249
	set -e; for x in $(BLOBS); do \
250
		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
251
	done
252
endif
253
	$(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
254
	set -e; for x in $(KEYMAPS); do \
255
		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
256
	done
257
	for d in $(TARGET_DIRS); do \
258
	$(MAKE) -C $$d $@ || exit 1 ; \
259
        done
260

    
261
# various test targets
262
test speed: all
263
	$(MAKE) -C tests $@
264

    
265
.PHONY: TAGS
266
TAGS:
267
	find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
268

    
269
cscope:
270
	rm -f ./cscope.*
271
	find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
272
	cscope -b
273

    
274
# documentation
275
%.html: %.texi
276
	$(call quiet-command,texi2html -I=. -monolithic -number $<,"  GEN   $@")
277

    
278
%.info: %.texi
279
	$(call quiet-command,makeinfo -I . $< -o $@,"  GEN   $@")
280

    
281
%.dvi: %.texi
282
	$(call quiet-command,texi2dvi -I . $<,"  GEN   $@")
283

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

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

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

    
293
qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
294
	$(call quiet-command, \
295
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu.pod && \
296
	  pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
297
	  "  GEN   $@")
298

    
299
qemu-img.1: qemu-img.texi qemu-img-cmds.texi
300
	$(call quiet-command, \
301
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \
302
	  pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
303
	  "  GEN   $@")
304

    
305
qemu-nbd.8: qemu-nbd.texi
306
	$(call quiet-command, \
307
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \
308
	  pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
309
	  "  GEN   $@")
310

    
311
info: qemu-doc.info qemu-tech.info
312

    
313
dvi: qemu-doc.dvi qemu-tech.dvi
314

    
315
html: qemu-doc.html qemu-tech.html
316

    
317
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
318

    
319
VERSION ?= $(shell cat VERSION)
320
FILE = qemu-$(VERSION)
321

    
322
# tar release (use 'make -k tar' on a checkouted tree)
323
tar:
324
	rm -rf /tmp/$(FILE)
325
	cp -r . /tmp/$(FILE)
326
	cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
327
	rm -rf /tmp/$(FILE)
328

    
329
# generate a binary distribution
330
tarbin:
331
	cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
332
	$(bindir)/qemu \
333
	$(bindir)/qemu-system-x86_64 \
334
	$(bindir)/qemu-system-arm \
335
	$(bindir)/qemu-system-cris \
336
	$(bindir)/qemu-system-m68k \
337
	$(bindir)/qemu-system-microblaze \
338
	$(bindir)/qemu-system-mips \
339
	$(bindir)/qemu-system-mipsel \
340
	$(bindir)/qemu-system-mips64 \
341
	$(bindir)/qemu-system-mips64el \
342
	$(bindir)/qemu-system-ppc \
343
	$(bindir)/qemu-system-ppcemb \
344
	$(bindir)/qemu-system-ppc64 \
345
	$(bindir)/qemu-system-sh4 \
346
	$(bindir)/qemu-system-sh4eb \
347
	$(bindir)/qemu-system-sparc \
348
	$(bindir)/qemu-i386 \
349
	$(bindir)/qemu-x86_64 \
350
	$(bindir)/qemu-alpha \
351
	$(bindir)/qemu-arm \
352
	$(bindir)/qemu-armeb \
353
	$(bindir)/qemu-cris \
354
	$(bindir)/qemu-m68k \
355
	$(bindir)/qemu-microblaze \
356
	$(bindir)/qemu-mips \
357
	$(bindir)/qemu-mipsel \
358
	$(bindir)/qemu-ppc \
359
	$(bindir)/qemu-ppc64 \
360
	$(bindir)/qemu-ppc64abi32 \
361
	$(bindir)/qemu-sh4 \
362
	$(bindir)/qemu-sh4eb \
363
	$(bindir)/qemu-sparc \
364
	$(bindir)/qemu-sparc64 \
365
	$(bindir)/qemu-sparc32plus \
366
	$(bindir)/qemu-img \
367
	$(bindir)/qemu-nbd \
368
	$(datadir)/bios.bin \
369
	$(datadir)/vgabios.bin \
370
	$(datadir)/vgabios-cirrus.bin \
371
	$(datadir)/ppc_rom.bin \
372
	$(datadir)/video.x \
373
	$(datadir)/openbios-sparc32 \
374
	$(datadir)/openbios-sparc64 \
375
	$(datadir)/openbios-ppc \
376
	$(datadir)/pxe-ne2k_pci.bin \
377
	$(datadir)/pxe-rtl8139.bin \
378
	$(datadir)/pxe-pcnet.bin \
379
	$(datadir)/pxe-e1000.bin \
380
	$(docdir)/qemu-doc.html \
381
	$(docdir)/qemu-tech.html \
382
	$(mandir)/man1/qemu.1 \
383
	$(mandir)/man1/qemu-img.1 \
384
	$(mandir)/man8/qemu-nbd.8
385

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