]> git.proxmox.com Git - mirror_qemu.git/blame - Makefile
Fix build failure.
[mirror_qemu.git] / Makefile
CommitLineData
0cb3fb1e
PB
1# Makefile for QEMU.
2
ad064840 3include config-host.mak
766a487a 4
0cb3fb1e
PB
5.PHONY: all clean distclean dvi info install install-doc tar tarbin \
6 speed test test2 html dvi info
7
6f30fa85
TS
8BASE_CFLAGS=
9BASE_LDFLAGS=
10
3142255c
BS
11BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
12BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
13
4fb240a4
FB
14CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP
15CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
16CPPFLAGS += -DQEMU_TOOL
766a487a 17LIBS=
1f50f8d1 18ifdef CONFIG_STATIC
6f30fa85 19BASE_LDFLAGS += -static
1f50f8d1 20endif
cc8ae6de 21ifdef BUILD_DOCS
acd935ef 22DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
cc8ae6de
PB
23else
24DOCS=
25endif
aa05ae6f 26
70956b77 27LIBS+=$(AIOLIBS)
83f64091 28
4fb240a4 29all: libqemu_common.a $(TOOLS) $(DOCS) recurse-all
b9dea4fb 30
4aa42531
PB
31subdir-%: dyngen$(EXESUF)
32 $(MAKE) -C $(subst subdir-,,$@) all
33
34recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
83f64091 35
4fb240a4
FB
36######################################################################
37# libqemu_common.a: target indepedent part of system emulation. The
38# long term path is to suppress *all* target specific code in case of
39# system emulation, i.e. a single QEMU executable should support all
40# CPUs and machines.
47cea614 41
4fb240a4
FB
42OBJS+=cutils.o readline.o console.o
43#OBJS+=block.o block-raw.o
44OBJS+=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
45
46ifdef CONFIG_WIN32
47OBJS+=tap-win32.o
48endif
49
50AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
51ifdef CONFIG_SDL
52AUDIO_OBJS += sdlaudio.o
53endif
54ifdef CONFIG_OSS
55AUDIO_OBJS += ossaudio.o
56endif
57ifdef CONFIG_COREAUDIO
58AUDIO_OBJS += coreaudio.o
59endif
60ifdef CONFIG_ALSA
61AUDIO_OBJS += alsaaudio.o
62endif
63ifdef CONFIG_DSOUND
64AUDIO_OBJS += dsoundaudio.o
65endif
66ifdef CONFIG_FMOD
67AUDIO_OBJS += fmodaudio.o
68audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
69endif
70AUDIO_OBJS+= wavcapture.o
71OBJS+=$(addprefix audio/, $(AUDIO_OBJS))
72
73ifdef CONFIG_SDL
74OBJS+=sdl.o x_keymap.o
75endif
76OBJS+=vnc.o d3des.o
77
78ifdef CONFIG_COCOA
79OBJS+=cocoa.o
80endif
81
82ifdef CONFIG_SLIRP
83CPPFLAGS+=-I$(SRC_PATH)/slirp
84SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
85slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
86tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
87OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
88endif
89
90cocoa.o: cocoa.m
91 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
92
93sdl.o: sdl.c keymaps.c sdl_keysym.h
94 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
95
96vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
97 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
98
99audio/sdlaudio.o: audio/sdlaudio.c
100 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
101
102libqemu_common.a: $(OBJS)
103 rm -f $@
104 $(AR) rcs $@ $(OBJS)
105
106######################################################################
107
108qemu-img$(EXESUF): qemu-img.o block.o block-raw.o libqemu_common.a
109 $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
110
111%.o: %.c
112 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
113
114# dyngen host tool
11d9f695 115dyngen$(EXESUF): dyngen.c
6f30fa85 116 $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
31e31b8a
FB
117
118clean:
2d80ae89 119# avoid old build problems by removing potentially incorrect old files
5fafdf24 120 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
4fb240a4
FB
121 rm -f *.o *.d *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~
122 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d
7d3505c5 123 $(MAKE) -C tests clean
626df76a 124 for d in $(TARGET_DIRS); do \
7d3505c5 125 $(MAKE) -C $$d $@ || exit 1 ; \
626df76a 126 done
31e31b8a 127
7d13299d 128distclean: clean
cc8ae6de 129 rm -f config-host.mak config-host.h $(DOCS)
0cb3fb1e 130 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
76bc6838 131 for d in $(TARGET_DIRS); do \
bc1b050d 132 rm -rf $$d || exit 1 ; \
76bc6838 133 done
7d13299d 134
fed4a9ad
FB
135KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
136ar de en-us fi fr-be hr it lv nl pl ru th \
137common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
138
38954dca
PB
139install-doc: $(DOCS)
140 mkdir -p "$(DESTDIR)$(docdir)"
141 $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
142ifndef CONFIG_WIN32
143 mkdir -p "$(DESTDIR)$(mandir)/man1"
144 $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
145endif
146
147install: all $(if $(BUILD_DOCS),install-doc)
1236cab7 148 mkdir -p "$(DESTDIR)$(bindir)"
932a79df 149ifneq ($(TOOLS),)
6a882643 150 $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
932a79df 151endif
1236cab7 152 mkdir -p "$(DESTDIR)$(datadir)"
ad064840 153 for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
860c6c52 154 video.x openbios-sparc32 pxe-ne2k_pci.bin \
eec85c2a 155 pxe-rtl8139.bin pxe-pcnet.bin; do \
6a882643 156 $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
ad064840 157 done
11d9f695 158ifndef CONFIG_WIN32
1236cab7 159 mkdir -p "$(DESTDIR)$(datadir)/keymaps"
ad064840 160 for x in $(KEYMAPS); do \
6a882643 161 $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
ad064840 162 done
11d9f695 163endif
626df76a 164 for d in $(TARGET_DIRS); do \
7d3505c5 165 $(MAKE) -C $$d $@ || exit 1 ; \
626df76a 166 done
612384d7 167
367e86e8 168# various test targets
82c7e2a4 169test speed test2: all
7d3505c5 170 $(MAKE) -C tests $@
31e31b8a 171
5fafdf24 172TAGS:
b9adb4a6 173 etags *.[ch] tests/*.[ch]
31e31b8a 174
6688bc6d
FB
175cscope:
176 rm -f ./cscope.*
177 find . -name "*.[ch]" -print > ./cscope.files
178 cscope -b
179
3ef693a0 180# documentation
1f673135 181%.html: %.texi
3ef693a0
FB
182 texi2html -monolithic -number $<
183
f3548328
FB
184%.info: %.texi
185 makeinfo $< -o $@
186
187%.dvi: %.texi
188 texi2dvi $<
189
5a67135a 190qemu.1: qemu-doc.texi
ad064840 191 $(SRC_PATH)/texi2pod.pl $< qemu.pod
5a67135a
FB
192 pod2man --section=1 --center=" " --release=" " qemu.pod > $@
193
acd935ef 194qemu-img.1: qemu-img.texi
ad064840 195 $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
acd935ef
FB
196 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
197
0cb3fb1e
PB
198info: qemu-doc.info qemu-tech.info
199
200dvi: qemu-doc.dvi qemu-tech.dvi
201
202html: qemu-doc.html qemu-tech.html
203
df5cf721
TS
204VERSION ?= $(shell cat VERSION)
205FILE = qemu-$(VERSION)
586314f2 206
1e43adfc 207# tar release (use 'make -k tar' on a checkouted tree)
586314f2
FB
208tar:
209 rm -rf /tmp/$(FILE)
1e43adfc 210 cp -r . /tmp/$(FILE)
76b62fd0 211 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS )
586314f2
FB
212 rm -rf /tmp/$(FILE)
213
76b62fd0 214# generate a binary distribution
d691f669 215tarbin:
4887d78b 216 ( cd / ; tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
43095f31 217 $(bindir)/qemu \
7efa4387 218 $(bindir)/qemu-system-ppc \
d4082e95
JM
219 $(bindir)/qemu-system-ppc64 \
220 $(bindir)/qemu-system-ppcemb \
acd935ef 221 $(bindir)/qemu-system-sparc \
43095f31 222 $(bindir)/qemu-system-x86_64 \
93856aac 223 $(bindir)/qemu-system-mips \
38260998 224 $(bindir)/qemu-system-mipsel \
fbe4f65b
TS
225 $(bindir)/qemu-system-mips64 \
226 $(bindir)/qemu-system-mips64el \
ea31eb5b 227 $(bindir)/qemu-system-arm \
ff1aaf65
TS
228 $(bindir)/qemu-system-m68k \
229 $(bindir)/qemu-system-sh4 \
7efa4387
FB
230 $(bindir)/qemu-i386 \
231 $(bindir)/qemu-arm \
ea31eb5b 232 $(bindir)/qemu-armeb \
7efa4387
FB
233 $(bindir)/qemu-sparc \
234 $(bindir)/qemu-ppc \
d4082e95 235 $(bindir)/qemu-ppc64 \
ea31eb5b
FB
236 $(bindir)/qemu-mips \
237 $(bindir)/qemu-mipsel \
540635ba
TS
238 $(bindir)/qemu-mipsn32 \
239 $(bindir)/qemu-mipsn32el \
240 $(bindir)/qemu-mips64 \
241 $(bindir)/qemu-mips64el \
cf6c1b16 242 $(bindir)/qemu-alpha \
ff1aaf65
TS
243 $(bindir)/qemu-m68k \
244 $(bindir)/qemu-sh4 \
b932caba 245 $(bindir)/qemu-img \
7efa4387
FB
246 $(datadir)/bios.bin \
247 $(datadir)/vgabios.bin \
de9258a8 248 $(datadir)/vgabios-cirrus.bin \
637f6cd7 249 $(datadir)/ppc_rom.bin \
d5295253 250 $(datadir)/video.x \
0986ac3b 251 $(datadir)/openbios-sparc32 \
19c80e50
FB
252 $(datadir)/pxe-ne2k_pci.bin \
253 $(datadir)/pxe-rtl8139.bin \
254 $(datadir)/pxe-pcnet.bin \
1f50f8d1
FB
255 $(docdir)/qemu-doc.html \
256 $(docdir)/qemu-tech.html \
acd935ef 257 $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
d691f669 258
31e31b8a
FB
259ifneq ($(wildcard .depend),)
260include .depend
261endif
4fb240a4
FB
262
263# Include automatically generated dependency files
264-include $(wildcard *.d audio/*.d slirp/*.d)