]> git.proxmox.com Git - qemu.git/blame - Makefile
target-arm: Detect tininess before rounding for FP operations
[qemu.git] / Makefile
CommitLineData
0cb3fb1e
PB
1# Makefile for QEMU.
2
df2943ba 3GENERATED_HEADERS = config-host.h trace.h qemu-options.def
b3d08c02
DB
4ifeq ($(TRACE_BACKEND),dtrace)
5GENERATED_HEADERS += trace-dtrace.h
6endif
f527c579 7
55d7e8f6 8ifneq ($(wildcard config-host.mak),)
1ad2134f
PB
9# Put the all: rule here so that config-host.mak can contain dependencies.
10all: build-all
ad064840 11include config-host.mak
17759187 12include $(SRC_PATH)/rules.mak
59bc10ee 13config-host.mak: $(SRC_PATH)/configure
e5efe7f5
JQ
14 @echo $@ is out-of-date, running configure
15 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
55d7e8f6
AJ
16else
17config-host.mak:
18 @echo "Please call configure before running make!"
19 @exit 1
20endif
766a487a 21
d9ace8b3
JQ
22# Don't try to regenerate Makefile or configure
23# We don't generate any of them
24Makefile: ;
25configure: ;
26
818220f5 27.PHONY: all clean cscope distclean dvi html info install install-doc \
20cc9997 28 pdf recurse-all speed tar tarbin test build-all
0cb3fb1e 29
076d2471 30$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
8c462f8f 31
3e2e0e6b 32LIBS+=-lz $(LIBS_TOOLS)
67c0f08d 33
cc8ae6de 34ifdef BUILD_DOCS
b40292e7 35DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
cc8ae6de
PB
36else
37DOCS=
38endif
aa05ae6f 39
1215c6e7 40SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
1f3d3c8f 41SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
bd9141bb 42SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %/config-devices.mak.d, $(TARGET_DIRS))
1f3d3c8f
JQ
43
44config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
01d86a85 45 $(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u > $@," GEN $@")
1f3d3c8f 46
bd9141bb
PB
47-include $(SUBDIR_DEVICES_MAK_DEP)
48
a992fe3d 49%/config-devices.mak: default-configs/%.mak
4c3b5a48 50 $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, " GEN $@")
012f0879 51 @if test -f $@; then \
904fe1fb 52 if cmp -s $@.old $@; then \
bd9141bb
PB
53 mv $@.tmp $@; \
54 cp -p $@ $@.old; \
012f0879
SW
55 else \
56 if test -f $@.old; then \
57 echo "WARNING: $@ (user modified) out of date.";\
58 else \
59 echo "WARNING: $@ out of date.";\
60 fi; \
61 echo "Run \"make defconfig\" to regenerate."; \
62 rm $@.tmp; \
63 fi; \
a992fe3d 64 else \
012f0879
SW
65 mv $@.tmp $@; \
66 cp -p $@ $@.old; \
a992fe3d
PB
67 fi
68
69defconfig:
70 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
71
1f3d3c8f 72-include config-all-devices.mak
1215c6e7 73
f527c579 74build-all: $(DOCS) $(TOOLS) recurse-all
b9dea4fb 75
1215c6e7
JQ
76config-host.h: config-host.h-timestamp
77config-host.h-timestamp: config-host.mak
e14056ad 78qemu-options.def: $(SRC_PATH)/qemu-options.hx
4c3b5a48 79 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
1215c6e7 80
cec7d0b6
PB
81SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
82
f527c579 83subdir-%: $(GENERATED_HEADERS)
0087375e 84 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
4aa42531 85
b88bc808 86ifneq ($(wildcard config-host.mak),)
0e8c9214 87include $(SRC_PATH)/Makefile.objs
b88bc808 88endif
0e8c9214
AF
89
90$(common-obj-y): $(GENERATED_HEADERS)
91f16900 91$(filter %-softmmu,$(SUBDIR_RULES)): $(trace-obj-y) $(common-obj-y) subdir-libdis
c05ac895 92
91f16900 93$(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) $(trace-obj-y) subdir-libdis-user subdir-libuser
add16157 94
c05ac895
PB
95ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
96romsubdir-%:
97 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
98
99ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
100
101recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
83f64091 102
98b068a9 103audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
0e22fd2f 104
a558ee17 105QEMU_CFLAGS+=$(CURL_CFLAGS)
769ce76d 106
3e230dd2 107ui/cocoa.o: ui/cocoa.m
4fb240a4 108
3e230dd2 109ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
0483755a 110
3e230dd2 111ui/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
fb599c9a 112
a558ee17 113bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
4fb240a4 114
9fe6de94
BS
115version.o: $(SRC_PATH)/version.rc config-host.mak
116 $(call quiet-command,$(WINDRES) -I. -o $@ $<," RC $(TARGET_DIR)$@")
117
118version-obj-$(CONFIG_WIN32) += version.o
4fb240a4
FB
119######################################################################
120
3c089e15 121qemu-img.o: qemu-img-cmds.h
6e14404a 122qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o cmd.o: $(GENERATED_HEADERS)
153859be 123
c1b0b93b 124qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) qemu-timer-common.o
0e8c9214 125
c1b0b93b 126qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) qemu-timer-common.o
0e8c9214 127
c1b0b93b 128qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) qemu-timer-common.o
0a8e1acd 129
153859be 130qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
4c3b5a48 131 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
153859be 132
4091da4b
JK
133check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o: $(GENERATED_HEADERS)
134
e71e00ed
LC
135CHECK_PROG_DEPS = qemu-malloc.o $(oslib-obj-y) $(trace-obj-y)
136
137check-qint: check-qint.o qint.o $(CHECK_PROG_DEPS)
138check-qstring: check-qstring.o qstring.o $(CHECK_PROG_DEPS)
139check-qdict: check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o $(CHECK_PROG_DEPS)
140check-qlist: check-qlist.o qlist.o qint.o $(CHECK_PROG_DEPS)
141check-qfloat: check-qfloat.o qfloat.o $(CHECK_PROG_DEPS)
142check-qjson: check-qjson.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o qjson.o json-streamer.o json-lexer.o json-parser.o $(CHECK_PROG_DEPS)
33837ba6 143
111a38b0
RR
144QEMULIBS=libhw32 libhw64 libuser libdis libdis-user
145
31e31b8a 146clean:
2d80ae89 147# avoid old build problems by removing potentially incorrect old files
25be210f 148 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
df2943ba 149 rm -f qemu-options.def
86e840ee 150 rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
3e230dd2 151 rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d fsdev/*.o fsdev/*.d ui/*.o ui/*.d
07b44ce9 152 rm -f qemu-img-cmds.h
d7489b72 153 rm -f trace.c trace.h trace.c-timestamp trace.h-timestamp
b3d08c02
DB
154 rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
155 rm -f trace-dtrace.h trace-dtrace.h-timestamp
7d3505c5 156 $(MAKE) -C tests clean
111a38b0 157 for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \
fc8e320e 158 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
df2943ba 159 rm -f $$d/qemu-options.def; \
626df76a 160 done
31e31b8a 161
7d13299d 162distclean: clean
fc8e320e 163 rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
a992fe3d 164 rm -f config-all-devices.mak
fc8e320e 165 rm -f roms/seabios/config.mak roms/vgabios/config.mak
e1a068b2
HS
166 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.dvi qemu-doc.fn qemu-doc.info qemu-doc.ky qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp qemu-doc.vr
167 rm -f qemu-tech.info qemu-tech.aux qemu-tech.cp qemu-tech.dvi qemu-tech.fn qemu-tech.info qemu-tech.ky qemu-tech.log qemu-tech.pdf qemu-tech.pg qemu-tech.toc qemu-tech.tp qemu-tech.vr
111a38b0 168 for d in $(TARGET_DIRS) $(QEMULIBS); do \
bc1b050d 169 rm -rf $$d || exit 1 ; \
76bc6838 170 done
7d13299d 171
fed4a9ad
FB
172KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
173ar de en-us fi fr-be hr it lv nl pl ru th \
174common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
175
77755340 176ifdef INSTALL_BLOBS
3b3d448e 177BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin \
7943a2fa 178vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \
3b3d448e 179ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc \
5309e5fb 180gpxe-eepro100-80861209.rom \
5309e5fb 181pxe-e1000.bin \
88e2b0a5
SW
182pxe-ne2k_pci.bin pxe-pcnet.bin \
183pxe-rtl8139.bin pxe-virtio.bin \
00914b7d 184bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
fe270d04 185multiboot.bin linuxboot.bin \
39ac8455 186s390-zipl.rom \
a9f8ad8f 187spapr-rtas.bin slof.bin
77755340
TS
188else
189BLOBS=
190endif
191
38954dca 192install-doc: $(DOCS)
58f8aead
AL
193 $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
194 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
96d409eb 195ifdef CONFIG_POSIX
58f8aead
AL
196 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
197 $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
198 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
199 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
38954dca
PB
200endif
201
b5ec5ce0 202install-sysconfig:
990caaf1
AP
203 $(INSTALL_DIR) "$(DESTDIR)$(sysconfdir)/qemu"
204 $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(sysconfdir)/qemu"
b5ec5ce0 205
206install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig
58f8aead 207 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
932a79df 208ifneq ($(TOOLS),)
58f8aead 209 $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
932a79df 210endif
77755340 211ifneq ($(BLOBS),)
58f8aead 212 $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
77755340 213 set -e; for x in $(BLOBS); do \
58f8aead 214 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
ad064840 215 done
77755340 216endif
58f8aead 217 $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
18be8d77 218 set -e; for x in $(KEYMAPS); do \
79fd42aa 219 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
ad064840 220 done
626df76a 221 for d in $(TARGET_DIRS); do \
7d3505c5 222 $(MAKE) -C $$d $@ || exit 1 ; \
626df76a 223 done
612384d7 224
367e86e8 225# various test targets
9b0b8203 226test speed: all
7d3505c5 227 $(MAKE) -C tests $@
31e31b8a 228
21d4e8e3 229.PHONY: TAGS
5fafdf24 230TAGS:
21d4e8e3 231 find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
31e31b8a 232
6688bc6d
FB
233cscope:
234 rm -f ./cscope.*
ede46085 235 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
6688bc6d
FB
236 cscope -b
237
3ef693a0 238# documentation
01668d98
SW
239MAKEINFO=makeinfo
240MAKEINFOFLAGS=--no-headers --no-split --number-sections
20cc9997
SW
241TEXIFLAG=$(if $(V),,--quiet)
242%.dvi: %.texi
243 $(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<," GEN $@")
244
1f673135 245%.html: %.texi
01668d98
SW
246 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \
247 " GEN $@")
3ef693a0 248
f3548328 249%.info: %.texi
01668d98 250 $(call quiet-command,$(MAKEINFO) $< -o $@," GEN $@")
f3548328 251
20cc9997
SW
252%.pdf: %.texi
253 $(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<," GEN $@")
5824d651
BS
254
255qemu-options.texi: $(SRC_PATH)/qemu-options.hx
4c3b5a48 256 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
f3548328 257
acd0a093 258qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
4c3b5a48 259 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
2313086a 260
82a56f0d 261QMP/qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
4c3b5a48 262 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@," GEN $@")
b40292e7 263
153859be 264qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
4c3b5a48 265 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
153859be 266
2313086a 267qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
0d00e563 268 $(call quiet-command, \
4c3b5a48 269 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
0d00e563
AL
270 pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
271 " GEN $@")
5a67135a 272
153859be 273qemu-img.1: qemu-img.texi qemu-img-cmds.texi
0d00e563 274 $(call quiet-command, \
4c3b5a48 275 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-img.pod && \
0d00e563
AL
276 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
277 " GEN $@")
acd935ef 278
7a5ca864 279qemu-nbd.8: qemu-nbd.texi
0d00e563 280 $(call quiet-command, \
4c3b5a48 281 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-nbd.pod && \
0d00e563
AL
282 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
283 " GEN $@")
7a5ca864 284
0cb3fb1e 285dvi: qemu-doc.dvi qemu-tech.dvi
0cb3fb1e 286html: qemu-doc.html qemu-tech.html
20cc9997
SW
287info: qemu-doc.info qemu-tech.info
288pdf: qemu-doc.pdf qemu-tech.pdf
0cb3fb1e 289
20cc9997
SW
290qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
291 qemu-img.texi qemu-nbd.texi qemu-options.texi \
292 qemu-monitor.texi qemu-img-cmds.texi
818220f5 293
df5cf721
TS
294VERSION ?= $(shell cat VERSION)
295FILE = qemu-$(VERSION)
586314f2 296
1e43adfc 297# tar release (use 'make -k tar' on a checkouted tree)
586314f2
FB
298tar:
299 rm -rf /tmp/$(FILE)
1e43adfc 300 cp -r . /tmp/$(FILE)
99c6c082 301 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
586314f2
FB
302 rm -rf /tmp/$(FILE)
303
4c0a6db0
SB
304SYSTEM_TARGETS=$(filter %-softmmu,$(TARGET_DIRS))
305SYSTEM_PROGS=$(patsubst qemu-system-i386,qemu, \
306 $(patsubst %-softmmu,qemu-system-%, \
307 $(SYSTEM_TARGETS)))
308
309USER_TARGETS=$(filter %-user,$(TARGET_DIRS))
310USER_PROGS=$(patsubst %-bsd-user,qemu-%, \
311 $(patsubst %-darwin-user,qemu-%, \
312 $(patsubst %-linux-user,qemu-%, \
313 $(USER_TARGETS))))
314
76b62fd0 315# generate a binary distribution
d691f669 316tarbin:
18be8d77 317 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
4c0a6db0
SB
318 $(patsubst %,$(bindir)/%, $(SYSTEM_PROGS)) \
319 $(patsubst %,$(bindir)/%, $(USER_PROGS)) \
40e8a53b
AJ
320 $(bindir)/qemu-img \
321 $(bindir)/qemu-nbd \
7efa4387
FB
322 $(datadir)/bios.bin \
323 $(datadir)/vgabios.bin \
de9258a8 324 $(datadir)/vgabios-cirrus.bin \
637f6cd7 325 $(datadir)/ppc_rom.bin \
0986ac3b 326 $(datadir)/openbios-sparc32 \
938255d2 327 $(datadir)/openbios-sparc64 \
e5d01b06 328 $(datadir)/openbios-ppc \
40e8a53b 329 $(datadir)/pxe-ne2k_pci.bin \
19c80e50 330 $(datadir)/pxe-rtl8139.bin \
40e8a53b 331 $(datadir)/pxe-pcnet.bin \
2991990b 332 $(datadir)/pxe-e1000.bin \
1f50f8d1
FB
333 $(docdir)/qemu-doc.html \
334 $(docdir)/qemu-tech.html \
40e8a53b
AJ
335 $(mandir)/man1/qemu.1 \
336 $(mandir)/man1/qemu-img.1 \
7a5ca864 337 $(mandir)/man8/qemu-nbd.8
d691f669 338
4fb240a4 339# Include automatically generated dependency files
3e230dd2 340-include $(wildcard *.d audio/*.d slirp/*.d block/*.d net/*.d ui/*.d)