xref: /openbmc/qemu/Makefile (revision 64ed6f92)
10cb3fb1eSpbrook# Makefile for QEMU.
20cb3fb1eSpbrook
34ace32e2SAntonio Ospiteifneq ($(words $(subst :, ,$(CURDIR))), 1)
44ace32e2SAntonio Ospite  $(error main directory cannot contain spaces nor colons)
54ace32e2SAntonio Ospiteendif
64ace32e2SAntonio Ospite
7519e1693SStefan Weil# Always point to the root of the build tree (needs GNU make).
8519e1693SStefan WeilBUILD_DIR=$(CURDIR)
9388d4758SLluís Vilanova
10eaa2ddbbSFam Zheng# Before including a proper config-host.mak, assume we are in the source tree
11eaa2ddbbSFam ZhengSRC_PATH=.
12eaa2ddbbSFam Zheng
1328fa2927SPhilippe Mathieu-DaudéUNCHECKED_GOALS := %clean TAGS cscope ctags dist \
1428fa2927SPhilippe Mathieu-Daudé    html info pdf txt \
15de1da442SMarc-André Lureau    help check-help print-% \
164f2f6276SPhilippe Mathieu-Daudé    docker docker-% vm-help vm-test vm-build-%
17eaa2ddbbSFam Zheng
18250b086eSLluís Vilanova# All following code might depend on configuration variables
1955d7e8f6Saurel32ifneq ($(wildcard config-host.mak),)
201ad2134fSPaul Brook# Put the all: rule here so that config-host.mak can contain dependencies.
218f67aa82SStefan Weilall:
22ad064840Spbrookinclude config-host.mak
23d1bd2423SPeter Maydell
24aef45d51SDaniel P. Berrangegit-submodule-update:
25aef45d51SDaniel P. Berrange
26aef45d51SDaniel P. Berrange.PHONY: git-submodule-update
27aef45d51SDaniel P. Berrange
28aef45d51SDaniel P. Berrangegit_module_status := $(shell \
29aef45d51SDaniel P. Berrange  cd '$(SRC_PATH)' && \
30cc84d63aSDaniel P. Berrange  GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
31aef45d51SDaniel P. Berrange  echo $$?; \
32aef45d51SDaniel P. Berrange)
33aef45d51SDaniel P. Berrange
34aef45d51SDaniel P. Berrangeifeq (1,$(git_module_status))
35f62bbee5SDaniel P. Berrangeifeq (no,$(GIT_UPDATE))
36f62bbee5SDaniel P. Berrangegit-submodule-update:
37f62bbee5SDaniel P. Berrange	$(call quiet-command, \
38f62bbee5SDaniel P. Berrange            echo && \
39f62bbee5SDaniel P. Berrange            echo "GIT submodule checkout is out of date. Please run" && \
40f62bbee5SDaniel P. Berrange            echo "  scripts/git-submodule.sh update $(GIT_SUBMODULES)" && \
41f62bbee5SDaniel P. Berrange            echo "from the source directory checkout $(SRC_PATH)" && \
42f62bbee5SDaniel P. Berrange            echo && \
43f62bbee5SDaniel P. Berrange            exit 1)
44f62bbee5SDaniel P. Berrangeelse
45aef45d51SDaniel P. Berrangegit-submodule-update:
46aef45d51SDaniel P. Berrange	$(call quiet-command, \
47cc84d63aSDaniel P. Berrange          (cd $(SRC_PATH) && GIT="$(GIT)" ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \
48aef45d51SDaniel P. Berrange          "GIT","$(GIT_SUBMODULES)")
49aef45d51SDaniel P. Berrangeendif
50aef45d51SDaniel P. Berrangeendif
51aef45d51SDaniel P. Berrange
52a5665051SPaolo Bonziniexport NINJA=./ninjatool
53a5665051SPaolo Bonzini
54a5665051SPaolo Bonzini# Running meson regenerates both build.ninja and ninjatool, and that is
55a5665051SPaolo Bonzini# enough to prime the rest of the build.
56a5665051SPaolo Bonzinininjatool: build.ninja
57a5665051SPaolo Bonzini
58a5665051SPaolo Bonzini# Only needed in case Makefile.ninja does not exist.
59a5665051SPaolo Bonzini.PHONY: ninja-clean ninja-distclean clean-ctlist
60a5665051SPaolo Bonziniclean-ctlist:
61a5665051SPaolo Bonzinininja-clean::
62a5665051SPaolo Bonzinininja-distclean::
63a5665051SPaolo Bonzinibuild.ninja: config-host.mak
64a5665051SPaolo Bonzini
65a5665051SPaolo BonziniMakefile.ninja: build.ninja ninjatool
66a5665051SPaolo Bonzini	./ninjatool -t ninja2make --omit clean dist uninstall < $< > $@
67a5665051SPaolo Bonzini-include Makefile.ninja
68a5665051SPaolo Bonzini
69a5665051SPaolo Bonzini${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
70a5665051SPaolo Bonzini
71245dac4aSPaolo Bonzini# If MESON is empty, the rule will be re-evaluated after Makefiles are
72245dac4aSPaolo Bonzini# reread (and MESON won't be empty anymore).
73245dac4aSPaolo Bonziniifneq ($(MESON),)
74245dac4aSPaolo BonziniMakefile.mtest: build.ninja scripts/mtest2make.py
75245dac4aSPaolo Bonzini	$(MESON) introspect --tests | $(PYTHON) scripts/mtest2make.py > $@
76245dac4aSPaolo Bonzini-include Makefile.mtest
77245dac4aSPaolo Bonziniendif
78245dac4aSPaolo Bonzini
7992712822SDaniel P. Berrange.git-submodule-status: git-submodule-update config-host.mak
80aef45d51SDaniel P. Berrange
81d1bd2423SPeter Maydell# Check that we're not trying to do an out-of-tree build from
82d1bd2423SPeter Maydell# a tree that's been used for an in-tree build.
83d1bd2423SPeter Maydellifneq ($(realpath $(SRC_PATH)),$(realpath .))
84d1bd2423SPeter Maydellifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
85d1bd2423SPeter Maydell$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
86d1bd2423SPeter Maydellseems to have been used for an in-tree build. You can fix this by running \
87b98a3baeSPhilippe Mathieu-Daudé"$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
88d1bd2423SPeter Maydellendif
89d1bd2423SPeter Maydellendif
90d1bd2423SPeter Maydell
912b1f35b9SAlex BennéeCONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
922b1f35b9SAlex BennéeCONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
936b827ccaSStefano StabelliniCONFIG_XEN := $(CONFIG_XEN_BACKEND)
94f3aa844bSPaolo BonziniCONFIG_ALL=y
95f3aa844bSPaolo Bonzini-include config-all-devices.mak
96f3aa844bSPaolo Bonzini-include config-all-disas.mak
97f3aa844bSPaolo Bonzini
983a6b016dSMarkus Armbrusterconfig-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
99e5efe7f5SJuan Quintela	@echo $@ is out-of-date, running configure
100a5665051SPaolo Bonzini	@if test -f meson-private/coredata.dat; then \
101a5665051SPaolo Bonzini	  ./config.status --skip-meson; \
102a5665051SPaolo Bonzini	else \
103a5665051SPaolo Bonzini	  ./config.status; \
104a5665051SPaolo Bonzini	fi
10526fffe29SEmilio G. Cota
10626fffe29SEmilio G. Cota# Force configure to re-run if the API symbols are updated
10726fffe29SEmilio G. Cotaifeq ($(CONFIG_PLUGIN),y)
10826fffe29SEmilio G. Cotaconfig-host.mak: $(SRC_PATH)/plugins/qemu-plugins.symbols
10926fffe29SEmilio G. Cotaendif
11026fffe29SEmilio G. Cota
11155d7e8f6Saurel32else
11255d7e8f6Saurel32config-host.mak:
113eaa2ddbbSFam Zhengifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
11455d7e8f6Saurel32	@echo "Please call configure before running make!"
11555d7e8f6Saurel32	@exit 1
11655d7e8f6Saurel32endif
1177748b8cbSMike Frysingerendif
118766a487aSbellard
119fb57c881SFam Zhenginclude $(SRC_PATH)/rules.mak
120fb57c881SFam Zheng
121c932ce31SPaolo Bonzini# lor is defined in rules.mak
12229de2804SLaurent VivierCONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
12329de2804SLaurent Vivier
1243dff199cSLaurent Viviergenerated-files-y += .git-submodule-status
1250ab8ed18SDaniel P. Berrange
126d9ace8b3SJuan Quintela# Don't try to regenerate Makefile or configure
127d9ace8b3SJuan Quintela# We don't generate any of them
128d9ace8b3SJuan QuintelaMakefile: ;
129d9ace8b3SJuan Quintelaconfigure: ;
130d9ace8b3SJuan Quintela
131bd3f5706SMarc-André Lureau.PHONY: all clean cscope distclean html info install install-doc \
1327c3d1917SDaniel P. Berrange	pdf txt recurse-all dist msi FORCE
1330cb3fb1eSpbrook
134fec90ff0SPaolo Bonzini$(call set-vpath, $(SRC_PATH))
1358c462f8fSpbrook
1363e2e0e6bSJuan QuintelaLIBS+=-lz $(LIBS_TOOLS)
13767c0f08dSJuan Quintela
138b53c54c6SPeter Maydell# Sphinx does not allow building manuals into the same directory as
139b53c54c6SPeter Maydell# the source files, so if we're doing an in-tree QEMU build we must
140b53c54c6SPeter Maydell# build the manuals into a subdirectory (and then install them from
141b53c54c6SPeter Maydell# there for 'make install'). For an out-of-tree build we can just
142b53c54c6SPeter Maydell# use the docs/ subdirectory in the build tree as normal.
143b53c54c6SPeter Maydellifeq ($(realpath $(SRC_PATH)),$(realpath .))
144b53c54c6SPeter MaydellMANUAL_BUILDDIR := docs/built
145b53c54c6SPeter Maydellelse
146b53c54c6SPeter MaydellMANUAL_BUILDDIR := docs
147b53c54c6SPeter Maydellendif
148b53c54c6SPeter Maydell
149cc8ae6deSpbrookifdef BUILD_DOCS
150d06118bfSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/system/qemu.1
151a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/qemu-img.1
152a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/qemu-nbd.8
15387c0868fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/interop/qemu-ga.8
1546a7e2bbeSStefan Hajnocziifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
155a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/virtiofsd.1
1566a7e2bbeSStefan Hajnocziendif
157acab923dSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7
158d59157eaSPaolo BonziniDOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
159d59157eaSPaolo BonziniDOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
1601bf84a1eSKashyap ChamarthyDOCS+=$(MANUAL_BUILDDIR)/system/qemu-cpu-models.7
16122108f33SStefan HajnocziDOCS+=$(MANUAL_BUILDDIR)/index.html
162983eef5aSMeador Ingeifdef CONFIG_VIRTFS
163a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1
164983eef5aSMeador Ingeendif
16562dd1048SDaniel P. Berrangéifdef CONFIG_TRACE_SYSTEMTAP
166a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1
16762dd1048SDaniel P. Berrangéendif
168cc8ae6deSpbrookelse
169cc8ae6deSpbrookDOCS=
170cc8ae6deSpbrookendif
1717d13299dSbellard
1728cc357b5SDaniel P. BerrangeSUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
173a992fe3dSPaul Brook
174992aeb8eSPaolo Bonziniifneq ($(wildcard config-host.mak),)
175992aeb8eSPaolo Bonziniinclude $(SRC_PATH)/Makefile.objs
176ba1183daSFam Zhengendif
177ba1183daSFam Zheng
17846e7b706SFam Zhenginclude $(SRC_PATH)/tests/Makefile.include
179992aeb8eSPaolo Bonzini
180c3a0ee84SPaolo Bonziniall: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) recurse-all modules
181b9dea4fbSpbrook
1821215c6e7SJuan Quintelaconfig-host.h: config-host.h-timestamp
1831215c6e7SJuan Quintelaconfig-host.h-timestamp: config-host.mak
1841215c6e7SJuan Quintela
185c621dc3eSAlexander BulekovTARGET_DIRS_RULES := $(foreach t, all fuzz clean install, $(addsuffix /$(t), $(TARGET_DIRS)))
186916359f6SAndreas Färber
1871338a4b7SMarkus Armbruster.PHONY: $(TARGET_DIRS_RULES)
1881338a4b7SMarkus Armbruster# The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
1891338a4b7SMarkus Armbruster# $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
1902becc36aSPaolo Bonzini$(TARGET_DIRS_RULES): $(TARGET_DEPS)
1911338a4b7SMarkus Armbruster	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
1924aa42531Spbrook
19367953a37SClaudio Fontana# LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
19467953a37SClaudio FontanaDTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_lib=""
195965f486cSPeter MaydellDTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
19667953a37SClaudio FontanaDTC_CPPFLAGS=-I$(SRC_PATH)/dtc/libfdt
197a540f158SPeter Crosthwaite
1983b8593eeSMarkus Armbruster.PHONY: dtc/all
19967953a37SClaudio Fontanadtc/all: .git-submodule-status dtc/libfdt
20067953a37SClaudio Fontana	$(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt,)
201a540f158SPeter Crosthwaite
20200525864SAaron Lindsaydtc/%: .git-submodule-status
203814e1110SJan Kiszka	@mkdir -p $@
204a540f158SPeter Crosthwaite
205e219c499SRichard Henderson# Overriding CFLAGS causes us to lose defines added in the sub-makefile.
206e219c499SRichard Henderson# Not overriding CFLAGS leads to mis-matches between compilation modes.
207e219c499SRichard Henderson# Therefore we replicate some of the logic in the sub-makefile.
208e219c499SRichard Henderson# Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
209e219c499SRichard Henderson# no need to annoy QEMU developers with such things.
210e219c499SRichard HendersonCAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS))
211e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
212e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_ARM
213e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_ARM64
214e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
215e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_X86
216e219c499SRichard Henderson
2173b8593eeSMarkus Armbruster.PHONY: capstone/all
2183b8593eeSMarkus Armbrustercapstone/all: .git-submodule-status
2199f81aeb5SAlistair Francis	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS) $(BUILD_DIR)/capstone/$(LIBCAPSTONE))
220e219c499SRichard Henderson
2213b8593eeSMarkus Armbruster.PHONY: slirp/all
2223b8593eeSMarkus Armbrusterslirp/all: .git-submodule-status
223daa79d9aSAlex Bennée	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp		\
224daa79d9aSAlex Bennée		BUILD_DIR="$(BUILD_DIR)/slirp" 			\
225daa79d9aSAlex Bennée		PKG_CONFIG="$(PKG_CONFIG)" 				\
226daa79d9aSAlex Bennée		CC="$(CC)" AR="$(AR)" 	LD="$(LD)" RANLIB="$(RANLIB)"	\
227db5adeaaSPaolo Bonzini		CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)")
228675b9b53SMarc-André Lureau
229*64ed6f92SPaolo Bonzini$(filter %/all, $(TARGET_DIRS_RULES)):
230c621dc3eSAlexander Bulekov
2313b8593eeSMarkus ArmbrusterROM_DIRS = $(addprefix pc-bios/, $(ROMS))
2321338a4b7SMarkus ArmbrusterROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
233a9c87304SMarc-André Lureau# Only keep -O and -g cflags
2341338a4b7SMarkus Armbruster.PHONY: $(ROM_DIRS_RULES)
2351338a4b7SMarkus Armbruster$(ROM_DIRS_RULES):
2361338a4b7SMarkus Armbruster	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))" $(notdir $@),)
237c05ac895SPaul Brook
2388d358a5eSMarkus Armbruster.PHONY: recurse-all recurse-clean recurse-install
2391338a4b7SMarkus Armbrusterrecurse-all: $(addsuffix /all, $(TARGET_DIRS) $(ROM_DIRS))
2401338a4b7SMarkus Armbrusterrecurse-clean: $(addsuffix /clean, $(TARGET_DIRS) $(ROM_DIRS))
2411338a4b7SMarkus Armbrusterrecurse-install: $(addsuffix /install, $(TARGET_DIRS))
24247ae060eSMarkus Armbruster$(addsuffix /install, $(TARGET_DIRS)): all
2434aa42531Spbrook
244c17a18efSMarc-André Lureau$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
2450bdb12c7SPeter Maydell	$(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
2465354e4d2SMarc-André Lureau
247c17a18efSMarc-André LureauMakefile: $(version-obj-y)
2483bc2f570SPaolo Bonzini
2493bc2f570SPaolo Bonzini######################################################################
2504fb240a4Sbellard
251a5665051SPaolo Bonziniclean: recurse-clean ninja-clean clean-ctlist
252a5665051SPaolo Bonzini	-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
2532d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files
25425be210fSJuan Quintela	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
25523858f40SLaszlo Ersek	find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \
25623858f40SLaszlo Ersek		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
25723858f40SLaszlo Ersek		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
25823858f40SLaszlo Ersek		! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
25923858f40SLaszlo Ersek		-exec rm {} +
260c3a0ee84SPaolo Bonzini	rm -f TAGS cscope.* *.pod *~ */*~
261b855f8d1SPaolo Bonzini	rm -f fsdev/*.pod scsi/*.pod
2623dff199cSLaurent Vivier	rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
26331e31b8aSbellard
26434bb443eSAnthony LiguoriVERSION ?= $(shell cat VERSION)
26534bb443eSAnthony Liguori
26634bb443eSAnthony Liguoridist: qemu-$(VERSION).tar.bz2
26734bb443eSAnthony Liguori
26834bb443eSAnthony Liguoriqemu-%.tar.bz2:
26934bb443eSAnthony Liguori	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
27034bb443eSAnthony Liguori
2715f71eac0SPeter Maydelldefine clean-manual =
2721290e671SPeter Maydellrm -rf $(MANUAL_BUILDDIR)/$1/_static
2731290e671SPeter Maydellrm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(MANUAL_BUILDDIR)/$1/*.html
2745f71eac0SPeter Maydellendef
2755f71eac0SPeter Maydell
276a5665051SPaolo Bonzinidistclean: clean ninja-distclean
277a5665051SPaolo Bonzini	-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean -g
278ee5195eeSRichard Henderson	rm -f config-host.mak config-host.h* $(DOCS)
2792038f8c8SPaolo Bonzini	rm -f tests/tcg/config-*.mak
2802becc36aSPaolo Bonzini	rm -f config-all-disas.mak config.status
281ae219359SThomas Huth	rm -f po/*.mo tests/qemu-iotests/common.env
282fc8e320eSMagnus Damm	rm -f roms/seabios/config.mak roms/vgabios/config.mak
28326fffe29SEmilio G. Cota	rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
284*64ed6f92SPaolo Bonzini	rm -f *-config-target.h *-config-devices.mak *-config-devices.h
285a5665051SPaolo Bonzini	rm -rf meson-private meson-logs meson-info compile_commands.json
286245dac4aSPaolo Bonzini	rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest
287793553acSAlexandre Raymond	rm -f config.log
28867ed96f9SPeter Maydell	rm -f linux-headers/asm
289d59157eaSPaolo Bonzini	rm -f docs/version.texi
290d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi
291d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7
292d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
293d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
294d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
29581f33401SPeter Maydell	rm -rf .doctrees
2965f71eac0SPeter Maydell	$(call clean-manual,devel)
2975f71eac0SPeter Maydell	$(call clean-manual,interop)
2980783a732SPeter Maydell	$(call clean-manual,specs)
2990928523aSPeter Maydell	$(call clean-manual,system)
30065c3542bSPeter Maydell	$(call clean-manual,tools)
30109147930SPaolo Bonzini	$(call clean-manual,user)
3022b1f35b9SAlex Bennée	for d in $(TARGET_DIRS); do \
303bc1b050dSbellard	rm -rf $$d || exit 1 ; \
30476bc6838Sbellard        done
305d9840e25STomoki Sekiyama	rm -Rf .sdk
3067d13299dSbellard
30706e7772fSGerd HoffmannKEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  no  pt-br  sv \
308fed4a9adSbellardar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
30926b1cbf8SGerd Hoffmannde-ch  es     fo  fr-ca  hu     ja  mk  pt  sl     tr \
3103751e722SJan Krupabepo    cz
311fed4a9adSbellard
31277755340Sthsifdef INSTALL_BLOBS
31332eb2da3SBruce RogersBLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
3147a4dfd1eSGerd Hoffmannvgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
3150a87fd69SGerd Hoffmannvgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
316b2ce76a0SThomas Huthopenbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
3175ee8ad71SAlex Williamsonpxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
3185ee8ad71SAlex Williamsonpxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
3199fd02979SSander Eikelenboomefi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
3209fd02979SSander Eikelenboomefi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
32145027808SGerd Hoffmannefi-e1000e.rom efi-vmxnet3.rom \
322b3ce38dcSPhilippe Mathieu-Daudéqemu-nsis.bmp \
3234b387f9eSBALATON Zoltanbamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
3242785dc7bSStefano Garzarellamultiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
3256c5359e1SChristian Borntraegers390-ccw.img s390-netboot.img \
326744a928cSAlexey Kardashevskiyslof.bin skiboot.lid \
3270c6ab8c9SCole Robinsonpalcode-clipper \
32882e65fe0SBALATON Zoltanu-boot.e500 u-boot-sam460-20100605.bin \
32943ad2564SRichard Hendersonqemu_vga.ndrv \
33026ce90fdSLaszlo Ersekedk2-licenses.txt \
33191f3a2f0SAlistair Francishppa-firmware.img \
332a6fcc80bSBin Mengopensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
33391f3a2f0SAlistair Francisopensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
33477755340Sthselse
33577755340SthsBLOBS=
33677755340Sthsendif
33777755340Sths
338336cfef4SPeter Maydell# Note that we manually filter-out the non-Sphinx documentation which
33927a296fcSPeter Maydell# is currently built into the docs/interop directory in the build tree,
34027a296fcSPeter Maydell# and also any sphinx-built manpages.
3415f71eac0SPeter Maydelldefine install-manual =
3421290e671SPeter Maydellfor d in $$(cd $(MANUAL_BUILDDIR) && find $1 -type d); do $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/$$d"; done
34327a296fcSPeter Maydellfor f in $$(cd $(MANUAL_BUILDDIR) && find $1 -type f -a '!' '(' -name '*.[0-9]' -o -name 'qemu-*-qapi.*' -o -name 'qemu-*-ref.*' ')' ); do $(INSTALL_DATA) "$(MANUAL_BUILDDIR)/$$f" "$(DESTDIR)$(qemu_docdir)/$$f"; done
3445f71eac0SPeter Maydellendef
3455f71eac0SPeter Maydell
3465f71eac0SPeter Maydell# Note that we deliberately do not install the "devel" manual: it is
3475f71eac0SPeter Maydell# for QEMU developers, and not interesting to our users.
3485f71eac0SPeter Maydell.PHONY: install-sphinxdocs
3495f71eac0SPeter Maydellinstall-sphinxdocs: sphinxdocs
3505f71eac0SPeter Maydell	$(call install-manual,interop)
3510783a732SPeter Maydell	$(call install-manual,specs)
3520928523aSPeter Maydell	$(call install-manual,system)
35365c3542bSPeter Maydell	$(call install-manual,tools)
35409147930SPaolo Bonzini	$(call install-manual,user)
3555f71eac0SPeter Maydell
3565f71eac0SPeter Maydellinstall-doc: $(DOCS) install-sphinxdocs
357d7dd65baSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
35822108f33SStefan Hajnoczi	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/index.html "$(DESTDIR)$(qemu_docdir)"
359c13dba2cSLiao Pingfang	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop"
360c13dba2cSLiao Pingfang	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)/interop"
361c13dba2cSLiao Pingfang	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)/interop"
36296d409ebSJuan Quintelaifdef CONFIG_POSIX
36358f8aeadSaliguori	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
364d06118bfSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu.1 "$(DESTDIR)$(mandir)/man1"
36556e8bdd4SMarc-André Lureau	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
366d59157eaSPaolo Bonzini	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
367acab923dSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
3681bf84a1eSKashyap Chamarthy	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
369c932ce31SPaolo Bonziniifeq ($(CONFIG_TOOLS),y)
370a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-img.1 "$(DESTDIR)$(mandir)/man1"
37158f8aeadSaliguori	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
372a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
37338954dcaSpbrookendif
37462dd1048SDaniel P. Berrangéifdef CONFIG_TRACE_SYSTEMTAP
375a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
37662dd1048SDaniel P. Berrangéendif
377f15bff25SPaolo Bonziniifeq ($(CONFIG_GUEST_AGENT),y)
378b53c54c6SPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
379c13dba2cSLiao Pingfang	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop"
380c13dba2cSLiao Pingfang	$(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)/interop"
381c13dba2cSLiao Pingfang	$(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)/interop"
382d59157eaSPaolo Bonzini	$(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
383665b5d0dSMarc-André Lureauendif
3848a3e8f7fSAndreas Färberendif
385a2d8f1beSM. Mohan Kumarifdef CONFIG_VIRTFS
386a2d8f1beSM. Mohan Kumar	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
387a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
388a2d8f1beSM. Mohan Kumarendif
3896a7e2bbeSStefan Hajnocziifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
390a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtiofsd.1 "$(DESTDIR)$(mandir)/man1"
3916a7e2bbeSStefan Hajnocziendif
392b5ec5ce0Sjohn cooper
393e2d87bffSEduardo Habkostinstall-datadir:
394e2d87bffSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
395e2d87bffSEduardo Habkost
396f2e3978bSLaszlo Ersekinstall-localstatedir:
397f2e3978bSLaszlo Ersekifdef CONFIG_POSIX
398f15bff25SPaolo Bonziniifeq ($(CONFIG_GUEST_AGENT),y)
399f2e3978bSLaszlo Ersek	$(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
400f2e3978bSLaszlo Ersekendif
401f2e3978bSLaszlo Ersekendif
402f2e3978bSLaszlo Ersek
403a8260d38SDaniel P. BerrangéICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
404e2d87bffSEduardo Habkost
405a5665051SPaolo Bonzini# Needed by "meson install"
406a5665051SPaolo Bonziniexport DESTDIR
40754cb65d8SEmilio G. Cotainstall: all $(if $(BUILD_DOCS),install-doc) \
408f556b4a1SPaolo Bonzini	install-datadir install-localstatedir \
4091338a4b7SMarkus Armbruster	recurse-install
41062dd1048SDaniel P. Berrangéifdef CONFIG_TRACE_SYSTEMTAP
41162dd1048SDaniel P. Berrangé	$(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
41262dd1048SDaniel P. Berrangéendif
41377755340Sthsifneq ($(BLOBS),)
41477755340Sths	set -e; for x in $(BLOBS); do \
4156aae2a2eSEduardo Habkost		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
416ad064840Spbrook	done
41777755340Sthsendif
418a8260d38SDaniel P. Berrangé	for s in $(ICON_SIZES); do \
4196c11dda9SStefan Hajnoczi		mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
420a8260d38SDaniel P. Berrangé		$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \
4216c11dda9SStefan Hajnoczi			"$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
422a8260d38SDaniel P. Berrangé	done; \
4236c11dda9SStefan Hajnoczi	mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
424a8260d38SDaniel P. Berrangé	$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \
4256c11dda9SStefan Hajnoczi		"$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
4266c11dda9SStefan Hajnoczi	mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
427a8260d38SDaniel P. Berrangé	$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \
4286c11dda9SStefan Hajnoczi		"$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
4296c11dda9SStefan Hajnoczi	mkdir -p "$(DESTDIR)$(qemu_desktopdir)"
43067ea9546SDaniel P. Berrangé	$(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
4316c11dda9SStefan Hajnoczi		"$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
4322a6b5372SMichael Tokarevifdef CONFIG_GTK
433834574eaSAnthony Liguori	$(MAKE) -C po $@
434834574eaSAnthony Liguoriendif
4356aae2a2eSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
43618be8d77Sblueswir1	set -e; for x in $(KEYMAPS); do \
4376aae2a2eSEduardo Habkost		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
438ad064840Spbrook	done
439a81df1b6SPaolo Bonzini	for d in $(TARGET_DIRS); do \
440a81df1b6SPaolo Bonzini	$(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
441a81df1b6SPaolo Bonzini        done
442612384d7Sbellard
4433ef693a0Sbellard# documentation
444e8518c92SMarkus ArmbrusterMAKEINFO=makeinfo
445d59157eaSPaolo BonziniMAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
446d59157eaSPaolo BonziniMAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
447e8338fdbSMarc-André LureauTEXI2PODFLAGS=$(MAKEINFOINCLUDES) -DVERSION="$(VERSION)" -DCONFDIR="$(qemu_confdir)"
448d59157eaSPaolo BonziniTEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
44956e8bdd4SMarc-André Lureau
450e8338fdbSMarc-André Lureaudocs/version.texi: $(SRC_PATH)/VERSION config-host.mak
451e8338fdbSMarc-André Lureau	$(call quiet-command,(\
452e8338fdbSMarc-André Lureau		echo "@set VERSION $(VERSION)" && \
453e8338fdbSMarc-André Lureau		echo "@set CONFDIR $(qemu_confdir)" \
454e8338fdbSMarc-André Lureau	)> $@,"GEN","$@")
455fea346f5SPeter Maydell
45644cb280dSPaolo Bonzini%.html: %.texi docs/version.texi
457e9ee06bdSMarc-André Lureau	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
458e9ee06bdSMarc-André Lureau	--html $< -o $@,"GEN","$@")
4593ef693a0Sbellard
46044cb280dSPaolo Bonzini%.info: %.texi docs/version.texi
461e9ee06bdSMarc-André Lureau	$(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
462f3548328Sbellard
46344cb280dSPaolo Bonzini%.txt: %.texi docs/version.texi
464f8bab10bSMarc-André Lureau	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
465f8bab10bSMarc-André Lureau	--plaintext $< -o $@,"GEN","$@")
466f8bab10bSMarc-André Lureau
46744cb280dSPaolo Bonzini%.pdf: %.texi docs/version.texi
468d59157eaSPaolo Bonzini	$(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@")
469bd7f9747SMarkus Armbruster
4705f71eac0SPeter Maydell# Sphinx builds all its documentation at once in one invocation
4715f71eac0SPeter Maydell# and handles "don't rebuild things unless necessary" itself.
4725f71eac0SPeter Maydell# The '.doctrees' files are cached information to speed this up.
4735f71eac0SPeter Maydell.PHONY: sphinxdocs
4740928523aSPeter Maydellsphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \
4750928523aSPeter Maydell            $(MANUAL_BUILDDIR)/interop/index.html \
4760928523aSPeter Maydell            $(MANUAL_BUILDDIR)/specs/index.html \
47765c3542bSPeter Maydell            $(MANUAL_BUILDDIR)/system/index.html \
47809147930SPaolo Bonzini            $(MANUAL_BUILDDIR)/tools/index.html \
47909147930SPaolo Bonzini            $(MANUAL_BUILDDIR)/user/index.html
4805f71eac0SPeter Maydell
4815f71eac0SPeter Maydell# Canned command to build a single manual
48227a296fcSPeter Maydell# Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
4836bda415cSEduardo Habkost# Note the use of different doctree for each (manual, builder) tuple;
4846bda415cSEduardo Habkost# this works around Sphinx not handling parallel invocation on
4856bda415cSEduardo Habkost# a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
486516e8b7dSPeter Maydellbuild-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) $(SPHINX_WERROR) -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
4875f71eac0SPeter Maydell# We assume all RST files in the manual's directory are used in it
488814e068fSPeter Maydellmanual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \
489de1572caSPeter Maydell              $(SRC_PATH)/docs/defs.rst.inc \
4909165d323SPeter Maydell              $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py \
4919165d323SPeter Maydell              $(SRC_PATH)/docs/sphinx/*.py
492e0f3728dSPeter Maydell# Macro to write out the rule and dependencies for building manpages
493e0f3728dSPeter Maydell# Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps])
494e0f3728dSPeter Maydell# 'extradeps' is optional, and specifies extra files (eg .hx files) that
495e0f3728dSPeter Maydell# the manual page depends on.
496e0f3728dSPeter Maydelldefine define-manpage-rule
497e0f3728dSPeter Maydell$(call atomic,$(foreach manpage,$2,$(MANUAL_BUILDDIR)/$1/$(manpage)),$(call manual-deps,$1) $3)
498e0f3728dSPeter Maydell	$(call build-manual,$1,man)
499e0f3728dSPeter Maydellendef
5005f71eac0SPeter Maydell
5011290e671SPeter Maydell$(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel)
50227a296fcSPeter Maydell	$(call build-manual,devel,html)
5035f71eac0SPeter Maydell
504a08b4a9fSPeter Maydell$(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop)
50527a296fcSPeter Maydell	$(call build-manual,interop,html)
5065f71eac0SPeter Maydell
5070783a732SPeter Maydell$(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
50827a296fcSPeter Maydell	$(call build-manual,specs,html)
50927a296fcSPeter Maydell
51009ce5f2dSPeter Maydell$(MANUAL_BUILDDIR)/system/index.html: $(call manual-deps,system) $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/qemu-options.hx
5110928523aSPeter Maydell	$(call build-manual,system,html)
5120928523aSPeter Maydell
513a08b4a9fSPeter Maydell$(MANUAL_BUILDDIR)/tools/index.html: $(call manual-deps,tools) $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc
51465c3542bSPeter Maydell	$(call build-manual,tools,html)
51565c3542bSPeter Maydell
51609147930SPaolo Bonzini$(MANUAL_BUILDDIR)/user/index.html: $(call manual-deps,user)
51709147930SPaolo Bonzini	$(call build-manual,user,html)
51809147930SPaolo Bonzini
519a08b4a9fSPeter Maydell$(call define-manpage-rule,interop,qemu-ga.8)
5200783a732SPeter Maydell
521d06118bfSPeter Maydell$(call define-manpage-rule,system,qemu.1 qemu-block-drivers.7 qemu-cpu-models.7)
522acab923dSPeter Maydell
523a08b4a9fSPeter Maydell$(call define-manpage-rule,tools,\
524a08b4a9fSPeter Maydell       qemu-img.1 qemu-nbd.8 qemu-trace-stap.1\
525a08b4a9fSPeter Maydell       virtiofsd.1 virtfs-proxy-helper.1,\
526a08b4a9fSPeter Maydell       $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc)
527a08b4a9fSPeter Maydell
52822108f33SStefan Hajnoczi$(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version.h
529d83bbedaSStefan Hajnoczi	@mkdir -p "$(MANUAL_BUILDDIR)"
53022108f33SStefan Hajnoczi	$(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \
53122108f33SStefan Hajnoczi             "GEN","$@")
53222108f33SStefan Hajnoczi
533eb815e24SMarkus Armbrusterdocs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
534fb0bc835SMarkus Armbruster	@cp -p $< $@
5354afeeb57SMarkus Armbruster
536f15bff25SPaolo Bonzinidocs/interop/qemu-ga-qapi.texi: qga/qga-qapi-doc.texi
537fb0bc835SMarkus Armbruster	@cp -p $< $@
53856e8bdd4SMarc-André Lureau
5395b1d0e92SPeter Maydellhtml: docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs
5405b1d0e92SPeter Maydellinfo: docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
5415b1d0e92SPeter Maydellpdf: docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
5425b1d0e92SPeter Maydelltxt: docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
543818220f5Saliguori
544d59157eaSPaolo Bonzinidocs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
545d59157eaSPaolo Bonzini    docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
546d59157eaSPaolo Bonzini    docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \
547d59157eaSPaolo Bonzini	docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi
54856e8bdd4SMarc-André Lureau
549d59157eaSPaolo Bonzinidocs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
550d59157eaSPaolo Bonzini    docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \
551d59157eaSPaolo Bonzini    docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
552d59157eaSPaolo Bonzini	docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
55356e8bdd4SMarc-André Lureau
554ae560cc3SEric Blake$(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl
555ae560cc3SEric Blake
556fe8bf5f6SAlex Bennée# Reports/Analysis
557fe8bf5f6SAlex Bennée
558fe8bf5f6SAlex Bennée%/coverage-report.html:
559fe8bf5f6SAlex Bennée	@mkdir -p $*
560fe8bf5f6SAlex Bennée	$(call quiet-command,\
5615eda6e42SAlex Bennée		gcovr -r $(SRC_PATH) \
5625eda6e42SAlex Bennée		$(foreach t, $(TARGET_DIRS), --object-directory $(BUILD_DIR)/$(t)) \
5635eda6e42SAlex Bennée		 --object-directory $(BUILD_DIR) \
564337f2311SAlex Bennée		-p --html --html-details -o $@, \
565fe8bf5f6SAlex Bennée		"GEN", "coverage-report.html")
566fe8bf5f6SAlex Bennée
567fe8bf5f6SAlex Bennée.PHONY: coverage-report
568fe8bf5f6SAlex Bennéecoverage-report: $(CURDIR)/reports/coverage/coverage-report.html
56956e8bdd4SMarc-André Lureau
570f53ec699SStefan Weilifdef CONFIG_WIN32
571f53ec699SStefan Weil
572f53ec699SStefan WeilINSTALLER = qemu-setup-$(VERSION)$(EXESUF)
573f53ec699SStefan Weil
574f53ec699SStefan Weilnsisflags = -V2 -NOCD
575f53ec699SStefan Weil
576f53ec699SStefan Weilifneq ($(wildcard $(SRC_PATH)/dll),)
577f53ec699SStefan Weilifeq ($(ARCH),x86_64)
578f53ec699SStefan Weil# 64 bit executables
579f53ec699SStefan WeilDLL_PATH = $(SRC_PATH)/dll/w64
580f53ec699SStefan Weilnsisflags += -DW64
581f53ec699SStefan Weilelse
582f53ec699SStefan Weil# 32 bit executables
583f53ec699SStefan WeilDLL_PATH = $(SRC_PATH)/dll/w32
584f53ec699SStefan Weilendif
585f53ec699SStefan Weilendif
586f53ec699SStefan Weil
587f53ec699SStefan Weil.PHONY: installer
588f53ec699SStefan Weilinstaller: $(INSTALLER)
589f53ec699SStefan Weil
590f53ec699SStefan WeilINSTDIR=/tmp/qemu-nsis
591f53ec699SStefan Weil
5921b00a4c4SPaolo Bonzini$(INSTALLER): $(SRC_PATH)/qemu.nsi
5931b00a4c4SPaolo Bonzini	$(MAKE) install DESTDIR=${INSTDIR}
594f53ec699SStefan Weilifdef SIGNCODE
5951b00a4c4SPaolo Bonzini	(cd ${INSTDIR}/${bindir}; \
596f53ec699SStefan Weil         for i in *.exe; do \
597f53ec699SStefan Weil           $(SIGNCODE) $${i}; \
598f53ec699SStefan Weil         done \
599f53ec699SStefan Weil        )
600f53ec699SStefan Weilendif # SIGNCODE
6011b00a4c4SPaolo Bonzini	(cd ${INSTDIR}/${bindir}; \
602f53ec699SStefan Weil         for i in qemu-system-*.exe; do \
603f53ec699SStefan Weil           arch=$${i%.exe}; \
604f53ec699SStefan Weil           arch=$${arch#qemu-system-}; \
605f53ec699SStefan Weil           echo Section \"$$arch\" Section_$$arch; \
606f53ec699SStefan Weil           echo SetOutPath \"\$$INSTDIR\"; \
607f53ec699SStefan Weil           echo File \"\$${BINDIR}\\$$i\"; \
608f53ec699SStefan Weil           echo SectionEnd; \
609f53ec699SStefan Weil         done \
6101b00a4c4SPaolo Bonzini        ) >${INSTDIR}/${bindir}/system-emulations.nsh
611f53ec699SStefan Weil	makensis $(nsisflags) \
612f53ec699SStefan Weil                $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
613f53ec699SStefan Weil                $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
6141b00a4c4SPaolo Bonzini                -DBINDIR="${INSTDIR}/${bindir}" \
615f53ec699SStefan Weil                $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
616f53ec699SStefan Weil                -DSRCDIR="$(SRC_PATH)" \
617f53ec699SStefan Weil                -DOUTFILE="$(INSTALLER)" \
618805d8a67SStefan Weil                -DDISPLAYVERSION="$(VERSION)" \
619f53ec699SStefan Weil                $(SRC_PATH)/qemu.nsi
620f53ec699SStefan Weil	rm -r ${INSTDIR}
621f53ec699SStefan Weilifdef SIGNCODE
622f53ec699SStefan Weil	$(SIGNCODE) $(INSTALLER)
623f53ec699SStefan Weilendif # SIGNCODE
624f53ec699SStefan Weilendif # CONFIG_WIN
625f53ec699SStefan Weil
626cb5fc67dSAnthony Liguori# Add a dependency on the generated files, so that they are always
627cb5fc67dSAnthony Liguori# rebuilt before other object files
628428952cfSThomas Huthifneq ($(wildcard config-host.mak),)
629eaa2ddbbSFam Zhengifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
6303dff199cSLaurent VivierMakefile: $(generated-files-y)
6317748b8cbSMike Frysingerendif
632428952cfSThomas Huthendif
633cb5fc67dSAnthony Liguori
6344fb240a4Sbellard# Include automatically generated dependency files
6351435ddb8SPaolo Bonzini# Dependencies in Makefile.objs files come from our recursive subdir rules
6361435ddb8SPaolo Bonzini-include $(wildcard *.d tests/*.d)
637324027c2SFam Zheng
638324027c2SFam Zhenginclude $(SRC_PATH)/tests/docker/Makefile.include
639b1fb9a63SFam Zhenginclude $(SRC_PATH)/tests/vm/Makefile.include
6400d8e065fSMarc-André Lureau
641c355de59SPhilippe Mathieu-Daudéprint-help-run = printf "  %-30s - %s\\n" "$1" "$2"
642c355de59SPhilippe Mathieu-Daudéprint-help = $(quiet-@)$(call print-help-run,$1,$2)
643c355de59SPhilippe Mathieu-Daudé
6440d8e065fSMarc-André Lureau.PHONY: help
6450d8e065fSMarc-André Lureauhelp:
6460d8e065fSMarc-André Lureau	@echo  'Generic targets:'
647c355de59SPhilippe Mathieu-Daudé	$(call print-help,all,Build all)
6480decdfe2SMarc-André Lureauifdef CONFIG_MODULES
649c355de59SPhilippe Mathieu-Daudé	$(call print-help,modules,Build all modules)
6500decdfe2SMarc-André Lureauendif
651c355de59SPhilippe Mathieu-Daudé	$(call print-help,dir/file.o,Build specified target only)
652c355de59SPhilippe Mathieu-Daudé	$(call print-help,install,Install QEMU, documentation and tools)
653c355de59SPhilippe Mathieu-Daudé	$(call print-help,ctags/TAGS,Generate tags file for editors)
654c355de59SPhilippe Mathieu-Daudé	$(call print-help,cscope,Generate cscope index)
655968b4db3SPaolo Bonzini	$(call print-help,sparse,Run sparse on the QEMU source)
6560d8e065fSMarc-André Lureau	@echo  ''
6572b1f35b9SAlex Bennée	@$(if $(TARGET_DIRS), \
6580d8e065fSMarc-André Lureau		echo 'Architecture specific targets:'; \
6592b1f35b9SAlex Bennée		$(foreach t, $(TARGET_DIRS), \
660763815a8SPhilippe Mathieu-Daudé		$(call print-help-run,$(t)/all,Build for $(t)); \
661763815a8SPhilippe Mathieu-Daudé		$(if $(CONFIG_FUZZ), \
662763815a8SPhilippe Mathieu-Daudé			$(if $(findstring softmmu,$(t)), \
663763815a8SPhilippe Mathieu-Daudé				$(call print-help-run,$(t)/fuzz,Build fuzzer for $(t)); \
664763815a8SPhilippe Mathieu-Daudé		))) \
6650d8e065fSMarc-André Lureau		echo '')
6660d8e065fSMarc-André Lureau	@echo  'Cleaning targets:'
667c355de59SPhilippe Mathieu-Daudé	$(call print-help,clean,Remove most generated files but keep the config)
668c355de59SPhilippe Mathieu-Daudé	$(call print-help,distclean,Remove all generated files)
669c355de59SPhilippe Mathieu-Daudé	$(call print-help,dist,Build a distributable tarball)
6700d8e065fSMarc-André Lureau	@echo  ''
6710d8e065fSMarc-André Lureau	@echo  'Test targets:'
672c355de59SPhilippe Mathieu-Daudé	$(call print-help,check,Run all tests (check-help for details))
673c355de59SPhilippe Mathieu-Daudé	$(call print-help,docker,Help about targets running tests inside containers)
674c355de59SPhilippe Mathieu-Daudé	$(call print-help,vm-help,Help about targets running tests inside VM)
6750d8e065fSMarc-André Lureau	@echo  ''
6760d8e065fSMarc-André Lureau	@echo  'Documentation targets:'
677c355de59SPhilippe Mathieu-Daudé	$(call print-help,html info pdf txt,Build documentation in specified format)
6780d8e065fSMarc-André Lureau	@echo  ''
6790d8e065fSMarc-André Lureauifdef CONFIG_WIN32
6800d8e065fSMarc-André Lureau	@echo  'Windows targets:'
681c355de59SPhilippe Mathieu-Daudé	$(call print-help,installer,Build NSIS-based installer for QEMU)
6820d8e065fSMarc-André Lureauifdef QEMU_GA_MSI_ENABLED
683c355de59SPhilippe Mathieu-Daudé	$(call print-help,msi,Build MSI-based installer for qemu-ga)
6840d8e065fSMarc-André Lureauendif
6850d8e065fSMarc-André Lureau	@echo  ''
6860d8e065fSMarc-André Lureauendif
687c355de59SPhilippe Mathieu-Daudé	$(call print-help,$(MAKE) [targets],(quiet build, default))
688c355de59SPhilippe Mathieu-Daudé	$(call print-help,$(MAKE) V=1 [targets],(verbose build))
689