xref: /openbmc/qemu/Makefile (revision a81df1b6)
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
12457b49737SPeter Maydell# Create QEMU_PKGVERSION and FULL_VERSION strings
12557b49737SPeter Maydell# If PKGVERSION is set, use that; otherwise get version and -dirty status from git
12657b49737SPeter MaydellQEMU_PKGVERSION := $(if $(PKGVERSION),$(PKGVERSION),$(shell \
12757b49737SPeter Maydell  cd $(SRC_PATH); \
12857b49737SPeter Maydell  if test -e .git; then \
12957b49737SPeter Maydell    git describe --match 'v*' 2>/dev/null | tr -d '\n'; \
13057b49737SPeter Maydell    if ! git diff-index --quiet HEAD &>/dev/null; then \
13157b49737SPeter Maydell      echo "-dirty"; \
13257b49737SPeter Maydell    fi; \
13357b49737SPeter Maydell  fi))
13457b49737SPeter Maydell
13557b49737SPeter Maydell# Either "version (pkgversion)", or just "version" if pkgversion not set
13657b49737SPeter MaydellFULL_VERSION := $(if $(QEMU_PKGVERSION),$(VERSION) ($(QEMU_PKGVERSION)),$(VERSION))
13757b49737SPeter Maydell
1383dff199cSLaurent Viviergenerated-files-y = qemu-version.h config-host.h qemu-options.def
139bf582c34SEric Blake
1403dff199cSLaurent Viviergenerated-files-y += trace/generated-tcg-tracers.h
141465830fbSLluís Vilanova
1423dff199cSLaurent Viviergenerated-files-y += trace/generated-helpers-wrappers.h
1433dff199cSLaurent Viviergenerated-files-y += trace/generated-helpers.h
1443dff199cSLaurent Viviergenerated-files-y += trace/generated-helpers.c
145707c8a98SLluís Vilanova
1463dff199cSLaurent Viviergenerated-files-y += module_block.h
1470c0c1fd9SMarc Mari
1483dff199cSLaurent Viviergenerated-files-y += .git-submodule-status
1490ab8ed18SDaniel P. Berrange
1508755b4afSDaniel P. Berrangetracetool-y = $(SRC_PATH)/scripts/tracetool.py
1518755b4afSDaniel P. Berrangetracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
1528755b4afSDaniel P. Berrange
153*a81df1b6SPaolo Bonzinitrace/generated-helpers-wrappers.h: trace/generated-helpers-wrappers.h-timestamp
1540ab8ed18SDaniel P. Berrange	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
155*a81df1b6SPaolo Bonzinitrace/generated-helpers-wrappers.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
156*a81df1b6SPaolo Bonzini	@mkdir -p $(dir $@)
1570ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
1580ab8ed18SDaniel P. Berrange		--group=root \
159*a81df1b6SPaolo Bonzini		--format=tcg-helper-wrapper-h \
160*a81df1b6SPaolo Bonzini		--backend=$(TRACE_BACKENDS) \
161*a81df1b6SPaolo Bonzini		$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
1620ab8ed18SDaniel P. Berrange
163*a81df1b6SPaolo Bonzinitrace/generated-helpers.h: trace/generated-helpers.h-timestamp
1640ab8ed18SDaniel P. Berrange	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
165*a81df1b6SPaolo Bonzinitrace/generated-helpers.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
166*a81df1b6SPaolo Bonzini	@mkdir -p $(dir $@)
1670ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
1680ab8ed18SDaniel P. Berrange		--group=root \
169*a81df1b6SPaolo Bonzini		--format=tcg-helper-h \
170*a81df1b6SPaolo Bonzini		--backend=$(TRACE_BACKENDS) \
171*a81df1b6SPaolo Bonzini		$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
1720ab8ed18SDaniel P. Berrange
173*a81df1b6SPaolo Bonzinitrace/generated-helpers.c: trace/generated-helpers.c-timestamp
1740ab8ed18SDaniel P. Berrange	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
175*a81df1b6SPaolo Bonzinitrace/generated-helpers.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
176*a81df1b6SPaolo Bonzini	@mkdir -p $(dir $@)
1770ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
1780ab8ed18SDaniel P. Berrange		--group=root \
179*a81df1b6SPaolo Bonzini		--format=tcg-helper-c \
180*a81df1b6SPaolo Bonzini		--backend=$(TRACE_BACKENDS) \
181*a81df1b6SPaolo Bonzini		$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
1820ab8ed18SDaniel P. Berrange
183*a81df1b6SPaolo Bonzinitrace/generated-helpers.o: trace/generated-helpers.c
1840ab8ed18SDaniel P. Berrange
185*a81df1b6SPaolo Bonzinitrace/generated-tcg-tracers.h: trace/generated-tcg-tracers.h-timestamp
1860ab8ed18SDaniel P. Berrange	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
187*a81df1b6SPaolo Bonzinitrace/generated-tcg-tracers.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
188*a81df1b6SPaolo Bonzini	@mkdir -p $(dir $@)
1890ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
1900ab8ed18SDaniel P. Berrange		--group=root \
191*a81df1b6SPaolo Bonzini		--format=tcg-h \
192*a81df1b6SPaolo Bonzini		--backend=$(TRACE_BACKENDS) \
193*a81df1b6SPaolo Bonzini		$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
1940ab8ed18SDaniel P. Berrange
19592712822SDaniel P. BerrangeKEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen
19692712822SDaniel P. BerrangeKEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv
19792712822SDaniel P. Berrange
19892712822SDaniel P. BerrangeKEYCODEMAP_FILES = \
199139c1837SPaolo Bonzini		 ui/input-keymap-atset1-to-qcode.c.inc \
200139c1837SPaolo Bonzini		 ui/input-keymap-linux-to-qcode.c.inc \
201139c1837SPaolo Bonzini		 ui/input-keymap-qcode-to-atset1.c.inc \
202139c1837SPaolo Bonzini		 ui/input-keymap-qcode-to-atset2.c.inc \
203139c1837SPaolo Bonzini		 ui/input-keymap-qcode-to-atset3.c.inc \
204139c1837SPaolo Bonzini		 ui/input-keymap-qcode-to-linux.c.inc \
205139c1837SPaolo Bonzini		 ui/input-keymap-qcode-to-qnum.c.inc \
206139c1837SPaolo Bonzini		 ui/input-keymap-qcode-to-sun.c.inc \
207139c1837SPaolo Bonzini		 ui/input-keymap-qnum-to-qcode.c.inc \
208139c1837SPaolo Bonzini		 ui/input-keymap-usb-to-qcode.c.inc \
209139c1837SPaolo Bonzini		 ui/input-keymap-win32-to-qcode.c.inc \
210139c1837SPaolo Bonzini		 ui/input-keymap-x11-to-qcode.c.inc \
211139c1837SPaolo Bonzini		 ui/input-keymap-xorgevdev-to-qcode.c.inc \
212139c1837SPaolo Bonzini		 ui/input-keymap-xorgkbd-to-qcode.c.inc \
213139c1837SPaolo Bonzini		 ui/input-keymap-xorgxquartz-to-qcode.c.inc \
214139c1837SPaolo Bonzini		 ui/input-keymap-xorgxwin-to-qcode.c.inc \
215139c1837SPaolo Bonzini		 ui/input-keymap-osx-to-qcode.c.inc \
21692712822SDaniel P. Berrange		 $(NULL)
21792712822SDaniel P. Berrange
2183dff199cSLaurent Viviergenerated-files-$(CONFIG_SOFTMMU) += $(KEYCODEMAP_FILES)
21992712822SDaniel P. Berrange
220139c1837SPaolo Bonziniui/input-keymap-%.c.inc: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile.objs
22192712822SDaniel P. Berrange	$(call quiet-command,\
2226809df1dSJan Beulich	    stem=$* && src=$${stem%-to-*} dst=$${stem#*-to-} && \
22392712822SDaniel P. Berrange	    test -e $(KEYCODEMAP_GEN) && \
22492712822SDaniel P. Berrange	    $(PYTHON) $(KEYCODEMAP_GEN) \
22592712822SDaniel P. Berrange	          --lang glib2 \
22692712822SDaniel P. Berrange	          --varname qemu_input_map_$${src}_to_$${dst} \
22792712822SDaniel P. Berrange	          code-map $(KEYCODEMAP_CSV) $${src} $${dst} \
22892712822SDaniel P. Berrange	        > $@ || rm -f $@, "GEN", "$@")
22992712822SDaniel P. Berrange
23092712822SDaniel P. Berrange$(KEYCODEMAP_GEN): .git-submodule-status
23192712822SDaniel P. Berrange$(KEYCODEMAP_CSV): .git-submodule-status
23292712822SDaniel P. Berrange
23326ce90fdSLaszlo Ersekedk2-decompressed = $(basename $(wildcard pc-bios/edk2-*.fd.bz2))
23426ce90fdSLaszlo Ersekpc-bios/edk2-%.fd: pc-bios/edk2-%.fd.bz2
23526ce90fdSLaszlo Ersek	$(call quiet-command,bzip2 -d -c $< > $@,"BUNZIP2",$<)
23626ce90fdSLaszlo Ersek
237d9ace8b3SJuan Quintela# Don't try to regenerate Makefile or configure
238d9ace8b3SJuan Quintela# We don't generate any of them
239d9ace8b3SJuan QuintelaMakefile: ;
240d9ace8b3SJuan Quintelaconfigure: ;
241d9ace8b3SJuan Quintela
242bd3f5706SMarc-André Lureau.PHONY: all clean cscope distclean html info install install-doc \
2437c3d1917SDaniel P. Berrange	pdf txt recurse-all dist msi FORCE
2440cb3fb1eSpbrook
245fec90ff0SPaolo Bonzini$(call set-vpath, $(SRC_PATH))
2468c462f8fSpbrook
2473e2e0e6bSJuan QuintelaLIBS+=-lz $(LIBS_TOOLS)
24867c0f08dSJuan Quintela
249d52c454aSMarc-André Lureauvhost-user-json-y =
250fdbff6bdSPhilippe Mathieu-DaudéHELPERS-y = $(HELPERS)
251d52c454aSMarc-André Lureau
252fdbff6bdSPhilippe Mathieu-DaudéHELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) += qemu-bridge-helper$(EXESUF)
2537b93fadfSCorey Bryant
25457589bc4SMarc-André Lureauifeq ($(CONFIG_LINUX)$(CONFIG_VIRGL)$(CONFIG_GBM)$(CONFIG_TOOLS),yyyy)
255d52c454aSMarc-André LureauHELPERS-y += vhost-user-gpu$(EXESUF)
256d52c454aSMarc-André Lureauvhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json
257d52c454aSMarc-André Lureauendif
258d52c454aSMarc-André Lureau
25957159bb2SPhilippe Mathieu-Daudéifeq ($(CONFIG_SOFTMMU)$(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyyy)
26081bfc42dSDr. David Alan GilbertHELPERS-y += virtiofsd$(EXESUF)
261315616edSStefan Hajnoczivhost-user-json-y += tools/virtiofsd/50-qemu-virtiofsd.json
26281bfc42dSDr. David Alan Gilbertendif
26381bfc42dSDr. David Alan Gilbert
264b53c54c6SPeter Maydell# Sphinx does not allow building manuals into the same directory as
265b53c54c6SPeter Maydell# the source files, so if we're doing an in-tree QEMU build we must
266b53c54c6SPeter Maydell# build the manuals into a subdirectory (and then install them from
267b53c54c6SPeter Maydell# there for 'make install'). For an out-of-tree build we can just
268b53c54c6SPeter Maydell# use the docs/ subdirectory in the build tree as normal.
269b53c54c6SPeter Maydellifeq ($(realpath $(SRC_PATH)),$(realpath .))
270b53c54c6SPeter MaydellMANUAL_BUILDDIR := docs/built
271b53c54c6SPeter Maydellelse
272b53c54c6SPeter MaydellMANUAL_BUILDDIR := docs
273b53c54c6SPeter Maydellendif
274b53c54c6SPeter Maydell
275cc8ae6deSpbrookifdef BUILD_DOCS
276d06118bfSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/system/qemu.1
277a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/qemu-img.1
278a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/qemu-nbd.8
27987c0868fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/interop/qemu-ga.8
2806a7e2bbeSStefan Hajnocziifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
281a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/virtiofsd.1
2826a7e2bbeSStefan Hajnocziendif
283acab923dSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7
284d59157eaSPaolo BonziniDOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
285d59157eaSPaolo BonziniDOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
2861bf84a1eSKashyap ChamarthyDOCS+=$(MANUAL_BUILDDIR)/system/qemu-cpu-models.7
28722108f33SStefan HajnocziDOCS+=$(MANUAL_BUILDDIR)/index.html
288983eef5aSMeador Ingeifdef CONFIG_VIRTFS
289a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1
290983eef5aSMeador Ingeendif
29162dd1048SDaniel P. Berrangéifdef CONFIG_TRACE_SYSTEMTAP
292a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1
29362dd1048SDaniel P. Berrangéendif
294cc8ae6deSpbrookelse
295cc8ae6deSpbrookDOCS=
296cc8ae6deSpbrookendif
2977d13299dSbellard
2988cc357b5SDaniel P. BerrangeSUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
299e0e312f3SPaolo BonziniSUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(filter %-softmmu, $(TARGET_DIRS)))
300e0e312f3SPaolo BonziniSUBDIR_DEVICES_MAK_DEP=$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK))
3011f3d3c8fSJuan Quintela
3028bdd3d49SStefan Weilifeq ($(SUBDIR_DEVICES_MAK),)
303b7c11e57SPaolo Bonziniconfig-all-devices.mak: config-host.mak
3040bdb12c7SPeter Maydell	$(call quiet-command,echo '# no devices' > $@,"GEN","$@")
3058bdd3d49SStefan Weilelse
306b7c11e57SPaolo Bonziniconfig-all-devices.mak: $(SUBDIR_DEVICES_MAK) config-host.mak
307bb585a78SPaolo Bonzini	$(call quiet-command, sed -n \
308bb585a78SPaolo Bonzini             's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
309bb585a78SPaolo Bonzini             $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
3100bdb12c7SPeter Maydell             "GEN","$@")
3118bdd3d49SStefan Weilendif
3121f3d3c8fSJuan Quintela
313bd9141bbSPaul Brook-include $(SUBDIR_DEVICES_MAK_DEP)
314bd9141bbSPaul Brook
315e0e312f3SPaolo Bonzini# This has to be kept in sync with Kconfig.host.
316e0e312f3SPaolo BonziniMINIKCONF_ARGS = \
317f3494749SPaolo Bonzini    $(CONFIG_MINIKCONF_MODE) \
318aaa1b70aSPaolo Bonzini    $@ $*/config-devices.mak.d $< $(SRC_PATH)/Kconfig \
31996df0fddSPhilippe Mathieu-Daudé    CONFIG_TCG=$(CONFIG_TCG) \
320e0e312f3SPaolo Bonzini    CONFIG_KVM=$(CONFIG_KVM) \
321e0e312f3SPaolo Bonzini    CONFIG_SPICE=$(CONFIG_SPICE) \
322e0e312f3SPaolo Bonzini    CONFIG_IVSHMEM=$(CONFIG_IVSHMEM) \
323e0e312f3SPaolo Bonzini    CONFIG_TPM=$(CONFIG_TPM) \
324e0e312f3SPaolo Bonzini    CONFIG_XEN=$(CONFIG_XEN) \
325e0e312f3SPaolo Bonzini    CONFIG_OPENGL=$(CONFIG_OPENGL) \
326e0e312f3SPaolo Bonzini    CONFIG_X11=$(CONFIG_X11) \
327e0e312f3SPaolo Bonzini    CONFIG_VHOST_USER=$(CONFIG_VHOST_USER) \
32821c6b0c8SMarc-André Lureau    CONFIG_VHOST_KERNEL=$(CONFIG_VHOST_KERNEL) \
329e0e312f3SPaolo Bonzini    CONFIG_VIRTFS=$(CONFIG_VIRTFS) \
330d6c1bd4aSPaolo Bonzini    CONFIG_LINUX=$(CONFIG_LINUX) \
331d6c1bd4aSPaolo Bonzini    CONFIG_PVRDMA=$(CONFIG_PVRDMA)
332e0e312f3SPaolo Bonzini
333f4bda37dSPhilippe Mathieu-DaudéMINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py
334e0e312f3SPaolo Bonzini
335aaa1b70aSPaolo Bonzini$(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak $(SRC_PATH)/Kconfig $(BUILD_DIR)/config-host.mak
3361e0ef873SPhilippe Mathieu-Daudé	$(call quiet-command, $(MINIKCONF) $(MINIKCONF_ARGS) \
3371e0ef873SPhilippe Mathieu-Daudé		> $@.tmp, "GEN", "$@.tmp")
33812ccfec9SMichael S. Tsirkin	$(call quiet-command, if test -f $@; then \
339904fe1fbSBlue Swirl	  if cmp -s $@.old $@; then \
340012f0879SStefan Weil	    mv $@.tmp $@; \
341012f0879SStefan Weil	    cp -p $@ $@.old; \
342012f0879SStefan Weil	  else \
343012f0879SStefan Weil	    if test -f $@.old; then \
344012f0879SStefan Weil	      echo "WARNING: $@ (user modified) out of date.";\
345012f0879SStefan Weil	    else \
346a992fe3dSPaul Brook	      echo "WARNING: $@ out of date.";\
347012f0879SStefan Weil	    fi; \
348b98a3baeSPhilippe Mathieu-Daudé	    echo "Run \"$(MAKE) defconfig\" to regenerate."; \
349a992fe3dSPaul Brook	    rm $@.tmp; \
350012f0879SStefan Weil	  fi; \
351a992fe3dSPaul Brook	 else \
352a992fe3dSPaul Brook	  mv $@.tmp $@; \
353012f0879SStefan Weil	  cp -p $@ $@.old; \
3540bdb12c7SPeter Maydell	 fi,"GEN","$@");
355a992fe3dSPaul Brook
356a992fe3dSPaul Brookdefconfig:
357a992fe3dSPaul Brook	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
358a992fe3dSPaul Brook
359992aeb8eSPaolo Bonziniifneq ($(wildcard config-host.mak),)
360992aeb8eSPaolo Bonziniinclude $(SRC_PATH)/Makefile.objs
361ba1183daSFam Zhengendif
362ba1183daSFam Zheng
363ba1183daSFam Zhengdummy := $(call unnest-vars,, \
3645b76dd13SDaniel P. Berrange                authz-obj-y \
36532d955a4SMarc-André Lureau                chardev-obj-y \
366ba1183daSFam Zheng                qga-obj-y \
3673fa2d384SViktor Prutyanov                elf2dmp-obj-y \
368a75eb03bSDavid Marchand                ivshmem-client-obj-y \
369a75eb03bSDavid Marchand                ivshmem-server-obj-y \
37081bfc42dSDr. David Alan Gilbert                virtiofsd-obj-y \
371a5d2f6f8SYuval Shaia                rdmacm-mux-obj-y \
3727b2e5c65SMarc-André Lureau                libvhost-user-obj-y \
37349cc0340SFelipe Franciosi                vhost-user-scsi-obj-y \
374406d2aa2SChangpeng Liu                vhost-user-blk-obj-y \
37506914c97SMarc-André Lureau                vhost-user-input-obj-y \
376d52c454aSMarc-André Lureau                vhost-user-gpu-obj-y \
377577a6723STomoki Sekiyama                qga-vss-dll-obj-y \
378ba1183daSFam Zheng                block-obj-y \
379cc475698SFam Zheng                block-obj-m \
38014837c64SKevin Wolf                storage-daemon-obj-y \
38114837c64SKevin Wolf                storage-daemon-obj-m \
382fb37726dSDaniel P. Berrange                crypto-obj-y \
3830c7012e0SDaniel P. Berrange                qom-obj-y \
384666a3af9SDaniel P. Berrange                io-obj-y \
385cc475698SFam Zheng                common-obj-y \
386*a81df1b6SPaolo Bonzini                common-obj-m)
387243af022SPaolo Bonzini
38846e7b706SFam Zhenginclude $(SRC_PATH)/tests/Makefile.include
389992aeb8eSPaolo Bonzini
390d52c454aSMarc-André Lureauall: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all modules $(vhost-user-json-y)
391b9dea4fbSpbrook
39267a1de0dSFam Zhengqemu-version.h: FORCE
39367a1de0dSFam Zheng	$(call quiet-command, \
39457b49737SPeter Maydell                (printf '#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \
39557b49737SPeter Maydell		printf '#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \
3967e563bfbSThomas Huth		) > $@.tmp)
397d9e73d32SLin Ma	$(call quiet-command, if ! cmp -s $@ $@.tmp; then \
398d9e73d32SLin Ma	  mv $@.tmp $@; \
399d9e73d32SLin Ma	 else \
400d9e73d32SLin Ma	  rm $@.tmp; \
401d9e73d32SLin Ma	 fi)
40267a1de0dSFam Zheng
4031215c6e7SJuan Quintelaconfig-host.h: config-host.h-timestamp
4041215c6e7SJuan Quintelaconfig-host.h-timestamp: config-host.mak
405077de81aSPaolo Bonziniqemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
4060bdb12c7SPeter Maydell	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
4071215c6e7SJuan Quintela
408c621dc3eSAlexander BulekovTARGET_DIRS_RULES := $(foreach t, all fuzz clean install, $(addsuffix /$(t), $(TARGET_DIRS)))
409916359f6SAndreas Färber
4101338a4b7SMarkus ArmbrusterSOFTMMU_ALL_RULES=$(filter %-softmmu/all, $(TARGET_DIRS_RULES))
4111338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(authz-obj-y)
4121338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(block-obj-y)
41314837c64SKevin Wolf$(SOFTMMU_ALL_RULES): $(storage-daemon-obj-y)
4141338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(chardev-obj-y)
4151338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(crypto-obj-y)
4161338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(io-obj-y)
4171338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): config-all-devices.mak
41805dfa22bSPhilippe Mathieu-Daudéifdef DECOMPRESS_EDK2_BLOBS
4191338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(edk2-decompressed)
42005dfa22bSPhilippe Mathieu-Daudéendif
421cec7d0b6Spbrook
422c621dc3eSAlexander BulekovSOFTMMU_FUZZ_RULES=$(filter %-softmmu/fuzz, $(TARGET_DIRS_RULES))
423c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(authz-obj-y)
424c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(block-obj-y)
425c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(chardev-obj-y)
426c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(crypto-obj-y)
427c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(io-obj-y)
428c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): config-all-devices.mak
429c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(edk2-decompressed)
430c621dc3eSAlexander Bulekov
4311338a4b7SMarkus Armbruster.PHONY: $(TARGET_DIRS_RULES)
4321338a4b7SMarkus Armbruster# The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
4331338a4b7SMarkus Armbruster# $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
4341338a4b7SMarkus Armbruster$(TARGET_DIRS_RULES):
4351338a4b7SMarkus Armbruster	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
4364aa42531Spbrook
43767953a37SClaudio Fontana# LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
43867953a37SClaudio FontanaDTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_lib=""
439965f486cSPeter MaydellDTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
44067953a37SClaudio FontanaDTC_CPPFLAGS=-I$(SRC_PATH)/dtc/libfdt
441a540f158SPeter Crosthwaite
4423b8593eeSMarkus Armbruster.PHONY: dtc/all
44367953a37SClaudio Fontanadtc/all: .git-submodule-status dtc/libfdt
44467953a37SClaudio 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,)
445a540f158SPeter Crosthwaite
44600525864SAaron Lindsaydtc/%: .git-submodule-status
447814e1110SJan Kiszka	@mkdir -p $@
448a540f158SPeter Crosthwaite
449e219c499SRichard Henderson# Overriding CFLAGS causes us to lose defines added in the sub-makefile.
450e219c499SRichard Henderson# Not overriding CFLAGS leads to mis-matches between compilation modes.
451e219c499SRichard Henderson# Therefore we replicate some of the logic in the sub-makefile.
452e219c499SRichard Henderson# Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
453e219c499SRichard Henderson# no need to annoy QEMU developers with such things.
454e219c499SRichard HendersonCAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS))
455e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
456e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_ARM
457e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_ARM64
458e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
459e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_X86
460e219c499SRichard Henderson
4613b8593eeSMarkus Armbruster.PHONY: capstone/all
4623b8593eeSMarkus Armbrustercapstone/all: .git-submodule-status
4639f81aeb5SAlistair 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))
464e219c499SRichard Henderson
4653b8593eeSMarkus Armbruster.PHONY: slirp/all
4663b8593eeSMarkus Armbrusterslirp/all: .git-submodule-status
467daa79d9aSAlex Bennée	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp		\
468daa79d9aSAlex Bennée		BUILD_DIR="$(BUILD_DIR)/slirp" 			\
469daa79d9aSAlex Bennée		PKG_CONFIG="$(PKG_CONFIG)" 				\
470daa79d9aSAlex Bennée		CC="$(CC)" AR="$(AR)" 	LD="$(LD)" RANLIB="$(RANLIB)"	\
471db5adeaaSPaolo Bonzini		CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)")
472675b9b53SMarc-André Lureau
4731338a4b7SMarkus Armbruster$(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
474b8d89ba8SPaolo Bonzini	$(qom-obj-y)
475add16157SBlue Swirl
476c621dc3eSAlexander Bulekov$(filter %/fuzz, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
477c621dc3eSAlexander Bulekov	$(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY))
478c621dc3eSAlexander Bulekov
4793b8593eeSMarkus ArmbrusterROM_DIRS = $(addprefix pc-bios/, $(ROMS))
4801338a4b7SMarkus ArmbrusterROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
481a9c87304SMarc-André Lureau# Only keep -O and -g cflags
4821338a4b7SMarkus Armbruster.PHONY: $(ROM_DIRS_RULES)
4831338a4b7SMarkus Armbruster$(ROM_DIRS_RULES):
4841338a4b7SMarkus Armbruster	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))" $(notdir $@),)
485c05ac895SPaul Brook
4868d358a5eSMarkus Armbruster.PHONY: recurse-all recurse-clean recurse-install
4871338a4b7SMarkus Armbrusterrecurse-all: $(addsuffix /all, $(TARGET_DIRS) $(ROM_DIRS))
4881338a4b7SMarkus Armbrusterrecurse-clean: $(addsuffix /clean, $(TARGET_DIRS) $(ROM_DIRS))
4891338a4b7SMarkus Armbrusterrecurse-install: $(addsuffix /install, $(TARGET_DIRS))
49047ae060eSMarkus Armbruster$(addsuffix /install, $(TARGET_DIRS)): all
4914aa42531Spbrook
492c17a18efSMarc-André Lureau$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
4930bdb12c7SPeter Maydell	$(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
4945354e4d2SMarc-André Lureau
495c17a18efSMarc-André LureauMakefile: $(version-obj-y)
4963bc2f570SPaolo Bonzini
4973bc2f570SPaolo Bonzini######################################################################
4988a090705SPaolo Bonzini# Build libraries
4993bc2f570SPaolo Bonzini
500*a81df1b6SPaolo Bonzinilibvhost-user.a: $(libvhost-user-obj-y)
5013bc2f570SPaolo Bonzini
5024fb240a4Sbellard######################################################################
5034fb240a4Sbellard
504ebedb37cSPaolo BonziniCOMMON_LDADDS = libqemuutil.a
5050ab8ed18SDaniel P. Berrange
5063c089e15SJuan Quintelaqemu-img.o: qemu-img-cmds.h
507153859beSStuart Brady
5085b76dd13SDaniel P. Berrangeqemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
5095b76dd13SDaniel P. Berrangeqemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
5105b76dd13SDaniel P. Berrangeqemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
5115e6911cfSKevin Wolfqemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) $(storage-daemon-obj-y) $(COMMON_LDADDS)
5120a8e1acdSaliguori
5130ab8ed18SDaniel P. Berrangeqemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
5147b93fadfSCorey Bryant
5156a021536SGerd Hoffmannqemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS)
5166a021536SGerd Hoffmann
51772d277a7SGerd Hoffmannqemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS)
51872d277a7SGerd Hoffmann
5190ab8ed18SDaniel P. Berrangefsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
52017bff52bSM. Mohan Kumar
5215b76dd13SDaniel P. Berrangescsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o $(authz-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
522fe8fc5aeSPaolo Bonziniifdef CONFIG_MPATH
523fe8fc5aeSPaolo Bonziniscsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
524fe8fc5aeSPaolo Bonziniendif
525b855f8d1SPaolo Bonzini
526077de81aSPaolo Bonziniqemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
5270bdb12c7SPeter Maydell	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
528153859beSStuart Brady
529957f1f99SMichael Rothqemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
53054c2e502SDunrong Huangqemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
531640e5404SMichael Roth
5326a021536SGerd Hoffmannqemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
5336a021536SGerd Hoffmannqemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
5346a021536SGerd Hoffmann
535e6c42b96SMarkus Armbrusterqapi-py = $(SRC_PATH)/scripts/qapi/__init__.py \
536e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/commands.py \
537fb0bc835SMarkus Armbruster$(SRC_PATH)/scripts/qapi/common.py \
538fb0bc835SMarkus Armbruster$(SRC_PATH)/scripts/qapi/doc.py \
539e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/error.py \
540e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/events.py \
541e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/expr.py \
542e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/gen.py \
543e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/introspect.py \
544e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/parser.py \
545e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/schema.py \
546e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/source.py \
547e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/types.py \
548e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/visit.py \
549fb0bc835SMarkus Armbruster$(SRC_PATH)/scripts/qapi-gen.py
5508d3bc517SAvi Kivity
551fb0bc835SMarkus Armbrusterqga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
552fb0bc835SMarkus Armbrusterqga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h \
553eb815e24SMarkus Armbrusterqga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \
55400ca24ffSMarkus Armbrusterqga/qapi-generated/qga-qapi-init-commands.h qga/qapi-generated/qga-qapi-init-commands.c \
555fb0bc835SMarkus Armbrusterqga/qapi-generated/qga-qapi-doc.texi: \
556fb0bc835SMarkus Armbrusterqga/qapi-generated/qapi-gen-timestamp ;
557fb0bc835SMarkus Armbrusterqga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
5580d6b93deSMatthias Maier	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
559fb0bc835SMarkus Armbruster		-o qga/qapi-generated -p "qga-" $<, \
560fb0bc835SMarkus Armbruster		"GEN","$(@:%-timestamp=%)")
561fb0bc835SMarkus Armbruster	@>$@
562e3d4d252SMichael Roth
56300ca24ffSMarkus ArmbrusterQGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h qga-qapi-init-commands.h)
5647a0b7ebaSMarc-André Lureau$(qga-obj-y): $(QGALIB_GEN)
565957f1f99SMichael Roth
5660ab8ed18SDaniel P. Berrangeqemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
567fafcaf1dSMichael Roth	$(call LINK, $^)
56848ff7a62SMichael Roth
5699dacf32dSYossi Hindinifdef QEMU_GA_MSI_ENABLED
5709dacf32dSYossi HindinQEMU_GA_MSI=qemu-ga-$(ARCH).msi
5719dacf32dSYossi Hindin
5720a18750fSLeonid Blochmsi: $(QEMU_GA_MSI)
5739dacf32dSYossi Hindin
574fafcaf1dSMichael Roth$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
5759dacf32dSYossi Hindin
5769dacf32dSYossi Hindin$(QEMU_GA_MSI): config-host.mak
5779dacf32dSYossi Hindin
578decdfbd2SLeonid Bloch$(QEMU_GA_MSI):  $(SRC_PATH)/qga/installer/qemu-ga.wxs
579decdfbd2SLeonid Bloch	$(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)" \
5800bdb12c7SPeter Maydell	wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<,"WIXL","$@")
5819dacf32dSYossi Hindinelse
5829dacf32dSYossi Hindinmsi:
58315b19ed8SMichael Roth	@echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
5849dacf32dSYossi Hindinendif
5859dacf32dSYossi Hindin
586fafcaf1dSMichael Rothifneq ($(EXESUF),)
587fafcaf1dSMichael Roth.PHONY: qemu-ga
588fafcaf1dSMichael Rothqemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
589fafcaf1dSMichael Rothendif
590fafcaf1dSMichael Roth
5911b9d35f3SViktor Prutyanovelf2dmp$(EXESUF): $(elf2dmp-obj-y)
5923fa2d384SViktor Prutyanov	$(call LINK, $^)
5933fa2d384SViktor Prutyanov
594b1449edbSKamil Rytarowskiifdef CONFIG_IVSHMEM
5950ab8ed18SDaniel P. Berrangeivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS)
596a75eb03bSDavid Marchand	$(call LINK, $^)
5970ab8ed18SDaniel P. Berrangeivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
598a75eb03bSDavid Marchand	$(call LINK, $^)
599b1449edbSKamil Rytarowskiendif
600*a81df1b6SPaolo Bonzinivhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a $(COMMON_LDADDS)
60149cc0340SFelipe Franciosi	$(call LINK, $^)
602*a81df1b6SPaolo Bonzinivhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a $(COMMON_LDADDS)
603406d2aa2SChangpeng Liu	$(call LINK, $^)
6040f645ba1SMarcel Apfelbaum
6050f645ba1SMarcel Apfelbaumrdmacm-mux$(EXESUF): LIBS += "-libumad"
606a5d2f6f8SYuval Shaiardmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
607a5d2f6f8SYuval Shaia	$(call LINK, $^)
608a75eb03bSDavid Marchand
6094f8bde99SStefan Hajnoczi# relies on Linux-specific syscalls
6102405f3c0SDr. David Alan Gilbertifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
61181bfc42dSDr. David Alan Gilbertvirtiofsd$(EXESUF): $(virtiofsd-obj-y) libvhost-user.a $(COMMON_LDADDS)
61281bfc42dSDr. David Alan Gilbert	$(call LINK, $^)
61381bfc42dSDr. David Alan Gilbertendif
61481bfc42dSDr. David Alan Gilbert
615*a81df1b6SPaolo Bonzinivhost-user-gpu$(EXESUF): $(vhost-user-gpu-obj-y) libvhost-user.a $(COMMON_LDADDS)
616d52c454aSMarc-André Lureau	$(call LINK, $^)
617d52c454aSMarc-André Lureau
61806914c97SMarc-André Lureauifdef CONFIG_VHOST_USER_INPUT
61906914c97SMarc-André Lureauifdef CONFIG_LINUX
620*a81df1b6SPaolo Bonzinivhost-user-input$(EXESUF): $(vhost-user-input-obj-y) libvhost-user.a $(COMMON_LDADDS)
62106914c97SMarc-André Lureau	$(call LINK, $^)
62206914c97SMarc-André Lureau
62306914c97SMarc-André Lureau# build by default, do not install
62406914c97SMarc-André Lureauall: vhost-user-input$(EXESUF)
62506914c97SMarc-André Lureauendif
62606914c97SMarc-André Lureauendif
62706914c97SMarc-André Lureau
6280c0c1fd9SMarc Marimodule_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
6290c0c1fd9SMarc Mari	$(call quiet-command,$(PYTHON) $< $@ \
6300c0c1fd9SMarc Mari	$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
6310bdb12c7SPeter Maydell	"GEN","$@")
6320c0c1fd9SMarc Mari
633a5665051SPaolo Bonziniclean: recurse-clean ninja-clean clean-ctlist
634a5665051SPaolo Bonzini	-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
6352d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files
63625be210fSJuan 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
637df2943baSMichael S. Tsirkin	rm -f qemu-options.def
6389dacf32dSYossi Hindin	rm -f *.msi
63923858f40SLaszlo Ersek	find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \
64023858f40SLaszlo Ersek		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
64123858f40SLaszlo Ersek		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
64223858f40SLaszlo Ersek		! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
64323858f40SLaszlo Ersek		-exec rm {} +
64426ce90fdSLaszlo Ersek	rm -f $(edk2-decompressed)
6450814465aSPaolo Bonzini	rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) TAGS cscope.* *.pod *~ */*~
646b855f8d1SPaolo Bonzini	rm -f fsdev/*.pod scsi/*.pod
64707b44ce9SBlue Swirl	rm -f qemu-img-cmds.h
648d98bc0b6SGerd Hoffmann	rm -f ui/shader/*-vert.h ui/shader/*-frag.h
6493dff199cSLaurent Vivier	rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
650fb0bc835SMarkus Armbruster	rm -f qapi-gen-timestamp
6512af282ecSKevin Wolf	rm -f storage-daemon/qapi/qapi-gen-timestamp
65254c2e502SDunrong Huang	rm -rf qga/qapi-generated
653e92af6ecSJuan Quintela	rm -f config-all-devices.mak
654d69cda7eSPeter Maydell	rm -f $(SUBDIR_DEVICES_MAK)
65531e31b8aSbellard
65634bb443eSAnthony LiguoriVERSION ?= $(shell cat VERSION)
65734bb443eSAnthony Liguori
65834bb443eSAnthony Liguoridist: qemu-$(VERSION).tar.bz2
65934bb443eSAnthony Liguori
66034bb443eSAnthony Liguoriqemu-%.tar.bz2:
66134bb443eSAnthony Liguori	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
66234bb443eSAnthony Liguori
6635f71eac0SPeter Maydelldefine clean-manual =
6641290e671SPeter Maydellrm -rf $(MANUAL_BUILDDIR)/$1/_static
6651290e671SPeter Maydellrm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(MANUAL_BUILDDIR)/$1/*.html
6665f71eac0SPeter Maydellendef
6675f71eac0SPeter Maydell
668a5665051SPaolo Bonzinidistclean: clean ninja-distclean
669a5665051SPaolo Bonzini	-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean -g
670ee5195eeSRichard Henderson	rm -f config-host.mak config-host.h* $(DOCS)
6712038f8c8SPaolo Bonzini	rm -f tests/tcg/config-*.mak
672ae219359SThomas Huth	rm -f config-all-devices.mak config-all-disas.mak config.status
673e92af6ecSJuan Quintela	rm -f $(SUBDIR_DEVICES_MAK)
674ae219359SThomas Huth	rm -f po/*.mo tests/qemu-iotests/common.env
675fc8e320eSMagnus Damm	rm -f roms/seabios/config.mak roms/vgabios/config.mak
67626fffe29SEmilio G. Cota	rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
677a5665051SPaolo Bonzini	rm -rf meson-private meson-logs meson-info compile_commands.json
678245dac4aSPaolo Bonzini	rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest
679793553acSAlexandre Raymond	rm -f config.log
68067ed96f9SPeter Maydell	rm -f linux-headers/asm
681d59157eaSPaolo Bonzini	rm -f docs/version.texi
682d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi
683d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7
684d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
685d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
686d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
68781f33401SPeter Maydell	rm -rf .doctrees
6885f71eac0SPeter Maydell	$(call clean-manual,devel)
6895f71eac0SPeter Maydell	$(call clean-manual,interop)
6900783a732SPeter Maydell	$(call clean-manual,specs)
6910928523aSPeter Maydell	$(call clean-manual,system)
69265c3542bSPeter Maydell	$(call clean-manual,tools)
69309147930SPaolo Bonzini	$(call clean-manual,user)
6942b1f35b9SAlex Bennée	for d in $(TARGET_DIRS); do \
695bc1b050dSbellard	rm -rf $$d || exit 1 ; \
69676bc6838Sbellard        done
697d9840e25STomoki Sekiyama	rm -Rf .sdk
6987d13299dSbellard
69906e7772fSGerd HoffmannKEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  no  pt-br  sv \
700fed4a9adSbellardar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
70126b1cbf8SGerd Hoffmannde-ch  es     fo  fr-ca  hu     ja  mk  pt  sl     tr \
7023751e722SJan Krupabepo    cz
703fed4a9adSbellard
70477755340Sthsifdef INSTALL_BLOBS
70532eb2da3SBruce RogersBLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
7067a4dfd1eSGerd Hoffmannvgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
7070a87fd69SGerd Hoffmannvgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
708b2ce76a0SThomas Huthopenbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
7095ee8ad71SAlex Williamsonpxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
7105ee8ad71SAlex Williamsonpxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
7119fd02979SSander Eikelenboomefi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
7129fd02979SSander Eikelenboomefi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
71345027808SGerd Hoffmannefi-e1000e.rom efi-vmxnet3.rom \
714b3ce38dcSPhilippe Mathieu-Daudéqemu-nsis.bmp \
7154b387f9eSBALATON Zoltanbamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
7162785dc7bSStefano Garzarellamultiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
7176c5359e1SChristian Borntraegers390-ccw.img s390-netboot.img \
718744a928cSAlexey Kardashevskiyslof.bin skiboot.lid \
7190c6ab8c9SCole Robinsonpalcode-clipper \
72082e65fe0SBALATON Zoltanu-boot.e500 u-boot-sam460-20100605.bin \
72143ad2564SRichard Hendersonqemu_vga.ndrv \
72226ce90fdSLaszlo Ersekedk2-licenses.txt \
72391f3a2f0SAlistair Francishppa-firmware.img \
724a6fcc80bSBin Mengopensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
72591f3a2f0SAlistair Francisopensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
72691f3a2f0SAlistair Francis
72726ce90fdSLaszlo Ersek
72826ce90fdSLaszlo ErsekDESCS=50-edk2-i386-secure.json 50-edk2-x86_64-secure.json \
72926ce90fdSLaszlo Ersek60-edk2-aarch64.json 60-edk2-arm.json 60-edk2-i386.json 60-edk2-x86_64.json
73077755340Sthselse
73177755340SthsBLOBS=
73226ce90fdSLaszlo ErsekDESCS=
73377755340Sthsendif
73477755340Sths
735336cfef4SPeter Maydell# Note that we manually filter-out the non-Sphinx documentation which
73627a296fcSPeter Maydell# is currently built into the docs/interop directory in the build tree,
73727a296fcSPeter Maydell# and also any sphinx-built manpages.
7385f71eac0SPeter Maydelldefine install-manual =
7391290e671SPeter Maydellfor d in $$(cd $(MANUAL_BUILDDIR) && find $1 -type d); do $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/$$d"; done
74027a296fcSPeter 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
7415f71eac0SPeter Maydellendef
7425f71eac0SPeter Maydell
7435f71eac0SPeter Maydell# Note that we deliberately do not install the "devel" manual: it is
7445f71eac0SPeter Maydell# for QEMU developers, and not interesting to our users.
7455f71eac0SPeter Maydell.PHONY: install-sphinxdocs
7465f71eac0SPeter Maydellinstall-sphinxdocs: sphinxdocs
7475f71eac0SPeter Maydell	$(call install-manual,interop)
7480783a732SPeter Maydell	$(call install-manual,specs)
7490928523aSPeter Maydell	$(call install-manual,system)
75065c3542bSPeter Maydell	$(call install-manual,tools)
75109147930SPaolo Bonzini	$(call install-manual,user)
7525f71eac0SPeter Maydell
7535f71eac0SPeter Maydellinstall-doc: $(DOCS) install-sphinxdocs
754d7dd65baSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
75522108f33SStefan Hajnoczi	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/index.html "$(DESTDIR)$(qemu_docdir)"
756c13dba2cSLiao Pingfang	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop"
757c13dba2cSLiao Pingfang	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)/interop"
758c13dba2cSLiao Pingfang	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)/interop"
75996d409ebSJuan Quintelaifdef CONFIG_POSIX
76058f8aeadSaliguori	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
761d06118bfSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu.1 "$(DESTDIR)$(mandir)/man1"
76256e8bdd4SMarc-André Lureau	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
763d59157eaSPaolo Bonzini	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
764acab923dSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
7651bf84a1eSKashyap Chamarthy	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
766c932ce31SPaolo Bonziniifeq ($(CONFIG_TOOLS),y)
767a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-img.1 "$(DESTDIR)$(mandir)/man1"
76858f8aeadSaliguori	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
769a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
77038954dcaSpbrookendif
77162dd1048SDaniel P. Berrangéifdef CONFIG_TRACE_SYSTEMTAP
772a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
77362dd1048SDaniel P. Berrangéendif
774665b5d0dSMarc-André Lureauifneq (,$(findstring qemu-ga,$(TOOLS)))
775b53c54c6SPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
776c13dba2cSLiao Pingfang	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop"
777c13dba2cSLiao Pingfang	$(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)/interop"
778c13dba2cSLiao Pingfang	$(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)/interop"
779d59157eaSPaolo Bonzini	$(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
780665b5d0dSMarc-André Lureauendif
7818a3e8f7fSAndreas Färberendif
782a2d8f1beSM. Mohan Kumarifdef CONFIG_VIRTFS
783a2d8f1beSM. Mohan Kumar	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
784a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
785a2d8f1beSM. Mohan Kumarendif
7866a7e2bbeSStefan Hajnocziifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
787a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtiofsd.1 "$(DESTDIR)$(mandir)/man1"
7886a7e2bbeSStefan Hajnocziendif
789b5ec5ce0Sjohn cooper
790e2d87bffSEduardo Habkostinstall-datadir:
791e2d87bffSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
792e2d87bffSEduardo Habkost
793f2e3978bSLaszlo Ersekinstall-localstatedir:
794f2e3978bSLaszlo Ersekifdef CONFIG_POSIX
795f2e3978bSLaszlo Ersekifneq (,$(findstring qemu-ga,$(TOOLS)))
796f2e3978bSLaszlo Ersek	$(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
797f2e3978bSLaszlo Ersekendif
798f2e3978bSLaszlo Ersekendif
799f2e3978bSLaszlo Ersek
800a8260d38SDaniel P. BerrangéICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
801e2d87bffSEduardo Habkost
80254cb65d8SEmilio G. Cotainstall-includedir:
80354cb65d8SEmilio G. Cota	$(INSTALL_DIR) "$(DESTDIR)$(includedir)"
80454cb65d8SEmilio G. Cota
805a5665051SPaolo Bonzini# Needed by "meson install"
806a5665051SPaolo Bonziniexport DESTDIR
80754cb65d8SEmilio G. Cotainstall: all $(if $(BUILD_DOCS),install-doc) \
80854cb65d8SEmilio G. Cota	install-datadir install-localstatedir install-includedir \
8091338a4b7SMarkus Armbruster	$(if $(INSTALL_BLOBS),$(edk2-decompressed)) \
8101338a4b7SMarkus Armbruster	recurse-install
811932a79dfSthsifneq ($(TOOLS),)
8120814465aSPaolo Bonzini	$(call install-prog,$(TOOLS),$(DESTDIR)$(bindir))
813932a79dfSthsendif
814e3be6f0eSFam Zhengifneq ($(CONFIG_MODULES),)
815e3be6f0eSFam Zheng	$(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
8162115182fSMichael Tokarev	for s in $(modules-m:.mo=$(DSOSUF)); do \
8172115182fSMichael Tokarev		t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
818264f8b4fSMichael Tokarev		$(INSTALL_LIB) $$s "$$t"; \
8192115182fSMichael Tokarev		test -z "$(STRIP)" || $(STRIP) "$$t"; \
820e3be6f0eSFam Zheng	done
821e3be6f0eSFam Zhengendif
8227b93fadfSCorey Bryantifneq ($(HELPERS-y),)
8230d659426SMichael Tokarev	$(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
8247b93fadfSCorey Bryantendif
825d52c454aSMarc-André Lureauifneq ($(vhost-user-json-y),)
826d52c454aSMarc-André Lureau	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/vhost-user/"
827d52c454aSMarc-André Lureau	for x in $(vhost-user-json-y); do \
828d52c454aSMarc-André Lureau		$(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)/vhost-user/"; \
829d52c454aSMarc-André Lureau	done
830d52c454aSMarc-André Lureauendif
83162dd1048SDaniel P. Berrangéifdef CONFIG_TRACE_SYSTEMTAP
83262dd1048SDaniel P. Berrangé	$(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
83362dd1048SDaniel P. Berrangéendif
83477755340Sthsifneq ($(BLOBS),)
83577755340Sths	set -e; for x in $(BLOBS); do \
8366aae2a2eSEduardo Habkost		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
837ad064840Spbrook	done
83877755340Sthsendif
83926ce90fdSLaszlo Ersekifdef INSTALL_BLOBS
84026ce90fdSLaszlo Ersek	set -e; for x in $(edk2-decompressed); do \
84126ce90fdSLaszlo Ersek		$(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)"; \
84226ce90fdSLaszlo Ersek	done
84326ce90fdSLaszlo Ersekendif
84426ce90fdSLaszlo Ersekifneq ($(DESCS),)
84526ce90fdSLaszlo Ersek	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/firmware"
84626ce90fdSLaszlo Ersek	set -e; tmpf=$$(mktemp); trap 'rm -f -- "$$tmpf"' EXIT; \
84726ce90fdSLaszlo Ersek	for x in $(DESCS); do \
848177cd674SOlaf Hering		sed -e 's,@DATADIR@,$(qemu_datadir),' \
84926ce90fdSLaszlo Ersek			"$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
85026ce90fdSLaszlo Ersek		$(INSTALL_DATA) "$$tmpf" \
85126ce90fdSLaszlo Ersek			"$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
85226ce90fdSLaszlo Ersek	done
85326ce90fdSLaszlo Ersekendif
854a8260d38SDaniel P. Berrangé	for s in $(ICON_SIZES); do \
8556c11dda9SStefan Hajnoczi		mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
856a8260d38SDaniel P. Berrangé		$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \
8576c11dda9SStefan Hajnoczi			"$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
858a8260d38SDaniel P. Berrangé	done; \
8596c11dda9SStefan Hajnoczi	mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
860a8260d38SDaniel P. Berrangé	$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \
8616c11dda9SStefan Hajnoczi		"$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
8626c11dda9SStefan Hajnoczi	mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
863a8260d38SDaniel P. Berrangé	$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \
8646c11dda9SStefan Hajnoczi		"$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
8656c11dda9SStefan Hajnoczi	mkdir -p "$(DESTDIR)$(qemu_desktopdir)"
86667ea9546SDaniel P. Berrangé	$(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
8676c11dda9SStefan Hajnoczi		"$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
8682a6b5372SMichael Tokarevifdef CONFIG_GTK
869834574eaSAnthony Liguori	$(MAKE) -C po $@
870834574eaSAnthony Liguoriendif
87154cb65d8SEmilio G. Cotaifeq ($(CONFIG_PLUGIN),y)
87254cb65d8SEmilio G. Cota	$(INSTALL_DATA) $(SRC_PATH)/include/qemu/qemu-plugin.h "$(DESTDIR)$(includedir)/qemu-plugin.h"
87354cb65d8SEmilio G. Cotaendif
8746aae2a2eSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
87518be8d77Sblueswir1	set -e; for x in $(KEYMAPS); do \
8766aae2a2eSEduardo Habkost		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
877ad064840Spbrook	done
878*a81df1b6SPaolo Bonzini	for d in $(TARGET_DIRS); do \
879*a81df1b6SPaolo Bonzini	$(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
880*a81df1b6SPaolo Bonzini        done
881612384d7Sbellard
882d98bc0b6SGerd Hoffmann# opengl shader programs
883d98bc0b6SGerd Hoffmannui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
884d98bc0b6SGerd Hoffmann	@mkdir -p $(dir $@)
885d98bc0b6SGerd Hoffmann	$(call quiet-command,\
886d98bc0b6SGerd Hoffmann		perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
8870bdb12c7SPeter Maydell		"VERT","$@")
888d98bc0b6SGerd Hoffmann
889d98bc0b6SGerd Hoffmannui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
890d98bc0b6SGerd Hoffmann	@mkdir -p $(dir $@)
891d98bc0b6SGerd Hoffmann	$(call quiet-command,\
892d98bc0b6SGerd Hoffmann		perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
8930bdb12c7SPeter Maydell		"FRAG","$@")
894d98bc0b6SGerd Hoffmann
89546e19e14SGerd Hoffmannui/shader.o: $(SRC_PATH)/ui/shader.c \
8962e1d70b9SGerd Hoffmann	ui/shader/texture-blit-vert.h \
8972e1d70b9SGerd Hoffmann	ui/shader/texture-blit-flip-vert.h \
8982e1d70b9SGerd Hoffmann	ui/shader/texture-blit-frag.h
899cd2bc889SGerd Hoffmann
9003ef693a0Sbellard# documentation
901e8518c92SMarkus ArmbrusterMAKEINFO=makeinfo
902d59157eaSPaolo BonziniMAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
903d59157eaSPaolo BonziniMAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
904e8338fdbSMarc-André LureauTEXI2PODFLAGS=$(MAKEINFOINCLUDES) -DVERSION="$(VERSION)" -DCONFDIR="$(qemu_confdir)"
905d59157eaSPaolo BonziniTEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
90656e8bdd4SMarc-André Lureau
907e8338fdbSMarc-André Lureaudocs/version.texi: $(SRC_PATH)/VERSION config-host.mak
908e8338fdbSMarc-André Lureau	$(call quiet-command,(\
909e8338fdbSMarc-André Lureau		echo "@set VERSION $(VERSION)" && \
910e8338fdbSMarc-André Lureau		echo "@set CONFDIR $(qemu_confdir)" \
911e8338fdbSMarc-André Lureau	)> $@,"GEN","$@")
912fea346f5SPeter Maydell
91344cb280dSPaolo Bonzini%.html: %.texi docs/version.texi
914e9ee06bdSMarc-André Lureau	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
915e9ee06bdSMarc-André Lureau	--html $< -o $@,"GEN","$@")
9163ef693a0Sbellard
91744cb280dSPaolo Bonzini%.info: %.texi docs/version.texi
918e9ee06bdSMarc-André Lureau	$(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
919f3548328Sbellard
92044cb280dSPaolo Bonzini%.txt: %.texi docs/version.texi
921f8bab10bSMarc-André Lureau	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
922f8bab10bSMarc-André Lureau	--plaintext $< -o $@,"GEN","$@")
923f8bab10bSMarc-André Lureau
92444cb280dSPaolo Bonzini%.pdf: %.texi docs/version.texi
925d59157eaSPaolo Bonzini	$(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@")
926bd7f9747SMarkus Armbruster
9275f71eac0SPeter Maydell# Sphinx builds all its documentation at once in one invocation
9285f71eac0SPeter Maydell# and handles "don't rebuild things unless necessary" itself.
9295f71eac0SPeter Maydell# The '.doctrees' files are cached information to speed this up.
9305f71eac0SPeter Maydell.PHONY: sphinxdocs
9310928523aSPeter Maydellsphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \
9320928523aSPeter Maydell            $(MANUAL_BUILDDIR)/interop/index.html \
9330928523aSPeter Maydell            $(MANUAL_BUILDDIR)/specs/index.html \
93465c3542bSPeter Maydell            $(MANUAL_BUILDDIR)/system/index.html \
93509147930SPaolo Bonzini            $(MANUAL_BUILDDIR)/tools/index.html \
93609147930SPaolo Bonzini            $(MANUAL_BUILDDIR)/user/index.html
9375f71eac0SPeter Maydell
9385f71eac0SPeter Maydell# Canned command to build a single manual
93927a296fcSPeter Maydell# Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
9406bda415cSEduardo Habkost# Note the use of different doctree for each (manual, builder) tuple;
9416bda415cSEduardo Habkost# this works around Sphinx not handling parallel invocation on
9426bda415cSEduardo Habkost# a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
943516e8b7dSPeter 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")
9445f71eac0SPeter Maydell# We assume all RST files in the manual's directory are used in it
945814e068fSPeter Maydellmanual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \
946de1572caSPeter Maydell              $(SRC_PATH)/docs/defs.rst.inc \
9479165d323SPeter Maydell              $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py \
9489165d323SPeter Maydell              $(SRC_PATH)/docs/sphinx/*.py
949e0f3728dSPeter Maydell# Macro to write out the rule and dependencies for building manpages
950e0f3728dSPeter Maydell# Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps])
951e0f3728dSPeter Maydell# 'extradeps' is optional, and specifies extra files (eg .hx files) that
952e0f3728dSPeter Maydell# the manual page depends on.
953e0f3728dSPeter Maydelldefine define-manpage-rule
954e0f3728dSPeter Maydell$(call atomic,$(foreach manpage,$2,$(MANUAL_BUILDDIR)/$1/$(manpage)),$(call manual-deps,$1) $3)
955e0f3728dSPeter Maydell	$(call build-manual,$1,man)
956e0f3728dSPeter Maydellendef
9575f71eac0SPeter Maydell
9581290e671SPeter Maydell$(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel)
95927a296fcSPeter Maydell	$(call build-manual,devel,html)
9605f71eac0SPeter Maydell
961a08b4a9fSPeter Maydell$(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop)
96227a296fcSPeter Maydell	$(call build-manual,interop,html)
9635f71eac0SPeter Maydell
9640783a732SPeter Maydell$(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
96527a296fcSPeter Maydell	$(call build-manual,specs,html)
96627a296fcSPeter Maydell
96709ce5f2dSPeter 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
9680928523aSPeter Maydell	$(call build-manual,system,html)
9690928523aSPeter Maydell
970a08b4a9fSPeter Maydell$(MANUAL_BUILDDIR)/tools/index.html: $(call manual-deps,tools) $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc
97165c3542bSPeter Maydell	$(call build-manual,tools,html)
97265c3542bSPeter Maydell
97309147930SPaolo Bonzini$(MANUAL_BUILDDIR)/user/index.html: $(call manual-deps,user)
97409147930SPaolo Bonzini	$(call build-manual,user,html)
97509147930SPaolo Bonzini
976a08b4a9fSPeter Maydell$(call define-manpage-rule,interop,qemu-ga.8)
9770783a732SPeter Maydell
978d06118bfSPeter Maydell$(call define-manpage-rule,system,qemu.1 qemu-block-drivers.7 qemu-cpu-models.7)
979acab923dSPeter Maydell
980a08b4a9fSPeter Maydell$(call define-manpage-rule,tools,\
981a08b4a9fSPeter Maydell       qemu-img.1 qemu-nbd.8 qemu-trace-stap.1\
982a08b4a9fSPeter Maydell       virtiofsd.1 virtfs-proxy-helper.1,\
983a08b4a9fSPeter Maydell       $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc)
984a08b4a9fSPeter Maydell
98522108f33SStefan Hajnoczi$(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version.h
986d83bbedaSStefan Hajnoczi	@mkdir -p "$(MANUAL_BUILDDIR)"
98722108f33SStefan Hajnoczi	$(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \
98822108f33SStefan Hajnoczi             "GEN","$@")
98922108f33SStefan Hajnoczi
990eb815e24SMarkus Armbrusterdocs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
991fb0bc835SMarkus Armbruster	@cp -p $< $@
9924afeeb57SMarkus Armbruster
993fb0bc835SMarkus Armbrusterdocs/interop/qemu-ga-qapi.texi: qga/qapi-generated/qga-qapi-doc.texi
994fb0bc835SMarkus Armbruster	@cp -p $< $@
99556e8bdd4SMarc-André Lureau
9965b1d0e92SPeter Maydellhtml: docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs
9975b1d0e92SPeter Maydellinfo: docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
9985b1d0e92SPeter Maydellpdf: docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
9995b1d0e92SPeter Maydelltxt: docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
1000818220f5Saliguori
1001d59157eaSPaolo Bonzinidocs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
1002d59157eaSPaolo Bonzini    docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
1003d59157eaSPaolo Bonzini    docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \
1004d59157eaSPaolo Bonzini	docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi
100556e8bdd4SMarc-André Lureau
1006d59157eaSPaolo Bonzinidocs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
1007d59157eaSPaolo Bonzini    docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \
1008d59157eaSPaolo Bonzini    docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
1009d59157eaSPaolo Bonzini	docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
101056e8bdd4SMarc-André Lureau
1011ae560cc3SEric Blake$(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl
1012ae560cc3SEric Blake
1013fe8bf5f6SAlex Bennée# Reports/Analysis
1014fe8bf5f6SAlex Bennée
1015fe8bf5f6SAlex Bennée%/coverage-report.html:
1016fe8bf5f6SAlex Bennée	@mkdir -p $*
1017fe8bf5f6SAlex Bennée	$(call quiet-command,\
10185eda6e42SAlex Bennée		gcovr -r $(SRC_PATH) \
10195eda6e42SAlex Bennée		$(foreach t, $(TARGET_DIRS), --object-directory $(BUILD_DIR)/$(t)) \
10205eda6e42SAlex Bennée		 --object-directory $(BUILD_DIR) \
1021337f2311SAlex Bennée		-p --html --html-details -o $@, \
1022fe8bf5f6SAlex Bennée		"GEN", "coverage-report.html")
1023fe8bf5f6SAlex Bennée
1024fe8bf5f6SAlex Bennée.PHONY: coverage-report
1025fe8bf5f6SAlex Bennéecoverage-report: $(CURDIR)/reports/coverage/coverage-report.html
102656e8bdd4SMarc-André Lureau
1027f53ec699SStefan Weilifdef CONFIG_WIN32
1028f53ec699SStefan Weil
1029f53ec699SStefan WeilINSTALLER = qemu-setup-$(VERSION)$(EXESUF)
1030f53ec699SStefan Weil
1031f53ec699SStefan Weilnsisflags = -V2 -NOCD
1032f53ec699SStefan Weil
1033f53ec699SStefan Weilifneq ($(wildcard $(SRC_PATH)/dll),)
1034f53ec699SStefan Weilifeq ($(ARCH),x86_64)
1035f53ec699SStefan Weil# 64 bit executables
1036f53ec699SStefan WeilDLL_PATH = $(SRC_PATH)/dll/w64
1037f53ec699SStefan Weilnsisflags += -DW64
1038f53ec699SStefan Weilelse
1039f53ec699SStefan Weil# 32 bit executables
1040f53ec699SStefan WeilDLL_PATH = $(SRC_PATH)/dll/w32
1041f53ec699SStefan Weilendif
1042f53ec699SStefan Weilendif
1043f53ec699SStefan Weil
1044f53ec699SStefan Weil.PHONY: installer
1045f53ec699SStefan Weilinstaller: $(INSTALLER)
1046f53ec699SStefan Weil
1047f53ec699SStefan WeilINSTDIR=/tmp/qemu-nsis
1048f53ec699SStefan Weil
10491b00a4c4SPaolo Bonzini$(INSTALLER): $(SRC_PATH)/qemu.nsi
10501b00a4c4SPaolo Bonzini	$(MAKE) install DESTDIR=${INSTDIR}
1051f53ec699SStefan Weilifdef SIGNCODE
10521b00a4c4SPaolo Bonzini	(cd ${INSTDIR}/${bindir}; \
1053f53ec699SStefan Weil         for i in *.exe; do \
1054f53ec699SStefan Weil           $(SIGNCODE) $${i}; \
1055f53ec699SStefan Weil         done \
1056f53ec699SStefan Weil        )
1057f53ec699SStefan Weilendif # SIGNCODE
10581b00a4c4SPaolo Bonzini	(cd ${INSTDIR}/${bindir}; \
1059f53ec699SStefan Weil         for i in qemu-system-*.exe; do \
1060f53ec699SStefan Weil           arch=$${i%.exe}; \
1061f53ec699SStefan Weil           arch=$${arch#qemu-system-}; \
1062f53ec699SStefan Weil           echo Section \"$$arch\" Section_$$arch; \
1063f53ec699SStefan Weil           echo SetOutPath \"\$$INSTDIR\"; \
1064f53ec699SStefan Weil           echo File \"\$${BINDIR}\\$$i\"; \
1065f53ec699SStefan Weil           echo SectionEnd; \
1066f53ec699SStefan Weil         done \
10671b00a4c4SPaolo Bonzini        ) >${INSTDIR}/${bindir}/system-emulations.nsh
1068f53ec699SStefan Weil	makensis $(nsisflags) \
1069f53ec699SStefan Weil                $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
1070f53ec699SStefan Weil                $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
10711b00a4c4SPaolo Bonzini                -DBINDIR="${INSTDIR}/${bindir}" \
1072f53ec699SStefan Weil                $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
1073f53ec699SStefan Weil                -DSRCDIR="$(SRC_PATH)" \
1074f53ec699SStefan Weil                -DOUTFILE="$(INSTALLER)" \
1075805d8a67SStefan Weil                -DDISPLAYVERSION="$(VERSION)" \
1076f53ec699SStefan Weil                $(SRC_PATH)/qemu.nsi
1077f53ec699SStefan Weil	rm -r ${INSTDIR}
1078f53ec699SStefan Weilifdef SIGNCODE
1079f53ec699SStefan Weil	$(SIGNCODE) $(INSTALLER)
1080f53ec699SStefan Weilendif # SIGNCODE
1081f53ec699SStefan Weilendif # CONFIG_WIN
1082f53ec699SStefan Weil
1083cb5fc67dSAnthony Liguori# Add a dependency on the generated files, so that they are always
1084cb5fc67dSAnthony Liguori# rebuilt before other object files
1085428952cfSThomas Huthifneq ($(wildcard config-host.mak),)
1086eaa2ddbbSFam Zhengifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
10873dff199cSLaurent VivierMakefile: $(generated-files-y)
10887748b8cbSMike Frysingerendif
1089428952cfSThomas Huthendif
1090cb5fc67dSAnthony Liguori
10914fb240a4Sbellard# Include automatically generated dependency files
10921435ddb8SPaolo Bonzini# Dependencies in Makefile.objs files come from our recursive subdir rules
10931435ddb8SPaolo Bonzini-include $(wildcard *.d tests/*.d)
1094324027c2SFam Zheng
1095324027c2SFam Zhenginclude $(SRC_PATH)/tests/docker/Makefile.include
1096b1fb9a63SFam Zhenginclude $(SRC_PATH)/tests/vm/Makefile.include
10970d8e065fSMarc-André Lureau
1098c355de59SPhilippe Mathieu-Daudéprint-help-run = printf "  %-30s - %s\\n" "$1" "$2"
1099c355de59SPhilippe Mathieu-Daudéprint-help = $(quiet-@)$(call print-help-run,$1,$2)
1100c355de59SPhilippe Mathieu-Daudé
11010d8e065fSMarc-André Lureau.PHONY: help
11020d8e065fSMarc-André Lureauhelp:
11030d8e065fSMarc-André Lureau	@echo  'Generic targets:'
1104c355de59SPhilippe Mathieu-Daudé	$(call print-help,all,Build all)
11050decdfe2SMarc-André Lureauifdef CONFIG_MODULES
1106c355de59SPhilippe Mathieu-Daudé	$(call print-help,modules,Build all modules)
11070decdfe2SMarc-André Lureauendif
1108c355de59SPhilippe Mathieu-Daudé	$(call print-help,dir/file.o,Build specified target only)
1109c355de59SPhilippe Mathieu-Daudé	$(call print-help,install,Install QEMU, documentation and tools)
1110c355de59SPhilippe Mathieu-Daudé	$(call print-help,ctags/TAGS,Generate tags file for editors)
1111c355de59SPhilippe Mathieu-Daudé	$(call print-help,cscope,Generate cscope index)
1112968b4db3SPaolo Bonzini	$(call print-help,sparse,Run sparse on the QEMU source)
11130d8e065fSMarc-André Lureau	@echo  ''
11142b1f35b9SAlex Bennée	@$(if $(TARGET_DIRS), \
11150d8e065fSMarc-André Lureau		echo 'Architecture specific targets:'; \
11162b1f35b9SAlex Bennée		$(foreach t, $(TARGET_DIRS), \
1117763815a8SPhilippe Mathieu-Daudé		$(call print-help-run,$(t)/all,Build for $(t)); \
1118763815a8SPhilippe Mathieu-Daudé		$(if $(CONFIG_FUZZ), \
1119763815a8SPhilippe Mathieu-Daudé			$(if $(findstring softmmu,$(t)), \
1120763815a8SPhilippe Mathieu-Daudé				$(call print-help-run,$(t)/fuzz,Build fuzzer for $(t)); \
1121763815a8SPhilippe Mathieu-Daudé		))) \
11220d8e065fSMarc-André Lureau		echo '')
1123fdbff6bdSPhilippe Mathieu-Daudé	@$(if $(HELPERS-y), \
1124fdbff6bdSPhilippe Mathieu-Daudé		echo 'Helper targets:'; \
1125fdbff6bdSPhilippe Mathieu-Daudé		$(foreach t, $(HELPERS-y), \
1126fdbff6bdSPhilippe Mathieu-Daudé		$(call print-help-run,$(t),Build $(shell basename $(t)));) \
1127fdbff6bdSPhilippe Mathieu-Daudé		echo '')
112881ed0a57SPhilippe Mathieu-Daudé	@$(if $(TOOLS), \
112981ed0a57SPhilippe Mathieu-Daudé		echo 'Tools targets:'; \
113081ed0a57SPhilippe Mathieu-Daudé		$(foreach t, $(TOOLS), \
113181ed0a57SPhilippe Mathieu-Daudé		$(call print-help-run,$(t),Build $(shell basename $(t)) tool);) \
11320d8e065fSMarc-André Lureau		echo '')
11330d8e065fSMarc-André Lureau	@echo  'Cleaning targets:'
1134c355de59SPhilippe Mathieu-Daudé	$(call print-help,clean,Remove most generated files but keep the config)
1135c355de59SPhilippe Mathieu-Daudé	$(call print-help,distclean,Remove all generated files)
1136c355de59SPhilippe Mathieu-Daudé	$(call print-help,dist,Build a distributable tarball)
11370d8e065fSMarc-André Lureau	@echo  ''
11380d8e065fSMarc-André Lureau	@echo  'Test targets:'
1139c355de59SPhilippe Mathieu-Daudé	$(call print-help,check,Run all tests (check-help for details))
1140c355de59SPhilippe Mathieu-Daudé	$(call print-help,docker,Help about targets running tests inside containers)
1141c355de59SPhilippe Mathieu-Daudé	$(call print-help,vm-help,Help about targets running tests inside VM)
11420d8e065fSMarc-André Lureau	@echo  ''
11430d8e065fSMarc-André Lureau	@echo  'Documentation targets:'
1144c355de59SPhilippe Mathieu-Daudé	$(call print-help,html info pdf txt,Build documentation in specified format)
11450d8e065fSMarc-André Lureau	@echo  ''
11460d8e065fSMarc-André Lureauifdef CONFIG_WIN32
11470d8e065fSMarc-André Lureau	@echo  'Windows targets:'
1148c355de59SPhilippe Mathieu-Daudé	$(call print-help,installer,Build NSIS-based installer for QEMU)
11490d8e065fSMarc-André Lureauifdef QEMU_GA_MSI_ENABLED
1150c355de59SPhilippe Mathieu-Daudé	$(call print-help,msi,Build MSI-based installer for qemu-ga)
11510d8e065fSMarc-André Lureauendif
11520d8e065fSMarc-André Lureau	@echo  ''
11530d8e065fSMarc-André Lureauendif
1154c355de59SPhilippe Mathieu-Daudé	$(call print-help,$(MAKE) [targets],(quiet build, default))
1155c355de59SPhilippe Mathieu-Daudé	$(call print-help,$(MAKE) V=1 [targets],(verbose build))
1156