3 include config-host.mak
5 .PHONY: all clean distclean dvi info install install-doc tar tarbin \
6 speed test html dvi info
8 VPATH=$(SRC_PATH):$(SRC_PATH)/hw
10 CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
11 LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
13 CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
14 CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
20 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
27 all: $(TOOLS) $(DOCS) recurse-all
29 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
31 subdir-%: dyngen$(EXESUF)
32 $(MAKE) -C $(subst subdir-,,$@) all
34 $(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
35 $(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
37 recurse-all: $(SUBDIR_RULES)
39 #######################################################################
40 # BLOCK_OBJS is code used by both qemu system emulation and qemu-img
42 BLOCK_OBJS=cutils.o qemu-malloc.o
43 BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
44 BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
45 BLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o
47 ######################################################################
48 # libqemu_common.a: Target independent part of system emulation. The
49 # long term path is to suppress *all* target specific code in case of
50 # system emulation, i.e. a single QEMU executable should support all
53 OBJS=nbd.o $(BLOCK_OBJS)
54 OBJS+=readline.o console.o
58 OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
59 OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
60 OBJS+=tmp105.o lm832x.o
61 OBJS+=scsi-disk.o cdrom.o
63 OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o
64 OBJS+=usb-serial.o usb-net.o
76 AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
78 AUDIO_OBJS += sdlaudio.o
81 AUDIO_OBJS += ossaudio.o
83 ifdef CONFIG_COREAUDIO
84 AUDIO_OBJS += coreaudio.o
88 AUDIO_OBJS += alsaaudio.o
91 AUDIO_OBJS += dsoundaudio.o
94 AUDIO_OBJS += fmodaudio.o
95 audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
100 AUDIO_OBJS += esdaudio.o
105 AUDIO_OBJS += paaudio.o
111 AUDIO_OBJS += audio_pt_int.o
113 AUDIO_OBJS+= wavcapture.o
114 OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
117 OBJS+=sdl.o x_keymap.o
129 CPPFLAGS+=-I$(SRC_PATH)/slirp
130 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
131 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
132 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
133 OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
139 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
141 sdl.o: sdl.c keymaps.c sdl_keysym.h
142 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
144 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
145 $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_VNC_TLS_CFLAGS) -c -o $@ $<
147 curses.o: curses.c keymaps.c curses_keys.h
148 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
150 audio/sdlaudio.o: audio/sdlaudio.c
151 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
153 libqemu_common.a: $(OBJS)
157 #######################################################################
158 # USER_OBJS is code used by qemu userspace emulation
161 libqemu_user.a: $(USER_OBJS)
163 $(AR) rcs $@ $(USER_OBJS)
165 QEMU_IMG_BLOCK_OBJS = nbd.o $(BLOCK_OBJS)
167 QEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-win32.o
169 QEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-posix.o
172 ######################################################################
174 qemu-img$(EXESUF): qemu-img.o qemu-img-block.o $(QEMU_IMG_BLOCK_OBJS)
175 $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
178 $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG -c -o $@ $<
181 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
184 $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_NBD -c -o $@ $<
186 qemu-nbd$(EXESUF): qemu-nbd.o qemu-nbd-nbd.o qemu-img-block.o \
187 osdep.o qemu-nbd-block-raw-posix.o $(BLOCK_OBJS)
188 $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
191 dyngen$(EXESUF): dyngen.c
192 $(HOST_CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
195 # avoid old build problems by removing potentially incorrect old files
196 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
197 rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~
199 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
200 $(MAKE) -C tests clean
201 for d in $(TARGET_DIRS); do \
202 $(MAKE) -C $$d $@ || exit 1 ; \
206 rm -f config-host.mak config-host.h $(DOCS)
207 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
208 for d in $(TARGET_DIRS); do \
209 rm -rf $$d || exit 1 ; \
212 KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
213 ar de en-us fi fr-be hr it lv nl pl ru th \
214 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
217 mkdir -p "$(DESTDIR)$(docdir)"
218 $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
220 mkdir -p "$(DESTDIR)$(mandir)/man1"
221 $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
222 mkdir -p "$(DESTDIR)$(mandir)/man8"
223 $(INSTALL) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
226 install: all $(if $(BUILD_DOCS),install-doc)
227 mkdir -p "$(DESTDIR)$(bindir)"
229 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
231 mkdir -p "$(DESTDIR)$(datadir)"
232 set -e; for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
233 video.x openbios-sparc32 openbios-sparc64 pxe-ne2k_pci.bin \
234 pxe-rtl8139.bin pxe-pcnet.bin; do \
235 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
238 mkdir -p "$(DESTDIR)$(datadir)/keymaps"
239 set -e; for x in $(KEYMAPS); do \
240 $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
243 for d in $(TARGET_DIRS); do \
244 $(MAKE) -C $$d $@ || exit 1 ; \
247 # various test targets
252 etags *.[ch] tests/*.[ch]
256 find . -name "*.[ch]" -print > ./cscope.files
261 texi2html -monolithic -number $<
269 qemu.1: qemu-doc.texi
270 $(SRC_PATH)/texi2pod.pl $< qemu.pod
271 pod2man --section=1 --center=" " --release=" " qemu.pod > $@
273 qemu-img.1: qemu-img.texi
274 $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
275 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
277 qemu-nbd.8: qemu-nbd.texi
278 $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod
279 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@
281 info: qemu-doc.info qemu-tech.info
283 dvi: qemu-doc.dvi qemu-tech.dvi
285 html: qemu-doc.html qemu-tech.html
287 VERSION ?= $(shell cat VERSION)
288 FILE = qemu-$(VERSION)
290 # tar release (use 'make -k tar' on a checkouted tree)
294 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
297 # generate a binary distribution
299 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
301 $(bindir)/qemu-system-ppc \
302 $(bindir)/qemu-system-ppc64 \
303 $(bindir)/qemu-system-ppcemb \
304 $(bindir)/qemu-system-sparc \
305 $(bindir)/qemu-system-x86_64 \
306 $(bindir)/qemu-system-mips \
307 $(bindir)/qemu-system-mipsel \
308 $(bindir)/qemu-system-mips64 \
309 $(bindir)/qemu-system-mips64el \
310 $(bindir)/qemu-system-arm \
311 $(bindir)/qemu-system-m68k \
312 $(bindir)/qemu-system-sh4 \
313 $(bindir)/qemu-system-sh4eb \
314 $(bindir)/qemu-system-cris \
315 $(bindir)/qemu-i386 \
316 $(bindir)/qemu-x86_64 \
318 $(bindir)/qemu-armeb \
319 $(bindir)/qemu-sparc \
320 $(bindir)/qemu-sparc32plus \
321 $(bindir)/qemu-sparc64 \
323 $(bindir)/qemu-ppc64 \
324 $(bindir)/qemu-ppc64abi32 \
325 $(bindir)/qemu-mips \
326 $(bindir)/qemu-mipsel \
327 $(bindir)/qemu-alpha \
328 $(bindir)/qemu-m68k \
330 $(bindir)/qemu-sh4eb \
331 $(bindir)/qemu-cris \
334 $(datadir)/bios.bin \
335 $(datadir)/vgabios.bin \
336 $(datadir)/vgabios-cirrus.bin \
337 $(datadir)/ppc_rom.bin \
339 $(datadir)/openbios-sparc32 \
340 $(datadir)/openbios-sparc64 \
341 $(datadir)/pxe-ne2k_pci.bin \
342 $(datadir)/pxe-rtl8139.bin \
343 $(datadir)/pxe-pcnet.bin \
344 $(docdir)/qemu-doc.html \
345 $(docdir)/qemu-tech.html \
346 $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1
347 $(mandir)/man8/qemu-nbd.8
349 # Include automatically generated dependency files
350 -include $(wildcard *.d audio/*.d slirp/*.d)