virtagent: Makefile fixups
[qemu/mdroth.git] / Makefile
blobf17be99035f6cd7253768e8f46a6195ef8c246ae
1 # Makefile for QEMU.
3 GENERATED_HEADERS = config-host.h trace.h qemu-options.def
4 ifeq ($(TRACE_BACKEND),dtrace)
5 GENERATED_HEADERS += trace-dtrace.h
6 endif
8 ifneq ($(wildcard config-host.mak),)
9 # Put the all: rule here so that config-host.mak can contain dependencies.
10 all: build-all
11 include config-host.mak
12 include $(SRC_PATH)/rules.mak
13 config-host.mak: $(SRC_PATH)/configure
14 @echo $@ is out-of-date, running configure
15 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
16 else
17 config-host.mak:
18 @echo "Please call configure before running make!"
19 @exit 1
20 endif
22 # Don't try to regenerate Makefile or configure
23 # We don't generate any of them
24 Makefile: ;
25 configure: ;
27 .PHONY: all clean cscope distclean dvi html info install install-doc \
28 pdf recurse-all speed tar tarbin test build-all
30 $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
32 LIBS+=-lz $(LIBS_TOOLS)
34 ifdef BUILD_DOCS
35 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
36 else
37 DOCS=
38 endif
40 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
41 SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
43 config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
44 $(call quiet-command,cat $(SUBDIR_DEVICES_MAK) | grep =y | sort -u > $@," GEN $@")
46 %/config-devices.mak: default-configs/%.mak
47 $(call quiet-command,cat $< > $@.tmp, " GEN $@")
48 @if test -f $@; then \
49 if cmp -s $@.old $@; then \
50 if ! cmp -s $@ $@.tmp; then \
51 mv $@.tmp $@; \
52 cp -p $@ $@.old; \
53 fi; \
54 else \
55 if test -f $@.old; then \
56 echo "WARNING: $@ (user modified) out of date.";\
57 else \
58 echo "WARNING: $@ out of date.";\
59 fi; \
60 echo "Run \"make defconfig\" to regenerate."; \
61 rm $@.tmp; \
62 fi; \
63 else \
64 mv $@.tmp $@; \
65 cp -p $@ $@.old; \
68 defconfig:
69 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
71 -include config-all-devices.mak
73 build-all: $(DOCS) $(TOOLS) recurse-all
75 config-host.h: config-host.h-timestamp
76 config-host.h-timestamp: config-host.mak
77 qemu-options.def: $(SRC_PATH)/qemu-options.hx
78 $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $@")
80 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
82 subdir-%: $(GENERATED_HEADERS)
83 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
85 ifneq ($(wildcard config-host.mak),)
86 include $(SRC_PATH)/Makefile.objs
87 endif
89 $(common-obj-y): $(GENERATED_HEADERS)
90 $(filter %-softmmu,$(SUBDIR_RULES)): $(trace-obj-y) $(common-obj-y) subdir-libdis
92 $(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) $(trace-obj-y) subdir-libdis-user subdir-libuser
94 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
95 romsubdir-%:
96 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
98 ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
100 recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
102 audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
104 QEMU_CFLAGS+=$(CURL_CFLAGS)
106 ui/cocoa.o: ui/cocoa.m
108 ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
110 ui/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
112 bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
114 ifeq ($(TRACE_BACKEND),dtrace)
115 trace.h: trace.h-timestamp trace-dtrace.h
116 else
117 trace.h: trace.h-timestamp
118 endif
119 trace.h-timestamp: $(SRC_PATH)/trace-events config-host.mak
120 $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -h < $< > $@," GEN trace.h")
121 @cmp -s $@ trace.h || cp $@ trace.h
123 trace.c: trace.c-timestamp
124 trace.c-timestamp: $(SRC_PATH)/trace-events config-host.mak
125 $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -c < $< > $@," GEN trace.c")
126 @cmp -s $@ trace.c || cp $@ trace.c
128 trace.o: trace.c $(GENERATED_HEADERS)
130 trace-dtrace.h: trace-dtrace.dtrace
131 $(call quiet-command,dtrace -o $@ -h -s $<, " GEN trace-dtrace.h")
133 # Normal practice is to name DTrace probe file with a '.d' extension
134 # but that gets picked up by QEMU's Makefile as an external dependancy
135 # rule file. So we use '.dtrace' instead
136 trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp
137 trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events config-host.mak
138 $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -d < $< > $@," GEN trace-dtrace.dtrace")
139 @cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace
141 trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS)
142 $(call quiet-command,dtrace -o $@ -G -s $<, " GEN trace-dtrace.o")
144 simpletrace.o: simpletrace.c $(GENERATED_HEADERS)
146 version.o: $(SRC_PATH)/version.rc config-host.mak
147 $(call quiet-command,$(WINDRES) -I. -o $@ $<," RC $(TARGET_DIR)$@")
149 version-obj-$(CONFIG_WIN32) += version.o
150 ######################################################################
152 qemu-img.o: qemu-img-cmds.h
153 qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o qemu-vp.o: $(GENERATED_HEADERS)
155 qemu-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
157 qemu-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
159 qemu-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
161 qemu-vp$(EXESUF): qemu-vp.o virtproxy.o virtagent.o virtagent-daemon.o virtagent-common.o qemu-tool.o qemu-error.o qemu-sockets.c $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y)
163 qemu-vp$(EXESUF): qemu-vp.o virtproxy.o virtagent.o virtagent-daemon.o virtagent-common.o qemu-tool.o qemu-error.o qemu-sockets.c $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) qemu-timer-common.o
165 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
166 $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $@")
168 check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o: $(GENERATED_HEADERS)
170 check-qint: check-qint.o qint.o qemu-malloc.o $(trace-obj-y)
171 check-qstring: check-qstring.o qstring.o qemu-malloc.o $(trace-obj-y)
172 check-qdict: check-qdict.o qdict.o qfloat.o qint.o qstring.o qbool.o qemu-malloc.o qlist.o $(trace-obj-y)
173 check-qlist: check-qlist.o qlist.o qint.o qemu-malloc.o $(trace-obj-y)
174 check-qfloat: check-qfloat.o qfloat.o qemu-malloc.o $(trace-obj-y)
175 check-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 qemu-malloc.o $(trace-obj-y)
177 clean:
178 # avoid old build problems by removing potentially incorrect old files
179 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
180 rm -f qemu-options.def
181 rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
182 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
183 rm -f qemu-img-cmds.h
184 rm -f trace.c trace.h trace.c-timestamp trace.h-timestamp
185 rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
186 rm -f trace-dtrace.h trace-dtrace.h-timestamp
187 $(MAKE) -C tests clean
188 for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser libdis libdis-user; do \
189 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
190 rm -f $$d/qemu-options.def; \
191 done
193 distclean: clean
194 rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
195 rm -f config-all-devices.mak
196 rm -f roms/seabios/config.mak roms/vgabios/config.mak
197 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
198 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
199 for d in $(TARGET_DIRS) libhw32 libhw64 libuser libdis libdis-user; do \
200 rm -rf $$d || exit 1 ; \
201 done
203 KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
204 ar de en-us fi fr-be hr it lv nl pl ru th \
205 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr
207 ifdef INSTALL_BLOBS
208 BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin \
209 vgabios-stdvga.bin vgabios-vmware.bin \
210 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc \
211 gpxe-eepro100-80861209.rom \
212 gpxe-eepro100-80861229.rom \
213 pxe-e1000.bin \
214 pxe-ne2k_pci.bin pxe-pcnet.bin \
215 pxe-rtl8139.bin pxe-virtio.bin \
216 bamboo.dtb petalogix-s3adsp1800.dtb \
217 multiboot.bin linuxboot.bin \
218 s390-zipl.rom
219 else
220 BLOBS=
221 endif
223 install-doc: $(DOCS)
224 $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
225 $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
226 ifdef CONFIG_POSIX
227 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
228 $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
229 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
230 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
231 endif
233 install-sysconfig:
234 $(INSTALL_DIR) "$(DESTDIR)$(sysconfdir)/qemu"
235 $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(sysconfdir)/qemu"
237 install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig
238 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
239 ifneq ($(TOOLS),)
240 $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
241 endif
242 ifneq ($(BLOBS),)
243 $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
244 set -e; for x in $(BLOBS); do \
245 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
246 done
247 endif
248 $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
249 set -e; for x in $(KEYMAPS); do \
250 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
251 done
252 for d in $(TARGET_DIRS); do \
253 $(MAKE) -C $$d $@ || exit 1 ; \
254 done
256 # various test targets
257 test speed: all
258 $(MAKE) -C tests $@
260 .PHONY: TAGS
261 TAGS:
262 find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
264 cscope:
265 rm -f ./cscope.*
266 find . -name "*.[ch]" -print | sed 's,^\./,,' > ./cscope.files
267 cscope -b
269 # documentation
270 MAKEINFO=makeinfo
271 MAKEINFOFLAGS=--no-headers --no-split --number-sections
272 TEXIFLAG=$(if $(V),,--quiet)
273 %.dvi: %.texi
274 $(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<," GEN $@")
276 %.html: %.texi
277 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \
278 " GEN $@")
280 %.info: %.texi
281 $(call quiet-command,$(MAKEINFO) $< -o $@," GEN $@")
283 %.pdf: %.texi
284 $(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<," GEN $@")
286 qemu-options.texi: $(SRC_PATH)/qemu-options.hx
287 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
289 qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
290 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
292 QMP/qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
293 $(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@," GEN $@")
295 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
296 $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
298 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
299 $(call quiet-command, \
300 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu.pod && \
301 pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
302 " GEN $@")
304 qemu-img.1: qemu-img.texi qemu-img-cmds.texi
305 $(call quiet-command, \
306 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \
307 pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
308 " GEN $@")
310 qemu-nbd.8: qemu-nbd.texi
311 $(call quiet-command, \
312 perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \
313 pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
314 " GEN $@")
316 dvi: qemu-doc.dvi qemu-tech.dvi
317 html: qemu-doc.html qemu-tech.html
318 info: qemu-doc.info qemu-tech.info
319 pdf: qemu-doc.pdf qemu-tech.pdf
321 qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
322 qemu-img.texi qemu-nbd.texi qemu-options.texi \
323 qemu-monitor.texi qemu-img-cmds.texi
325 VERSION ?= $(shell cat VERSION)
326 FILE = qemu-$(VERSION)
328 # tar release (use 'make -k tar' on a checkouted tree)
329 tar:
330 rm -rf /tmp/$(FILE)
331 cp -r . /tmp/$(FILE)
332 cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn
333 rm -rf /tmp/$(FILE)
335 SYSTEM_TARGETS=$(filter %-softmmu,$(TARGET_DIRS))
336 SYSTEM_PROGS=$(patsubst qemu-system-i386,qemu, \
337 $(patsubst %-softmmu,qemu-system-%, \
338 $(SYSTEM_TARGETS)))
340 USER_TARGETS=$(filter %-user,$(TARGET_DIRS))
341 USER_PROGS=$(patsubst %-bsd-user,qemu-%, \
342 $(patsubst %-darwin-user,qemu-%, \
343 $(patsubst %-linux-user,qemu-%, \
344 $(USER_TARGETS))))
346 # generate a binary distribution
347 tarbin:
348 cd / && tar zcvf ~/qemu-$(VERSION)-$(ARCH).tar.gz \
349 $(patsubst %,$(bindir)/%, $(SYSTEM_PROGS)) \
350 $(patsubst %,$(bindir)/%, $(USER_PROGS)) \
351 $(bindir)/qemu-img \
352 $(bindir)/qemu-nbd \
353 $(datadir)/bios.bin \
354 $(datadir)/vgabios.bin \
355 $(datadir)/vgabios-cirrus.bin \
356 $(datadir)/ppc_rom.bin \
357 $(datadir)/openbios-sparc32 \
358 $(datadir)/openbios-sparc64 \
359 $(datadir)/openbios-ppc \
360 $(datadir)/pxe-ne2k_pci.bin \
361 $(datadir)/pxe-rtl8139.bin \
362 $(datadir)/pxe-pcnet.bin \
363 $(datadir)/pxe-e1000.bin \
364 $(docdir)/qemu-doc.html \
365 $(docdir)/qemu-tech.html \
366 $(mandir)/man1/qemu.1 \
367 $(mandir)/man1/qemu-img.1 \
368 $(mandir)/man8/qemu-nbd.8
370 # Include automatically generated dependency files
371 -include $(wildcard *.d audio/*.d slirp/*.d block/*.d net/*.d ui/*.d)