blob: e8f0724b5b94234904f49f91f0e296589eb56161 [file] [log] [blame]
pbrook0cb3fb12006-05-14 12:07:53 +00001# Makefile for QEMU.
2
pbrookad064842006-04-16 12:41:07 +00003include config-host.mak
bellard766a4872003-02-18 23:35:48 +00004
pbrook0cb3fb12006-05-14 12:07:53 +00005.PHONY: all clean distclean dvi info install install-doc tar tarbin \
bellard9b0b8202007-11-14 10:34:57 +00006 speed test html dvi info
pbrook0cb3fb12006-05-14 12:07:53 +00007
pbrook8c462f82007-11-18 21:12:37 +00008VPATH=$(SRC_PATH):$(SRC_PATH)/hw
9
ths6f30fa82007-01-05 01:00:47 +000010BASE_CFLAGS=
11BASE_LDFLAGS=
12
blueswir131422552007-04-16 18:27:06 +000013BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
14BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
15
bellard4fb240a2007-11-07 19:24:02 +000016CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP
17CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
bellard766a4872003-02-18 23:35:48 +000018LIBS=
bellard1f50f8d2004-05-08 14:44:43 +000019ifdef CONFIG_STATIC
ths6f30fa82007-01-05 01:00:47 +000020BASE_LDFLAGS += -static
bellard1f50f8d2004-05-08 14:44:43 +000021endif
pbrookcc8ae6d2006-04-23 17:57:59 +000022ifdef BUILD_DOCS
bellardacd935e2004-11-15 22:57:26 +000023DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
pbrookcc8ae6d2006-04-23 17:57:59 +000024else
25DOCS=
26endif
bellard7d132992003-03-06 23:23:54 +000027
ths70956b72007-03-17 15:00:37 +000028LIBS+=$(AIOLIBS)
bellard83f64092006-08-01 16:21:11 +000029
pbrookda0b0df2007-11-10 19:30:52 +000030all: $(TOOLS) $(DOCS) recurse-all
pbrookb9dea4f2006-05-13 16:54:03 +000031
pbrookda0b0df2007-11-10 19:30:52 +000032subdir-%: dyngen$(EXESUF) libqemu_common.a
pbrook4aa42532006-05-13 13:55:08 +000033 $(MAKE) -C $(subst subdir-,,$@) all
34
35recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
bellard83f64092006-08-01 16:21:11 +000036
pbrookfaf07962007-11-11 02:51:17 +000037#######################################################################
38# BLOCK_OBJS is code used by both qemu system emulation and qemu-img
39
40BLOCK_OBJS=cutils.o
41BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
42BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
43BLOCK_OBJS+=block-qcow2.o block-parallels.o
44
bellard4fb240a2007-11-07 19:24:02 +000045######################################################################
pbrookfaf07962007-11-11 02:51:17 +000046# libqemu_common.a: Target indepedent part of system emulation. The
bellard4fb240a2007-11-07 19:24:02 +000047# long term path is to suppress *all* target specific code in case of
48# system emulation, i.e. a single QEMU executable should support all
49# CPUs and machines.
bellard47cea612004-05-17 20:06:42 +000050
pbrookfaf07962007-11-11 02:51:17 +000051OBJS=$(BLOCK_OBJS)
pbrook87ecb682007-11-17 17:14:51 +000052OBJS+=readline.o console.o
pbrookfaf07962007-11-11 02:51:17 +000053OBJS+=block.o
bellard4fb240a2007-11-07 19:24:02 +000054
pbrook87ecb682007-11-17 17:14:51 +000055OBJS+=irq.o
56OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
pbrookcf0dbb22007-11-18 14:36:08 +000057OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o
pbrook87ecb682007-11-17 17:14:51 +000058OBJS+=scsi-disk.o cdrom.o
59OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o
60
bellard4fb240a2007-11-07 19:24:02 +000061ifdef CONFIG_WIN32
62OBJS+=tap-win32.o
63endif
64
65AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
66ifdef CONFIG_SDL
67AUDIO_OBJS += sdlaudio.o
68endif
69ifdef CONFIG_OSS
70AUDIO_OBJS += ossaudio.o
71endif
72ifdef CONFIG_COREAUDIO
73AUDIO_OBJS += coreaudio.o
74endif
75ifdef CONFIG_ALSA
76AUDIO_OBJS += alsaaudio.o
77endif
78ifdef CONFIG_DSOUND
79AUDIO_OBJS += dsoundaudio.o
80endif
81ifdef CONFIG_FMOD
82AUDIO_OBJS += fmodaudio.o
83audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
84endif
85AUDIO_OBJS+= wavcapture.o
86OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
87
88ifdef CONFIG_SDL
89OBJS+=sdl.o x_keymap.o
90endif
91OBJS+=vnc.o d3des.o
92
93ifdef CONFIG_COCOA
94OBJS+=cocoa.o
95endif
96
97ifdef CONFIG_SLIRP
98CPPFLAGS+=-I$(SRC_PATH)/slirp
99SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
100slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
101tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
102OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
103endif
104
105cocoa.o: cocoa.m
106 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
107
108sdl.o: sdl.c keymaps.c sdl_keysym.h
109 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
110
111vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
112 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
113
114audio/sdlaudio.o: audio/sdlaudio.c
115 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
116
117libqemu_common.a: $(OBJS)
118 rm -f $@
119 $(AR) rcs $@ $(OBJS)
120
121######################################################################
122
pbrookfaf07962007-11-11 02:51:17 +0000123qemu-img$(EXESUF): qemu-img.o qemu-img-block.o qemu-img-block-raw.o $(BLOCK_OBJS)
bellard4fb240a2007-11-07 19:24:02 +0000124 $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
125
pbrookfaf07962007-11-11 02:51:17 +0000126qemu-img-%.o: %.c
127 $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG $(BASE_CFLAGS) -c -o $@ $<
128
bellard4fb240a2007-11-07 19:24:02 +0000129%.o: %.c
130 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
131
132# dyngen host tool
bellard11d9f692004-04-02 20:55:59 +0000133dyngen$(EXESUF): dyngen.c
ths6f30fa82007-01-05 01:00:47 +0000134 $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
bellard31e31b82003-02-18 22:55:36 +0000135
136clean:
bellard2d80ae82003-08-11 23:01:33 +0000137# avoid old build problems by removing potentially incorrect old files
ths5fafdf22007-09-16 21:08:06 +0000138 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
bellard4fb240a2007-11-07 19:24:02 +0000139 rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~
140 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
bellard7d3505c2004-05-12 19:32:15 +0000141 $(MAKE) -C tests clean
bellard626df762003-08-10 21:39:31 +0000142 for d in $(TARGET_DIRS); do \
bellard7d3505c2004-05-12 19:32:15 +0000143 $(MAKE) -C $$d $@ || exit 1 ; \
bellard626df762003-08-10 21:39:31 +0000144 done
bellard31e31b82003-02-18 22:55:36 +0000145
bellard7d132992003-03-06 23:23:54 +0000146distclean: clean
pbrookcc8ae6d2006-04-23 17:57:59 +0000147 rm -f config-host.mak config-host.h $(DOCS)
pbrook0cb3fb12006-05-14 12:07:53 +0000148 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
bellard76bc6832003-08-10 23:41:46 +0000149 for d in $(TARGET_DIRS); do \
bellardbc1b0502003-10-28 00:12:52 +0000150 rm -rf $$d || exit 1 ; \
bellard76bc6832003-08-10 23:41:46 +0000151 done
bellard7d132992003-03-06 23:23:54 +0000152
bellardfed4a9a2004-12-12 22:18:34 +0000153KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
154ar de en-us fi fr-be hr it lv nl pl ru th \
155common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
156
pbrook38954dc2006-04-30 23:54:18 +0000157install-doc: $(DOCS)
158 mkdir -p "$(DESTDIR)$(docdir)"
159 $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
160ifndef CONFIG_WIN32
161 mkdir -p "$(DESTDIR)$(mandir)/man1"
162 $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
163endif
164
165install: all $(if $(BUILD_DOCS),install-doc)
pbrook1236cab2006-04-09 20:47:35 +0000166 mkdir -p "$(DESTDIR)$(bindir)"
ths932a79d2007-10-20 18:29:34 +0000167ifneq ($(TOOLS),)
pbrook6a882642006-04-17 13:57:12 +0000168 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
ths932a79d2007-10-20 18:29:34 +0000169endif
pbrook1236cab2006-04-09 20:47:35 +0000170 mkdir -p "$(DESTDIR)$(datadir)"
pbrookad064842006-04-16 12:41:07 +0000171 for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
ths860c6c52007-05-20 10:54:50 +0000172 video.x openbios-sparc32 pxe-ne2k_pci.bin \
thseec85c22007-01-05 17:41:07 +0000173 pxe-rtl8139.bin pxe-pcnet.bin; do \
pbrook6a882642006-04-17 13:57:12 +0000174 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
pbrookad064842006-04-16 12:41:07 +0000175 done
bellard11d9f692004-04-02 20:55:59 +0000176ifndef CONFIG_WIN32
pbrook1236cab2006-04-09 20:47:35 +0000177 mkdir -p "$(DESTDIR)$(datadir)/keymaps"
pbrookad064842006-04-16 12:41:07 +0000178 for x in $(KEYMAPS); do \
pbrook6a882642006-04-17 13:57:12 +0000179 $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
pbrookad064842006-04-16 12:41:07 +0000180 done
bellard11d9f692004-04-02 20:55:59 +0000181endif
bellard626df762003-08-10 21:39:31 +0000182 for d in $(TARGET_DIRS); do \
bellard7d3505c2004-05-12 19:32:15 +0000183 $(MAKE) -C $$d $@ || exit 1 ; \
bellard626df762003-08-10 21:39:31 +0000184 done
bellard612384d2003-03-22 17:31:19 +0000185
bellard367e86e2003-03-01 17:13:26 +0000186# various test targets
bellard9b0b8202007-11-14 10:34:57 +0000187test speed: all
bellard7d3505c2004-05-12 19:32:15 +0000188 $(MAKE) -C tests $@
bellard31e31b82003-02-18 22:55:36 +0000189
ths5fafdf22007-09-16 21:08:06 +0000190TAGS:
bellardb9adb4a2003-04-29 20:41:16 +0000191 etags *.[ch] tests/*.[ch]
bellard31e31b82003-02-18 22:55:36 +0000192
bellard6688bc62005-08-21 09:23:39 +0000193cscope:
194 rm -f ./cscope.*
195 find . -name "*.[ch]" -print > ./cscope.files
196 cscope -b
197
bellard3ef693a2003-03-23 20:17:16 +0000198# documentation
bellard1f673132004-04-04 15:21:17 +0000199%.html: %.texi
bellard3ef693a2003-03-23 20:17:16 +0000200 texi2html -monolithic -number $<
201
bellardf3548322006-04-30 22:51:54 +0000202%.info: %.texi
203 makeinfo $< -o $@
204
205%.dvi: %.texi
206 texi2dvi $<
207
bellard5a671352003-10-01 00:13:48 +0000208qemu.1: qemu-doc.texi
pbrookad064842006-04-16 12:41:07 +0000209 $(SRC_PATH)/texi2pod.pl $< qemu.pod
bellard5a671352003-10-01 00:13:48 +0000210 pod2man --section=1 --center=" " --release=" " qemu.pod > $@
211
bellardacd935e2004-11-15 22:57:26 +0000212qemu-img.1: qemu-img.texi
pbrookad064842006-04-16 12:41:07 +0000213 $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
bellardacd935e2004-11-15 22:57:26 +0000214 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
215
pbrook0cb3fb12006-05-14 12:07:53 +0000216info: qemu-doc.info qemu-tech.info
217
218dvi: qemu-doc.dvi qemu-tech.dvi
219
220html: qemu-doc.html qemu-tech.html
221
thsdf5cf722007-01-24 22:56:36 +0000222VERSION ?= $(shell cat VERSION)
223FILE = qemu-$(VERSION)
bellard586314f2003-03-03 15:02:29 +0000224
bellard1e43adf2003-09-30 20:54:24 +0000225# tar release (use 'make -k tar' on a checkouted tree)
bellard586314f2003-03-03 15:02:29 +0000226tar:
227 rm -rf /tmp/$(FILE)
bellard1e43adf2003-09-30 20:54:24 +0000228 cp -r . /tmp/$(FILE)
bellard76b62fd2003-10-28 00:47:44 +0000229 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
bellard586314f2003-03-03 15:02:29 +0000230 rm -rf /tmp/$(FILE)
231
bellard76b62fd2003-10-28 00:47:44 +0000232# generate a binary distribution
bellardd691f662003-03-24 21:58:34 +0000233tarbin:
ths4887d782007-09-29 21:22:33 +0000234 ( cd / ; tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
bellard43095f32005-04-27 20:49:23 +0000235 $(bindir)/qemu \
bellard7efa4382004-05-12 18:54:06 +0000236 $(bindir)/qemu-system-ppc \
j_mayerd4082e92007-04-24 07:34:03 +0000237 $(bindir)/qemu-system-ppc64 \
238 $(bindir)/qemu-system-ppcemb \
bellardacd935e2004-11-15 22:57:26 +0000239 $(bindir)/qemu-system-sparc \
bellard43095f32005-04-27 20:49:23 +0000240 $(bindir)/qemu-system-x86_64 \
bellard93856aa2005-07-24 18:44:35 +0000241 $(bindir)/qemu-system-mips \
pbrook38260992006-03-11 14:51:13 +0000242 $(bindir)/qemu-system-mipsel \
thsfbe4f652007-04-01 11:16:48 +0000243 $(bindir)/qemu-system-mips64 \
244 $(bindir)/qemu-system-mips64el \
bellardea31eb52005-12-06 21:42:03 +0000245 $(bindir)/qemu-system-arm \
thsff1aaf62007-09-29 21:18:26 +0000246 $(bindir)/qemu-system-m68k \
247 $(bindir)/qemu-system-sh4 \
bellard7efa4382004-05-12 18:54:06 +0000248 $(bindir)/qemu-i386 \
249 $(bindir)/qemu-arm \
bellardea31eb52005-12-06 21:42:03 +0000250 $(bindir)/qemu-armeb \
bellard7efa4382004-05-12 18:54:06 +0000251 $(bindir)/qemu-sparc \
252 $(bindir)/qemu-ppc \
j_mayerd4082e92007-04-24 07:34:03 +0000253 $(bindir)/qemu-ppc64 \
bellardea31eb52005-12-06 21:42:03 +0000254 $(bindir)/qemu-mips \
255 $(bindir)/qemu-mipsel \
ths540635b2007-09-30 01:58:33 +0000256 $(bindir)/qemu-mipsn32 \
257 $(bindir)/qemu-mipsn32el \
258 $(bindir)/qemu-mips64 \
259 $(bindir)/qemu-mips64el \
j_mayercf6c1b12007-04-05 20:46:02 +0000260 $(bindir)/qemu-alpha \
thsff1aaf62007-09-29 21:18:26 +0000261 $(bindir)/qemu-m68k \
262 $(bindir)/qemu-sh4 \
bellardb932cab2004-08-01 21:46:49 +0000263 $(bindir)/qemu-img \
bellard7efa4382004-05-12 18:54:06 +0000264 $(datadir)/bios.bin \
265 $(datadir)/vgabios.bin \
bellardde9258a2004-06-06 15:50:03 +0000266 $(datadir)/vgabios-cirrus.bin \
bellard637f6cd2004-06-21 19:54:47 +0000267 $(datadir)/ppc_rom.bin \
bellardd5295252005-07-03 14:00:51 +0000268 $(datadir)/video.x \
bellard0986ac32006-06-14 12:36:32 +0000269 $(datadir)/openbios-sparc32 \
bellard19c80e52007-02-05 21:22:42 +0000270 $(datadir)/pxe-ne2k_pci.bin \
271 $(datadir)/pxe-rtl8139.bin \
272 $(datadir)/pxe-pcnet.bin \
bellard1f50f8d2004-05-08 14:44:43 +0000273 $(docdir)/qemu-doc.html \
274 $(docdir)/qemu-tech.html \
bellardacd935e2004-11-15 22:57:26 +0000275 $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
bellardd691f662003-03-24 21:58:34 +0000276
bellard31e31b82003-02-18 22:55:36 +0000277ifneq ($(wildcard .depend),)
278include .depend
279endif
bellard4fb240a2007-11-07 19:24:02 +0000280
281# Include automatically generated dependency files
282-include $(wildcard *.d audio/*.d slirp/*.d)