xref: /openbmc/qemu/Makefile (revision 818220f5)
10cb3fb1eSpbrook# Makefile for QEMU.
20cb3fb1eSpbrook
3ad064840Spbrookinclude config-host.mak
4766a487aSbellard
5*818220f5Saliguori.PHONY: all clean cscope distclean dvi html info install install-doc \
6*818220f5Saliguori	recurse-all speed tar tarbin test
70cb3fb1eSpbrook
88c462f8fSpbrookVPATH=$(SRC_PATH):$(SRC_PATH)/hw
98c462f8fSpbrook
1040293e58SbellardCFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
1140293e58SbellardLDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
123142255cSblueswir1
1396935aa4SmalcCPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
144fb240a4SbellardCPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
15766a487aSbellardLIBS=
161f50f8d1Sbellardifdef CONFIG_STATIC
1740293e58SbellardLDFLAGS += -static
181f50f8d1Sbellardendif
19cc8ae6deSpbrookifdef BUILD_DOCS
207a5ca864SbellardDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
21cc8ae6deSpbrookelse
22cc8ae6deSpbrookDOCS=
23cc8ae6deSpbrookendif
247d13299dSbellard
2570956b77SthsLIBS+=$(AIOLIBS)
2683f64091Sbellard
277e00eb9bSaliguoriifdef CONFIG_SOLARIS
287e00eb9bSaliguoriLIBS+=-lsocket -lnsl -lresolv
297e00eb9bSaliguoriendif
307e00eb9bSaliguori
3103ff3ca3Saliguoriifdef CONFIG_WIN32
3203ff3ca3SaliguoriLIBS+=-lwinmm -lws2_32 -liphlpapi
3303ff3ca3Saliguoriendif
3403ff3ca3Saliguori
35da0b0df8Spbrookall: $(TOOLS) $(DOCS) recurse-all
36b9dea4fbSpbrook
37cec7d0b6SpbrookSUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
38cec7d0b6Spbrook
39cec7d0b6Spbrooksubdir-%: dyngen$(EXESUF)
404aa42531Spbrook	$(MAKE) -C $(subst subdir-,,$@) all
414aa42531Spbrook
42cec7d0b6Spbrook$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
43cec7d0b6Spbrook$(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
44cec7d0b6Spbrook
45cec7d0b6Spbrookrecurse-all: $(SUBDIR_RULES)
464aa42531Spbrook
47faf07963Spbrook#######################################################################
48faf07963Spbrook# BLOCK_OBJS is code used by both qemu system emulation and qemu-img
49faf07963Spbrook
5017e2377aSpbrookBLOCK_OBJS=cutils.o qemu-malloc.o
51faf07963SpbrookBLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
52faf07963SpbrookBLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
5303ff3ca3SaliguoriBLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o
54a76bab49SaliguoriBLOCK_OBJS+=nbd.o block.o aio.o
5503ff3ca3Saliguori
5603ff3ca3Saliguoriifdef CONFIG_WIN32
5703ff3ca3SaliguoriBLOCK_OBJS += block-raw-win32.o
5803ff3ca3Saliguorielse
5903ff3ca3SaliguoriBLOCK_OBJS += block-raw-posix.o
6003ff3ca3Saliguoriendif
6103ff3ca3Saliguori
6203ff3ca3Saliguoriifdef CONFIG_AIO
6303ff3ca3SaliguoriBLOCK_OBJS += compatfd.o
64cd01b4a3Saliguoriendif
65faf07963Spbrook
664fb240a4Sbellard######################################################################
672e2ea909Sbellard# libqemu_common.a: Target independent part of system emulation. The
684fb240a4Sbellard# long term path is to suppress *all* target specific code in case of
694fb240a4Sbellard# system emulation, i.e. a single QEMU executable should support all
704fb240a4Sbellard# CPUs and machines.
7147cea614Sbellard
72cd01b4a3SaliguoriOBJS=$(BLOCK_OBJS)
73faf07963SpbrookOBJS+=readline.o console.o
74cd01b4a3Saliguori
7587ecb68bSpbrookOBJS+=irq.o
7687ecb68bSpbrookOBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
777e7c5e4cSbalrogOBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
781d4e547bSbalrogOBJS+=tmp105.o lm832x.o
7987ecb68bSpbrookOBJS+=scsi-disk.o cdrom.o
80985a03b0SthsOBJS+=scsi-generic.o
816c9f886cSbalrogOBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o
826c9f886cSbalrogOBJS+=usb-serial.o usb-net.o
83775616c3SpbrookOBJS+=sd.o ssi-sd.o
8487ecb68bSpbrook
852e4d9fb1Saurel32ifdef CONFIG_BRLAPI
862e4d9fb1Saurel32OBJS+= baum.o
872e4d9fb1Saurel32LIBS+=-lbrlapi
882e4d9fb1Saurel32endif
892e4d9fb1Saurel32
904fb240a4Sbellardifdef CONFIG_WIN32
914fb240a4SbellardOBJS+=tap-win32.o
924fb240a4Sbellardendif
934fb240a4Sbellard
944fb240a4SbellardAUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
954fb240a4Sbellardifdef CONFIG_SDL
964fb240a4SbellardAUDIO_OBJS += sdlaudio.o
974fb240a4Sbellardendif
984fb240a4Sbellardifdef CONFIG_OSS
994fb240a4SbellardAUDIO_OBJS += ossaudio.o
1004fb240a4Sbellardendif
1014fb240a4Sbellardifdef CONFIG_COREAUDIO
1024fb240a4SbellardAUDIO_OBJS += coreaudio.o
103ca9cc28cSbalrogAUDIO_PT = yes
1044fb240a4Sbellardendif
1054fb240a4Sbellardifdef CONFIG_ALSA
1064fb240a4SbellardAUDIO_OBJS += alsaaudio.o
1074fb240a4Sbellardendif
1084fb240a4Sbellardifdef CONFIG_DSOUND
1094fb240a4SbellardAUDIO_OBJS += dsoundaudio.o
1104fb240a4Sbellardendif
1114fb240a4Sbellardifdef CONFIG_FMOD
1124fb240a4SbellardAUDIO_OBJS += fmodaudio.o
1134fb240a4Sbellardaudio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
1144fb240a4Sbellardendif
115ca9cc28cSbalrogifdef CONFIG_ESD
116ca9cc28cSbalrogAUDIO_PT = yes
117ca9cc28cSbalrogAUDIO_PT_INT = yes
118ca9cc28cSbalrogAUDIO_OBJS += esdaudio.o
119ca9cc28cSbalrogendif
120b8e59f18Smalcifdef CONFIG_PA
121b8e59f18SmalcAUDIO_PT = yes
122b8e59f18SmalcAUDIO_PT_INT = yes
123b8e59f18SmalcAUDIO_OBJS += paaudio.o
124b8e59f18Smalcendif
125ca9cc28cSbalrogifdef AUDIO_PT
126ca9cc28cSbalrogLDFLAGS += -pthread
127ca9cc28cSbalrogendif
128ca9cc28cSbalrogifdef AUDIO_PT_INT
129ca9cc28cSbalrogAUDIO_OBJS += audio_pt_int.o
130ca9cc28cSbalrogendif
1314fb240a4SbellardAUDIO_OBJS+= wavcapture.o
1324fb240a4SbellardOBJS+=$(addprefix audio/, $(AUDIO_OBJS))
1334fb240a4Sbellard
1344fb240a4Sbellardifdef CONFIG_SDL
1354fb240a4SbellardOBJS+=sdl.o x_keymap.o
1364fb240a4Sbellardendif
1374d3b6f6eSbalrogifdef CONFIG_CURSES
1384d3b6f6eSbalrogOBJS+=curses.o
1394d3b6f6eSbalrogendif
1404fb240a4SbellardOBJS+=vnc.o d3des.o
1414fb240a4Sbellard
1424fb240a4Sbellardifdef CONFIG_COCOA
1434fb240a4SbellardOBJS+=cocoa.o
1444fb240a4Sbellardendif
1454fb240a4Sbellard
1464fb240a4Sbellardifdef CONFIG_SLIRP
1474fb240a4SbellardCPPFLAGS+=-I$(SRC_PATH)/slirp
1484fb240a4SbellardSLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
1494fb240a4Sbellardslirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
1504fb240a4Sbellardtcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
1514fb240a4SbellardOBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
1524fb240a4Sbellardendif
1534fb240a4Sbellard
1548a16d273SthsLIBS+=$(VDE_LIBS)
1558a16d273Sths
1564fb240a4Sbellardcocoa.o: cocoa.m
15740293e58Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
1584fb240a4Sbellard
1594fb240a4Sbellardsdl.o: sdl.c keymaps.c sdl_keysym.h
16040293e58Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
1614fb240a4Sbellard
1624fb240a4Sbellardvnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
16340293e58Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_VNC_TLS_CFLAGS) -c -o $@ $<
1644fb240a4Sbellard
1654d3b6f6eSbalrogcurses.o: curses.c keymaps.c curses_keys.h
166f5d28393Spbrook	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
1674d3b6f6eSbalrog
1684fb240a4Sbellardaudio/sdlaudio.o: audio/sdlaudio.c
16940293e58Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
1704fb240a4Sbellard
1714fb240a4Sbellardlibqemu_common.a: $(OBJS)
1724fb240a4Sbellard	rm -f $@
1734fb240a4Sbellard	$(AR) rcs $@ $(OBJS)
1744fb240a4Sbellard
175cec7d0b6Spbrook#######################################################################
176cec7d0b6Spbrook# USER_OBJS is code used by qemu userspace emulation
177cec7d0b6SpbrookUSER_OBJS=cutils.o
178cec7d0b6Spbrook
179cec7d0b6Spbrooklibqemu_user.a: $(USER_OBJS)
180cec7d0b6Spbrook	rm -f $@
181cec7d0b6Spbrook	$(AR) rcs $@ $(USER_OBJS)
182cec7d0b6Spbrook
1834fb240a4Sbellard######################################################################
1844fb240a4Sbellard
18503ff3ca3Saliguoriqemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS)
18640293e58Sbellard	$(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
1874fb240a4Sbellard
1884fb240a4Sbellard%.o: %.c
18940293e58Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
1904fb240a4Sbellard
19103ff3ca3Saliguoriqemu-nbd$(EXESUF):  qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS)
1927a5ca864Sbellard	$(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
1937a5ca864Sbellard
1944fb240a4Sbellard# dyngen host tool
19511d9f695Sbellarddyngen$(EXESUF): dyngen.c
19640293e58Sbellard	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
19731e31b8aSbellard
19831e31b8aSbellardclean:
1992d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files
2002d80ae89Sbellard	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
2014fb240a4Sbellard	rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~
202b94ec3ecSbalrog	rm -rf dyngen.dSYM
2034fb240a4Sbellard	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
2047d3505c5Sbellard	$(MAKE) -C tests clean
205626df76aSbellard	for d in $(TARGET_DIRS); do \
2067d3505c5Sbellard	$(MAKE) -C $$d $@ || exit 1 ; \
207626df76aSbellard        done
20831e31b8aSbellard
2097d13299dSbellarddistclean: clean
210cc8ae6deSpbrook	rm -f config-host.mak config-host.h $(DOCS)
2110cb3fb1eSpbrook	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
21276bc6838Sbellard	for d in $(TARGET_DIRS); do \
213bc1b050dSbellard	rm -rf $$d || exit 1 ; \
21476bc6838Sbellard        done
2157d13299dSbellard
216fed4a9adSbellardKEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
217fed4a9adSbellardar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
218fed4a9adSbellardcommon  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
219fed4a9adSbellard
22038954dcaSpbrookinstall-doc: $(DOCS)
22138954dcaSpbrook	mkdir -p "$(DESTDIR)$(docdir)"
22238954dcaSpbrook	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
22338954dcaSpbrookifndef CONFIG_WIN32
22438954dcaSpbrook	mkdir -p "$(DESTDIR)$(mandir)/man1"
22538954dcaSpbrook	$(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
2267a5ca864Sbellard	mkdir -p "$(DESTDIR)$(mandir)/man8"
2277a5ca864Sbellard	$(INSTALL) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
22838954dcaSpbrookendif
22938954dcaSpbrook
23038954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc)
2311236cab7Spbrook	mkdir -p "$(DESTDIR)$(bindir)"
232932a79dfSthsifneq ($(TOOLS),)
2336a882643Spbrook	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
234932a79dfSthsendif
2351236cab7Spbrook	mkdir -p "$(DESTDIR)$(datadir)"
23618be8d77Sblueswir1	set -e; for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
237938255d2Sblueswir1		video.x openbios-sparc32 openbios-sparc64 pxe-ne2k_pci.bin \
2382991990bSaliguori		pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin; do \
2396a882643Spbrook		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
240ad064840Spbrook	done
24111d9f695Sbellardifndef CONFIG_WIN32
2421236cab7Spbrook	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
24318be8d77Sblueswir1	set -e; for x in $(KEYMAPS); do \
2446a882643Spbrook		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
245ad064840Spbrook	done
24611d9f695Sbellardendif
247626df76aSbellard	for d in $(TARGET_DIRS); do \
2487d3505c5Sbellard	$(MAKE) -C $$d $@ || exit 1 ; \
249626df76aSbellard        done
250612384d7Sbellard
251367e86e8Sbellard# various test targets
2529b0b8203Sbellardtest speed: all
2537d3505c5Sbellard	$(MAKE) -C tests $@
25431e31b8aSbellard
255367e86e8SbellardTAGS:
256b9adb4a6Sbellard	etags *.[ch] tests/*.[ch]
25731e31b8aSbellard
2586688bc6dSbellardcscope:
2596688bc6dSbellard	rm -f ./cscope.*
2606688bc6dSbellard	find . -name "*.[ch]" -print > ./cscope.files
2616688bc6dSbellard	cscope -b
2626688bc6dSbellard
2633ef693a0Sbellard# documentation
2641f673135Sbellard%.html: %.texi
2653ef693a0Sbellard	texi2html -monolithic -number $<
2663ef693a0Sbellard
267f3548328Sbellard%.info: %.texi
268f3548328Sbellard	makeinfo $< -o $@
269f3548328Sbellard
270f3548328Sbellard%.dvi: %.texi
271f3548328Sbellard	texi2dvi $<
272f3548328Sbellard
2735a67135aSbellardqemu.1: qemu-doc.texi
274ad064840Spbrook	$(SRC_PATH)/texi2pod.pl $< qemu.pod
2755a67135aSbellard	pod2man --section=1 --center=" " --release=" " qemu.pod > $@
2765a67135aSbellard
277acd935efSbellardqemu-img.1: qemu-img.texi
278ad064840Spbrook	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
279acd935efSbellard	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
280acd935efSbellard
2817a5ca864Sbellardqemu-nbd.8: qemu-nbd.texi
2827a5ca864Sbellard	$(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod
2837a5ca864Sbellard	pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@
2847a5ca864Sbellard
2850cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info
2860cb3fb1eSpbrook
2870cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi
2880cb3fb1eSpbrook
2890cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html
2900cb3fb1eSpbrook
291*818220f5Saliguoriqemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi
292*818220f5Saliguori
293df5cf721SthsVERSION ?= $(shell cat VERSION)
294df5cf721SthsFILE = qemu-$(VERSION)
295586314f2Sbellard
2961e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree)
297586314f2Sbellardtar:
298586314f2Sbellard	rm -rf /tmp/$(FILE)
2991e43adfcSbellard	cp -r . /tmp/$(FILE)
30099c6c082Saurel32	cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
301586314f2Sbellard	rm -rf /tmp/$(FILE)
302586314f2Sbellard
30376b62fd0Sbellard# generate a binary distribution
304d691f669Sbellardtarbin:
30518be8d77Sblueswir1	cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
30643095f31Sbellard	$(bindir)/qemu \
3077efa4387Sbellard	$(bindir)/qemu-system-ppc \
308d4082e95Sj_mayer	$(bindir)/qemu-system-ppc64 \
309d4082e95Sj_mayer	$(bindir)/qemu-system-ppcemb \
310acd935efSbellard	$(bindir)/qemu-system-sparc \
31143095f31Sbellard	$(bindir)/qemu-system-x86_64 \
31293856aacSbellard	$(bindir)/qemu-system-mips \
31338260998Spbrook	$(bindir)/qemu-system-mipsel \
314fbe4f65bSths	$(bindir)/qemu-system-mips64 \
315fbe4f65bSths	$(bindir)/qemu-system-mips64el \
316ea31eb5bSbellard	$(bindir)/qemu-system-arm \
317ff1aaf65Sths	$(bindir)/qemu-system-m68k \
318ff1aaf65Sths	$(bindir)/qemu-system-sh4 \
31985ffbdfcSths	$(bindir)/qemu-system-sh4eb \
320f0403c03Sbellard	$(bindir)/qemu-system-cris \
3217efa4387Sbellard	$(bindir)/qemu-i386 \
322f0403c03Sbellard	$(bindir)/qemu-x86_64 \
3237efa4387Sbellard        $(bindir)/qemu-arm \
324ea31eb5bSbellard        $(bindir)/qemu-armeb \
3257efa4387Sbellard        $(bindir)/qemu-sparc \
326f0403c03Sbellard        $(bindir)/qemu-sparc32plus \
327f0403c03Sbellard        $(bindir)/qemu-sparc64 \
3287efa4387Sbellard        $(bindir)/qemu-ppc \
329d4082e95Sj_mayer        $(bindir)/qemu-ppc64 \
330f0403c03Sbellard        $(bindir)/qemu-ppc64abi32 \
331ea31eb5bSbellard        $(bindir)/qemu-mips \
332ea31eb5bSbellard        $(bindir)/qemu-mipsel \
333cf6c1b16Sj_mayer        $(bindir)/qemu-alpha \
334ff1aaf65Sths        $(bindir)/qemu-m68k \
335ff1aaf65Sths        $(bindir)/qemu-sh4 \
33685ffbdfcSths        $(bindir)/qemu-sh4eb \
337f0403c03Sbellard        $(bindir)/qemu-cris \
338b932cabaSbellard        $(bindir)/qemu-img \
3397a5ca864Sbellard        $(bindir)/qemu-nbd \
3407efa4387Sbellard	$(datadir)/bios.bin \
3417efa4387Sbellard	$(datadir)/vgabios.bin \
342de9258a8Sbellard	$(datadir)/vgabios-cirrus.bin \
343637f6cd7Sbellard	$(datadir)/ppc_rom.bin \
344d5295253Sbellard	$(datadir)/video.x \
3450986ac3bSbellard	$(datadir)/openbios-sparc32 \
346938255d2Sblueswir1	$(datadir)/openbios-sparc64 \
34719c80e50Sbellard        $(datadir)/pxe-ne2k_pci.bin \
34819c80e50Sbellard	$(datadir)/pxe-rtl8139.bin \
34919c80e50Sbellard        $(datadir)/pxe-pcnet.bin \
3502991990bSaliguori	$(datadir)/pxe-e1000.bin \
3511f50f8d1Sbellard	$(docdir)/qemu-doc.html \
3521f50f8d1Sbellard	$(docdir)/qemu-tech.html \
35318be8d77Sblueswir1	$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1
3547a5ca864Sbellard	$(mandir)/man8/qemu-nbd.8
355d691f669Sbellard
3564fb240a4Sbellard# Include automatically generated dependency files
3574fb240a4Sbellard-include $(wildcard *.d audio/*.d slirp/*.d)
358