hax: Fix some merge problems
[qemu/ar7.git] / Makefile
blob85d530632f2ce65d7fae083f1d5882735022039f
1 # Makefile for QEMU.
3 # Always point to the root of the build tree (needs GNU make).
4 BUILD_DIR=$(CURDIR)
6 # Before including a proper config-host.mak, assume we are in the source tree
7 SRC_PATH=.
9 UNCHECKED_GOALS := %clean TAGS cscope ctags docker docker-%
11 # All following code might depend on configuration variables
12 ifneq ($(wildcard config-host.mak),)
13 # Put the all: rule here so that config-host.mak can contain dependencies.
14 all:
15 include config-host.mak
17 # Check that we're not trying to do an out-of-tree build from
18 # a tree that's been used for an in-tree build.
19 ifneq ($(realpath $(SRC_PATH)),$(realpath .))
20 ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
21 $(error This is an out of tree build but your source tree ($(SRC_PATH)) \
22 seems to have been used for an in-tree build. You can fix this by running \
23 "make distclean && rm -rf *-linux-user *-softmmu" in your source tree)
24 endif
25 endif
27 CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
28 CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
29 CONFIG_ALL=y
30 -include config-all-devices.mak
31 -include config-all-disas.mak
33 config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios
34 @echo $@ is out-of-date, running configure
35 @# TODO: The next lines include code which supports a smooth
36 @# transition from old configurations without config.status.
37 @# This code can be removed after QEMU 1.7.
38 @if test -x config.status; then \
39 ./config.status; \
40 else \
41 sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh; \
43 else
44 config-host.mak:
45 ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
46 @echo "Please call configure before running make!"
47 @exit 1
48 endif
49 endif
51 include $(SRC_PATH)/rules.mak
53 GENERATED_HEADERS = qemu-version.h config-host.h qemu-options.def
54 GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h
55 GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
56 GENERATED_HEADERS += qmp-introspect.h
57 GENERATED_SOURCES += qmp-introspect.c
59 GENERATED_HEADERS += trace/generated-tracers.h
60 ifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace)
61 GENERATED_HEADERS += trace/generated-tracers-dtrace.h
62 endif
63 GENERATED_SOURCES += trace/generated-tracers.c
65 GENERATED_HEADERS += trace/generated-tcg-tracers.h
67 GENERATED_HEADERS += trace/generated-helpers-wrappers.h
68 GENERATED_HEADERS += trace/generated-helpers.h
69 GENERATED_SOURCES += trace/generated-helpers.c
71 ifeq ($(findstring ust,$(TRACE_BACKENDS)),ust)
72 GENERATED_HEADERS += trace/generated-ust-provider.h
73 GENERATED_SOURCES += trace/generated-ust.c
74 endif
76 GENERATED_HEADERS += module_block.h
78 # Don't try to regenerate Makefile or configure
79 # We don't generate any of them
80 Makefile: ;
81 configure: ;
83 .PHONY: all clean cscope dist distclean doc dvi html \
84 info install install-doc install-tools msi \
85 pdf txt recurse-all speed test tools FORCE
87 $(call set-vpath, $(SRC_PATH))
89 LIBS+=-lz $(LIBS_TOOLS)
91 HELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)
93 DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8
94 DOCS+=docs/qemu-qmp-ref.html docs/qemu-qmp-ref.txt docs/qemu-qmp-ref.7
95 DOCS+=docs/qemu-ga-ref.html docs/qemu-ga-ref.txt docs/qemu-ga-ref.7
96 ifdef CONFIG_VIRTFS
97 DOCS+=fsdev/virtfs-proxy-helper.1
98 endif
100 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR)
101 SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
102 SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
104 ifeq ($(SUBDIR_DEVICES_MAK),)
105 config-all-devices.mak:
106 $(call quiet-command,echo '# no devices' > $@,"GEN","$@")
107 else
108 config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
109 $(call quiet-command, sed -n \
110 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
111 $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
112 "GEN","$@")
113 endif
115 -include $(SUBDIR_DEVICES_MAK_DEP)
117 %/config-devices.mak: default-configs/%.mak $(SRC_PATH)/scripts/make_device_config.sh
118 $(call quiet-command, \
119 $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > $@.tmp,"GEN","$@.tmp")
120 $(call quiet-command, if test -f $@; then \
121 if cmp -s $@.old $@; then \
122 mv $@.tmp $@; \
123 cp -p $@ $@.old; \
124 else \
125 if test -f $@.old; then \
126 echo "WARNING: $@ (user modified) out of date.";\
127 else \
128 echo "WARNING: $@ out of date.";\
129 fi; \
130 echo "Run \"make defconfig\" to regenerate."; \
131 rm $@.tmp; \
132 fi; \
133 else \
134 mv $@.tmp $@; \
135 cp -p $@ $@.old; \
136 fi,"GEN","$@");
138 defconfig:
139 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
141 ifneq ($(wildcard config-host.mak),)
142 include $(SRC_PATH)/Makefile.objs
143 endif
145 dummy := $(call unnest-vars,, \
146 stub-obj-y \
147 util-obj-y \
148 qga-obj-y \
149 ivshmem-client-obj-y \
150 ivshmem-server-obj-y \
151 libvhost-user-obj-y \
152 qga-vss-dll-obj-y \
153 block-obj-y \
154 block-obj-m \
155 crypto-obj-y \
156 crypto-aes-obj-y \
157 qom-obj-y \
158 io-obj-y \
159 common-obj-y \
160 common-obj-m)
162 ifneq ($(wildcard config-host.mak),)
163 include $(SRC_PATH)/tests/Makefile.include
164 endif
166 all: recurse-all
168 ifdef BUILD_DOCS
169 all: doc
170 endif
172 ifdef BUILD_TOOLS
173 all: tools
174 endif
176 all: $(HELPERS-y)
177 all: modules
179 doc: $(DOCS)
180 tools: $(TOOLS)
182 qemu-version.h: FORCE
183 $(call quiet-command, \
184 (cd $(SRC_PATH); \
185 printf '#define QEMU_PKGVERSION '; \
186 if test -n "$(PKGVERSION)"; then \
187 printf '"$(PKGVERSION)"\n'; \
188 else \
189 if test -d .git; then \
190 printf '" ('; \
191 git describe --match 'v*' 2>/dev/null | tr -d '\n'; \
192 if ! git diff-index --quiet HEAD &>/dev/null; then \
193 printf -- '-dirty'; \
194 fi; \
195 printf ')"\n'; \
196 else \
197 printf '""\n'; \
198 fi; \
199 fi) > $@.tmp)
200 $(call quiet-command, cmp -s $@ $@.tmp || mv $@.tmp $@)
202 config-host.h: config-host.h-timestamp
203 config-host.h-timestamp: config-host.mak
204 qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
205 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
207 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
208 SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
210 $(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
211 $(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
212 $(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
213 $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
215 subdir-%:
216 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
218 subdir-pixman: pixman/Makefile
219 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pixman V="$(V)" all,)
221 pixman/Makefile: $(SRC_PATH)/pixman/configure
222 (cd pixman; CFLAGS="$(CFLAGS) -fPIC $(extra_cflags) $(extra_ldflags)" $(SRC_PATH)/pixman/configure $(AUTOCONF_HOST) --disable-gtk --disable-shared --enable-static)
224 $(SRC_PATH)/pixman/configure:
225 (cd $(SRC_PATH)/pixman; autoreconf -v --install)
227 DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
228 DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
229 DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
231 subdir-dtc:dtc/libfdt dtc/tests
232 $(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,)
234 dtc/%:
235 mkdir -p $@
237 $(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
239 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
240 # Only keep -O and -g cflags
241 romsubdir-%:
242 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
244 ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
246 recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
248 $(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
249 $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
251 Makefile: $(version-obj-y)
253 ######################################################################
254 # Build libraries
256 libqemustub.a: $(stub-obj-y)
257 libqemuutil.a: $(util-obj-y)
259 ######################################################################
261 qemu-img.o: qemu-img-cmds.h
263 qemu-img$(EXESUF): qemu-img.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) libqemuutil.a libqemustub.a
264 qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) libqemuutil.a libqemustub.a
265 qemu-io$(EXESUF): qemu-io.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) libqemuutil.a libqemustub.a
267 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o libqemuutil.a libqemustub.a
269 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o libqemuutil.a libqemustub.a
270 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
272 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
273 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
275 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
276 qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
278 gen-out-type = $(subst .,-,$(suffix $@))
280 qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
281 qapi-py += $(SRC_PATH)/scripts/qapi2texi.py
283 qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
284 $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
285 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
286 $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
287 "GEN","$@")
288 qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
289 $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
290 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
291 $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
292 "GEN","$@")
293 qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
294 $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
295 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
296 $(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
297 "GEN","$@")
299 qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
300 $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
301 $(SRC_PATH)/qapi/event.json $(SRC_PATH)/qapi/introspect.json \
302 $(SRC_PATH)/qapi/crypto.json $(SRC_PATH)/qapi/rocker.json \
303 $(SRC_PATH)/qapi/trace.json
305 qapi-types.c qapi-types.h :\
306 $(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
307 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
308 $(gen-out-type) -o "." -b $<, \
309 "GEN","$@")
310 qapi-visit.c qapi-visit.h :\
311 $(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
312 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
313 $(gen-out-type) -o "." -b $<, \
314 "GEN","$@")
315 qapi-event.c qapi-event.h :\
316 $(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
317 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
318 $(gen-out-type) -o "." $<, \
319 "GEN","$@")
320 qmp-commands.h qmp-marshal.c :\
321 $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
322 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
323 $(gen-out-type) -o "." $<, \
324 "GEN","$@")
325 qmp-introspect.h qmp-introspect.c :\
326 $(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
327 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
328 $(gen-out-type) -o "." $<, \
329 "GEN","$@")
331 QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
332 $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
334 qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
335 $(call LINK, $^)
337 ifdef QEMU_GA_MSI_ENABLED
338 QEMU_GA_MSI=qemu-ga-$(ARCH).msi
340 msi: $(QEMU_GA_MSI)
342 $(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
344 $(QEMU_GA_MSI): config-host.mak
346 $(QEMU_GA_MSI): $(SRC_PATH)/qga/installer/qemu-ga.wxs
347 $(call quiet-command,QEMU_GA_VERSION="$(QEMU_GA_VERSION)" QEMU_GA_MANUFACTURER="$(QEMU_GA_MANUFACTURER)" QEMU_GA_DISTRO="$(QEMU_GA_DISTRO)" BUILD_DIR="$(BUILD_DIR)" \
348 wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<,"WIXL","$@")
349 else
350 msi:
351 @echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
352 endif
354 ifneq ($(EXESUF),)
355 .PHONY: qemu-ga
356 qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
357 endif
359 ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) libqemuutil.a libqemustub.a
360 $(call LINK, $^)
361 ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) libqemuutil.a libqemustub.a
362 $(call LINK, $^)
364 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
365 $(call quiet-command,$(PYTHON) $< $@ \
366 $(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
367 "GEN","$@")
369 clean:
370 # avoid old build problems by removing potentially incorrect old files
371 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
372 rm -f qemu-options.def
373 rm -f *.msi
374 find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} +
375 rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
376 rm -f fsdev/*.pod
377 rm -f qemu-img-cmds.h
378 rm -f ui/shader/*-vert.h ui/shader/*-frag.h
379 @# May not be present in GENERATED_HEADERS
380 rm -f trace/generated-tracers-dtrace.dtrace*
381 rm -f trace/generated-tracers-dtrace.h*
382 rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
383 rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
384 rm -rf qapi-generated
385 rm -rf qga/qapi-generated
386 for d in $(ALL_SUBDIRS); do \
387 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
388 rm -f $$d/qemu-options.def; \
389 done
390 rm -f $(SUBDIR_DEVICES_MAK) config-all-devices.mak
392 VERSION ?= $(shell cat VERSION)
394 dist: qemu-$(VERSION).tar.bz2
396 qemu-%.tar.bz2:
397 $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
399 distclean: clean
400 rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi qemu-monitor-info.texi
401 rm -f config-all-devices.mak config-all-disas.mak config.status
402 rm -f po/*.mo tests/qemu-iotests/common.env
403 rm -f roms/seabios/config.mak roms/vgabios/config.mak
404 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps
405 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
406 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
407 rm -f qemu-doc.vr
408 rm -f config.log
409 rm -f linux-headers/asm
410 rm -f qemu-ga-qapi.texi qemu-qapi.texi
411 rm -f docs/qemu-qmp-ref.7 docs/qemu-ga-ref.7
412 rm -f docs/qemu-qmp-ref.txt docs/qemu-ga-ref.txt
413 rm -f docs/qemu-qmp-ref.pdf docs/qemu-ga-ref.pdf
414 rm -f docs/qemu-qmp-ref.html docs/qemu-ga-ref.html
415 for d in $(TARGET_DIRS); do \
416 rm -rf $$d || exit 1 ; \
417 done
418 rm -Rf .sdk
419 if test -f pixman/config.log; then $(MAKE) -C pixman distclean; fi
420 if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
422 KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \
423 ar de en-us fi fr-be hr it lv nl pl ru th \
424 common de-ch es fo fr-ca hu ja mk nl-be pt sl tr \
425 bepo cz
427 ifdef INSTALL_BLOBS
428 BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
429 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
430 acpi-dsdt.aml \
431 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
432 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
433 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
434 efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
435 efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
436 efi-e1000e.rom efi-vmxnet3.rom \
437 qemu-icon.bmp qemu_logo_no_text.svg \
438 bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
439 multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \
440 s390-ccw.img \
441 spapr-rtas.bin slof.bin skiboot.lid \
442 palcode-clipper \
443 u-boot.e500
444 else
445 BLOBS=
446 endif
448 install-doc: doc
449 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
450 $(INSTALL_DATA) qemu-doc.html "$(DESTDIR)$(qemu_docdir)"
451 $(INSTALL_DATA) qemu-doc.txt "$(DESTDIR)$(qemu_docdir)"
452 $(INSTALL_DATA) docs/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)"
453 $(INSTALL_DATA) docs/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)"
454 ifdef CONFIG_POSIX
455 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
456 $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
457 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
458 $(INSTALL_DATA) docs/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
459 ifneq ($(TOOLS),)
460 $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
461 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
462 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
463 endif
464 ifneq (,$(findstring qemu-ga,$(TOOLS)))
465 $(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
466 $(INSTALL_DATA) docs/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)"
467 $(INSTALL_DATA) docs/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)"
468 $(INSTALL_DATA) docs/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
469 endif
470 endif
471 ifdef CONFIG_VIRTFS
472 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
473 $(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
474 endif
476 install-datadir:
477 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
479 install-localstatedir:
480 ifdef CONFIG_POSIX
481 ifneq (,$(findstring qemu-ga,$(TOOLS)))
482 $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
483 endif
484 endif
487 install-tools: tools
488 $(call install-prog,$(filter-out qemu-ga,$(TOOLS)),$(DESTDIR)$(bindir))
489 # qemu-ga is included in TOOLS, but we need special install rules for w32
490 ifneq (,$(findstring qemu-ga,$(TOOLS)))
491 $(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
492 endif
495 install: all $(if $(BUILD_DOCS),install-doc) $(if $(BUILD_TOOLS),install-tools) \
496 install-datadir install-localstatedir
497 ifneq ($(CONFIG_MODULES),)
498 $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
499 for s in $(modules-m:.mo=$(DSOSUF)); do \
500 t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
501 $(INSTALL_LIB) $$s "$$t"; \
502 test -z "$(STRIP)" || $(STRIP) "$$t"; \
503 done
504 endif
505 ifneq ($(HELPERS-y),)
506 $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
507 endif
508 ifneq ($(BLOBS),)
509 set -e; for x in $(BLOBS); do \
510 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
511 done
512 endif
513 ifeq ($(CONFIG_GTK),y)
514 $(MAKE) -C po $@
515 endif
516 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
517 set -e; for x in $(KEYMAPS); do \
518 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
519 done
520 $(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
521 for d in $(TARGET_DIRS); do \
522 $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
523 done
525 # various test targets
526 test speed: all
527 $(MAKE) -C tests/tcg $@
529 .PHONY: ctags
530 ctags:
531 rm -f tags
532 find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
534 .PHONY: TAGS
535 TAGS:
536 rm -f TAGS
537 find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
539 cscope:
540 rm -f "$(SRC_PATH)"/cscope.*
541 find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
542 cscope -b -i"$(SRC_PATH)/cscope.files"
544 # opengl shader programs
545 ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
546 @mkdir -p $(dir $@)
547 $(call quiet-command,\
548 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
549 "VERT","$@")
551 ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
552 @mkdir -p $(dir $@)
553 $(call quiet-command,\
554 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
555 "FRAG","$@")
557 ui/console-gl.o: $(SRC_PATH)/ui/console-gl.c \
558 ui/shader/texture-blit-vert.h ui/shader/texture-blit-frag.h
560 # documentation
561 MAKEINFO=makeinfo -D 'VERSION $(VERSION)'
562 MAKEINFOFLAGS=--no-split --number-sections
563 TEXIFLAG=$(if $(V),,--quiet) --command='@set VERSION $(VERSION)'
565 %.html: %.texi
566 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
567 --html $< -o $@,"GEN","$@")
569 %.info: %.texi
570 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
572 %.txt: %.texi
573 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
574 --plaintext $< -o $@,"GEN","$@")
576 %.pdf: %.texi
577 $(call quiet-command,texi2pdf $(TEXIFLAG) -I $(SRC_PATH) -I . $< -o $@,"GEN","$@")
579 qemu-options.texi: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
580 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
582 qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
583 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
585 qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
586 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
588 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
589 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
591 qemu-qapi.texi: $(qapi-modules) $(qapi-py)
592 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN" "$@")
594 qemu-ga-qapi.texi: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
595 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi2texi.py $< > $@,"GEN","$@")
597 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
598 qemu.1: qemu-option-trace.texi
599 qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
600 fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
601 qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
602 qemu-ga.8: qemu-ga.texi
604 html: qemu-doc.html docs/qemu-qmp-ref.html docs/qemu-ga-ref.html
605 info: qemu-doc.info docs/qemu-qmp-ref.info docs/qemu-ga-ref.info
606 pdf: qemu-doc.pdf docs/qemu-qmp-ref.pdf docs/qemu-ga-ref.pdf
607 txt: qemu-doc.txt docs/qemu-qmp-ref.txt docs/qemu-ga-ref.txt
609 qemu-doc.html qemu-doc.info qemu-doc.pdf: \
610 qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \
611 qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
612 qemu-monitor-info.texi
614 docs/qemu-ga-ref.dvi docs/qemu-ga-ref.html docs/qemu-ga-ref.info docs/qemu-ga-ref.pdf docs/qemu-ga-ref.txt docs/qemu-ga-ref.7: \
615 docs/qemu-ga-ref.texi qemu-ga-qapi.texi
617 docs/qemu-qmp-ref.dvi docs/qemu-qmp-ref.html docs/qemu-qmp-ref.info docs/qemu-qmp-ref.pdf docs/qemu-qmp-ref.txt docs/qemu-qmp-ref.7: \
618 docs/qemu-qmp-ref.texi qemu-qapi.texi
621 ifdef CONFIG_WIN32
623 INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
625 nsisflags = -V2 -NOCD
627 ifneq ($(wildcard $(SRC_PATH)/dll),)
628 ifeq ($(ARCH),x86_64)
629 # 64 bit executables
630 DLL_PATH = $(SRC_PATH)/dll/w64
631 nsisflags += -DW64
632 else
633 # 32 bit executables
634 DLL_PATH = $(SRC_PATH)/dll/w32
635 endif
636 endif
638 .PHONY: installer
639 installer: $(INSTALLER)
641 INSTDIR=/tmp/qemu-nsis
643 $(INSTALLER): $(SRC_PATH)/qemu.nsi
644 $(MAKE) install prefix=${INSTDIR}
645 ifdef SIGNCODE
646 (cd ${INSTDIR}; \
647 for i in *.exe; do \
648 $(SIGNCODE) $${i}; \
649 done \
651 endif # SIGNCODE
652 (cd ${INSTDIR}; \
653 for i in qemu-system-*.exe; do \
654 arch=$${i%.exe}; \
655 arch=$${arch#qemu-system-}; \
656 echo Section \"$$arch\" Section_$$arch; \
657 echo SetOutPath \"\$$INSTDIR\"; \
658 echo File \"\$${BINDIR}\\$$i\"; \
659 echo SectionEnd; \
660 done \
661 ) >${INSTDIR}/system-emulations.nsh
662 makensis $(nsisflags) \
663 $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
664 $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
665 -DBINDIR="${INSTDIR}" \
666 $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
667 -DSRCDIR="$(SRC_PATH)" \
668 -DOUTFILE="$(INSTALLER)" \
669 -DDISPLAYVERSION="$(VERSION)" \
670 $(SRC_PATH)/qemu.nsi
671 rm -r ${INSTDIR}
672 ifdef SIGNCODE
673 $(SIGNCODE) $(INSTALLER)
674 endif # SIGNCODE
675 endif # CONFIG_WIN
677 # Add a dependency on the generated files, so that they are always
678 # rebuilt before other object files
679 ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
680 Makefile: $(GENERATED_HEADERS)
681 endif
683 # Include automatically generated dependency files
684 # Dependencies in Makefile.objs files come from our recursive subdir rules
685 -include $(wildcard *.d tests/*.d)
687 include $(SRC_PATH)/tests/docker/Makefile.include
689 .PHONY: help
690 help:
691 @echo 'Generic targets:'
692 @echo ' all - Build all'
693 @echo ' dir/file.o - Build specified target only'
694 @echo ' install - Install QEMU, documentation and tools'
695 @echo ' ctags/TAGS - Generate tags file for editors'
696 @echo ' cscope - Generate cscope index'
697 @echo ''
698 @$(if $(TARGET_DIRS), \
699 echo 'Architecture specific targets:'; \
700 $(foreach t, $(TARGET_DIRS), \
701 printf " %-30s - Build for %s\\n" $(patsubst %,subdir-%,$(t)) $(t);) \
702 echo '')
703 @echo 'Cleaning targets:'
704 @echo ' clean - Remove most generated files but keep the config'
705 @echo ' distclean - Remove all generated files'
706 @echo ' dist - Build a distributable tarball'
707 @echo ''
708 @echo 'Test targets:'
709 @echo ' check - Run all tests (check-help for details)'
710 @echo ' docker - Help about targets running tests inside Docker containers'
711 @echo ''
712 @echo 'Documentation targets:'
713 @echo ' html info pdf txt'
714 @echo ' - Build documentation in specified format'
715 @echo ''
716 ifdef CONFIG_WIN32
717 @echo 'Windows targets:'
718 @echo ' installer - Build NSIS-based installer for QEMU'
719 ifdef QEMU_GA_MSI_ENABLED
720 @echo ' msi - Build MSI-based installer for qemu-ga'
721 endif
722 @echo ''
723 endif
724 @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'