xref: /openbmc/qemu/Makefile (revision 87ecb68b)
10cb3fb1eSpbrook# Makefile for QEMU.
20cb3fb1eSpbrook
3*87ecb68bSpbrookVPATH=$(SRC_PATH):$(SRC_PATH)/hw
4*87ecb68bSpbrook
5ad064840Spbrookinclude config-host.mak
6766a487aSbellard
70cb3fb1eSpbrook.PHONY: all clean distclean dvi info install install-doc tar tarbin \
89b0b8203Sbellard	speed test html dvi info
90cb3fb1eSpbrook
106f30fa85SthsBASE_CFLAGS=
116f30fa85SthsBASE_LDFLAGS=
126f30fa85Sths
133142255cSblueswir1BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
143142255cSblueswir1BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
153142255cSblueswir1
164fb240a4SbellardCPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP
174fb240a4SbellardCPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
18766a487aSbellardLIBS=
191f50f8d1Sbellardifdef CONFIG_STATIC
206f30fa85SthsBASE_LDFLAGS += -static
211f50f8d1Sbellardendif
22cc8ae6deSpbrookifdef BUILD_DOCS
23acd935efSbellardDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
24cc8ae6deSpbrookelse
25cc8ae6deSpbrookDOCS=
26cc8ae6deSpbrookendif
277d13299dSbellard
2870956b77SthsLIBS+=$(AIOLIBS)
2983f64091Sbellard
30da0b0df8Spbrookall: $(TOOLS) $(DOCS) recurse-all
31b9dea4fbSpbrook
32da0b0df8Spbrooksubdir-%: dyngen$(EXESUF) libqemu_common.a
334aa42531Spbrook	$(MAKE) -C $(subst subdir-,,$@) all
344aa42531Spbrook
354aa42531Spbrookrecurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
364aa42531Spbrook
37faf07963Spbrook#######################################################################
38faf07963Spbrook# BLOCK_OBJS is code used by both qemu system emulation and qemu-img
39faf07963Spbrook
40faf07963SpbrookBLOCK_OBJS=cutils.o
41faf07963SpbrookBLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
42faf07963SpbrookBLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
43faf07963SpbrookBLOCK_OBJS+=block-qcow2.o block-parallels.o
44faf07963Spbrook
454fb240a4Sbellard######################################################################
46faf07963Spbrook# libqemu_common.a: Target indepedent part of system emulation. The
474fb240a4Sbellard# long term path is to suppress *all* target specific code in case of
484fb240a4Sbellard# system emulation, i.e. a single QEMU executable should support all
494fb240a4Sbellard# CPUs and machines.
5047cea614Sbellard
51faf07963SpbrookOBJS=$(BLOCK_OBJS)
52faf07963SpbrookOBJS+=readline.o console.o
53faf07963SpbrookOBJS+=block.o
544fb240a4Sbellard
55*87ecb68bSpbrookOBJS+=irq.o
56*87ecb68bSpbrookOBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
57*87ecb68bSpbrookOBJS+=ssd0303.o ssd0323.o ads7846.o
58*87ecb68bSpbrookOBJS+=scsi-disk.o cdrom.o
59*87ecb68bSpbrookOBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o
60*87ecb68bSpbrook
614fb240a4Sbellardifdef CONFIG_WIN32
624fb240a4SbellardOBJS+=tap-win32.o
634fb240a4Sbellardendif
644fb240a4Sbellard
654fb240a4SbellardAUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
664fb240a4Sbellardifdef CONFIG_SDL
674fb240a4SbellardAUDIO_OBJS += sdlaudio.o
684fb240a4Sbellardendif
694fb240a4Sbellardifdef CONFIG_OSS
704fb240a4SbellardAUDIO_OBJS += ossaudio.o
714fb240a4Sbellardendif
724fb240a4Sbellardifdef CONFIG_COREAUDIO
734fb240a4SbellardAUDIO_OBJS += coreaudio.o
744fb240a4Sbellardendif
754fb240a4Sbellardifdef CONFIG_ALSA
764fb240a4SbellardAUDIO_OBJS += alsaaudio.o
774fb240a4Sbellardendif
784fb240a4Sbellardifdef CONFIG_DSOUND
794fb240a4SbellardAUDIO_OBJS += dsoundaudio.o
804fb240a4Sbellardendif
814fb240a4Sbellardifdef CONFIG_FMOD
824fb240a4SbellardAUDIO_OBJS += fmodaudio.o
834fb240a4Sbellardaudio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
844fb240a4Sbellardendif
854fb240a4SbellardAUDIO_OBJS+= wavcapture.o
864fb240a4SbellardOBJS+=$(addprefix audio/, $(AUDIO_OBJS))
874fb240a4Sbellard
884fb240a4Sbellardifdef CONFIG_SDL
894fb240a4SbellardOBJS+=sdl.o x_keymap.o
904fb240a4Sbellardendif
914fb240a4SbellardOBJS+=vnc.o d3des.o
924fb240a4Sbellard
934fb240a4Sbellardifdef CONFIG_COCOA
944fb240a4SbellardOBJS+=cocoa.o
954fb240a4Sbellardendif
964fb240a4Sbellard
974fb240a4Sbellardifdef CONFIG_SLIRP
984fb240a4SbellardCPPFLAGS+=-I$(SRC_PATH)/slirp
994fb240a4SbellardSLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
1004fb240a4Sbellardslirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
1014fb240a4Sbellardtcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
1024fb240a4SbellardOBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
1034fb240a4Sbellardendif
1044fb240a4Sbellard
1054fb240a4Sbellardcocoa.o: cocoa.m
1064fb240a4Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
1074fb240a4Sbellard
1084fb240a4Sbellardsdl.o: sdl.c keymaps.c sdl_keysym.h
1094fb240a4Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
1104fb240a4Sbellard
1114fb240a4Sbellardvnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
1124fb240a4Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
1134fb240a4Sbellard
1144fb240a4Sbellardaudio/sdlaudio.o: audio/sdlaudio.c
1154fb240a4Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
1164fb240a4Sbellard
1174fb240a4Sbellardlibqemu_common.a: $(OBJS)
1184fb240a4Sbellard	rm -f $@
1194fb240a4Sbellard	$(AR) rcs $@ $(OBJS)
1204fb240a4Sbellard
1214fb240a4Sbellard######################################################################
1224fb240a4Sbellard
123faf07963Spbrookqemu-img$(EXESUF): qemu-img.o qemu-img-block.o qemu-img-block-raw.o $(BLOCK_OBJS)
1244fb240a4Sbellard	$(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
1254fb240a4Sbellard
126faf07963Spbrookqemu-img-%.o: %.c
127faf07963Spbrook	$(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG $(BASE_CFLAGS) -c -o $@ $<
128faf07963Spbrook
1294fb240a4Sbellard%.o: %.c
1304fb240a4Sbellard	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
1314fb240a4Sbellard
1324fb240a4Sbellard# dyngen host tool
13311d9f695Sbellarddyngen$(EXESUF): dyngen.c
1346f30fa85Sths	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
13531e31b8aSbellard
13631e31b8aSbellardclean:
1372d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files
1382d80ae89Sbellard	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
1394fb240a4Sbellard	rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~
1404fb240a4Sbellard	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
1417d3505c5Sbellard	$(MAKE) -C tests clean
142626df76aSbellard	for d in $(TARGET_DIRS); do \
1437d3505c5Sbellard	$(MAKE) -C $$d $@ || exit 1 ; \
144626df76aSbellard        done
14531e31b8aSbellard
1467d13299dSbellarddistclean: clean
147cc8ae6deSpbrook	rm -f config-host.mak config-host.h $(DOCS)
1480cb3fb1eSpbrook	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
14976bc6838Sbellard	for d in $(TARGET_DIRS); do \
150bc1b050dSbellard	rm -rf $$d || exit 1 ; \
15176bc6838Sbellard        done
1527d13299dSbellard
153fed4a9adSbellardKEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
154fed4a9adSbellardar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
155fed4a9adSbellardcommon  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
156fed4a9adSbellard
15738954dcaSpbrookinstall-doc: $(DOCS)
15838954dcaSpbrook	mkdir -p "$(DESTDIR)$(docdir)"
15938954dcaSpbrook	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
16038954dcaSpbrookifndef CONFIG_WIN32
16138954dcaSpbrook	mkdir -p "$(DESTDIR)$(mandir)/man1"
16238954dcaSpbrook	$(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
16338954dcaSpbrookendif
16438954dcaSpbrook
16538954dcaSpbrookinstall: all $(if $(BUILD_DOCS),install-doc)
1661236cab7Spbrook	mkdir -p "$(DESTDIR)$(bindir)"
167932a79dfSthsifneq ($(TOOLS),)
1686a882643Spbrook	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
169932a79dfSthsendif
1701236cab7Spbrook	mkdir -p "$(DESTDIR)$(datadir)"
171ad064840Spbrook	for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
172860c6c52Sths		video.x openbios-sparc32 pxe-ne2k_pci.bin \
173eec85c2aSths		pxe-rtl8139.bin pxe-pcnet.bin; do \
1746a882643Spbrook		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
175ad064840Spbrook	done
17611d9f695Sbellardifndef CONFIG_WIN32
1771236cab7Spbrook	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
178ad064840Spbrook	for x in $(KEYMAPS); do \
1796a882643Spbrook		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
180ad064840Spbrook	done
18111d9f695Sbellardendif
182626df76aSbellard	for d in $(TARGET_DIRS); do \
1837d3505c5Sbellard	$(MAKE) -C $$d $@ || exit 1 ; \
184626df76aSbellard        done
185612384d7Sbellard
186367e86e8Sbellard# various test targets
1879b0b8203Sbellardtest speed: all
1887d3505c5Sbellard	$(MAKE) -C tests $@
18931e31b8aSbellard
190367e86e8SbellardTAGS:
191b9adb4a6Sbellard	etags *.[ch] tests/*.[ch]
19231e31b8aSbellard
1936688bc6dSbellardcscope:
1946688bc6dSbellard	rm -f ./cscope.*
1956688bc6dSbellard	find . -name "*.[ch]" -print > ./cscope.files
1966688bc6dSbellard	cscope -b
1976688bc6dSbellard
1983ef693a0Sbellard# documentation
1991f673135Sbellard%.html: %.texi
2003ef693a0Sbellard	texi2html -monolithic -number $<
2013ef693a0Sbellard
202f3548328Sbellard%.info: %.texi
203f3548328Sbellard	makeinfo $< -o $@
204f3548328Sbellard
205f3548328Sbellard%.dvi: %.texi
206f3548328Sbellard	texi2dvi $<
207f3548328Sbellard
2085a67135aSbellardqemu.1: qemu-doc.texi
209ad064840Spbrook	$(SRC_PATH)/texi2pod.pl $< qemu.pod
2105a67135aSbellard	pod2man --section=1 --center=" " --release=" " qemu.pod > $@
2115a67135aSbellard
212acd935efSbellardqemu-img.1: qemu-img.texi
213ad064840Spbrook	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
214acd935efSbellard	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
215acd935efSbellard
2160cb3fb1eSpbrookinfo: qemu-doc.info qemu-tech.info
2170cb3fb1eSpbrook
2180cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi
2190cb3fb1eSpbrook
2200cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html
2210cb3fb1eSpbrook
222df5cf721SthsVERSION ?= $(shell cat VERSION)
223df5cf721SthsFILE = qemu-$(VERSION)
224586314f2Sbellard
2251e43adfcSbellard# tar release (use 'make -k tar' on a checkouted tree)
226586314f2Sbellardtar:
227586314f2Sbellard	rm -rf /tmp/$(FILE)
2281e43adfcSbellard	cp -r . /tmp/$(FILE)
22976b62fd0Sbellard	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
230586314f2Sbellard	rm -rf /tmp/$(FILE)
231586314f2Sbellard
23276b62fd0Sbellard# generate a binary distribution
233d691f669Sbellardtarbin:
2344887d78bSths	( cd / ; tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
23543095f31Sbellard	$(bindir)/qemu \
2367efa4387Sbellard	$(bindir)/qemu-system-ppc \
237d4082e95Sj_mayer	$(bindir)/qemu-system-ppc64 \
238d4082e95Sj_mayer	$(bindir)/qemu-system-ppcemb \
239acd935efSbellard	$(bindir)/qemu-system-sparc \
24043095f31Sbellard	$(bindir)/qemu-system-x86_64 \
24193856aacSbellard	$(bindir)/qemu-system-mips \
24238260998Spbrook	$(bindir)/qemu-system-mipsel \
243fbe4f65bSths	$(bindir)/qemu-system-mips64 \
244fbe4f65bSths	$(bindir)/qemu-system-mips64el \
245ea31eb5bSbellard	$(bindir)/qemu-system-arm \
246ff1aaf65Sths	$(bindir)/qemu-system-m68k \
247ff1aaf65Sths	$(bindir)/qemu-system-sh4 \
2487efa4387Sbellard	$(bindir)/qemu-i386 \
2497efa4387Sbellard        $(bindir)/qemu-arm \
250ea31eb5bSbellard        $(bindir)/qemu-armeb \
2517efa4387Sbellard        $(bindir)/qemu-sparc \
2527efa4387Sbellard        $(bindir)/qemu-ppc \
253d4082e95Sj_mayer        $(bindir)/qemu-ppc64 \
254ea31eb5bSbellard        $(bindir)/qemu-mips \
255ea31eb5bSbellard        $(bindir)/qemu-mipsel \
256540635baSths        $(bindir)/qemu-mipsn32 \
257540635baSths        $(bindir)/qemu-mipsn32el \
258540635baSths        $(bindir)/qemu-mips64 \
259540635baSths        $(bindir)/qemu-mips64el \
260cf6c1b16Sj_mayer        $(bindir)/qemu-alpha \
261ff1aaf65Sths        $(bindir)/qemu-m68k \
262ff1aaf65Sths        $(bindir)/qemu-sh4 \
263b932cabaSbellard        $(bindir)/qemu-img \
2647efa4387Sbellard	$(datadir)/bios.bin \
2657efa4387Sbellard	$(datadir)/vgabios.bin \
266de9258a8Sbellard	$(datadir)/vgabios-cirrus.bin \
267637f6cd7Sbellard	$(datadir)/ppc_rom.bin \
268d5295253Sbellard	$(datadir)/video.x \
2690986ac3bSbellard	$(datadir)/openbios-sparc32 \
27019c80e50Sbellard        $(datadir)/pxe-ne2k_pci.bin \
27119c80e50Sbellard	$(datadir)/pxe-rtl8139.bin \
27219c80e50Sbellard        $(datadir)/pxe-pcnet.bin \
2731f50f8d1Sbellard	$(docdir)/qemu-doc.html \
2741f50f8d1Sbellard	$(docdir)/qemu-tech.html \
275acd935efSbellard	$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
276d691f669Sbellard
27731e31b8aSbellardifneq ($(wildcard .depend),)
27831e31b8aSbellardinclude .depend
27931e31b8aSbellardendif
2804fb240a4Sbellard
2814fb240a4Sbellard# Include automatically generated dependency files
2824fb240a4Sbellard-include $(wildcard *.d audio/*.d slirp/*.d)
283