]> git.proxmox.com Git - qemu.git/blame - Makefile
target-arm: Fix garbage collection of temporaries in Neon emulation.
[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
b3d08c02
DB
115ifeq ($(TRACE_BACKEND),dtrace)
116trace.h: trace.h-timestamp trace-dtrace.h
117else
a82cdd58 118trace.h: trace.h-timestamp
b3d08c02 119endif
a82cdd58 120trace.h-timestamp: $(SRC_PATH)/trace-events config-host.mak
4c3b5a48 121 $(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -h < $< > $@," GEN trace.h")
a82cdd58
BS
122 @cmp -s $@ trace.h || cp $@ trace.h
123
124trace.c: trace.c-timestamp
125trace.c-timestamp: $(SRC_PATH)/trace-events config-host.mak
4c3b5a48 126 $(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -c < $< > $@," GEN trace.c")
a82cdd58 127 @cmp -s $@ trace.c || cp $@ trace.c
94a420b1
SH
128
129trace.o: trace.c $(GENERATED_HEADERS)
130
b3d08c02
DB
131trace-dtrace.h: trace-dtrace.dtrace
132 $(call quiet-command,dtrace -o $@ -h -s $<, " GEN trace-dtrace.h")
133
134# Normal practice is to name DTrace probe file with a '.d' extension
135# but that gets picked up by QEMU's Makefile as an external dependancy
136# rule file. So we use '.dtrace' instead
137trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp
138trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events config-host.mak
4c3b5a48 139 $(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -d < $< > $@," GEN trace-dtrace.dtrace")
b3d08c02
DB
140 @cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace
141
142trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS)
143 $(call quiet-command,dtrace -o $@ -G -s $<, " GEN trace-dtrace.o")
144
26f7227b
SH
145simpletrace.o: simpletrace.c $(GENERATED_HEADERS)
146
9fe6de94
BS
147version.o: $(SRC_PATH)/version.rc config-host.mak
148 $(call quiet-command,$(WINDRES) -I. -o $@ $<," RC $(TARGET_DIR)$@")
149
150version-obj-$(CONFIG_WIN32) += version.o
4fb240a4
FB
151######################################################################
152
3c089e15 153qemu-img.o: qemu-img-cmds.h
6e14404a 154qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o cmd.o: $(GENERATED_HEADERS)
153859be 155
c1b0b93b 156qemu-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 157
c1b0b93b 158qemu-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 159
c1b0b93b 160qemu-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 161
153859be 162qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
4c3b5a48 163 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@")
153859be 164
4091da4b
JK
165check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o: $(GENERATED_HEADERS)
166
e71e00ed
LC
167CHECK_PROG_DEPS = qemu-malloc.o $(oslib-obj-y) $(trace-obj-y)
168
169check-qint: check-qint.o qint.o $(CHECK_PROG_DEPS)
170check-qstring: check-qstring.o qstring.o $(CHECK_PROG_DEPS)
171check-qdict: check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qlist.o $(CHECK_PROG_DEPS)
172check-qlist: check-qlist.o qlist.o qint.o $(CHECK_PROG_DEPS)
173check-qfloat: check-qfloat.o qfloat.o $(CHECK_PROG_DEPS)
174check-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 175
31e31b8a 176clean:
2d80ae89 177# avoid old build problems by removing potentially incorrect old files
25be210f 178 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 179 rm -f qemu-options.def
86e840ee 180 rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
3e230dd2 181 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 182 rm -f qemu-img-cmds.h
d7489b72 183 rm -f trace.c trace.h trace.c-timestamp trace.h-timestamp
b3d08c02
DB
184 rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
185 rm -f trace-dtrace.h trace-dtrace.h-timestamp
7d3505c5 186 $(MAKE) -C tests clean
4d904533 187 for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser libdis libdis-user; do \
fc8e320e 188 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
df2943ba 189 rm -f $$d/qemu-options.def; \
626df76a 190 done
31e31b8a 191
7d13299d 192distclean: clean
fc8e320e 193 rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
a992fe3d 194 rm -f config-all-devices.mak
fc8e320e 195 rm -f roms/seabios/config.mak roms/vgabios/config.mak
e1a068b2
HS
196 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
197 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
4d904533 198 for d in $(TARGET_DIRS) libhw32 libhw64 libuser libdis libdis-user; do \
bc1b050d 199 rm -rf $$d || exit 1 ; \
76bc6838 200 done
7d13299d 201
fed4a9ad
FB
202KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
203ar de en-us fi fr-be hr it lv nl pl ru th \
204common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
205
77755340 206ifdef INSTALL_BLOBS
3b3d448e 207BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin \
7943a2fa 208vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \
3b3d448e 209ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc \
5309e5fb 210gpxe-eepro100-80861209.rom \
5309e5fb 211pxe-e1000.bin \
88e2b0a5
SW
212pxe-ne2k_pci.bin pxe-pcnet.bin \
213pxe-rtl8139.bin pxe-virtio.bin \
253d0942 214bamboo.dtb petalogix-s3adsp1800.dtb \
fe270d04
AG
215multiboot.bin linuxboot.bin \
216s390-zipl.rom
77755340
TS
217else
218BLOBS=
219endif
220
38954dca 221install-doc: $(DOCS)
58f8aead
AL
222 $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
223 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
96d409eb 224ifdef CONFIG_POSIX
58f8aead
AL
225 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
226 $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
227 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
228 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
38954dca
PB
229endif
230
b5ec5ce0 231install-sysconfig:
990caaf1
AP
232 $(INSTALL_DIR) "$(DESTDIR)$(sysconfdir)/qemu"
233 $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(sysconfdir)/qemu"
b5ec5ce0 234
235install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig
58f8aead 236 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
932a79df 237ifneq ($(TOOLS),)
58f8aead 238 $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
932a79df 239endif
77755340 240ifneq ($(BLOBS),)
58f8aead 241 $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
77755340 242 set -e; for x in $(BLOBS); do \
58f8aead 243 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
ad064840 244 done
77755340 245endif
58f8aead 246 $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
18be8d77 247 set -e; for x in $(KEYMAPS); do \
79fd42aa 248 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
ad064840 249 done
626df76a 250 for d in $(TARGET_DIRS); do \
7d3505c5 251 $(MAKE) -C $$d $@ || exit 1 ; \
626df76a 252 done
612384d7 253
367e86e8 254# various test targets
9b0b8203 255test speed: all
7d3505c5 256 $(MAKE) -C tests $@
31e31b8a 257
21d4e8e3 258.PHONY: TAGS
5fafdf24 259TAGS:
21d4e8e3 260 find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
31e31b8a 261
6688bc6d
FB
262cscope:
263 rm -f ./cscope.*
ede46085 264 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
6688bc6d
FB
265 cscope -b
266
3ef693a0 267# documentation
01668d98
SW
268MAKEINFO=makeinfo
269MAKEINFOFLAGS=--no-headers --no-split --number-sections
20cc9997
SW
270TEXIFLAG=$(if $(V),,--quiet)
271%.dvi: %.texi
272 $(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<," GEN $@")
273
1f673135 274%.html: %.texi
01668d98
SW
275 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \
276 " GEN $@")
3ef693a0 277
f3548328 278%.info: %.texi
01668d98 279 $(call quiet-command,$(MAKEINFO) $< -o $@," GEN $@")
f3548328 280
20cc9997
SW
281%.pdf: %.texi
282 $(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<," GEN $@")
5824d651
BS
283
284qemu-options.texi: $(SRC_PATH)/qemu-options.hx
4c3b5a48 285 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
f3548328 286
acd0a093 287qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
4c3b5a48 288 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
2313086a 289
82a56f0d 290QMP/qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
4c3b5a48 291 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@," GEN $@")
b40292e7 292
153859be 293qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
4c3b5a48 294 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@")
153859be 295
2313086a 296qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
0d00e563 297 $(call quiet-command, \
4c3b5a48 298 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
0d00e563
AL
299 pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
300 " GEN $@")
5a67135a 301
153859be 302qemu-img.1: qemu-img.texi qemu-img-cmds.texi
0d00e563 303 $(call quiet-command, \
4c3b5a48 304 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-img.pod && \
0d00e563
AL
305 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
306 " GEN $@")
acd935ef 307
7a5ca864 308qemu-nbd.8: qemu-nbd.texi
0d00e563 309 $(call quiet-command, \
4c3b5a48 310 perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-nbd.pod && \
0d00e563
AL
311 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
312 " GEN $@")
7a5ca864 313
0cb3fb1e 314dvi: qemu-doc.dvi qemu-tech.dvi
0cb3fb1e 315html: qemu-doc.html qemu-tech.html
20cc9997
SW
316info: qemu-doc.info qemu-tech.info
317pdf: qemu-doc.pdf qemu-tech.pdf
0cb3fb1e 318
20cc9997
SW
319qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
320 qemu-img.texi qemu-nbd.texi qemu-options.texi \
321 qemu-monitor.texi qemu-img-cmds.texi
818220f5 322
df5cf721
TS
323VERSION ?= $(shell cat VERSION)
324FILE = qemu-$(VERSION)
586314f2 325
1e43adfc 326# tar release (use 'make -k tar' on a checkouted tree)
586314f2
FB
327tar:
328 rm -rf /tmp/$(FILE)
1e43adfc 329 cp -r . /tmp/$(FILE)
99c6c082 330 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
586314f2
FB
331 rm -rf /tmp/$(FILE)
332
4c0a6db0
SB
333SYSTEM_TARGETS=$(filter %-softmmu,$(TARGET_DIRS))
334SYSTEM_PROGS=$(patsubst qemu-system-i386,qemu, \
335 $(patsubst %-softmmu,qemu-system-%, \
336 $(SYSTEM_TARGETS)))
337
338USER_TARGETS=$(filter %-user,$(TARGET_DIRS))
339USER_PROGS=$(patsubst %-bsd-user,qemu-%, \
340 $(patsubst %-darwin-user,qemu-%, \
341 $(patsubst %-linux-user,qemu-%, \
342 $(USER_TARGETS))))
343
76b62fd0 344# generate a binary distribution
d691f669 345tarbin:
18be8d77 346 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
4c0a6db0
SB
347 $(patsubst %,$(bindir)/%, $(SYSTEM_PROGS)) \
348 $(patsubst %,$(bindir)/%, $(USER_PROGS)) \
40e8a53b
AJ
349 $(bindir)/qemu-img \
350 $(bindir)/qemu-nbd \
7efa4387
FB
351 $(datadir)/bios.bin \
352 $(datadir)/vgabios.bin \
de9258a8 353 $(datadir)/vgabios-cirrus.bin \
637f6cd7 354 $(datadir)/ppc_rom.bin \
0986ac3b 355 $(datadir)/openbios-sparc32 \
938255d2 356 $(datadir)/openbios-sparc64 \
e5d01b06 357 $(datadir)/openbios-ppc \
40e8a53b 358 $(datadir)/pxe-ne2k_pci.bin \
19c80e50 359 $(datadir)/pxe-rtl8139.bin \
40e8a53b 360 $(datadir)/pxe-pcnet.bin \
2991990b 361 $(datadir)/pxe-e1000.bin \
1f50f8d1
FB
362 $(docdir)/qemu-doc.html \
363 $(docdir)/qemu-tech.html \
40e8a53b
AJ
364 $(mandir)/man1/qemu.1 \
365 $(mandir)/man1/qemu-img.1 \
7a5ca864 366 $(mandir)/man8/qemu-nbd.8
d691f669 367
4fb240a4 368# Include automatically generated dependency files
3e230dd2 369-include $(wildcard *.d audio/*.d slirp/*.d block/*.d net/*.d ui/*.d)