xref: /openbmc/qemu/Makefile (revision da0b0df8)
10cb3fb1eSpbrook# Makefile for QEMU.
20cb3fb1eSpbrook
3ad064840Spbrookinclude config-host.mak
4766a487aSbellard
50cb3fb1eSpbrook.PHONY: all clean distclean dvi info install install-doc tar tarbin \
60cb3fb1eSpbrook	speed test test2 html dvi info
70cb3fb1eSpbrook
86f30fa85SthsBASE_CFLAGS=
96f30fa85SthsBASE_LDFLAGS=
106f30fa85Sths
113142255cSblueswir1BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
123142255cSblueswir1BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
133142255cSblueswir1
144fb240a4SbellardCPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP
154fb240a4SbellardCPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
164fb240a4SbellardCPPFLAGS += -DQEMU_TOOL
17766a487aSbellardLIBS=
181f50f8d1Sbellardifdef CONFIG_STATIC
196f30fa85SthsBASE_LDFLAGS += -static
201f50f8d1Sbellardendif
21cc8ae6deSpbrookifdef BUILD_DOCS
22acd935efSbellardDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
23cc8ae6deSpbrookelse
24cc8ae6deSpbrookDOCS=
25cc8ae6deSpbrookendif
267d13299dSbellard
2770956b77SthsLIBS+=$(AIOLIBS)
2883f64091Sbellard
29*da0b0df8Spbrookall: $(TOOLS) $(DOCS) recurse-all
30b9dea4fbSpbrook
31*da0b0df8Spbrooksubdir-%: dyngen$(EXESUF) libqemu_common.a
324aa42531Spbrook	$(MAKE) -C $(subst subdir-,,$@) all
334aa42531Spbrook
344aa42531Spbrookrecurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
354aa42531Spbrook
364fb240a4Sbellard######################################################################
374fb240a4Sbellard# libqemu_common.a: target indepedent part of system emulation. The
384fb240a4Sbellard# long term path is to suppress *all* target specific code in case of
394fb240a4Sbellard# system emulation, i.e. a single QEMU executable should support all
404fb240a4Sbellard# CPUs and machines.
4147cea614Sbellard
424fb240a4SbellardOBJS+=cutils.o readline.o console.o
434fb240a4Sbellard#OBJS+=block.o block-raw.o
444fb240a4SbellardOBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o block-dmg.o block-bochs.o block-vpc.o block-vvfat.o block-qcow2.o block-parallels.o
454fb240a4Sbellard
464fb240a4Sbellardifdef CONFIG_WIN32
474fb240a4SbellardOBJS+=tap-win32.o
484fb240a4Sbellardendif
494fb240a4Sbellard
504fb240a4SbellardAUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
514fb240a4Sbellardifdef CONFIG_SDL
524fb240a4SbellardAUDIO_OBJS += sdlaudio.o
534fb240a4Sbellardendif
544fb240a4Sbellardifdef CONFIG_OSS
554fb240a4SbellardAUDIO_OBJS += ossaudio.o
564fb240a4Sbellardendif
574fb240a4Sbellardifdef CONFIG_COREAUDIO
584fb240a4SbellardAUDIO_OBJS += coreaudio.o
594fb240a4Sbellardendif
604fb240a4Sbellardifdef CONFIG_ALSA
614fb240a4SbellardAUDIO_OBJS += alsaaudio.o
624fb240a4Sbellardendif
634fb240a4Sbellardifdef CONFIG_DSOUND
644fb240a4SbellardAUDIO_OBJS += dsoundaudio.o
654fb240a4Sbellardendif
664fb240a4Sbellardifdef CONFIG_FMOD
674fb240a4SbellardAUDIO_OBJS += fmodaudio.o
684fb240a4Sbellardaudio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
694fb240a4Sbellardendif
704fb240a4SbellardAUDIO_OBJS+= wavcapture.o
714fb240a4SbellardOBJS+=$(addprefix audio/, $(AUDIO_OBJS))
724fb240a4Sbellard
734fb240a4Sbellardifdef CONFIG_SDL
744fb240a4SbellardOBJS+=sdl.o x_keymap.o
754fb240a4Sbellardendif
764fb240a4SbellardOBJS+=vnc.o d3des.o
774fb240a4Sbellard
784fb240a4Sbellardifdef CONFIG_COCOA
794fb240a4SbellardOBJS+=cocoa.o
804fb240a4Sbellardendif
814fb240a4Sbellard
824fb240a4Sbellardifdef CONFIG_SLIRP
834fb240a4SbellardCPPFLAGS+=-I$(SRC_PATH)/slirp
844fb240a4SbellardSLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
854fb240a4Sbellardslirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
864fb240a4Sbellardtcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
874fb240a4SbellardOBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
884fb240a4Sbellardendif
894fb240a4Sbellard
904fb240a4Sbellardcocoa.o: cocoa.m
914fb240a4Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
924fb240a4Sbellard
934fb240a4Sbellardsdl.o: sdl.c keymaps.c sdl_keysym.h
944fb240a4Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
954fb240a4Sbellard
964fb240a4Sbellardvnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
974fb240a4Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
984fb240a4Sbellard
994fb240a4Sbellardaudio/sdlaudio.o: audio/sdlaudio.c
1004fb240a4Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
1014fb240a4Sbellard
1024fb240a4Sbellardlibqemu_common.a: $(OBJS)
1034fb240a4Sbellard	rm -f $@
1044fb240a4Sbellard	$(AR) rcs $@ $(OBJS)
1054fb240a4Sbellard
1064fb240a4Sbellard######################################################################
1074fb240a4Sbellard
1084fb240a4Sbellardqemu-img$(EXESUF): qemu-img.o block.o block-raw.o libqemu_common.a
1094fb240a4Sbellard	$(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
1104fb240a4Sbellard
1114fb240a4Sbellard%.o: %.c
1124fb240a4Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
1134fb240a4Sbellard
1144fb240a4Sbellard# dyngen host tool
11511d9f695Sbellarddyngen$(EXESUF): dyngen.c
1166f30fa85Sths	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
11731e31b8aSbellard
11831e31b8aSbellardclean:
1192d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files
1202d80ae89Sbellard	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
1214fb240a4Sbellard	rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~
1224fb240a4Sbellard	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
1237d3505c5Sbellard	$(MAKE) -C tests clean
124626df76aSbellard	for d in $(TARGET_DIRS); do \
1257d3505c5Sbellard	$(MAKE) -C $$d $@ || exit 1 ; \
126626df76aSbellard        done
12731e31b8aSbellard
1287d13299dSbellarddistclean: clean
129cc8ae6deSpbrook	rm -f config-host.mak config-host.h $(DOCS)
1300cb3fb1eSpbrook	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
13176bc6838Sbellard	for d in $(TARGET_DIRS); do \
132bc1b050dSbellard	rm -rf $$d || exit 1 ; \
13376bc6838Sbellard        done
1347d13299dSbellard
135fed4a9adSbellardKEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
136fed4a9adSbellardar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
137fed4a9adSbellardcommon  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
138fed4a9adSbellard
13938954dcaSpbrookinstall-doc: $(DOCS)
14038954dcaSpbrook	mkdir -p "$(DESTDIR)$(docdir)"
14138954dcaSpbrook	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
14238954dcaSpbrookifndef CONFIG_WIN32
14338954dcaSpbrook	mkdir -p "$(DESTDIR)$(mandir)/man1"
14438954dcaSpbrook	$(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
14538954dcaSpbrookendif
14638954dcaSpbrook
14738954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc)
1481236cab7Spbrook	mkdir -p "$(DESTDIR)$(bindir)"
149932a79dfSthsifneq ($(TOOLS),)
1506a882643Spbrook	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
151932a79dfSthsendif
1521236cab7Spbrook	mkdir -p "$(DESTDIR)$(datadir)"
153ad064840Spbrook	for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
154860c6c52Sths		video.x openbios-sparc32 pxe-ne2k_pci.bin \
155eec85c2aSths		pxe-rtl8139.bin pxe-pcnet.bin; do \
1566a882643Spbrook		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
157ad064840Spbrook	done
15811d9f695Sbellardifndef CONFIG_WIN32
1591236cab7Spbrook	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
160ad064840Spbrook	for x in $(KEYMAPS); do \
1616a882643Spbrook		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
162ad064840Spbrook	done
16311d9f695Sbellardendif
164626df76aSbellard	for d in $(TARGET_DIRS); do \
1657d3505c5Sbellard	$(MAKE) -C $$d $@ || exit 1 ; \
166626df76aSbellard        done
167612384d7Sbellard
168367e86e8Sbellard# various test targets
16982c7e2a4Sbellardtest speed test2: all
1707d3505c5Sbellard	$(MAKE) -C tests $@
17131e31b8aSbellard
172367e86e8SbellardTAGS:
173b9adb4a6Sbellard	etags *.[ch] tests/*.[ch]
17431e31b8aSbellard
1756688bc6dSbellardcscope:
1766688bc6dSbellard	rm -f ./cscope.*
1776688bc6dSbellard	find . -name "*.[ch]" -print > ./cscope.files
1786688bc6dSbellard	cscope -b
1796688bc6dSbellard
1803ef693a0Sbellard# documentation
1811f673135Sbellard%.html: %.texi
1823ef693a0Sbellard	texi2html -monolithic -number $<
1833ef693a0Sbellard
184f3548328Sbellard%.info: %.texi
185f3548328Sbellard	makeinfo $< -o $@
186f3548328Sbellard
187f3548328Sbellard%.dvi: %.texi
188f3548328Sbellard	texi2dvi $<
189f3548328Sbellard
1905a67135aSbellardqemu.1: qemu-doc.texi
191ad064840Spbrook	$(SRC_PATH)/texi2pod.pl $< qemu.pod
1925a67135aSbellard	pod2man --section=1 --center=" " --release=" " qemu.pod > $@
1935a67135aSbellard
194acd935efSbellardqemu-img.1: qemu-img.texi
195ad064840Spbrook	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
196acd935efSbellard	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
197acd935efSbellard
1980cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info
1990cb3fb1eSpbrook
2000cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi
2010cb3fb1eSpbrook
2020cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html
2030cb3fb1eSpbrook
204df5cf721SthsVERSION ?= $(shell cat VERSION)
205df5cf721SthsFILE = qemu-$(VERSION)
206586314f2Sbellard
2071e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree)
208586314f2Sbellardtar:
209586314f2Sbellard	rm -rf /tmp/$(FILE)
2101e43adfcSbellard	cp -r . /tmp/$(FILE)
21176b62fd0Sbellard	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
212586314f2Sbellard	rm -rf /tmp/$(FILE)
213586314f2Sbellard
21476b62fd0Sbellard# generate a binary distribution
215d691f669Sbellardtarbin:
2164887d78bSths	( cd / ; tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
21743095f31Sbellard	$(bindir)/qemu \
2187efa4387Sbellard	$(bindir)/qemu-system-ppc \
219d4082e95Sj_mayer	$(bindir)/qemu-system-ppc64 \
220d4082e95Sj_mayer	$(bindir)/qemu-system-ppcemb \
221acd935efSbellard	$(bindir)/qemu-system-sparc \
22243095f31Sbellard	$(bindir)/qemu-system-x86_64 \
22393856aacSbellard	$(bindir)/qemu-system-mips \
22438260998Spbrook	$(bindir)/qemu-system-mipsel \
225fbe4f65bSths	$(bindir)/qemu-system-mips64 \
226fbe4f65bSths	$(bindir)/qemu-system-mips64el \
227ea31eb5bSbellard	$(bindir)/qemu-system-arm \
228ff1aaf65Sths	$(bindir)/qemu-system-m68k \
229ff1aaf65Sths	$(bindir)/qemu-system-sh4 \
2307efa4387Sbellard	$(bindir)/qemu-i386 \
2317efa4387Sbellard        $(bindir)/qemu-arm \
232ea31eb5bSbellard        $(bindir)/qemu-armeb \
2337efa4387Sbellard        $(bindir)/qemu-sparc \
2347efa4387Sbellard        $(bindir)/qemu-ppc \
235d4082e95Sj_mayer        $(bindir)/qemu-ppc64 \
236ea31eb5bSbellard        $(bindir)/qemu-mips \
237ea31eb5bSbellard        $(bindir)/qemu-mipsel \
238540635baSths        $(bindir)/qemu-mipsn32 \
239540635baSths        $(bindir)/qemu-mipsn32el \
240540635baSths        $(bindir)/qemu-mips64 \
241540635baSths        $(bindir)/qemu-mips64el \
242cf6c1b16Sj_mayer        $(bindir)/qemu-alpha \
243ff1aaf65Sths        $(bindir)/qemu-m68k \
244ff1aaf65Sths        $(bindir)/qemu-sh4 \
245b932cabaSbellard        $(bindir)/qemu-img \
2467efa4387Sbellard	$(datadir)/bios.bin \
2477efa4387Sbellard	$(datadir)/vgabios.bin \
248de9258a8Sbellard	$(datadir)/vgabios-cirrus.bin \
249637f6cd7Sbellard	$(datadir)/ppc_rom.bin \
250d5295253Sbellard	$(datadir)/video.x \
2510986ac3bSbellard	$(datadir)/openbios-sparc32 \
25219c80e50Sbellard        $(datadir)/pxe-ne2k_pci.bin \
25319c80e50Sbellard	$(datadir)/pxe-rtl8139.bin \
25419c80e50Sbellard        $(datadir)/pxe-pcnet.bin \
2551f50f8d1Sbellard	$(docdir)/qemu-doc.html \
2561f50f8d1Sbellard	$(docdir)/qemu-tech.html \
257acd935efSbellard	$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
258d691f669Sbellard
25931e31b8aSbellardifneq ($(wildcard .depend),)
26031e31b8aSbellardinclude .depend
26131e31b8aSbellardendif
2624fb240a4Sbellard
2634fb240a4Sbellard# Include automatically generated dependency files
2644fb240a4Sbellard-include $(wildcard *.d audio/*.d slirp/*.d)
265