xref: /openbmc/qemu/Makefile (revision 6473e68f)
10cb3fb1eSpbrook# Makefile for QEMU.
20cb3fb1eSpbrook
3ad064840Spbrookinclude config-host.mak
417759187Saliguoriinclude $(SRC_PATH)/rules.mak
5766a487aSbellard
6818220f5Saliguori.PHONY: all clean cscope distclean dvi html info install install-doc \
7818220f5Saliguori	recurse-all speed tar tarbin test
80cb3fb1eSpbrook
98c462f8fSpbrookVPATH=$(SRC_PATH):$(SRC_PATH)/hw
108c462f8fSpbrook
1117759187Saliguori
1240293e58SbellardCFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
1340293e58SbellardLDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
143142255cSblueswir1
1596935aa4SmalcCPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
164fb240a4SbellardCPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
17766a487aSbellardLIBS=
181f50f8d1Sbellardifdef CONFIG_STATIC
1940293e58SbellardLDFLAGS += -static
201f50f8d1Sbellardendif
21cc8ae6deSpbrookifdef BUILD_DOCS
227a5ca864SbellardDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
23cc8ae6deSpbrookelse
24cc8ae6deSpbrookDOCS=
25cc8ae6deSpbrookendif
267d13299dSbellard
2770956b77SthsLIBS+=$(AIOLIBS)
2883f64091Sbellard
297e00eb9bSaliguoriifdef CONFIG_SOLARIS
307e00eb9bSaliguoriLIBS+=-lsocket -lnsl -lresolv
317e00eb9bSaliguoriendif
327e00eb9bSaliguori
3303ff3ca3Saliguoriifdef CONFIG_WIN32
3403ff3ca3SaliguoriLIBS+=-lwinmm -lws2_32 -liphlpapi
3503ff3ca3Saliguoriendif
3603ff3ca3Saliguori
37da0b0df8Spbrookall: $(TOOLS) $(DOCS) recurse-all
38b9dea4fbSpbrook
39cec7d0b6SpbrookSUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
40cec7d0b6Spbrook
4186e840eeSaurel32subdir-%:
424f188f88Saliguori	$(MAKE) -C $(subst subdir-,,$@) V="$(V)" all
434aa42531Spbrook
44cec7d0b6Spbrook$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
45cec7d0b6Spbrook$(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
46cec7d0b6Spbrook
47cec7d0b6Spbrookrecurse-all: $(SUBDIR_RULES)
484aa42531Spbrook
49faf07963Spbrook#######################################################################
50faf07963Spbrook# BLOCK_OBJS is code used by both qemu system emulation and qemu-img
51faf07963Spbrook
5217e2377aSpbrookBLOCK_OBJS=cutils.o qemu-malloc.o
53faf07963SpbrookBLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
54faf07963SpbrookBLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
5503ff3ca3SaliguoriBLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o
56a76bab49SaliguoriBLOCK_OBJS+=nbd.o block.o aio.o
5703ff3ca3Saliguori
5803ff3ca3Saliguoriifdef CONFIG_WIN32
5903ff3ca3SaliguoriBLOCK_OBJS += block-raw-win32.o
6003ff3ca3Saliguorielse
613c529d93Saliguoriifdef CONFIG_AIO
623c529d93SaliguoriBLOCK_OBJS += posix-aio-compat.o
633c529d93Saliguoriendif
6403ff3ca3SaliguoriBLOCK_OBJS += block-raw-posix.o
6503ff3ca3Saliguoriendif
6603ff3ca3Saliguori
674fb240a4Sbellard######################################################################
682e2ea909Sbellard# libqemu_common.a: Target independent part of system emulation. The
694fb240a4Sbellard# long term path is to suppress *all* target specific code in case of
704fb240a4Sbellard# system emulation, i.e. a single QEMU executable should support all
714fb240a4Sbellard# CPUs and machines.
7247cea614Sbellard
73cd01b4a3SaliguoriOBJS=$(BLOCK_OBJS)
74faf07963SpbrookOBJS+=readline.o console.o
75cd01b4a3Saliguori
7687ecb68bSpbrookOBJS+=irq.o
7787ecb68bSpbrookOBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
787e7c5e4cSbalrogOBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
791d4e547bSbalrogOBJS+=tmp105.o lm832x.o
8087ecb68bSpbrookOBJS+=scsi-disk.o cdrom.o
81985a03b0SthsOBJS+=scsi-generic.o
8268063649Sblueswir1OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
836c9f886cSbalrogOBJS+=usb-serial.o usb-net.o
84775616c3SpbrookOBJS+=sd.o ssi-sd.o
85e6a6d5abSbalrogOBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
86559b90fbSaliguoriOBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
87902b3d5cSmalcOBJS+=qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o
8887ecb68bSpbrook
892e4d9fb1Saurel32ifdef CONFIG_BRLAPI
902e4d9fb1Saurel32OBJS+= baum.o
912e4d9fb1Saurel32LIBS+=-lbrlapi
922e4d9fb1Saurel32endif
932e4d9fb1Saurel32
944fb240a4Sbellardifdef CONFIG_WIN32
954fb240a4SbellardOBJS+=tap-win32.o
96559b90fbSaliguorielse
97559b90fbSaliguoriOBJS+=migration-exec.o
984fb240a4Sbellardendif
994fb240a4Sbellard
1004fb240a4SbellardAUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
1014fb240a4Sbellardifdef CONFIG_SDL
1024fb240a4SbellardAUDIO_OBJS += sdlaudio.o
1034fb240a4Sbellardendif
1044fb240a4Sbellardifdef CONFIG_OSS
1054fb240a4SbellardAUDIO_OBJS += ossaudio.o
1064fb240a4Sbellardendif
1074fb240a4Sbellardifdef CONFIG_COREAUDIO
1084fb240a4SbellardAUDIO_OBJS += coreaudio.o
109ca9cc28cSbalrogAUDIO_PT = yes
1104fb240a4Sbellardendif
1114fb240a4Sbellardifdef CONFIG_ALSA
1124fb240a4SbellardAUDIO_OBJS += alsaaudio.o
1134fb240a4Sbellardendif
1144fb240a4Sbellardifdef CONFIG_DSOUND
1154fb240a4SbellardAUDIO_OBJS += dsoundaudio.o
1164fb240a4Sbellardendif
1174fb240a4Sbellardifdef CONFIG_FMOD
1184fb240a4SbellardAUDIO_OBJS += fmodaudio.o
1194fb240a4Sbellardaudio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
1204fb240a4Sbellardendif
121ca9cc28cSbalrogifdef CONFIG_ESD
122ca9cc28cSbalrogAUDIO_PT = yes
123ca9cc28cSbalrogAUDIO_PT_INT = yes
124ca9cc28cSbalrogAUDIO_OBJS += esdaudio.o
125ca9cc28cSbalrogendif
126b8e59f18Smalcifdef CONFIG_PA
127b8e59f18SmalcAUDIO_PT = yes
128b8e59f18SmalcAUDIO_PT_INT = yes
129b8e59f18SmalcAUDIO_OBJS += paaudio.o
130b8e59f18Smalcendif
131ca9cc28cSbalrogifdef AUDIO_PT
132ca9cc28cSbalrogLDFLAGS += -pthread
133ca9cc28cSbalrogendif
134ca9cc28cSbalrogifdef AUDIO_PT_INT
135ca9cc28cSbalrogAUDIO_OBJS += audio_pt_int.o
136ca9cc28cSbalrogendif
1374fb240a4SbellardAUDIO_OBJS+= wavcapture.o
1384fb240a4SbellardOBJS+=$(addprefix audio/, $(AUDIO_OBJS))
1394fb240a4Sbellard
1404fb240a4Sbellardifdef CONFIG_SDL
1414fb240a4SbellardOBJS+=sdl.o x_keymap.o
1424fb240a4Sbellardendif
1434d3b6f6eSbalrogifdef CONFIG_CURSES
1444d3b6f6eSbalrogOBJS+=curses.o
1454d3b6f6eSbalrogendif
1464fb240a4SbellardOBJS+=vnc.o d3des.o
1474fb240a4Sbellard
1484fb240a4Sbellardifdef CONFIG_COCOA
1494fb240a4SbellardOBJS+=cocoa.o
1504fb240a4Sbellardendif
1514fb240a4Sbellard
1524fb240a4Sbellardifdef CONFIG_SLIRP
1534fb240a4SbellardCPPFLAGS+=-I$(SRC_PATH)/slirp
1544fb240a4SbellardSLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
1554fb240a4Sbellardslirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
1564fb240a4Sbellardtcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
1574fb240a4SbellardOBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
1584fb240a4Sbellardendif
1594fb240a4Sbellard
1608a16d273SthsLIBS+=$(VDE_LIBS)
1618a16d273Sths
1624fb240a4Sbellardcocoa.o: cocoa.m
1634fb240a4Sbellard
1644fb240a4Sbellardsdl.o: sdl.c keymaps.c sdl_keysym.h
165807544e2Saliguori
166807544e2Saliguorisdl.o audio/sdlaudio.o: CFLAGS += $(SDL_CFLAGS)
1674fb240a4Sbellard
1684fb240a4Sbellardvnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
169807544e2Saliguori
170807544e2Saliguorivnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
1714fb240a4Sbellard
1724d3b6f6eSbalrogcurses.o: curses.c keymaps.c curses_keys.h
1734d3b6f6eSbalrog
174807544e2Saliguoribt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)
1754fb240a4Sbellard
1764fb240a4Sbellardlibqemu_common.a: $(OBJS)
1774fb240a4Sbellard
178cec7d0b6Spbrook#######################################################################
179cec7d0b6Spbrook# USER_OBJS is code used by qemu userspace emulation
180902b3d5cSmalcUSER_OBJS=cutils.o  cache-utils.o
181cec7d0b6Spbrook
182cec7d0b6Spbrooklibqemu_user.a: $(USER_OBJS)
183cec7d0b6Spbrook
1844fb240a4Sbellard######################################################################
1854fb240a4Sbellard
18603ff3ca3Saliguoriqemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS)
1874fb240a4Sbellard
18803ff3ca3Saliguoriqemu-nbd$(EXESUF):  qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS)
1893aa892d7Saliguori
1903aa892d7Saliguoriqemu-img$(EXESUF) qemu-nbd$(EXESUF): LIBS += -lz
1917a5ca864Sbellard
19231e31b8aSbellardclean:
1932d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files
1942d80ae89Sbellard	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
19586e840eeSaurel32	rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
1964fb240a4Sbellard	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
1977d3505c5Sbellard	$(MAKE) -C tests clean
198626df76aSbellard	for d in $(TARGET_DIRS); do \
1997d3505c5Sbellard	$(MAKE) -C $$d $@ || exit 1 ; \
200626df76aSbellard        done
20131e31b8aSbellard
2027d13299dSbellarddistclean: clean
203cc8ae6deSpbrook	rm -f config-host.mak config-host.h $(DOCS)
2040cb3fb1eSpbrook	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
20576bc6838Sbellard	for d in $(TARGET_DIRS); do \
206bc1b050dSbellard	rm -rf $$d || exit 1 ; \
20776bc6838Sbellard        done
2087d13299dSbellard
209fed4a9adSbellardKEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
210fed4a9adSbellardar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
211fed4a9adSbellardcommon  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
212fed4a9adSbellard
21377755340Sthsifdef INSTALL_BLOBS
21477755340SthsBLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
215e5d01b06Saurel32video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
216e5d01b06Saurel32pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
217e5d01b06Saurel32bamboo.dtb
21877755340Sthselse
21977755340SthsBLOBS=
22077755340Sthsendif
22177755340Sths
22238954dcaSpbrookinstall-doc: $(DOCS)
22338954dcaSpbrook	mkdir -p "$(DESTDIR)$(docdir)"
22438954dcaSpbrook	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
22538954dcaSpbrookifndef CONFIG_WIN32
22638954dcaSpbrook	mkdir -p "$(DESTDIR)$(mandir)/man1"
227*6473e68fSaliguori	$(INSTALL) -m 644 qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
2287a5ca864Sbellard	mkdir -p "$(DESTDIR)$(mandir)/man8"
229*6473e68fSaliguori	$(INSTALL) -m 644 qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
23038954dcaSpbrookendif
23138954dcaSpbrook
23238954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc)
2331236cab7Spbrook	mkdir -p "$(DESTDIR)$(bindir)"
234932a79dfSthsifneq ($(TOOLS),)
2356a882643Spbrook	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
236932a79dfSthsendif
23777755340Sthsifneq ($(BLOBS),)
2381236cab7Spbrook	mkdir -p "$(DESTDIR)$(datadir)"
23977755340Sths	set -e; for x in $(BLOBS); do \
2406a882643Spbrook		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
241ad064840Spbrook	done
24277755340Sthsendif
24311d9f695Sbellardifndef CONFIG_WIN32
2441236cab7Spbrook	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
24518be8d77Sblueswir1	set -e; for x in $(KEYMAPS); do \
2466a882643Spbrook		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
247ad064840Spbrook	done
24811d9f695Sbellardendif
249626df76aSbellard	for d in $(TARGET_DIRS); do \
2507d3505c5Sbellard	$(MAKE) -C $$d $@ || exit 1 ; \
251626df76aSbellard        done
252612384d7Sbellard
253367e86e8Sbellard# various test targets
2549b0b8203Sbellardtest speed: all
2557d3505c5Sbellard	$(MAKE) -C tests $@
25631e31b8aSbellard
257367e86e8SbellardTAGS:
258b9adb4a6Sbellard	etags *.[ch] tests/*.[ch]
25931e31b8aSbellard
2606688bc6dSbellardcscope:
2616688bc6dSbellard	rm -f ./cscope.*
262ede46085Saurel32	find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
2636688bc6dSbellard	cscope -b
2646688bc6dSbellard
2653ef693a0Sbellard# documentation
2661f673135Sbellard%.html: %.texi
2673ef693a0Sbellard	texi2html -monolithic -number $<
2683ef693a0Sbellard
269f3548328Sbellard%.info: %.texi
270f3548328Sbellard	makeinfo $< -o $@
271f3548328Sbellard
272f3548328Sbellard%.dvi: %.texi
273f3548328Sbellard	texi2dvi $<
274f3548328Sbellard
2755a67135aSbellardqemu.1: qemu-doc.texi
276ad064840Spbrook	$(SRC_PATH)/texi2pod.pl $< qemu.pod
2775a67135aSbellard	pod2man --section=1 --center=" " --release=" " qemu.pod > $@
2785a67135aSbellard
279acd935efSbellardqemu-img.1: qemu-img.texi
280ad064840Spbrook	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
281acd935efSbellard	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
282acd935efSbellard
2837a5ca864Sbellardqemu-nbd.8: qemu-nbd.texi
2847a5ca864Sbellard	$(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod
2857a5ca864Sbellard	pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@
2867a5ca864Sbellard
2870cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info
2880cb3fb1eSpbrook
2890cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi
2900cb3fb1eSpbrook
2910cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html
2920cb3fb1eSpbrook
293818220f5Saliguoriqemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi
294818220f5Saliguori
295df5cf721SthsVERSION ?= $(shell cat VERSION)
296df5cf721SthsFILE = qemu-$(VERSION)
297586314f2Sbellard
2981e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree)
299586314f2Sbellardtar:
300586314f2Sbellard	rm -rf /tmp/$(FILE)
3011e43adfcSbellard	cp -r . /tmp/$(FILE)
30299c6c082Saurel32	cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
303586314f2Sbellard	rm -rf /tmp/$(FILE)
304586314f2Sbellard
30576b62fd0Sbellard# generate a binary distribution
306d691f669Sbellardtarbin:
30718be8d77Sblueswir1	cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
30843095f31Sbellard	$(bindir)/qemu \
30943095f31Sbellard	$(bindir)/qemu-system-x86_64 \
31040e8a53bSaurel32	$(bindir)/qemu-system-arm \
31140e8a53bSaurel32	$(bindir)/qemu-system-cris \
31240e8a53bSaurel32	$(bindir)/qemu-system-m68k \
31393856aacSbellard	$(bindir)/qemu-system-mips \
31438260998Spbrook	$(bindir)/qemu-system-mipsel \
315fbe4f65bSths	$(bindir)/qemu-system-mips64 \
316fbe4f65bSths	$(bindir)/qemu-system-mips64el \
31740e8a53bSaurel32	$(bindir)/qemu-system-ppc \
31840e8a53bSaurel32	$(bindir)/qemu-system-ppcemb \
31940e8a53bSaurel32	$(bindir)/qemu-system-ppc64 \
320ff1aaf65Sths	$(bindir)/qemu-system-sh4 \
32185ffbdfcSths	$(bindir)/qemu-system-sh4eb \
32240e8a53bSaurel32	$(bindir)/qemu-system-sparc \
3237efa4387Sbellard	$(bindir)/qemu-i386 \
324f0403c03Sbellard	$(bindir)/qemu-x86_64 \
32540e8a53bSaurel32	$(bindir)/qemu-alpha \
3267efa4387Sbellard	$(bindir)/qemu-arm \
327ea31eb5bSbellard	$(bindir)/qemu-armeb \
32840e8a53bSaurel32	$(bindir)/qemu-cris \
32940e8a53bSaurel32	$(bindir)/qemu-m68k \
33040e8a53bSaurel32	$(bindir)/qemu-mips \
33140e8a53bSaurel32	$(bindir)/qemu-mipsel \
3327efa4387Sbellard	$(bindir)/qemu-ppc \
333d4082e95Sj_mayer	$(bindir)/qemu-ppc64 \
334f0403c03Sbellard	$(bindir)/qemu-ppc64abi32 \
335ff1aaf65Sths	$(bindir)/qemu-sh4 \
33685ffbdfcSths	$(bindir)/qemu-sh4eb \
33740e8a53bSaurel32	$(bindir)/qemu-sparc \
33840e8a53bSaurel32	$(bindir)/qemu-sparc64 \
33940e8a53bSaurel32	$(bindir)/qemu-sparc32plus \
340b932cabaSbellard	$(bindir)/qemu-img \
3417a5ca864Sbellard	$(bindir)/qemu-nbd \
3427efa4387Sbellard	$(datadir)/bios.bin \
3437efa4387Sbellard	$(datadir)/vgabios.bin \
344de9258a8Sbellard	$(datadir)/vgabios-cirrus.bin \
345637f6cd7Sbellard	$(datadir)/ppc_rom.bin \
346d5295253Sbellard	$(datadir)/video.x \
3470986ac3bSbellard	$(datadir)/openbios-sparc32 \
348938255d2Sblueswir1	$(datadir)/openbios-sparc64 \
349e5d01b06Saurel32	$(datadir)/openbios-ppc \
35019c80e50Sbellard	$(datadir)/pxe-ne2k_pci.bin \
35119c80e50Sbellard	$(datadir)/pxe-rtl8139.bin \
35219c80e50Sbellard	$(datadir)/pxe-pcnet.bin \
3532991990bSaliguori	$(datadir)/pxe-e1000.bin \
3541f50f8d1Sbellard	$(docdir)/qemu-doc.html \
3551f50f8d1Sbellard	$(docdir)/qemu-tech.html \
35640e8a53bSaurel32	$(mandir)/man1/qemu.1 \
35740e8a53bSaurel32	$(mandir)/man1/qemu-img.1 \
3587a5ca864Sbellard	$(mandir)/man8/qemu-nbd.8
359d691f669Sbellard
3604fb240a4Sbellard# Include automatically generated dependency files
3614fb240a4Sbellard-include $(wildcard *.d audio/*.d slirp/*.d)
362