xref: /openbmc/qemu/Makefile (revision 139c1837)
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
5292712822SDaniel P. Berrange.git-submodule-status: git-submodule-update config-host.mak
53aef45d51SDaniel P. Berrange
54d1bd2423SPeter Maydell# Check that we're not trying to do an out-of-tree build from
55d1bd2423SPeter Maydell# a tree that's been used for an in-tree build.
56d1bd2423SPeter Maydellifneq ($(realpath $(SRC_PATH)),$(realpath .))
57d1bd2423SPeter Maydellifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
58d1bd2423SPeter Maydell$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
59d1bd2423SPeter Maydellseems to have been used for an in-tree build. You can fix this by running \
60b98a3baeSPhilippe Mathieu-Daudé"$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
61d1bd2423SPeter Maydellendif
62d1bd2423SPeter Maydellendif
63d1bd2423SPeter Maydell
642b1f35b9SAlex BennéeCONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
652b1f35b9SAlex BennéeCONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
666b827ccaSStefano StabelliniCONFIG_XEN := $(CONFIG_XEN_BACKEND)
67f3aa844bSPaolo BonziniCONFIG_ALL=y
68f3aa844bSPaolo Bonzini-include config-all-devices.mak
69f3aa844bSPaolo Bonzini-include config-all-disas.mak
70f3aa844bSPaolo Bonzini
713a6b016dSMarkus Armbrusterconfig-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
72e5efe7f5SJuan Quintela	@echo $@ is out-of-date, running configure
73cdb69b08SMarkus Armbruster	@./config.status
7426fffe29SEmilio G. Cota
7526fffe29SEmilio G. Cota# Force configure to re-run if the API symbols are updated
7626fffe29SEmilio G. Cotaifeq ($(CONFIG_PLUGIN),y)
7726fffe29SEmilio G. Cotaconfig-host.mak: $(SRC_PATH)/plugins/qemu-plugins.symbols
7826fffe29SEmilio G. Cotaendif
7926fffe29SEmilio G. Cota
8055d7e8f6Saurel32else
8155d7e8f6Saurel32config-host.mak:
82eaa2ddbbSFam Zhengifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
8355d7e8f6Saurel32	@echo "Please call configure before running make!"
8455d7e8f6Saurel32	@exit 1
8555d7e8f6Saurel32endif
867748b8cbSMike Frysingerendif
87766a487aSbellard
88fb57c881SFam Zhenginclude $(SRC_PATH)/rules.mak
89fb57c881SFam Zheng
90c932ce31SPaolo Bonzini# lor is defined in rules.mak
9129de2804SLaurent VivierCONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
9229de2804SLaurent Vivier
9357b49737SPeter Maydell# Create QEMU_PKGVERSION and FULL_VERSION strings
9457b49737SPeter Maydell# If PKGVERSION is set, use that; otherwise get version and -dirty status from git
9557b49737SPeter MaydellQEMU_PKGVERSION := $(if $(PKGVERSION),$(PKGVERSION),$(shell \
9657b49737SPeter Maydell  cd $(SRC_PATH); \
9757b49737SPeter Maydell  if test -e .git; then \
9857b49737SPeter Maydell    git describe --match 'v*' 2>/dev/null | tr -d '\n'; \
9957b49737SPeter Maydell    if ! git diff-index --quiet HEAD &>/dev/null; then \
10057b49737SPeter Maydell      echo "-dirty"; \
10157b49737SPeter Maydell    fi; \
10257b49737SPeter Maydell  fi))
10357b49737SPeter Maydell
10457b49737SPeter Maydell# Either "version (pkgversion)", or just "version" if pkgversion not set
10557b49737SPeter MaydellFULL_VERSION := $(if $(QEMU_PKGVERSION),$(VERSION) ($(QEMU_PKGVERSION)),$(VERSION))
10657b49737SPeter Maydell
1073dff199cSLaurent Viviergenerated-files-y = qemu-version.h config-host.h qemu-options.def
108bf582c34SEric Blake
109bf582c34SEric BlakeGENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c
110bf582c34SEric BlakeGENERATED_QAPI_FILES += qapi/qapi-types.h qapi/qapi-types.c
111bf582c34SEric BlakeGENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.h)
112bf582c34SEric BlakeGENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.c)
113bf582c34SEric BlakeGENERATED_QAPI_FILES += qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c
114bf582c34SEric BlakeGENERATED_QAPI_FILES += qapi/qapi-visit.h qapi/qapi-visit.c
115bf582c34SEric BlakeGENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.h)
116bf582c34SEric BlakeGENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.c)
11700ca24ffSMarkus ArmbrusterGENERATED_QAPI_FILES += qapi/qapi-init-commands.h qapi/qapi-init-commands.c
118bf582c34SEric BlakeGENERATED_QAPI_FILES += qapi/qapi-commands.h qapi/qapi-commands.c
119bf582c34SEric BlakeGENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.h)
120bf582c34SEric BlakeGENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.c)
1215d75648bSMarkus ArmbrusterGENERATED_QAPI_FILES += qapi/qapi-emit-events.h qapi/qapi-emit-events.c
122bf582c34SEric BlakeGENERATED_QAPI_FILES += qapi/qapi-events.h qapi/qapi-events.c
123bf582c34SEric BlakeGENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.h)
124bf582c34SEric BlakeGENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.c)
125bf582c34SEric BlakeGENERATED_QAPI_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h
126bf582c34SEric BlakeGENERATED_QAPI_FILES += qapi/qapi-doc.texi
127bf582c34SEric Blake
1282af282ecSKevin Wolf# The following list considers only the storage daemon main module. All other
1292af282ecSKevin Wolf# modules are currently shared with the main schema, so we don't actually
1302af282ecSKevin Wolf# generate additional files.
1312af282ecSKevin Wolf
1322af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES = storage-daemon/qapi/qapi-commands.h
1332af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-commands.c
1342af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-emit-events.h
1352af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-emit-events.c
1362af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-events.h
1372af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-events.c
1382af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-init-commands.h
1392af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-init-commands.c
1402af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-introspect.h
1412af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-introspect.c
1422af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-types.h
1432af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-types.c
1442af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-visit.h
1452af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-visit.c
1462af282ecSKevin WolfGENERATED_STORAGE_DAEMON_QAPI_FILES += storage-daemon/qapi/qapi-doc.texi
1472af282ecSKevin Wolf
1483dff199cSLaurent Viviergenerated-files-y += $(GENERATED_QAPI_FILES)
1492af282ecSKevin Wolfgenerated-files-y += $(GENERATED_STORAGE_DAEMON_QAPI_FILES)
150eac236eaSLluís Vilanova
1513dff199cSLaurent Viviergenerated-files-y += trace/generated-tcg-tracers.h
152465830fbSLluís Vilanova
1533dff199cSLaurent Viviergenerated-files-y += trace/generated-helpers-wrappers.h
1543dff199cSLaurent Viviergenerated-files-y += trace/generated-helpers.h
1553dff199cSLaurent Viviergenerated-files-y += trace/generated-helpers.c
156707c8a98SLluís Vilanova
1573dff199cSLaurent Viviergenerated-files-$(CONFIG_TRACE_UST) += trace-ust-all.h
1583dff199cSLaurent Viviergenerated-files-$(CONFIG_TRACE_UST) += trace-ust-all.c
159e6bf23f8SMohamad Gebai
1603dff199cSLaurent Viviergenerated-files-y += module_block.h
1610c0c1fd9SMarc Mari
162243af022SPaolo BonziniTRACE_HEADERS = trace/trace-root.h
163243af022SPaolo BonziniTRACE_SOURCES = trace/trace-root.c
1640ab8ed18SDaniel P. BerrangeTRACE_DTRACE =
1650ab8ed18SDaniel P. Berrangeifdef CONFIG_TRACE_DTRACE
1660ab8ed18SDaniel P. BerrangeTRACE_HEADERS += trace-dtrace-root.h $(trace-events-subdirs:%=%/trace-dtrace.h)
1670ab8ed18SDaniel P. BerrangeTRACE_DTRACE += trace-dtrace-root.dtrace $(trace-events-subdirs:%=%/trace-dtrace.dtrace)
1680ab8ed18SDaniel P. Berrangeendif
1690ab8ed18SDaniel P. Berrangeifdef CONFIG_TRACE_UST
1700ab8ed18SDaniel P. BerrangeTRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h)
1710ab8ed18SDaniel P. Berrangeendif
1720ab8ed18SDaniel P. Berrange
1733dff199cSLaurent Viviergenerated-files-y += $(BUILD_DIR)/trace-events-all
1743dff199cSLaurent Viviergenerated-files-y += .git-submodule-status
1750ab8ed18SDaniel P. Berrange
1760ab8ed18SDaniel P. Berrangetrace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
177243af022SPaolo Bonzinitrace-group-suffix = $(shell echo $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
1780ab8ed18SDaniel P. Berrange
1798755b4afSDaniel P. Berrangetracetool-y = $(SRC_PATH)/scripts/tracetool.py
1808755b4afSDaniel P. Berrangetracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
1818755b4afSDaniel P. Berrange
182243af022SPaolo Bonzinidefine __trace_rules
183243af022SPaolo BonziniTRACE_HEADERS += trace/trace-$2.h
184243af022SPaolo BonziniTRACE_SOURCES += trace/trace-$2.c
185243af022SPaolo Bonzinitrace-obj-y += trace/trace-$2.o
186243af022SPaolo Bonzinitrace/trace-$2.h: trace/trace-$2.h-timestamp
187243af022SPaolo Bonzini	@cmp $$< $$@ >/dev/null 2>&1 || cp $$< $$@
188243af022SPaolo Bonzinitrace/trace-$2.h-timestamp: $(SRC_PATH)/$1/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
1890ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
190243af022SPaolo Bonzini		--group=$2 \
1910ab8ed18SDaniel P. Berrange		--format=h \
1920ab8ed18SDaniel P. Berrange		--backends=$(TRACE_BACKENDS) \
193243af022SPaolo Bonzini		$$< > $$@,"GEN","$$(@:%-timestamp=%)")
1940ab8ed18SDaniel P. Berrange
195243af022SPaolo Bonzinitrace/trace-$2.c: trace/trace-$2.c-timestamp
196243af022SPaolo Bonzini	@cmp $$< $$@ >/dev/null 2>&1 || cp $$< $$@
197243af022SPaolo Bonzinitrace/trace-$2.c-timestamp: $(SRC_PATH)/$1/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
1980ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
199243af022SPaolo Bonzini		--group=$2 \
2000ab8ed18SDaniel P. Berrange		--format=c \
2010ab8ed18SDaniel P. Berrange		--backends=$(TRACE_BACKENDS) \
202243af022SPaolo Bonzini		$$< > $$@,"GEN","$$(@:%-timestamp=%)")
203243af022SPaolo Bonziniendef
2040ab8ed18SDaniel P. Berrange
2050ab8ed18SDaniel P. Berrange%/trace-ust.h: %/trace-ust.h-timestamp
2060ab8ed18SDaniel P. Berrange	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
20757b7bdf4SStefan Hajnoczi%/trace-ust.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
2080ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
2090ab8ed18SDaniel P. Berrange		--group=$(call trace-group-name,$@) \
2100ab8ed18SDaniel P. Berrange		--format=ust-events-h \
2110ab8ed18SDaniel P. Berrange		--backends=$(TRACE_BACKENDS) \
2120ab8ed18SDaniel P. Berrange		$< > $@,"GEN","$(@:%-timestamp=%)")
2130ab8ed18SDaniel P. Berrange
2140ab8ed18SDaniel P. Berrange%/trace-dtrace.dtrace: %/trace-dtrace.dtrace-timestamp
2150ab8ed18SDaniel P. Berrange	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
2160ab8ed18SDaniel P. Berrange%/trace-dtrace.dtrace-timestamp: $(SRC_PATH)/%/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
2170ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
2180ab8ed18SDaniel P. Berrange		--group=$(call trace-group-name,$@) \
2190ab8ed18SDaniel P. Berrange		--format=d \
2200ab8ed18SDaniel P. Berrange		--backends=$(TRACE_BACKENDS) \
2210ab8ed18SDaniel P. Berrange		$< > $@,"GEN","$(@:%-timestamp=%)")
2220ab8ed18SDaniel P. Berrange
2230ab8ed18SDaniel P. Berrange%/trace-dtrace.h: %/trace-dtrace.dtrace $(tracetool-y)
2240ab8ed18SDaniel P. Berrange	$(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@")
2250ab8ed18SDaniel P. Berrange
2260ab8ed18SDaniel P. Berrange%/trace-dtrace.o: %/trace-dtrace.dtrace $(tracetool-y)
2270ab8ed18SDaniel P. Berrange
2280ab8ed18SDaniel P. Berrange
229243af022SPaolo Bonzinitrace/trace-root.h: trace/trace-root.h-timestamp
2300ab8ed18SDaniel P. Berrange	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
231243af022SPaolo Bonzinitrace/trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
2320ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
2330ab8ed18SDaniel P. Berrange		--group=root \
2340ab8ed18SDaniel P. Berrange		--format=h \
2350ab8ed18SDaniel P. Berrange		--backends=$(TRACE_BACKENDS) \
2360ab8ed18SDaniel P. Berrange		$< > $@,"GEN","$(@:%-timestamp=%)")
2370ab8ed18SDaniel P. Berrange
238243af022SPaolo Bonzinitrace/trace-root.c: trace/trace-root.c-timestamp
2390ab8ed18SDaniel P. Berrange	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
240243af022SPaolo Bonzinitrace/trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
2410ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
2420ab8ed18SDaniel P. Berrange		--group=root \
2430ab8ed18SDaniel P. Berrange		--format=c \
2440ab8ed18SDaniel P. Berrange		--backends=$(TRACE_BACKENDS) \
2450ab8ed18SDaniel P. Berrange		$< > $@,"GEN","$(@:%-timestamp=%)")
2460ab8ed18SDaniel P. Berrange
2470ab8ed18SDaniel P. Berrangetrace-ust-root.h: trace-ust-root.h-timestamp
2480ab8ed18SDaniel P. Berrange	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
24957b7bdf4SStefan Hajnoczitrace-ust-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
2500ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
2510ab8ed18SDaniel P. Berrange		--group=root \
2520ab8ed18SDaniel P. Berrange		--format=ust-events-h \
2530ab8ed18SDaniel P. Berrange		--backends=$(TRACE_BACKENDS) \
2540ab8ed18SDaniel P. Berrange		$< > $@,"GEN","$(@:%-timestamp=%)")
2550ab8ed18SDaniel P. Berrange
2560ab8ed18SDaniel P. Berrangetrace-ust-all.h: trace-ust-all.h-timestamp
2570ab8ed18SDaniel P. Berrange	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
25857b7bdf4SStefan Hajnoczitrace-ust-all.h-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak
2590ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
2600ab8ed18SDaniel P. Berrange		--group=all \
2610ab8ed18SDaniel P. Berrange		--format=ust-events-h \
2620ab8ed18SDaniel P. Berrange		--backends=$(TRACE_BACKENDS) \
2630ab8ed18SDaniel P. Berrange		$(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)")
2640ab8ed18SDaniel P. Berrange
2650ab8ed18SDaniel P. Berrangetrace-ust-all.c: trace-ust-all.c-timestamp
2660ab8ed18SDaniel P. Berrange	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
26757b7bdf4SStefan Hajnoczitrace-ust-all.c-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak
2680ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
2690ab8ed18SDaniel P. Berrange		--group=all \
2700ab8ed18SDaniel P. Berrange		--format=ust-events-c \
2710ab8ed18SDaniel P. Berrange		--backends=$(TRACE_BACKENDS) \
2720ab8ed18SDaniel P. Berrange		$(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)")
2730ab8ed18SDaniel P. Berrange
2740ab8ed18SDaniel P. Berrangetrace-dtrace-root.dtrace: trace-dtrace-root.dtrace-timestamp
2750ab8ed18SDaniel P. Berrange	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
2760ab8ed18SDaniel P. Berrangetrace-dtrace-root.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
2770ab8ed18SDaniel P. Berrange	$(call quiet-command,$(TRACETOOL) \
2780ab8ed18SDaniel P. Berrange		--group=root \
2790ab8ed18SDaniel P. Berrange		--format=d \
2800ab8ed18SDaniel P. Berrange		--backends=$(TRACE_BACKENDS) \
2810ab8ed18SDaniel P. Berrange		$< > $@,"GEN","$(@:%-timestamp=%)")
2820ab8ed18SDaniel P. Berrange
2830ab8ed18SDaniel P. Berrangetrace-dtrace-root.h: trace-dtrace-root.dtrace
2840ab8ed18SDaniel P. Berrange	$(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@")
2850ab8ed18SDaniel P. Berrange
2860ab8ed18SDaniel P. Berrangetrace-dtrace-root.o: trace-dtrace-root.dtrace
2870ab8ed18SDaniel P. Berrange
28892712822SDaniel P. BerrangeKEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen
28992712822SDaniel P. BerrangeKEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv
29092712822SDaniel P. Berrange
29192712822SDaniel P. BerrangeKEYCODEMAP_FILES = \
292*139c1837SPaolo Bonzini		 ui/input-keymap-atset1-to-qcode.c.inc \
293*139c1837SPaolo Bonzini		 ui/input-keymap-linux-to-qcode.c.inc \
294*139c1837SPaolo Bonzini		 ui/input-keymap-qcode-to-atset1.c.inc \
295*139c1837SPaolo Bonzini		 ui/input-keymap-qcode-to-atset2.c.inc \
296*139c1837SPaolo Bonzini		 ui/input-keymap-qcode-to-atset3.c.inc \
297*139c1837SPaolo Bonzini		 ui/input-keymap-qcode-to-linux.c.inc \
298*139c1837SPaolo Bonzini		 ui/input-keymap-qcode-to-qnum.c.inc \
299*139c1837SPaolo Bonzini		 ui/input-keymap-qcode-to-sun.c.inc \
300*139c1837SPaolo Bonzini		 ui/input-keymap-qnum-to-qcode.c.inc \
301*139c1837SPaolo Bonzini		 ui/input-keymap-usb-to-qcode.c.inc \
302*139c1837SPaolo Bonzini		 ui/input-keymap-win32-to-qcode.c.inc \
303*139c1837SPaolo Bonzini		 ui/input-keymap-x11-to-qcode.c.inc \
304*139c1837SPaolo Bonzini		 ui/input-keymap-xorgevdev-to-qcode.c.inc \
305*139c1837SPaolo Bonzini		 ui/input-keymap-xorgkbd-to-qcode.c.inc \
306*139c1837SPaolo Bonzini		 ui/input-keymap-xorgxquartz-to-qcode.c.inc \
307*139c1837SPaolo Bonzini		 ui/input-keymap-xorgxwin-to-qcode.c.inc \
308*139c1837SPaolo Bonzini		 ui/input-keymap-osx-to-qcode.c.inc \
30992712822SDaniel P. Berrange		 $(NULL)
31092712822SDaniel P. Berrange
3113dff199cSLaurent Viviergenerated-files-$(CONFIG_SOFTMMU) += $(KEYCODEMAP_FILES)
31292712822SDaniel P. Berrange
313*139c1837SPaolo Bonziniui/input-keymap-%.c.inc: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile.objs
31492712822SDaniel P. Berrange	$(call quiet-command,\
3156809df1dSJan Beulich	    stem=$* && src=$${stem%-to-*} dst=$${stem#*-to-} && \
31692712822SDaniel P. Berrange	    test -e $(KEYCODEMAP_GEN) && \
31792712822SDaniel P. Berrange	    $(PYTHON) $(KEYCODEMAP_GEN) \
31892712822SDaniel P. Berrange	          --lang glib2 \
31992712822SDaniel P. Berrange	          --varname qemu_input_map_$${src}_to_$${dst} \
32092712822SDaniel P. Berrange	          code-map $(KEYCODEMAP_CSV) $${src} $${dst} \
32192712822SDaniel P. Berrange	        > $@ || rm -f $@, "GEN", "$@")
32292712822SDaniel P. Berrange
32392712822SDaniel P. Berrange$(KEYCODEMAP_GEN): .git-submodule-status
32492712822SDaniel P. Berrange$(KEYCODEMAP_CSV): .git-submodule-status
32592712822SDaniel P. Berrange
32626ce90fdSLaszlo Ersekedk2-decompressed = $(basename $(wildcard pc-bios/edk2-*.fd.bz2))
32726ce90fdSLaszlo Ersekpc-bios/edk2-%.fd: pc-bios/edk2-%.fd.bz2
32826ce90fdSLaszlo Ersek	$(call quiet-command,bzip2 -d -c $< > $@,"BUNZIP2",$<)
32926ce90fdSLaszlo Ersek
330d9ace8b3SJuan Quintela# Don't try to regenerate Makefile or configure
331d9ace8b3SJuan Quintela# We don't generate any of them
332d9ace8b3SJuan QuintelaMakefile: ;
333d9ace8b3SJuan Quintelaconfigure: ;
334d9ace8b3SJuan Quintela
335bd3f5706SMarc-André Lureau.PHONY: all clean cscope distclean html info install install-doc \
3367c3d1917SDaniel P. Berrange	pdf txt recurse-all dist msi FORCE
3370cb3fb1eSpbrook
338fec90ff0SPaolo Bonzini$(call set-vpath, $(SRC_PATH))
3398c462f8fSpbrook
3403e2e0e6bSJuan QuintelaLIBS+=-lz $(LIBS_TOOLS)
34167c0f08dSJuan Quintela
342d52c454aSMarc-André Lureauvhost-user-json-y =
343fdbff6bdSPhilippe Mathieu-DaudéHELPERS-y = $(HELPERS)
344d52c454aSMarc-André Lureau
345fdbff6bdSPhilippe Mathieu-DaudéHELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) += qemu-bridge-helper$(EXESUF)
3467b93fadfSCorey Bryant
34757589bc4SMarc-André Lureauifeq ($(CONFIG_LINUX)$(CONFIG_VIRGL)$(CONFIG_GBM)$(CONFIG_TOOLS),yyyy)
348d52c454aSMarc-André LureauHELPERS-y += vhost-user-gpu$(EXESUF)
349d52c454aSMarc-André Lureauvhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json
350d52c454aSMarc-André Lureauendif
351d52c454aSMarc-André Lureau
35257159bb2SPhilippe Mathieu-Daudéifeq ($(CONFIG_SOFTMMU)$(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyyy)
35381bfc42dSDr. David Alan GilbertHELPERS-y += virtiofsd$(EXESUF)
354315616edSStefan Hajnoczivhost-user-json-y += tools/virtiofsd/50-qemu-virtiofsd.json
35581bfc42dSDr. David Alan Gilbertendif
35681bfc42dSDr. David Alan Gilbert
357b53c54c6SPeter Maydell# Sphinx does not allow building manuals into the same directory as
358b53c54c6SPeter Maydell# the source files, so if we're doing an in-tree QEMU build we must
359b53c54c6SPeter Maydell# build the manuals into a subdirectory (and then install them from
360b53c54c6SPeter Maydell# there for 'make install'). For an out-of-tree build we can just
361b53c54c6SPeter Maydell# use the docs/ subdirectory in the build tree as normal.
362b53c54c6SPeter Maydellifeq ($(realpath $(SRC_PATH)),$(realpath .))
363b53c54c6SPeter MaydellMANUAL_BUILDDIR := docs/built
364b53c54c6SPeter Maydellelse
365b53c54c6SPeter MaydellMANUAL_BUILDDIR := docs
366b53c54c6SPeter Maydellendif
367b53c54c6SPeter Maydell
368cc8ae6deSpbrookifdef BUILD_DOCS
369d06118bfSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/system/qemu.1
370a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/qemu-img.1
371a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/qemu-nbd.8
37287c0868fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/interop/qemu-ga.8
3736a7e2bbeSStefan Hajnocziifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
374a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/virtiofsd.1
3756a7e2bbeSStefan Hajnocziendif
376acab923dSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7
377d59157eaSPaolo BonziniDOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
378d59157eaSPaolo BonziniDOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
3791bf84a1eSKashyap ChamarthyDOCS+=$(MANUAL_BUILDDIR)/system/qemu-cpu-models.7
38022108f33SStefan HajnocziDOCS+=$(MANUAL_BUILDDIR)/index.html
381983eef5aSMeador Ingeifdef CONFIG_VIRTFS
382a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1
383983eef5aSMeador Ingeendif
38462dd1048SDaniel P. Berrangéifdef CONFIG_TRACE_SYSTEMTAP
385a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1
38662dd1048SDaniel P. Berrangéendif
387cc8ae6deSpbrookelse
388cc8ae6deSpbrookDOCS=
389cc8ae6deSpbrookendif
3907d13299dSbellard
3918cc357b5SDaniel P. BerrangeSUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
392e0e312f3SPaolo BonziniSUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(filter %-softmmu, $(TARGET_DIRS)))
393e0e312f3SPaolo BonziniSUBDIR_DEVICES_MAK_DEP=$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK))
3941f3d3c8fSJuan Quintela
3958bdd3d49SStefan Weilifeq ($(SUBDIR_DEVICES_MAK),)
396b7c11e57SPaolo Bonziniconfig-all-devices.mak: config-host.mak
3970bdb12c7SPeter Maydell	$(call quiet-command,echo '# no devices' > $@,"GEN","$@")
3988bdd3d49SStefan Weilelse
399b7c11e57SPaolo Bonziniconfig-all-devices.mak: $(SUBDIR_DEVICES_MAK) config-host.mak
400bb585a78SPaolo Bonzini	$(call quiet-command, sed -n \
401bb585a78SPaolo Bonzini             's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
402bb585a78SPaolo Bonzini             $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
4030bdb12c7SPeter Maydell             "GEN","$@")
4048bdd3d49SStefan Weilendif
4051f3d3c8fSJuan Quintela
406bd9141bbSPaul Brook-include $(SUBDIR_DEVICES_MAK_DEP)
407bd9141bbSPaul Brook
408e0e312f3SPaolo Bonzini# This has to be kept in sync with Kconfig.host.
409e0e312f3SPaolo BonziniMINIKCONF_ARGS = \
410f3494749SPaolo Bonzini    $(CONFIG_MINIKCONF_MODE) \
411aaa1b70aSPaolo Bonzini    $@ $*/config-devices.mak.d $< $(SRC_PATH)/Kconfig \
41296df0fddSPhilippe Mathieu-Daudé    CONFIG_TCG=$(CONFIG_TCG) \
413e0e312f3SPaolo Bonzini    CONFIG_KVM=$(CONFIG_KVM) \
414e0e312f3SPaolo Bonzini    CONFIG_SPICE=$(CONFIG_SPICE) \
415e0e312f3SPaolo Bonzini    CONFIG_IVSHMEM=$(CONFIG_IVSHMEM) \
416e0e312f3SPaolo Bonzini    CONFIG_TPM=$(CONFIG_TPM) \
417e0e312f3SPaolo Bonzini    CONFIG_XEN=$(CONFIG_XEN) \
418e0e312f3SPaolo Bonzini    CONFIG_OPENGL=$(CONFIG_OPENGL) \
419e0e312f3SPaolo Bonzini    CONFIG_X11=$(CONFIG_X11) \
420e0e312f3SPaolo Bonzini    CONFIG_VHOST_USER=$(CONFIG_VHOST_USER) \
42121c6b0c8SMarc-André Lureau    CONFIG_VHOST_KERNEL=$(CONFIG_VHOST_KERNEL) \
422e0e312f3SPaolo Bonzini    CONFIG_VIRTFS=$(CONFIG_VIRTFS) \
423d6c1bd4aSPaolo Bonzini    CONFIG_LINUX=$(CONFIG_LINUX) \
424d6c1bd4aSPaolo Bonzini    CONFIG_PVRDMA=$(CONFIG_PVRDMA)
425e0e312f3SPaolo Bonzini
426f4bda37dSPhilippe Mathieu-DaudéMINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py
427e0e312f3SPaolo Bonzini
428aaa1b70aSPaolo Bonzini$(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak $(SRC_PATH)/Kconfig $(BUILD_DIR)/config-host.mak
4291e0ef873SPhilippe Mathieu-Daudé	$(call quiet-command, $(MINIKCONF) $(MINIKCONF_ARGS) \
4301e0ef873SPhilippe Mathieu-Daudé		> $@.tmp, "GEN", "$@.tmp")
43112ccfec9SMichael S. Tsirkin	$(call quiet-command, if test -f $@; then \
432904fe1fbSBlue Swirl	  if cmp -s $@.old $@; then \
433012f0879SStefan Weil	    mv $@.tmp $@; \
434012f0879SStefan Weil	    cp -p $@ $@.old; \
435012f0879SStefan Weil	  else \
436012f0879SStefan Weil	    if test -f $@.old; then \
437012f0879SStefan Weil	      echo "WARNING: $@ (user modified) out of date.";\
438012f0879SStefan Weil	    else \
439a992fe3dSPaul Brook	      echo "WARNING: $@ out of date.";\
440012f0879SStefan Weil	    fi; \
441b98a3baeSPhilippe Mathieu-Daudé	    echo "Run \"$(MAKE) defconfig\" to regenerate."; \
442a992fe3dSPaul Brook	    rm $@.tmp; \
443012f0879SStefan Weil	  fi; \
444a992fe3dSPaul Brook	 else \
445a992fe3dSPaul Brook	  mv $@.tmp $@; \
446012f0879SStefan Weil	  cp -p $@ $@.old; \
4470bdb12c7SPeter Maydell	 fi,"GEN","$@");
448a992fe3dSPaul Brook
449a992fe3dSPaul Brookdefconfig:
450a992fe3dSPaul Brook	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
451a992fe3dSPaul Brook
452992aeb8eSPaolo Bonziniifneq ($(wildcard config-host.mak),)
453992aeb8eSPaolo Bonziniinclude $(SRC_PATH)/Makefile.objs
454ba1183daSFam Zhengendif
455ba1183daSFam Zheng
456ba1183daSFam Zhengdummy := $(call unnest-vars,, \
457ba1183daSFam Zheng                stub-obj-y \
4585b76dd13SDaniel P. Berrange                authz-obj-y \
45932d955a4SMarc-André Lureau                chardev-obj-y \
460ba1183daSFam Zheng                util-obj-y \
461ba1183daSFam Zheng                qga-obj-y \
4623fa2d384SViktor Prutyanov                elf2dmp-obj-y \
463a75eb03bSDavid Marchand                ivshmem-client-obj-y \
464a75eb03bSDavid Marchand                ivshmem-server-obj-y \
46581bfc42dSDr. David Alan Gilbert                virtiofsd-obj-y \
466a5d2f6f8SYuval Shaia                rdmacm-mux-obj-y \
4677b2e5c65SMarc-André Lureau                libvhost-user-obj-y \
46849cc0340SFelipe Franciosi                vhost-user-scsi-obj-y \
469406d2aa2SChangpeng Liu                vhost-user-blk-obj-y \
47006914c97SMarc-André Lureau                vhost-user-input-obj-y \
471d52c454aSMarc-André Lureau                vhost-user-gpu-obj-y \
472577a6723STomoki Sekiyama                qga-vss-dll-obj-y \
473ba1183daSFam Zheng                block-obj-y \
474cc475698SFam Zheng                block-obj-m \
47514837c64SKevin Wolf                storage-daemon-obj-y \
47614837c64SKevin Wolf                storage-daemon-obj-m \
477fb37726dSDaniel P. Berrange                crypto-obj-y \
4780c7012e0SDaniel P. Berrange                qom-obj-y \
479666a3af9SDaniel P. Berrange                io-obj-y \
480cc475698SFam Zheng                common-obj-y \
4810ab8ed18SDaniel P. Berrange                common-obj-m \
482675b9b53SMarc-André Lureau                trace-obj-y)
483ba1183daSFam Zheng
484243af022SPaolo Bonzinidummy := $(foreach DIR,$(trace-events-subdirs),$(eval $(call __trace_rules,$(DIR),$(call trace-group-suffix,$(DIR)))))
485243af022SPaolo Bonzini
486243af022SPaolo Bonzinigenerated-files-y += $(TRACE_HEADERS)
487243af022SPaolo Bonzinigenerated-files-y += $(TRACE_SOURCES)
488243af022SPaolo Bonzini
489243af022SPaolo Bonzini
49046e7b706SFam Zhenginclude $(SRC_PATH)/tests/Makefile.include
491992aeb8eSPaolo Bonzini
492d52c454aSMarc-André Lureauall: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all modules $(vhost-user-json-y)
493b9dea4fbSpbrook
49467a1de0dSFam Zhengqemu-version.h: FORCE
49567a1de0dSFam Zheng	$(call quiet-command, \
49657b49737SPeter Maydell                (printf '#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \
49757b49737SPeter Maydell		printf '#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \
4987e563bfbSThomas Huth		) > $@.tmp)
499d9e73d32SLin Ma	$(call quiet-command, if ! cmp -s $@ $@.tmp; then \
500d9e73d32SLin Ma	  mv $@.tmp $@; \
501d9e73d32SLin Ma	 else \
502d9e73d32SLin Ma	  rm $@.tmp; \
503d9e73d32SLin Ma	 fi)
50467a1de0dSFam Zheng
5051215c6e7SJuan Quintelaconfig-host.h: config-host.h-timestamp
5061215c6e7SJuan Quintelaconfig-host.h-timestamp: config-host.mak
507077de81aSPaolo Bonziniqemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
5080bdb12c7SPeter Maydell	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
5091215c6e7SJuan Quintela
510c621dc3eSAlexander BulekovTARGET_DIRS_RULES := $(foreach t, all fuzz clean install, $(addsuffix /$(t), $(TARGET_DIRS)))
511916359f6SAndreas Färber
5121338a4b7SMarkus ArmbrusterSOFTMMU_ALL_RULES=$(filter %-softmmu/all, $(TARGET_DIRS_RULES))
5131338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(authz-obj-y)
5141338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(block-obj-y)
51514837c64SKevin Wolf$(SOFTMMU_ALL_RULES): $(storage-daemon-obj-y)
5161338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(chardev-obj-y)
5171338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(crypto-obj-y)
5181338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(io-obj-y)
5191338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): config-all-devices.mak
52005dfa22bSPhilippe Mathieu-Daudéifdef DECOMPRESS_EDK2_BLOBS
5211338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(edk2-decompressed)
52205dfa22bSPhilippe Mathieu-Daudéendif
523cec7d0b6Spbrook
524c621dc3eSAlexander BulekovSOFTMMU_FUZZ_RULES=$(filter %-softmmu/fuzz, $(TARGET_DIRS_RULES))
525c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(authz-obj-y)
526c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(block-obj-y)
527c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(chardev-obj-y)
528c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(crypto-obj-y)
529c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(io-obj-y)
530c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): config-all-devices.mak
531c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(edk2-decompressed)
532c621dc3eSAlexander Bulekov
5331338a4b7SMarkus Armbruster.PHONY: $(TARGET_DIRS_RULES)
5341338a4b7SMarkus Armbruster# The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
5351338a4b7SMarkus Armbruster# $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
5361338a4b7SMarkus Armbruster$(TARGET_DIRS_RULES):
5371338a4b7SMarkus Armbruster	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
5384aa42531Spbrook
53967953a37SClaudio Fontana# LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
54067953a37SClaudio FontanaDTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_lib=""
541965f486cSPeter MaydellDTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
54267953a37SClaudio FontanaDTC_CPPFLAGS=-I$(SRC_PATH)/dtc/libfdt
543a540f158SPeter Crosthwaite
5443b8593eeSMarkus Armbruster.PHONY: dtc/all
54567953a37SClaudio Fontanadtc/all: .git-submodule-status dtc/libfdt
54667953a37SClaudio 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,)
547a540f158SPeter Crosthwaite
54800525864SAaron Lindsaydtc/%: .git-submodule-status
549814e1110SJan Kiszka	@mkdir -p $@
550a540f158SPeter Crosthwaite
551e219c499SRichard Henderson# Overriding CFLAGS causes us to lose defines added in the sub-makefile.
552e219c499SRichard Henderson# Not overriding CFLAGS leads to mis-matches between compilation modes.
553e219c499SRichard Henderson# Therefore we replicate some of the logic in the sub-makefile.
554e219c499SRichard Henderson# Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
555e219c499SRichard Henderson# no need to annoy QEMU developers with such things.
556e219c499SRichard HendersonCAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS))
557e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
558e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_ARM
559e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_ARM64
560e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
561e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_X86
562e219c499SRichard Henderson
5633b8593eeSMarkus Armbruster.PHONY: capstone/all
5643b8593eeSMarkus Armbrustercapstone/all: .git-submodule-status
5659f81aeb5SAlistair 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))
566e219c499SRichard Henderson
5673b8593eeSMarkus Armbruster.PHONY: slirp/all
5683b8593eeSMarkus Armbrusterslirp/all: .git-submodule-status
569daa79d9aSAlex Bennée	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp		\
570daa79d9aSAlex Bennée		BUILD_DIR="$(BUILD_DIR)/slirp" 			\
571daa79d9aSAlex Bennée		PKG_CONFIG="$(PKG_CONFIG)" 				\
572daa79d9aSAlex Bennée		CC="$(CC)" AR="$(AR)" 	LD="$(LD)" RANLIB="$(RANLIB)"	\
573db5adeaaSPaolo Bonzini		CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)")
574675b9b53SMarc-André Lureau
5751338a4b7SMarkus Armbruster$(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
576b8d89ba8SPaolo Bonzini	$(qom-obj-y)
577add16157SBlue Swirl
578c621dc3eSAlexander Bulekov$(filter %/fuzz, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
579c621dc3eSAlexander Bulekov	$(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY))
580c621dc3eSAlexander Bulekov
5813b8593eeSMarkus ArmbrusterROM_DIRS = $(addprefix pc-bios/, $(ROMS))
5821338a4b7SMarkus ArmbrusterROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
583a9c87304SMarc-André Lureau# Only keep -O and -g cflags
5841338a4b7SMarkus Armbruster.PHONY: $(ROM_DIRS_RULES)
5851338a4b7SMarkus Armbruster$(ROM_DIRS_RULES):
5861338a4b7SMarkus Armbruster	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))" $(notdir $@),)
587c05ac895SPaul Brook
5888d358a5eSMarkus Armbruster.PHONY: recurse-all recurse-clean recurse-install
5891338a4b7SMarkus Armbrusterrecurse-all: $(addsuffix /all, $(TARGET_DIRS) $(ROM_DIRS))
5901338a4b7SMarkus Armbrusterrecurse-clean: $(addsuffix /clean, $(TARGET_DIRS) $(ROM_DIRS))
5911338a4b7SMarkus Armbrusterrecurse-install: $(addsuffix /install, $(TARGET_DIRS))
59247ae060eSMarkus Armbruster$(addsuffix /install, $(TARGET_DIRS)): all
5934aa42531Spbrook
594c17a18efSMarc-André Lureau$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
5950bdb12c7SPeter Maydell	$(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
5965354e4d2SMarc-André Lureau
597c17a18efSMarc-André LureauMakefile: $(version-obj-y)
5983bc2f570SPaolo Bonzini
5993bc2f570SPaolo Bonzini######################################################################
6008a090705SPaolo Bonzini# Build libraries
6013bc2f570SPaolo Bonzini
602ebedb37cSPaolo Bonzinilibqemuutil.a: $(util-obj-y) $(trace-obj-y) $(stub-obj-y)
6035f9ff1efSXie Yongjilibvhost-user.a: $(libvhost-user-obj-y) $(util-obj-y) $(stub-obj-y)
6043bc2f570SPaolo Bonzini
6054fb240a4Sbellard######################################################################
6064fb240a4Sbellard
607ebedb37cSPaolo BonziniCOMMON_LDADDS = libqemuutil.a
6080ab8ed18SDaniel P. Berrange
6093c089e15SJuan Quintelaqemu-img.o: qemu-img-cmds.h
610153859beSStuart Brady
6115b76dd13SDaniel P. Berrangeqemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
6125b76dd13SDaniel P. Berrangeqemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
6135b76dd13SDaniel P. Berrangeqemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
6145e6911cfSKevin 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)
6150a8e1acdSaliguori
6160ab8ed18SDaniel P. Berrangeqemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
6177b93fadfSCorey Bryant
6186a021536SGerd Hoffmannqemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS)
6196a021536SGerd Hoffmann
62072d277a7SGerd Hoffmannqemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS)
62172d277a7SGerd Hoffmann
6220ab8ed18SDaniel P. Berrangefsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
62317bff52bSM. Mohan Kumar
6245b76dd13SDaniel 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)
625fe8fc5aeSPaolo Bonziniifdef CONFIG_MPATH
626fe8fc5aeSPaolo Bonziniscsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist
627fe8fc5aeSPaolo Bonziniendif
628b855f8d1SPaolo Bonzini
629077de81aSPaolo Bonziniqemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
6300bdb12c7SPeter Maydell	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
631153859beSStuart Brady
632957f1f99SMichael Rothqemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
63354c2e502SDunrong Huangqemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
634640e5404SMichael Roth
6356a021536SGerd Hoffmannqemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
6366a021536SGerd Hoffmannqemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
6376a021536SGerd Hoffmann
638e6c42b96SMarkus Armbrusterqapi-py = $(SRC_PATH)/scripts/qapi/__init__.py \
639e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/commands.py \
640fb0bc835SMarkus Armbruster$(SRC_PATH)/scripts/qapi/common.py \
641fb0bc835SMarkus Armbruster$(SRC_PATH)/scripts/qapi/doc.py \
642e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/error.py \
643e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/events.py \
644e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/expr.py \
645e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/gen.py \
646e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/introspect.py \
647e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/parser.py \
648e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/schema.py \
649e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/source.py \
650e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/types.py \
651e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/visit.py \
652fb0bc835SMarkus Armbruster$(SRC_PATH)/scripts/qapi-gen.py
6538d3bc517SAvi Kivity
654fb0bc835SMarkus Armbrusterqga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
655fb0bc835SMarkus Armbrusterqga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h \
656eb815e24SMarkus Armbrusterqga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \
65700ca24ffSMarkus Armbrusterqga/qapi-generated/qga-qapi-init-commands.h qga/qapi-generated/qga-qapi-init-commands.c \
658fb0bc835SMarkus Armbrusterqga/qapi-generated/qga-qapi-doc.texi: \
659fb0bc835SMarkus Armbrusterqga/qapi-generated/qapi-gen-timestamp ;
660fb0bc835SMarkus Armbrusterqga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
6610d6b93deSMatthias Maier	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
662fb0bc835SMarkus Armbruster		-o qga/qapi-generated -p "qga-" $<, \
663fb0bc835SMarkus Armbruster		"GEN","$(@:%-timestamp=%)")
664fb0bc835SMarkus Armbruster	@>$@
665e3d4d252SMichael Roth
666bf582c34SEric Blakeqapi-modules = $(SRC_PATH)/qapi/qapi-schema.json \
667bf582c34SEric Blake               $(QAPI_MODULES:%=$(SRC_PATH)/qapi/%.json)
668be13d46dSMax Reitz
669bf582c34SEric Blake$(GENERATED_QAPI_FILES): qapi-gen-timestamp ;
670fb0bc835SMarkus Armbrusterqapi-gen-timestamp: $(qapi-modules) $(qapi-py)
6710d6b93deSMatthias Maier	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
672eb815e24SMarkus Armbruster		-o "qapi" -b $<, \
673fb0bc835SMarkus Armbruster		"GEN","$(@:%-timestamp=%)")
674fb0bc835SMarkus Armbruster	@>$@
675e3193601SAnthony Liguori
6762af282ecSKevin Wolfqapi-modules-storage-daemon = \
6772af282ecSKevin Wolf	$(SRC_PATH)/storage-daemon/qapi/qapi-schema.json \
6782af282ecSKevin Wolf    $(QAPI_MODULES_STORAGE_DAEMON:%=$(SRC_PATH)/qapi/%.json)
6792af282ecSKevin Wolf
6802af282ecSKevin Wolf$(GENERATED_STORAGE_DAEMON_QAPI_FILES): storage-daemon/qapi/qapi-gen-timestamp ;
6812af282ecSKevin Wolfstorage-daemon/qapi/qapi-gen-timestamp: $(qapi-modules-storage-daemon) $(qapi-py)
6822af282ecSKevin Wolf	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
6832af282ecSKevin Wolf		-o "storage-daemon/qapi" $<, \
6842af282ecSKevin Wolf		"GEN","$(@:%-timestamp=%)")
6852af282ecSKevin Wolf	@>$@
6862af282ecSKevin Wolf
68700ca24ffSMarkus ArmbrusterQGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h qga-qapi-init-commands.h)
6887a0b7ebaSMarc-André Lureau$(qga-obj-y): $(QGALIB_GEN)
689957f1f99SMichael Roth
6900ab8ed18SDaniel P. Berrangeqemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
691fafcaf1dSMichael Roth	$(call LINK, $^)
69248ff7a62SMichael Roth
6939dacf32dSYossi Hindinifdef QEMU_GA_MSI_ENABLED
6949dacf32dSYossi HindinQEMU_GA_MSI=qemu-ga-$(ARCH).msi
6959dacf32dSYossi Hindin
6960a18750fSLeonid Blochmsi: $(QEMU_GA_MSI)
6979dacf32dSYossi Hindin
698fafcaf1dSMichael Roth$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
6999dacf32dSYossi Hindin
7009dacf32dSYossi Hindin$(QEMU_GA_MSI): config-host.mak
7019dacf32dSYossi Hindin
702decdfbd2SLeonid Bloch$(QEMU_GA_MSI):  $(SRC_PATH)/qga/installer/qemu-ga.wxs
703decdfbd2SLeonid 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)" \
7040bdb12c7SPeter Maydell	wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<,"WIXL","$@")
7059dacf32dSYossi Hindinelse
7069dacf32dSYossi Hindinmsi:
70715b19ed8SMichael Roth	@echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
7089dacf32dSYossi Hindinendif
7099dacf32dSYossi Hindin
710fafcaf1dSMichael Rothifneq ($(EXESUF),)
711fafcaf1dSMichael Roth.PHONY: qemu-ga
712fafcaf1dSMichael Rothqemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
713fafcaf1dSMichael Rothendif
714fafcaf1dSMichael Roth
7151b9d35f3SViktor Prutyanovelf2dmp$(EXESUF): $(elf2dmp-obj-y)
7163fa2d384SViktor Prutyanov	$(call LINK, $^)
7173fa2d384SViktor Prutyanov
718b1449edbSKamil Rytarowskiifdef CONFIG_IVSHMEM
7190ab8ed18SDaniel P. Berrangeivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS)
720a75eb03bSDavid Marchand	$(call LINK, $^)
7210ab8ed18SDaniel P. Berrangeivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
722a75eb03bSDavid Marchand	$(call LINK, $^)
723b1449edbSKamil Rytarowskiendif
724d59a031cSMarc-André Lureauvhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a
72549cc0340SFelipe Franciosi	$(call LINK, $^)
726406d2aa2SChangpeng Liuvhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a
727406d2aa2SChangpeng Liu	$(call LINK, $^)
7280f645ba1SMarcel Apfelbaum
7290f645ba1SMarcel Apfelbaumrdmacm-mux$(EXESUF): LIBS += "-libumad"
730a5d2f6f8SYuval Shaiardmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
731a5d2f6f8SYuval Shaia	$(call LINK, $^)
732a75eb03bSDavid Marchand
7334f8bde99SStefan Hajnoczi# relies on Linux-specific syscalls
7342405f3c0SDr. David Alan Gilbertifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
73581bfc42dSDr. David Alan Gilbertvirtiofsd$(EXESUF): $(virtiofsd-obj-y) libvhost-user.a $(COMMON_LDADDS)
73681bfc42dSDr. David Alan Gilbert	$(call LINK, $^)
73781bfc42dSDr. David Alan Gilbertendif
73881bfc42dSDr. David Alan Gilbert
739d2a71d74SThomas Huthvhost-user-gpu$(EXESUF): $(vhost-user-gpu-obj-y) $(libvhost-user-obj-y) libqemuutil.a
740d52c454aSMarc-André Lureau	$(call LINK, $^)
741d52c454aSMarc-André Lureau
74206914c97SMarc-André Lureauifdef CONFIG_VHOST_USER_INPUT
74306914c97SMarc-André Lureauifdef CONFIG_LINUX
74406914c97SMarc-André Lureauvhost-user-input$(EXESUF): $(vhost-user-input-obj-y) libvhost-user.a libqemuutil.a
74506914c97SMarc-André Lureau	$(call LINK, $^)
74606914c97SMarc-André Lureau
74706914c97SMarc-André Lureau# build by default, do not install
74806914c97SMarc-André Lureauall: vhost-user-input$(EXESUF)
74906914c97SMarc-André Lureauendif
75006914c97SMarc-André Lureauendif
75106914c97SMarc-André Lureau
7520c0c1fd9SMarc Marimodule_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
7530c0c1fd9SMarc Mari	$(call quiet-command,$(PYTHON) $< $@ \
7540c0c1fd9SMarc Mari	$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
7550bdb12c7SPeter Maydell	"GEN","$@")
7560c0c1fd9SMarc Mari
757990e6a27SAlex Bennéeifdef CONFIG_GCOV
758990e6a27SAlex Bennée.PHONY: clean-coverage
759990e6a27SAlex Bennéeclean-coverage:
760990e6a27SAlex Bennée	$(call quiet-command, \
761990e6a27SAlex Bennée		find . \( -name '*.gcda' -o -name '*.gcov' \) -type f -exec rm {} +, \
762990e6a27SAlex Bennée		"CLEAN", "coverage files")
763990e6a27SAlex Bennéeendif
764990e6a27SAlex Bennée
7651338a4b7SMarkus Armbrusterclean: recurse-clean
7662d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files
76725be210fSJuan 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
768df2943baSMichael S. Tsirkin	rm -f qemu-options.def
7699dacf32dSYossi Hindin	rm -f *.msi
77023858f40SLaszlo Ersek	find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \
77123858f40SLaszlo Ersek		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
77223858f40SLaszlo Ersek		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
77323858f40SLaszlo Ersek		! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
77423858f40SLaszlo Ersek		-exec rm {} +
77526ce90fdSLaszlo Ersek	rm -f $(edk2-decompressed)
7760814465aSPaolo Bonzini	rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) TAGS cscope.* *.pod *~ */*~
777b855f8d1SPaolo Bonzini	rm -f fsdev/*.pod scsi/*.pod
77807b44ce9SBlue Swirl	rm -f qemu-img-cmds.h
779d98bc0b6SGerd Hoffmann	rm -f ui/shader/*-vert.h ui/shader/*-frag.h
7803dff199cSLaurent Vivier	@# May not be present in generated-files-y
781eac236eaSLluís Vilanova	rm -f trace/generated-tracers-dtrace.dtrace*
782eac236eaSLluís Vilanova	rm -f trace/generated-tracers-dtrace.h*
7833dff199cSLaurent Vivier	rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
784fb0bc835SMarkus Armbruster	rm -f qapi-gen-timestamp
7852af282ecSKevin Wolf	rm -f storage-daemon/qapi/qapi-gen-timestamp
78654c2e502SDunrong Huang	rm -rf qga/qapi-generated
787e92af6ecSJuan Quintela	rm -f config-all-devices.mak
788d69cda7eSPeter Maydell	rm -f $(SUBDIR_DEVICES_MAK)
78931e31b8aSbellard
79034bb443eSAnthony LiguoriVERSION ?= $(shell cat VERSION)
79134bb443eSAnthony Liguori
79234bb443eSAnthony Liguoridist: qemu-$(VERSION).tar.bz2
79334bb443eSAnthony Liguori
79434bb443eSAnthony Liguoriqemu-%.tar.bz2:
79534bb443eSAnthony Liguori	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
79634bb443eSAnthony Liguori
7975f71eac0SPeter Maydelldefine clean-manual =
7981290e671SPeter Maydellrm -rf $(MANUAL_BUILDDIR)/$1/_static
7991290e671SPeter Maydellrm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(MANUAL_BUILDDIR)/$1/*.html
8005f71eac0SPeter Maydellendef
8015f71eac0SPeter Maydell
8027d13299dSbellarddistclean: clean
803ee5195eeSRichard Henderson	rm -f config-host.mak config-host.h* $(DOCS)
8042038f8c8SPaolo Bonzini	rm -f tests/tcg/config-*.mak
805ae219359SThomas Huth	rm -f config-all-devices.mak config-all-disas.mak config.status
806e92af6ecSJuan Quintela	rm -f $(SUBDIR_DEVICES_MAK)
807ae219359SThomas Huth	rm -f po/*.mo tests/qemu-iotests/common.env
808fc8e320eSMagnus Damm	rm -f roms/seabios/config.mak roms/vgabios/config.mak
80926fffe29SEmilio G. Cota	rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
810793553acSAlexandre Raymond	rm -f config.log
81167ed96f9SPeter Maydell	rm -f linux-headers/asm
812d59157eaSPaolo Bonzini	rm -f docs/version.texi
813d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi
814d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7
815d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
816d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
817d59157eaSPaolo Bonzini	rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
81881f33401SPeter Maydell	rm -rf .doctrees
8195f71eac0SPeter Maydell	$(call clean-manual,devel)
8205f71eac0SPeter Maydell	$(call clean-manual,interop)
8210783a732SPeter Maydell	$(call clean-manual,specs)
8220928523aSPeter Maydell	$(call clean-manual,system)
82365c3542bSPeter Maydell	$(call clean-manual,tools)
82409147930SPaolo Bonzini	$(call clean-manual,user)
8252b1f35b9SAlex Bennée	for d in $(TARGET_DIRS); do \
826bc1b050dSbellard	rm -rf $$d || exit 1 ; \
82776bc6838Sbellard        done
828d9840e25STomoki Sekiyama	rm -Rf .sdk
8297d13299dSbellard
83006e7772fSGerd HoffmannKEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  no  pt-br  sv \
831fed4a9adSbellardar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
83226b1cbf8SGerd Hoffmannde-ch  es     fo  fr-ca  hu     ja  mk  pt  sl     tr \
8333751e722SJan Krupabepo    cz
834fed4a9adSbellard
83577755340Sthsifdef INSTALL_BLOBS
83632eb2da3SBruce RogersBLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
8377a4dfd1eSGerd Hoffmannvgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
8380a87fd69SGerd Hoffmannvgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \
839b2ce76a0SThomas Huthopenbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
8405ee8ad71SAlex Williamsonpxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
8415ee8ad71SAlex Williamsonpxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
8429fd02979SSander Eikelenboomefi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
8439fd02979SSander Eikelenboomefi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
84445027808SGerd Hoffmannefi-e1000e.rom efi-vmxnet3.rom \
845b3ce38dcSPhilippe Mathieu-Daudéqemu-nsis.bmp \
8464b387f9eSBALATON Zoltanbamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
8472785dc7bSStefano Garzarellamultiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \
8486c5359e1SChristian Borntraegers390-ccw.img s390-netboot.img \
849744a928cSAlexey Kardashevskiyslof.bin skiboot.lid \
8500c6ab8c9SCole Robinsonpalcode-clipper \
85182e65fe0SBALATON Zoltanu-boot.e500 u-boot-sam460-20100605.bin \
85243ad2564SRichard Hendersonqemu_vga.ndrv \
85326ce90fdSLaszlo Ersekedk2-licenses.txt \
85491f3a2f0SAlistair Francishppa-firmware.img \
855a6fcc80bSBin Mengopensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \
85691f3a2f0SAlistair Francisopensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin
85791f3a2f0SAlistair Francis
85826ce90fdSLaszlo Ersek
85926ce90fdSLaszlo ErsekDESCS=50-edk2-i386-secure.json 50-edk2-x86_64-secure.json \
86026ce90fdSLaszlo Ersek60-edk2-aarch64.json 60-edk2-arm.json 60-edk2-i386.json 60-edk2-x86_64.json
86177755340Sthselse
86277755340SthsBLOBS=
86326ce90fdSLaszlo ErsekDESCS=
86477755340Sthsendif
86577755340Sths
866336cfef4SPeter Maydell# Note that we manually filter-out the non-Sphinx documentation which
86727a296fcSPeter Maydell# is currently built into the docs/interop directory in the build tree,
86827a296fcSPeter Maydell# and also any sphinx-built manpages.
8695f71eac0SPeter Maydelldefine install-manual =
8701290e671SPeter Maydellfor d in $$(cd $(MANUAL_BUILDDIR) && find $1 -type d); do $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/$$d"; done
87127a296fcSPeter 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
8725f71eac0SPeter Maydellendef
8735f71eac0SPeter Maydell
8745f71eac0SPeter Maydell# Note that we deliberately do not install the "devel" manual: it is
8755f71eac0SPeter Maydell# for QEMU developers, and not interesting to our users.
8765f71eac0SPeter Maydell.PHONY: install-sphinxdocs
8775f71eac0SPeter Maydellinstall-sphinxdocs: sphinxdocs
8785f71eac0SPeter Maydell	$(call install-manual,interop)
8790783a732SPeter Maydell	$(call install-manual,specs)
8800928523aSPeter Maydell	$(call install-manual,system)
88165c3542bSPeter Maydell	$(call install-manual,tools)
88209147930SPaolo Bonzini	$(call install-manual,user)
8835f71eac0SPeter Maydell
8845f71eac0SPeter Maydellinstall-doc: $(DOCS) install-sphinxdocs
885d7dd65baSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
88622108f33SStefan Hajnoczi	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/index.html "$(DESTDIR)$(qemu_docdir)"
887c13dba2cSLiao Pingfang	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop"
888c13dba2cSLiao Pingfang	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)/interop"
889c13dba2cSLiao Pingfang	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)/interop"
89096d409ebSJuan Quintelaifdef CONFIG_POSIX
89158f8aeadSaliguori	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
892d06118bfSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu.1 "$(DESTDIR)$(mandir)/man1"
89356e8bdd4SMarc-André Lureau	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
894d59157eaSPaolo Bonzini	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
895acab923dSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
8961bf84a1eSKashyap Chamarthy	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
897c932ce31SPaolo Bonziniifeq ($(CONFIG_TOOLS),y)
898a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-img.1 "$(DESTDIR)$(mandir)/man1"
89958f8aeadSaliguori	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
900a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
90138954dcaSpbrookendif
90262dd1048SDaniel P. Berrangéifdef CONFIG_TRACE_SYSTEMTAP
903a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
90462dd1048SDaniel P. Berrangéendif
905665b5d0dSMarc-André Lureauifneq (,$(findstring qemu-ga,$(TOOLS)))
906b53c54c6SPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
907c13dba2cSLiao Pingfang	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop"
908c13dba2cSLiao Pingfang	$(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)/interop"
909c13dba2cSLiao Pingfang	$(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)/interop"
910d59157eaSPaolo Bonzini	$(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
911665b5d0dSMarc-André Lureauendif
9128a3e8f7fSAndreas Färberendif
913a2d8f1beSM. Mohan Kumarifdef CONFIG_VIRTFS
914a2d8f1beSM. Mohan Kumar	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
915a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
916a2d8f1beSM. Mohan Kumarendif
9176a7e2bbeSStefan Hajnocziifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
918a08b4a9fSPeter Maydell	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtiofsd.1 "$(DESTDIR)$(mandir)/man1"
9196a7e2bbeSStefan Hajnocziendif
920b5ec5ce0Sjohn cooper
921e2d87bffSEduardo Habkostinstall-datadir:
922e2d87bffSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
923e2d87bffSEduardo Habkost
924f2e3978bSLaszlo Ersekinstall-localstatedir:
925f2e3978bSLaszlo Ersekifdef CONFIG_POSIX
926f2e3978bSLaszlo Ersekifneq (,$(findstring qemu-ga,$(TOOLS)))
927f2e3978bSLaszlo Ersek	$(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
928f2e3978bSLaszlo Ersekendif
929f2e3978bSLaszlo Ersekendif
930f2e3978bSLaszlo Ersek
931a8260d38SDaniel P. BerrangéICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
932e2d87bffSEduardo Habkost
93354cb65d8SEmilio G. Cotainstall-includedir:
93454cb65d8SEmilio G. Cota	$(INSTALL_DIR) "$(DESTDIR)$(includedir)"
93554cb65d8SEmilio G. Cota
93654cb65d8SEmilio G. Cotainstall: all $(if $(BUILD_DOCS),install-doc) \
93754cb65d8SEmilio G. Cota	install-datadir install-localstatedir install-includedir \
9381338a4b7SMarkus Armbruster	$(if $(INSTALL_BLOBS),$(edk2-decompressed)) \
9391338a4b7SMarkus Armbruster	recurse-install
940932a79dfSthsifneq ($(TOOLS),)
9410814465aSPaolo Bonzini	$(call install-prog,$(TOOLS),$(DESTDIR)$(bindir))
942932a79dfSthsendif
943e3be6f0eSFam Zhengifneq ($(CONFIG_MODULES),)
944e3be6f0eSFam Zheng	$(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
9452115182fSMichael Tokarev	for s in $(modules-m:.mo=$(DSOSUF)); do \
9462115182fSMichael Tokarev		t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
947264f8b4fSMichael Tokarev		$(INSTALL_LIB) $$s "$$t"; \
9482115182fSMichael Tokarev		test -z "$(STRIP)" || $(STRIP) "$$t"; \
949e3be6f0eSFam Zheng	done
950e3be6f0eSFam Zhengendif
9517b93fadfSCorey Bryantifneq ($(HELPERS-y),)
9520d659426SMichael Tokarev	$(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
9537b93fadfSCorey Bryantendif
954d52c454aSMarc-André Lureauifneq ($(vhost-user-json-y),)
955d52c454aSMarc-André Lureau	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/vhost-user/"
956d52c454aSMarc-André Lureau	for x in $(vhost-user-json-y); do \
957d52c454aSMarc-André Lureau		$(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)/vhost-user/"; \
958d52c454aSMarc-André Lureau	done
959d52c454aSMarc-André Lureauendif
96062dd1048SDaniel P. Berrangéifdef CONFIG_TRACE_SYSTEMTAP
96162dd1048SDaniel P. Berrangé	$(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir)
96262dd1048SDaniel P. Berrangéendif
96377755340Sthsifneq ($(BLOBS),)
96477755340Sths	set -e; for x in $(BLOBS); do \
9656aae2a2eSEduardo Habkost		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
966ad064840Spbrook	done
96777755340Sthsendif
96826ce90fdSLaszlo Ersekifdef INSTALL_BLOBS
96926ce90fdSLaszlo Ersek	set -e; for x in $(edk2-decompressed); do \
97026ce90fdSLaszlo Ersek		$(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)"; \
97126ce90fdSLaszlo Ersek	done
97226ce90fdSLaszlo Ersekendif
97326ce90fdSLaszlo Ersekifneq ($(DESCS),)
97426ce90fdSLaszlo Ersek	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/firmware"
97526ce90fdSLaszlo Ersek	set -e; tmpf=$$(mktemp); trap 'rm -f -- "$$tmpf"' EXIT; \
97626ce90fdSLaszlo Ersek	for x in $(DESCS); do \
977177cd674SOlaf Hering		sed -e 's,@DATADIR@,$(qemu_datadir),' \
97826ce90fdSLaszlo Ersek			"$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
97926ce90fdSLaszlo Ersek		$(INSTALL_DATA) "$$tmpf" \
98026ce90fdSLaszlo Ersek			"$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
98126ce90fdSLaszlo Ersek	done
98226ce90fdSLaszlo Ersekendif
983a8260d38SDaniel P. Berrangé	for s in $(ICON_SIZES); do \
9846c11dda9SStefan Hajnoczi		mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
985a8260d38SDaniel P. Berrangé		$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \
9866c11dda9SStefan Hajnoczi			"$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
987a8260d38SDaniel P. Berrangé	done; \
9886c11dda9SStefan Hajnoczi	mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
989a8260d38SDaniel P. Berrangé	$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \
9906c11dda9SStefan Hajnoczi		"$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
9916c11dda9SStefan Hajnoczi	mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
992a8260d38SDaniel P. Berrangé	$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \
9936c11dda9SStefan Hajnoczi		"$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
9946c11dda9SStefan Hajnoczi	mkdir -p "$(DESTDIR)$(qemu_desktopdir)"
99567ea9546SDaniel P. Berrangé	$(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
9966c11dda9SStefan Hajnoczi		"$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
9972a6b5372SMichael Tokarevifdef CONFIG_GTK
998834574eaSAnthony Liguori	$(MAKE) -C po $@
999834574eaSAnthony Liguoriendif
100054cb65d8SEmilio G. Cotaifeq ($(CONFIG_PLUGIN),y)
100154cb65d8SEmilio G. Cota	$(INSTALL_DATA) $(SRC_PATH)/include/qemu/qemu-plugin.h "$(DESTDIR)$(includedir)/qemu-plugin.h"
100254cb65d8SEmilio G. Cotaendif
10036aae2a2eSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
100418be8d77Sblueswir1	set -e; for x in $(KEYMAPS); do \
10056aae2a2eSEduardo Habkost		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
1006ad064840Spbrook	done
10071412cf58SDaniel P. Berrange	$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
1008612384d7Sbellard
1009ae5fdc81SFam Zheng.PHONY: ctags
1010ae5fdc81SFam Zhengctags:
1011ac99c624SSergey Fedorov	rm -f tags
1012ae5fdc81SFam Zheng	find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
1013ae5fdc81SFam Zheng
101421d4e8e3SAlexandre Bique.PHONY: TAGS
1015367e86e8SbellardTAGS:
1016ac99c624SSergey Fedorov	rm -f TAGS
1017b1999e87SDavid Gibson	find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
101831e31b8aSbellard
10196688bc6dSbellardcscope:
1020eaa2ddbbSFam Zheng	rm -f "$(SRC_PATH)"/cscope.*
1021eaa2ddbbSFam Zheng	find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
1022eaa2ddbbSFam Zheng	cscope -b -i"$(SRC_PATH)/cscope.files"
10236688bc6dSbellard
1024d98bc0b6SGerd Hoffmann# opengl shader programs
1025d98bc0b6SGerd Hoffmannui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
1026d98bc0b6SGerd Hoffmann	@mkdir -p $(dir $@)
1027d98bc0b6SGerd Hoffmann	$(call quiet-command,\
1028d98bc0b6SGerd Hoffmann		perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
10290bdb12c7SPeter Maydell		"VERT","$@")
1030d98bc0b6SGerd Hoffmann
1031d98bc0b6SGerd Hoffmannui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
1032d98bc0b6SGerd Hoffmann	@mkdir -p $(dir $@)
1033d98bc0b6SGerd Hoffmann	$(call quiet-command,\
1034d98bc0b6SGerd Hoffmann		perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
10350bdb12c7SPeter Maydell		"FRAG","$@")
1036d98bc0b6SGerd Hoffmann
103746e19e14SGerd Hoffmannui/shader.o: $(SRC_PATH)/ui/shader.c \
10382e1d70b9SGerd Hoffmann	ui/shader/texture-blit-vert.h \
10392e1d70b9SGerd Hoffmann	ui/shader/texture-blit-flip-vert.h \
10402e1d70b9SGerd Hoffmann	ui/shader/texture-blit-frag.h
1041cd2bc889SGerd Hoffmann
10423ef693a0Sbellard# documentation
1043e8518c92SMarkus ArmbrusterMAKEINFO=makeinfo
1044d59157eaSPaolo BonziniMAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
1045d59157eaSPaolo BonziniMAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
1046e8338fdbSMarc-André LureauTEXI2PODFLAGS=$(MAKEINFOINCLUDES) -DVERSION="$(VERSION)" -DCONFDIR="$(qemu_confdir)"
1047d59157eaSPaolo BonziniTEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
104856e8bdd4SMarc-André Lureau
1049e8338fdbSMarc-André Lureaudocs/version.texi: $(SRC_PATH)/VERSION config-host.mak
1050e8338fdbSMarc-André Lureau	$(call quiet-command,(\
1051e8338fdbSMarc-André Lureau		echo "@set VERSION $(VERSION)" && \
1052e8338fdbSMarc-André Lureau		echo "@set CONFDIR $(qemu_confdir)" \
1053e8338fdbSMarc-André Lureau	)> $@,"GEN","$@")
1054fea346f5SPeter Maydell
105544cb280dSPaolo Bonzini%.html: %.texi docs/version.texi
1056e9ee06bdSMarc-André Lureau	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
1057e9ee06bdSMarc-André Lureau	--html $< -o $@,"GEN","$@")
10583ef693a0Sbellard
105944cb280dSPaolo Bonzini%.info: %.texi docs/version.texi
1060e9ee06bdSMarc-André Lureau	$(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@")
1061f3548328Sbellard
106244cb280dSPaolo Bonzini%.txt: %.texi docs/version.texi
1063f8bab10bSMarc-André Lureau	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
1064f8bab10bSMarc-André Lureau	--plaintext $< -o $@,"GEN","$@")
1065f8bab10bSMarc-André Lureau
106644cb280dSPaolo Bonzini%.pdf: %.texi docs/version.texi
1067d59157eaSPaolo Bonzini	$(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@")
1068bd7f9747SMarkus Armbruster
10695f71eac0SPeter Maydell# Sphinx builds all its documentation at once in one invocation
10705f71eac0SPeter Maydell# and handles "don't rebuild things unless necessary" itself.
10715f71eac0SPeter Maydell# The '.doctrees' files are cached information to speed this up.
10725f71eac0SPeter Maydell.PHONY: sphinxdocs
10730928523aSPeter Maydellsphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \
10740928523aSPeter Maydell            $(MANUAL_BUILDDIR)/interop/index.html \
10750928523aSPeter Maydell            $(MANUAL_BUILDDIR)/specs/index.html \
107665c3542bSPeter Maydell            $(MANUAL_BUILDDIR)/system/index.html \
107709147930SPaolo Bonzini            $(MANUAL_BUILDDIR)/tools/index.html \
107809147930SPaolo Bonzini            $(MANUAL_BUILDDIR)/user/index.html
10795f71eac0SPeter Maydell
10805f71eac0SPeter Maydell# Canned command to build a single manual
108127a296fcSPeter Maydell# Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
10826bda415cSEduardo Habkost# Note the use of different doctree for each (manual, builder) tuple;
10836bda415cSEduardo Habkost# this works around Sphinx not handling parallel invocation on
10846bda415cSEduardo Habkost# a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
1085516e8b7dSPeter 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")
10865f71eac0SPeter Maydell# We assume all RST files in the manual's directory are used in it
1087814e068fSPeter Maydellmanual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \
1088de1572caSPeter Maydell              $(SRC_PATH)/docs/defs.rst.inc \
10899165d323SPeter Maydell              $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py \
10909165d323SPeter Maydell              $(SRC_PATH)/docs/sphinx/*.py
1091e0f3728dSPeter Maydell# Macro to write out the rule and dependencies for building manpages
1092e0f3728dSPeter Maydell# Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps])
1093e0f3728dSPeter Maydell# 'extradeps' is optional, and specifies extra files (eg .hx files) that
1094e0f3728dSPeter Maydell# the manual page depends on.
1095e0f3728dSPeter Maydelldefine define-manpage-rule
1096e0f3728dSPeter Maydell$(call atomic,$(foreach manpage,$2,$(MANUAL_BUILDDIR)/$1/$(manpage)),$(call manual-deps,$1) $3)
1097e0f3728dSPeter Maydell	$(call build-manual,$1,man)
1098e0f3728dSPeter Maydellendef
10995f71eac0SPeter Maydell
11001290e671SPeter Maydell$(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel)
110127a296fcSPeter Maydell	$(call build-manual,devel,html)
11025f71eac0SPeter Maydell
1103a08b4a9fSPeter Maydell$(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop)
110427a296fcSPeter Maydell	$(call build-manual,interop,html)
11055f71eac0SPeter Maydell
11060783a732SPeter Maydell$(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
110727a296fcSPeter Maydell	$(call build-manual,specs,html)
110827a296fcSPeter Maydell
110909ce5f2dSPeter 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
11100928523aSPeter Maydell	$(call build-manual,system,html)
11110928523aSPeter Maydell
1112a08b4a9fSPeter Maydell$(MANUAL_BUILDDIR)/tools/index.html: $(call manual-deps,tools) $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc
111365c3542bSPeter Maydell	$(call build-manual,tools,html)
111465c3542bSPeter Maydell
111509147930SPaolo Bonzini$(MANUAL_BUILDDIR)/user/index.html: $(call manual-deps,user)
111609147930SPaolo Bonzini	$(call build-manual,user,html)
111709147930SPaolo Bonzini
1118a08b4a9fSPeter Maydell$(call define-manpage-rule,interop,qemu-ga.8)
11190783a732SPeter Maydell
1120d06118bfSPeter Maydell$(call define-manpage-rule,system,qemu.1 qemu-block-drivers.7 qemu-cpu-models.7)
1121acab923dSPeter Maydell
1122a08b4a9fSPeter Maydell$(call define-manpage-rule,tools,\
1123a08b4a9fSPeter Maydell       qemu-img.1 qemu-nbd.8 qemu-trace-stap.1\
1124a08b4a9fSPeter Maydell       virtiofsd.1 virtfs-proxy-helper.1,\
1125a08b4a9fSPeter Maydell       $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc)
1126a08b4a9fSPeter Maydell
112722108f33SStefan Hajnoczi$(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version.h
1128d83bbedaSStefan Hajnoczi	@mkdir -p "$(MANUAL_BUILDDIR)"
112922108f33SStefan Hajnoczi	$(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \
113022108f33SStefan Hajnoczi             "GEN","$@")
113122108f33SStefan Hajnoczi
1132eb815e24SMarkus Armbrusterdocs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
1133fb0bc835SMarkus Armbruster	@cp -p $< $@
11344afeeb57SMarkus Armbruster
1135fb0bc835SMarkus Armbrusterdocs/interop/qemu-ga-qapi.texi: qga/qapi-generated/qga-qapi-doc.texi
1136fb0bc835SMarkus Armbruster	@cp -p $< $@
113756e8bdd4SMarc-André Lureau
11385b1d0e92SPeter Maydellhtml: docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs
11395b1d0e92SPeter Maydellinfo: docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
11405b1d0e92SPeter Maydellpdf: docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
11415b1d0e92SPeter Maydelltxt: docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
1142818220f5Saliguori
1143d59157eaSPaolo Bonzinidocs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
1144d59157eaSPaolo Bonzini    docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
1145d59157eaSPaolo Bonzini    docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \
1146d59157eaSPaolo Bonzini	docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi
114756e8bdd4SMarc-André Lureau
1148d59157eaSPaolo Bonzinidocs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
1149d59157eaSPaolo Bonzini    docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \
1150d59157eaSPaolo Bonzini    docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
1151d59157eaSPaolo Bonzini	docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
115256e8bdd4SMarc-André Lureau
1153ae560cc3SEric Blake$(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl
1154ae560cc3SEric Blake
1155fe8bf5f6SAlex Bennée# Reports/Analysis
1156fe8bf5f6SAlex Bennée
1157fe8bf5f6SAlex Bennée%/coverage-report.html:
1158fe8bf5f6SAlex Bennée	@mkdir -p $*
1159fe8bf5f6SAlex Bennée	$(call quiet-command,\
11605eda6e42SAlex Bennée		gcovr -r $(SRC_PATH) \
11615eda6e42SAlex Bennée		$(foreach t, $(TARGET_DIRS), --object-directory $(BUILD_DIR)/$(t)) \
11625eda6e42SAlex Bennée		 --object-directory $(BUILD_DIR) \
1163337f2311SAlex Bennée		-p --html --html-details -o $@, \
1164fe8bf5f6SAlex Bennée		"GEN", "coverage-report.html")
1165fe8bf5f6SAlex Bennée
1166fe8bf5f6SAlex Bennée.PHONY: coverage-report
1167fe8bf5f6SAlex Bennéecoverage-report: $(CURDIR)/reports/coverage/coverage-report.html
116856e8bdd4SMarc-André Lureau
1169f53ec699SStefan Weilifdef CONFIG_WIN32
1170f53ec699SStefan Weil
1171f53ec699SStefan WeilINSTALLER = qemu-setup-$(VERSION)$(EXESUF)
1172f53ec699SStefan Weil
1173f53ec699SStefan Weilnsisflags = -V2 -NOCD
1174f53ec699SStefan Weil
1175f53ec699SStefan Weilifneq ($(wildcard $(SRC_PATH)/dll),)
1176f53ec699SStefan Weilifeq ($(ARCH),x86_64)
1177f53ec699SStefan Weil# 64 bit executables
1178f53ec699SStefan WeilDLL_PATH = $(SRC_PATH)/dll/w64
1179f53ec699SStefan Weilnsisflags += -DW64
1180f53ec699SStefan Weilelse
1181f53ec699SStefan Weil# 32 bit executables
1182f53ec699SStefan WeilDLL_PATH = $(SRC_PATH)/dll/w32
1183f53ec699SStefan Weilendif
1184f53ec699SStefan Weilendif
1185f53ec699SStefan Weil
1186f53ec699SStefan Weil.PHONY: installer
1187f53ec699SStefan Weilinstaller: $(INSTALLER)
1188f53ec699SStefan Weil
1189f53ec699SStefan WeilINSTDIR=/tmp/qemu-nsis
1190f53ec699SStefan Weil
1191f84f9f75SPhilippe Mathieu-Daudé$(INSTALLER): install-doc $(SRC_PATH)/qemu.nsi
1192fb8597bbSEd Maste	$(MAKE) install prefix=${INSTDIR}
1193f53ec699SStefan Weilifdef SIGNCODE
1194f53ec699SStefan Weil	(cd ${INSTDIR}; \
1195f53ec699SStefan Weil         for i in *.exe; do \
1196f53ec699SStefan Weil           $(SIGNCODE) $${i}; \
1197f53ec699SStefan Weil         done \
1198f53ec699SStefan Weil        )
1199f53ec699SStefan Weilendif # SIGNCODE
1200f53ec699SStefan Weil	(cd ${INSTDIR}; \
1201f53ec699SStefan Weil         for i in qemu-system-*.exe; do \
1202f53ec699SStefan Weil           arch=$${i%.exe}; \
1203f53ec699SStefan Weil           arch=$${arch#qemu-system-}; \
1204f53ec699SStefan Weil           echo Section \"$$arch\" Section_$$arch; \
1205f53ec699SStefan Weil           echo SetOutPath \"\$$INSTDIR\"; \
1206f53ec699SStefan Weil           echo File \"\$${BINDIR}\\$$i\"; \
1207f53ec699SStefan Weil           echo SectionEnd; \
1208f53ec699SStefan Weil         done \
1209f53ec699SStefan Weil        ) >${INSTDIR}/system-emulations.nsh
1210f53ec699SStefan Weil	makensis $(nsisflags) \
1211f53ec699SStefan Weil                $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
1212f53ec699SStefan Weil                $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
1213f53ec699SStefan Weil                -DBINDIR="${INSTDIR}" \
1214f53ec699SStefan Weil                $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
1215f53ec699SStefan Weil                -DSRCDIR="$(SRC_PATH)" \
1216f53ec699SStefan Weil                -DOUTFILE="$(INSTALLER)" \
1217805d8a67SStefan Weil                -DDISPLAYVERSION="$(VERSION)" \
1218f53ec699SStefan Weil                $(SRC_PATH)/qemu.nsi
1219f53ec699SStefan Weil	rm -r ${INSTDIR}
1220f53ec699SStefan Weilifdef SIGNCODE
1221f53ec699SStefan Weil	$(SIGNCODE) $(INSTALLER)
1222f53ec699SStefan Weilendif # SIGNCODE
1223f53ec699SStefan Weilendif # CONFIG_WIN
1224f53ec699SStefan Weil
1225cb5fc67dSAnthony Liguori# Add a dependency on the generated files, so that they are always
1226cb5fc67dSAnthony Liguori# rebuilt before other object files
1227428952cfSThomas Huthifneq ($(wildcard config-host.mak),)
1228eaa2ddbbSFam Zhengifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
12293dff199cSLaurent VivierMakefile: $(generated-files-y)
12307748b8cbSMike Frysingerendif
1231428952cfSThomas Huthendif
1232cb5fc67dSAnthony Liguori
12330ab8ed18SDaniel P. Berrange.SECONDARY: $(TRACE_HEADERS) $(TRACE_HEADERS:%=%-timestamp) \
12340ab8ed18SDaniel P. Berrange	$(TRACE_SOURCES) $(TRACE_SOURCES:%=%-timestamp) \
12350ab8ed18SDaniel P. Berrange	$(TRACE_DTRACE) $(TRACE_DTRACE:%=%-timestamp)
12360ab8ed18SDaniel P. Berrange
12374fb240a4Sbellard# Include automatically generated dependency files
12381435ddb8SPaolo Bonzini# Dependencies in Makefile.objs files come from our recursive subdir rules
12391435ddb8SPaolo Bonzini-include $(wildcard *.d tests/*.d)
1240324027c2SFam Zheng
1241324027c2SFam Zhenginclude $(SRC_PATH)/tests/docker/Makefile.include
1242b1fb9a63SFam Zhenginclude $(SRC_PATH)/tests/vm/Makefile.include
12430d8e065fSMarc-André Lureau
1244c355de59SPhilippe Mathieu-Daudéprint-help-run = printf "  %-30s - %s\\n" "$1" "$2"
1245c355de59SPhilippe Mathieu-Daudéprint-help = $(quiet-@)$(call print-help-run,$1,$2)
1246c355de59SPhilippe Mathieu-Daudé
12470d8e065fSMarc-André Lureau.PHONY: help
12480d8e065fSMarc-André Lureauhelp:
12490d8e065fSMarc-André Lureau	@echo  'Generic targets:'
1250c355de59SPhilippe Mathieu-Daudé	$(call print-help,all,Build all)
12510decdfe2SMarc-André Lureauifdef CONFIG_MODULES
1252c355de59SPhilippe Mathieu-Daudé	$(call print-help,modules,Build all modules)
12530decdfe2SMarc-André Lureauendif
1254c355de59SPhilippe Mathieu-Daudé	$(call print-help,dir/file.o,Build specified target only)
1255c355de59SPhilippe Mathieu-Daudé	$(call print-help,install,Install QEMU, documentation and tools)
1256c355de59SPhilippe Mathieu-Daudé	$(call print-help,ctags/TAGS,Generate tags file for editors)
1257c355de59SPhilippe Mathieu-Daudé	$(call print-help,cscope,Generate cscope index)
12580d8e065fSMarc-André Lureau	@echo  ''
12592b1f35b9SAlex Bennée	@$(if $(TARGET_DIRS), \
12600d8e065fSMarc-André Lureau		echo 'Architecture specific targets:'; \
12612b1f35b9SAlex Bennée		$(foreach t, $(TARGET_DIRS), \
1262763815a8SPhilippe Mathieu-Daudé		$(call print-help-run,$(t)/all,Build for $(t)); \
1263763815a8SPhilippe Mathieu-Daudé		$(if $(CONFIG_FUZZ), \
1264763815a8SPhilippe Mathieu-Daudé			$(if $(findstring softmmu,$(t)), \
1265763815a8SPhilippe Mathieu-Daudé				$(call print-help-run,$(t)/fuzz,Build fuzzer for $(t)); \
1266763815a8SPhilippe Mathieu-Daudé		))) \
12670d8e065fSMarc-André Lureau		echo '')
1268fdbff6bdSPhilippe Mathieu-Daudé	@$(if $(HELPERS-y), \
1269fdbff6bdSPhilippe Mathieu-Daudé		echo 'Helper targets:'; \
1270fdbff6bdSPhilippe Mathieu-Daudé		$(foreach t, $(HELPERS-y), \
1271fdbff6bdSPhilippe Mathieu-Daudé		$(call print-help-run,$(t),Build $(shell basename $(t)));) \
1272fdbff6bdSPhilippe Mathieu-Daudé		echo '')
127381ed0a57SPhilippe Mathieu-Daudé	@$(if $(TOOLS), \
127481ed0a57SPhilippe Mathieu-Daudé		echo 'Tools targets:'; \
127581ed0a57SPhilippe Mathieu-Daudé		$(foreach t, $(TOOLS), \
127681ed0a57SPhilippe Mathieu-Daudé		$(call print-help-run,$(t),Build $(shell basename $(t)) tool);) \
12770d8e065fSMarc-André Lureau		echo '')
12780d8e065fSMarc-André Lureau	@echo  'Cleaning targets:'
1279c355de59SPhilippe Mathieu-Daudé	$(call print-help,clean,Remove most generated files but keep the config)
1280990e6a27SAlex Bennéeifdef CONFIG_GCOV
1281c355de59SPhilippe Mathieu-Daudé	$(call print-help,clean-coverage,Remove coverage files)
1282990e6a27SAlex Bennéeendif
1283c355de59SPhilippe Mathieu-Daudé	$(call print-help,distclean,Remove all generated files)
1284c355de59SPhilippe Mathieu-Daudé	$(call print-help,dist,Build a distributable tarball)
12850d8e065fSMarc-André Lureau	@echo  ''
12860d8e065fSMarc-André Lureau	@echo  'Test targets:'
1287c355de59SPhilippe Mathieu-Daudé	$(call print-help,check,Run all tests (check-help for details))
1288c355de59SPhilippe Mathieu-Daudé	$(call print-help,docker,Help about targets running tests inside containers)
1289c355de59SPhilippe Mathieu-Daudé	$(call print-help,vm-help,Help about targets running tests inside VM)
12900d8e065fSMarc-André Lureau	@echo  ''
12910d8e065fSMarc-André Lureau	@echo  'Documentation targets:'
1292c355de59SPhilippe Mathieu-Daudé	$(call print-help,html info pdf txt,Build documentation in specified format)
1293fe8bf5f6SAlex Bennéeifdef CONFIG_GCOV
1294c355de59SPhilippe Mathieu-Daudé	$(call print-help,coverage-report,Create code coverage report)
1295fe8bf5f6SAlex Bennéeendif
12960d8e065fSMarc-André Lureau	@echo  ''
12970d8e065fSMarc-André Lureauifdef CONFIG_WIN32
12980d8e065fSMarc-André Lureau	@echo  'Windows targets:'
1299c355de59SPhilippe Mathieu-Daudé	$(call print-help,installer,Build NSIS-based installer for QEMU)
13000d8e065fSMarc-André Lureauifdef QEMU_GA_MSI_ENABLED
1301c355de59SPhilippe Mathieu-Daudé	$(call print-help,msi,Build MSI-based installer for qemu-ga)
13020d8e065fSMarc-André Lureauendif
13030d8e065fSMarc-André Lureau	@echo  ''
13040d8e065fSMarc-André Lureauendif
1305c355de59SPhilippe Mathieu-Daudé	$(call print-help,$(MAKE) [targets],(quiet build, default))
1306c355de59SPhilippe Mathieu-Daudé	$(call print-help,$(MAKE) V=1 [targets],(verbose build))
1307