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 124d3b18480SMarc-André Lureaugenerated-files-y += target/s390x/gen-features.h 125d3b18480SMarc-André Lureautarget/s390x/gen-features.h: Makefile.ninja 1260c0c1fd9SMarc Mari 1273dff199cSLaurent Viviergenerated-files-y += .git-submodule-status 1280ab8ed18SDaniel P. Berrange 129d9ace8b3SJuan Quintela# Don't try to regenerate Makefile or configure 130d9ace8b3SJuan Quintela# We don't generate any of them 131d9ace8b3SJuan QuintelaMakefile: ; 132d9ace8b3SJuan Quintelaconfigure: ; 133d9ace8b3SJuan Quintela 134bd3f5706SMarc-André Lureau.PHONY: all clean cscope distclean html info install install-doc \ 1357c3d1917SDaniel P. Berrange pdf txt recurse-all dist msi FORCE 1360cb3fb1eSpbrook 137fec90ff0SPaolo Bonzini$(call set-vpath, $(SRC_PATH)) 1388c462f8fSpbrook 1393e2e0e6bSJuan QuintelaLIBS+=-lz $(LIBS_TOOLS) 14067c0f08dSJuan Quintela 141b53c54c6SPeter Maydell# Sphinx does not allow building manuals into the same directory as 142b53c54c6SPeter Maydell# the source files, so if we're doing an in-tree QEMU build we must 143b53c54c6SPeter Maydell# build the manuals into a subdirectory (and then install them from 144b53c54c6SPeter Maydell# there for 'make install'). For an out-of-tree build we can just 145b53c54c6SPeter Maydell# use the docs/ subdirectory in the build tree as normal. 146b53c54c6SPeter Maydellifeq ($(realpath $(SRC_PATH)),$(realpath .)) 147b53c54c6SPeter MaydellMANUAL_BUILDDIR := docs/built 148b53c54c6SPeter Maydellelse 149b53c54c6SPeter MaydellMANUAL_BUILDDIR := docs 150b53c54c6SPeter Maydellendif 151b53c54c6SPeter Maydell 152cc8ae6deSpbrookifdef BUILD_DOCS 153d06118bfSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/system/qemu.1 154a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/qemu-img.1 155a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/qemu-nbd.8 15687c0868fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/interop/qemu-ga.8 1576a7e2bbeSStefan Hajnocziifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy) 158a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/virtiofsd.1 1596a7e2bbeSStefan Hajnocziendif 160acab923dSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 161d59157eaSPaolo BonziniDOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7 162d59157eaSPaolo BonziniDOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7 1631bf84a1eSKashyap ChamarthyDOCS+=$(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 16422108f33SStefan HajnocziDOCS+=$(MANUAL_BUILDDIR)/index.html 165983eef5aSMeador Ingeifdef CONFIG_VIRTFS 166a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 167983eef5aSMeador Ingeendif 16862dd1048SDaniel P. Berrangéifdef CONFIG_TRACE_SYSTEMTAP 169a08b4a9fSPeter MaydellDOCS+=$(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 17062dd1048SDaniel P. Berrangéendif 171cc8ae6deSpbrookelse 172cc8ae6deSpbrookDOCS= 173cc8ae6deSpbrookendif 1747d13299dSbellard 1758cc357b5SDaniel P. BerrangeSUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR) 176a992fe3dSPaul Brook 177992aeb8eSPaolo Bonziniifneq ($(wildcard config-host.mak),) 178992aeb8eSPaolo Bonziniinclude $(SRC_PATH)/Makefile.objs 179ba1183daSFam Zhengendif 180ba1183daSFam Zheng 181ba1183daSFam Zhengdummy := $(call unnest-vars,, \ 18214837c64SKevin Wolf storage-daemon-obj-y \ 18314837c64SKevin Wolf storage-daemon-obj-m \ 184cc475698SFam Zheng common-obj-y \ 185a81df1b6SPaolo Bonzini common-obj-m) 186243af022SPaolo Bonzini 18746e7b706SFam Zhenginclude $(SRC_PATH)/tests/Makefile.include 188992aeb8eSPaolo Bonzini 189*c3a0ee84SPaolo Bonziniall: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) recurse-all modules 190b9dea4fbSpbrook 1911215c6e7SJuan Quintelaconfig-host.h: config-host.h-timestamp 1921215c6e7SJuan Quintelaconfig-host.h-timestamp: config-host.mak 1931215c6e7SJuan Quintela 194c621dc3eSAlexander BulekovTARGET_DIRS_RULES := $(foreach t, all fuzz clean install, $(addsuffix /$(t), $(TARGET_DIRS))) 195916359f6SAndreas Färber 1961338a4b7SMarkus ArmbrusterSOFTMMU_ALL_RULES=$(filter %-softmmu/all, $(TARGET_DIRS_RULES)) 1971338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(authz-obj-y) 1981338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(block-obj-y) 19914837c64SKevin Wolf$(SOFTMMU_ALL_RULES): $(storage-daemon-obj-y) 2001338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(chardev-obj-y) 2011338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(crypto-obj-y) 2021338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): $(io-obj-y) 203de59dda3SMarc-André Lureau$(SOFTMMU_ALL_RULES): $(qom-obj-y) 2041338a4b7SMarkus Armbruster$(SOFTMMU_ALL_RULES): config-all-devices.mak 205cec7d0b6Spbrook 206c621dc3eSAlexander BulekovSOFTMMU_FUZZ_RULES=$(filter %-softmmu/fuzz, $(TARGET_DIRS_RULES)) 207c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(authz-obj-y) 208c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(block-obj-y) 209c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(chardev-obj-y) 210c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(crypto-obj-y) 211c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(io-obj-y) 212c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): config-all-devices.mak 213c621dc3eSAlexander Bulekov$(SOFTMMU_FUZZ_RULES): $(edk2-decompressed) 214c621dc3eSAlexander Bulekov 2152becc36aSPaolo Bonzini# meson: this is sub-optimal but going away after conversion 2162becc36aSPaolo BonziniTARGET_DEPS = $(patsubst %,%-config-target.h, $(TARGET_DIRS)) 2172becc36aSPaolo BonziniTARGET_DEPS += $(patsubst %,%-config-devices.h, $(filter %-softmmu,$(TARGET_DIRS))) 2182becc36aSPaolo BonziniTARGET_DEPS += $(patsubst %,libqemu-%.fa, $(TARGET_DIRS)) 2192becc36aSPaolo Bonzini 2201338a4b7SMarkus Armbruster.PHONY: $(TARGET_DIRS_RULES) 2211338a4b7SMarkus Armbruster# The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that 2221338a4b7SMarkus Armbruster# $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal 2232becc36aSPaolo Bonzini$(TARGET_DIRS_RULES): $(TARGET_DEPS) 2241338a4b7SMarkus Armbruster $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),) 2254aa42531Spbrook 22667953a37SClaudio Fontana# LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC 22767953a37SClaudio FontanaDTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_lib="" 228965f486cSPeter MaydellDTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS) 22967953a37SClaudio FontanaDTC_CPPFLAGS=-I$(SRC_PATH)/dtc/libfdt 230a540f158SPeter Crosthwaite 2313b8593eeSMarkus Armbruster.PHONY: dtc/all 23267953a37SClaudio Fontanadtc/all: .git-submodule-status dtc/libfdt 23367953a37SClaudio 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,) 234a540f158SPeter Crosthwaite 23500525864SAaron Lindsaydtc/%: .git-submodule-status 236814e1110SJan Kiszka @mkdir -p $@ 237a540f158SPeter Crosthwaite 238e219c499SRichard Henderson# Overriding CFLAGS causes us to lose defines added in the sub-makefile. 239e219c499SRichard Henderson# Not overriding CFLAGS leads to mis-matches between compilation modes. 240e219c499SRichard Henderson# Therefore we replicate some of the logic in the sub-makefile. 241e219c499SRichard Henderson# Remove all the extra -Warning flags that QEMU uses that Capstone doesn't; 242e219c499SRichard Henderson# no need to annoy QEMU developers with such things. 243e219c499SRichard HendersonCAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS)) 244e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM 245e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_ARM 246e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_ARM64 247e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_POWERPC 248e219c499SRichard HendersonCAP_CFLAGS += -DCAPSTONE_HAS_X86 249e219c499SRichard Henderson 2503b8593eeSMarkus Armbruster.PHONY: capstone/all 2513b8593eeSMarkus Armbrustercapstone/all: .git-submodule-status 2529f81aeb5SAlistair 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)) 253e219c499SRichard Henderson 2543b8593eeSMarkus Armbruster.PHONY: slirp/all 2553b8593eeSMarkus Armbrusterslirp/all: .git-submodule-status 256daa79d9aSAlex Bennée $(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp \ 257daa79d9aSAlex Bennée BUILD_DIR="$(BUILD_DIR)/slirp" \ 258daa79d9aSAlex Bennée PKG_CONFIG="$(PKG_CONFIG)" \ 259daa79d9aSAlex Bennée CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" \ 260db5adeaaSPaolo Bonzini CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)") 261675b9b53SMarc-André Lureau 2621338a4b7SMarkus Armbruster$(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \ 2633154fee4SMarc-André Lureau $(qom-obj-y) block.syms qemu.syms 264add16157SBlue Swirl 265c621dc3eSAlexander Bulekov$(filter %/fuzz, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \ 266c621dc3eSAlexander Bulekov $(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY)) 267c621dc3eSAlexander Bulekov 2683b8593eeSMarkus ArmbrusterROM_DIRS = $(addprefix pc-bios/, $(ROMS)) 2691338a4b7SMarkus ArmbrusterROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS))) 270a9c87304SMarc-André Lureau# Only keep -O and -g cflags 2711338a4b7SMarkus Armbruster.PHONY: $(ROM_DIRS_RULES) 2721338a4b7SMarkus Armbruster$(ROM_DIRS_RULES): 2731338a4b7SMarkus Armbruster $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))" $(notdir $@),) 274c05ac895SPaul Brook 2758d358a5eSMarkus Armbruster.PHONY: recurse-all recurse-clean recurse-install 2761338a4b7SMarkus Armbrusterrecurse-all: $(addsuffix /all, $(TARGET_DIRS) $(ROM_DIRS)) 2771338a4b7SMarkus Armbrusterrecurse-clean: $(addsuffix /clean, $(TARGET_DIRS) $(ROM_DIRS)) 2781338a4b7SMarkus Armbrusterrecurse-install: $(addsuffix /install, $(TARGET_DIRS)) 27947ae060eSMarkus Armbruster$(addsuffix /install, $(TARGET_DIRS)): all 2804aa42531Spbrook 281c17a18efSMarc-André Lureau$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h 2820bdb12c7SPeter Maydell $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o") 2835354e4d2SMarc-André Lureau 284c17a18efSMarc-André LureauMakefile: $(version-obj-y) 2853bc2f570SPaolo Bonzini 2863bc2f570SPaolo Bonzini###################################################################### 2874fb240a4Sbellard 288ebedb37cSPaolo BonziniCOMMON_LDADDS = libqemuutil.a 2890ab8ed18SDaniel P. Berrange 2905e6911cfSKevin 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) 2910a8e1acdSaliguori 292a5665051SPaolo Bonziniclean: recurse-clean ninja-clean clean-ctlist 293a5665051SPaolo Bonzini -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean 2942d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files 29525be210fSJuan 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 29623858f40SLaszlo Ersek find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f \ 29723858f40SLaszlo Ersek ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \ 29823858f40SLaszlo Ersek ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \ 29923858f40SLaszlo Ersek ! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \ 30023858f40SLaszlo Ersek -exec rm {} + 301*c3a0ee84SPaolo Bonzini rm -f TAGS cscope.* *.pod *~ */*~ 302b855f8d1SPaolo Bonzini rm -f fsdev/*.pod scsi/*.pod 3033dff199cSLaurent Vivier rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp) 30431e31b8aSbellard 30534bb443eSAnthony LiguoriVERSION ?= $(shell cat VERSION) 30634bb443eSAnthony Liguori 30734bb443eSAnthony Liguoridist: qemu-$(VERSION).tar.bz2 30834bb443eSAnthony Liguori 30934bb443eSAnthony Liguoriqemu-%.tar.bz2: 31034bb443eSAnthony Liguori $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)" 31134bb443eSAnthony Liguori 3125f71eac0SPeter Maydelldefine clean-manual = 3131290e671SPeter Maydellrm -rf $(MANUAL_BUILDDIR)/$1/_static 3141290e671SPeter Maydellrm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(MANUAL_BUILDDIR)/$1/*.html 3155f71eac0SPeter Maydellendef 3165f71eac0SPeter Maydell 317a5665051SPaolo Bonzinidistclean: clean ninja-distclean 318a5665051SPaolo Bonzini -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean -g 319ee5195eeSRichard Henderson rm -f config-host.mak config-host.h* $(DOCS) 3202038f8c8SPaolo Bonzini rm -f tests/tcg/config-*.mak 3212becc36aSPaolo Bonzini rm -f config-all-disas.mak config.status 322ae219359SThomas Huth rm -f po/*.mo tests/qemu-iotests/common.env 323fc8e320eSMagnus Damm rm -f roms/seabios/config.mak roms/vgabios/config.mak 32426fffe29SEmilio G. Cota rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols 325a5665051SPaolo Bonzini rm -rf meson-private meson-logs meson-info compile_commands.json 326245dac4aSPaolo Bonzini rm -f Makefile.ninja ninjatool ninjatool.stamp Makefile.mtest 327793553acSAlexandre Raymond rm -f config.log 32867ed96f9SPeter Maydell rm -f linux-headers/asm 329d59157eaSPaolo Bonzini rm -f docs/version.texi 330d59157eaSPaolo Bonzini rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi 331d59157eaSPaolo Bonzini rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7 332d59157eaSPaolo Bonzini rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt 333d59157eaSPaolo Bonzini rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf 334d59157eaSPaolo Bonzini rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html 33581f33401SPeter Maydell rm -rf .doctrees 3365f71eac0SPeter Maydell $(call clean-manual,devel) 3375f71eac0SPeter Maydell $(call clean-manual,interop) 3380783a732SPeter Maydell $(call clean-manual,specs) 3390928523aSPeter Maydell $(call clean-manual,system) 34065c3542bSPeter Maydell $(call clean-manual,tools) 34109147930SPaolo Bonzini $(call clean-manual,user) 3422b1f35b9SAlex Bennée for d in $(TARGET_DIRS); do \ 343bc1b050dSbellard rm -rf $$d || exit 1 ; \ 34476bc6838Sbellard done 345d9840e25STomoki Sekiyama rm -Rf .sdk 3467d13299dSbellard 34706e7772fSGerd HoffmannKEYMAPS=da en-gb et fr fr-ch is lt no pt-br sv \ 348fed4a9adSbellardar de en-us fi fr-be hr it lv nl pl ru th \ 34926b1cbf8SGerd Hoffmannde-ch es fo fr-ca hu ja mk pt sl tr \ 3503751e722SJan Krupabepo cz 351fed4a9adSbellard 35277755340Sthsifdef INSTALL_BLOBS 35332eb2da3SBruce RogersBLOBS=bios.bin bios-256k.bin bios-microvm.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \ 3547a4dfd1eSGerd Hoffmannvgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \ 3550a87fd69SGerd Hoffmannvgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \ 356b2ce76a0SThomas Huthopenbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \ 3575ee8ad71SAlex Williamsonpxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \ 3585ee8ad71SAlex Williamsonpxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \ 3599fd02979SSander Eikelenboomefi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \ 3609fd02979SSander Eikelenboomefi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \ 36145027808SGerd Hoffmannefi-e1000e.rom efi-vmxnet3.rom \ 362b3ce38dcSPhilippe Mathieu-Daudéqemu-nsis.bmp \ 3634b387f9eSBALATON Zoltanbamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \ 3642785dc7bSStefano Garzarellamultiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \ 3656c5359e1SChristian Borntraegers390-ccw.img s390-netboot.img \ 366744a928cSAlexey Kardashevskiyslof.bin skiboot.lid \ 3670c6ab8c9SCole Robinsonpalcode-clipper \ 36882e65fe0SBALATON Zoltanu-boot.e500 u-boot-sam460-20100605.bin \ 36943ad2564SRichard Hendersonqemu_vga.ndrv \ 37026ce90fdSLaszlo Ersekedk2-licenses.txt \ 37191f3a2f0SAlistair Francishppa-firmware.img \ 372a6fcc80bSBin Mengopensbi-riscv32-sifive_u-fw_jump.bin opensbi-riscv32-virt-fw_jump.bin \ 37391f3a2f0SAlistair Francisopensbi-riscv64-sifive_u-fw_jump.bin opensbi-riscv64-virt-fw_jump.bin 37477755340Sthselse 37577755340SthsBLOBS= 37677755340Sthsendif 37777755340Sths 378336cfef4SPeter Maydell# Note that we manually filter-out the non-Sphinx documentation which 37927a296fcSPeter Maydell# is currently built into the docs/interop directory in the build tree, 38027a296fcSPeter Maydell# and also any sphinx-built manpages. 3815f71eac0SPeter Maydelldefine install-manual = 3821290e671SPeter Maydellfor d in $$(cd $(MANUAL_BUILDDIR) && find $1 -type d); do $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/$$d"; done 38327a296fcSPeter 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 3845f71eac0SPeter Maydellendef 3855f71eac0SPeter Maydell 3865f71eac0SPeter Maydell# Note that we deliberately do not install the "devel" manual: it is 3875f71eac0SPeter Maydell# for QEMU developers, and not interesting to our users. 3885f71eac0SPeter Maydell.PHONY: install-sphinxdocs 3895f71eac0SPeter Maydellinstall-sphinxdocs: sphinxdocs 3905f71eac0SPeter Maydell $(call install-manual,interop) 3910783a732SPeter Maydell $(call install-manual,specs) 3920928523aSPeter Maydell $(call install-manual,system) 39365c3542bSPeter Maydell $(call install-manual,tools) 39409147930SPaolo Bonzini $(call install-manual,user) 3955f71eac0SPeter Maydell 3965f71eac0SPeter Maydellinstall-doc: $(DOCS) install-sphinxdocs 397d7dd65baSEduardo Habkost $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)" 39822108f33SStefan Hajnoczi $(INSTALL_DATA) $(MANUAL_BUILDDIR)/index.html "$(DESTDIR)$(qemu_docdir)" 399c13dba2cSLiao Pingfang $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop" 400c13dba2cSLiao Pingfang $(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)/interop" 401c13dba2cSLiao Pingfang $(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)/interop" 40296d409ebSJuan Quintelaifdef CONFIG_POSIX 40358f8aeadSaliguori $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" 404d06118bfSPeter Maydell $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu.1 "$(DESTDIR)$(mandir)/man1" 40556e8bdd4SMarc-André Lureau $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7" 406d59157eaSPaolo Bonzini $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7" 407acab923dSPeter Maydell $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7" 4081bf84a1eSKashyap Chamarthy $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7" 409c932ce31SPaolo Bonziniifeq ($(CONFIG_TOOLS),y) 410a08b4a9fSPeter Maydell $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-img.1 "$(DESTDIR)$(mandir)/man1" 41158f8aeadSaliguori $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" 412a08b4a9fSPeter Maydell $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" 41338954dcaSpbrookendif 41462dd1048SDaniel P. Berrangéifdef CONFIG_TRACE_SYSTEMTAP 415a08b4a9fSPeter Maydell $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1" 41662dd1048SDaniel P. Berrangéendif 417f15bff25SPaolo Bonziniifeq ($(CONFIG_GUEST_AGENT),y) 418b53c54c6SPeter Maydell $(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-ga.8 "$(DESTDIR)$(mandir)/man8" 419c13dba2cSLiao Pingfang $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/interop" 420c13dba2cSLiao Pingfang $(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)/interop" 421c13dba2cSLiao Pingfang $(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)/interop" 422d59157eaSPaolo Bonzini $(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7" 423665b5d0dSMarc-André Lureauendif 4248a3e8f7fSAndreas Färberendif 425a2d8f1beSM. Mohan Kumarifdef CONFIG_VIRTFS 426a2d8f1beSM. Mohan Kumar $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" 427a08b4a9fSPeter Maydell $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1" 428a2d8f1beSM. Mohan Kumarendif 4296a7e2bbeSStefan Hajnocziifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy) 430a08b4a9fSPeter Maydell $(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtiofsd.1 "$(DESTDIR)$(mandir)/man1" 4316a7e2bbeSStefan Hajnocziendif 432b5ec5ce0Sjohn cooper 433e2d87bffSEduardo Habkostinstall-datadir: 434e2d87bffSEduardo Habkost $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)" 435e2d87bffSEduardo Habkost 436f2e3978bSLaszlo Ersekinstall-localstatedir: 437f2e3978bSLaszlo Ersekifdef CONFIG_POSIX 438f15bff25SPaolo Bonziniifeq ($(CONFIG_GUEST_AGENT),y) 439f2e3978bSLaszlo Ersek $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run 440f2e3978bSLaszlo Ersekendif 441f2e3978bSLaszlo Ersekendif 442f2e3978bSLaszlo Ersek 443a8260d38SDaniel P. BerrangéICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512 444e2d87bffSEduardo Habkost 44554cb65d8SEmilio G. Cotainstall-includedir: 44654cb65d8SEmilio G. Cota $(INSTALL_DIR) "$(DESTDIR)$(includedir)" 44754cb65d8SEmilio G. Cota 448a5665051SPaolo Bonzini# Needed by "meson install" 449a5665051SPaolo Bonziniexport DESTDIR 45054cb65d8SEmilio G. Cotainstall: all $(if $(BUILD_DOCS),install-doc) \ 45154cb65d8SEmilio G. Cota install-datadir install-localstatedir install-includedir \ 4521338a4b7SMarkus Armbruster recurse-install 45362dd1048SDaniel P. Berrangéifdef CONFIG_TRACE_SYSTEMTAP 45462dd1048SDaniel P. Berrangé $(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir) 45562dd1048SDaniel P. Berrangéendif 45677755340Sthsifneq ($(BLOBS),) 45777755340Sths set -e; for x in $(BLOBS); do \ 4586aae2a2eSEduardo Habkost $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \ 459ad064840Spbrook done 46077755340Sthsendif 461a8260d38SDaniel P. Berrangé for s in $(ICON_SIZES); do \ 4626c11dda9SStefan Hajnoczi mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \ 463a8260d38SDaniel P. Berrangé $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \ 4646c11dda9SStefan Hajnoczi "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \ 465a8260d38SDaniel P. Berrangé done; \ 4666c11dda9SStefan Hajnoczi mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \ 467a8260d38SDaniel P. Berrangé $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \ 4686c11dda9SStefan Hajnoczi "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \ 4696c11dda9SStefan Hajnoczi mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \ 470a8260d38SDaniel P. Berrangé $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \ 4716c11dda9SStefan Hajnoczi "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg" 4726c11dda9SStefan Hajnoczi mkdir -p "$(DESTDIR)$(qemu_desktopdir)" 47367ea9546SDaniel P. Berrangé $(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \ 4746c11dda9SStefan Hajnoczi "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop" 4752a6b5372SMichael Tokarevifdef CONFIG_GTK 476834574eaSAnthony Liguori $(MAKE) -C po $@ 477834574eaSAnthony Liguoriendif 47854cb65d8SEmilio G. Cotaifeq ($(CONFIG_PLUGIN),y) 47954cb65d8SEmilio G. Cota $(INSTALL_DATA) $(SRC_PATH)/include/qemu/qemu-plugin.h "$(DESTDIR)$(includedir)/qemu-plugin.h" 48054cb65d8SEmilio G. Cotaendif 4816aae2a2eSEduardo Habkost $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps" 48218be8d77Sblueswir1 set -e; for x in $(KEYMAPS); do \ 4836aae2a2eSEduardo Habkost $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \ 484ad064840Spbrook done 485a81df1b6SPaolo Bonzini for d in $(TARGET_DIRS); do \ 486a81df1b6SPaolo Bonzini $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \ 487a81df1b6SPaolo Bonzini done 488612384d7Sbellard 4893ef693a0Sbellard# documentation 490e8518c92SMarkus ArmbrusterMAKEINFO=makeinfo 491d59157eaSPaolo BonziniMAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D) 492d59157eaSPaolo BonziniMAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES) 493e8338fdbSMarc-André LureauTEXI2PODFLAGS=$(MAKEINFOINCLUDES) -DVERSION="$(VERSION)" -DCONFDIR="$(qemu_confdir)" 494d59157eaSPaolo BonziniTEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES) 49556e8bdd4SMarc-André Lureau 496e8338fdbSMarc-André Lureaudocs/version.texi: $(SRC_PATH)/VERSION config-host.mak 497e8338fdbSMarc-André Lureau $(call quiet-command,(\ 498e8338fdbSMarc-André Lureau echo "@set VERSION $(VERSION)" && \ 499e8338fdbSMarc-André Lureau echo "@set CONFDIR $(qemu_confdir)" \ 500e8338fdbSMarc-André Lureau )> $@,"GEN","$@") 501fea346f5SPeter Maydell 50244cb280dSPaolo Bonzini%.html: %.texi docs/version.texi 503e9ee06bdSMarc-André Lureau $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \ 504e9ee06bdSMarc-André Lureau --html $< -o $@,"GEN","$@") 5053ef693a0Sbellard 50644cb280dSPaolo Bonzini%.info: %.texi docs/version.texi 507e9ee06bdSMarc-André Lureau $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@") 508f3548328Sbellard 50944cb280dSPaolo Bonzini%.txt: %.texi docs/version.texi 510f8bab10bSMarc-André Lureau $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \ 511f8bab10bSMarc-André Lureau --plaintext $< -o $@,"GEN","$@") 512f8bab10bSMarc-André Lureau 51344cb280dSPaolo Bonzini%.pdf: %.texi docs/version.texi 514d59157eaSPaolo Bonzini $(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@") 515bd7f9747SMarkus Armbruster 5165f71eac0SPeter Maydell# Sphinx builds all its documentation at once in one invocation 5175f71eac0SPeter Maydell# and handles "don't rebuild things unless necessary" itself. 5185f71eac0SPeter Maydell# The '.doctrees' files are cached information to speed this up. 5195f71eac0SPeter Maydell.PHONY: sphinxdocs 5200928523aSPeter Maydellsphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \ 5210928523aSPeter Maydell $(MANUAL_BUILDDIR)/interop/index.html \ 5220928523aSPeter Maydell $(MANUAL_BUILDDIR)/specs/index.html \ 52365c3542bSPeter Maydell $(MANUAL_BUILDDIR)/system/index.html \ 52409147930SPaolo Bonzini $(MANUAL_BUILDDIR)/tools/index.html \ 52509147930SPaolo Bonzini $(MANUAL_BUILDDIR)/user/index.html 5265f71eac0SPeter Maydell 5275f71eac0SPeter Maydell# Canned command to build a single manual 52827a296fcSPeter Maydell# Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man') 5296bda415cSEduardo Habkost# Note the use of different doctree for each (manual, builder) tuple; 5306bda415cSEduardo Habkost# this works around Sphinx not handling parallel invocation on 5316bda415cSEduardo Habkost# a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946 532516e8b7dSPeter 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") 5335f71eac0SPeter Maydell# We assume all RST files in the manual's directory are used in it 534814e068fSPeter Maydellmanual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \ 535de1572caSPeter Maydell $(SRC_PATH)/docs/defs.rst.inc \ 5369165d323SPeter Maydell $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py \ 5379165d323SPeter Maydell $(SRC_PATH)/docs/sphinx/*.py 538e0f3728dSPeter Maydell# Macro to write out the rule and dependencies for building manpages 539e0f3728dSPeter Maydell# Usage: $(call define-manpage-rule,manualname,manpage1 manpage2...[,extradeps]) 540e0f3728dSPeter Maydell# 'extradeps' is optional, and specifies extra files (eg .hx files) that 541e0f3728dSPeter Maydell# the manual page depends on. 542e0f3728dSPeter Maydelldefine define-manpage-rule 543e0f3728dSPeter Maydell$(call atomic,$(foreach manpage,$2,$(MANUAL_BUILDDIR)/$1/$(manpage)),$(call manual-deps,$1) $3) 544e0f3728dSPeter Maydell $(call build-manual,$1,man) 545e0f3728dSPeter Maydellendef 5465f71eac0SPeter Maydell 5471290e671SPeter Maydell$(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel) 54827a296fcSPeter Maydell $(call build-manual,devel,html) 5495f71eac0SPeter Maydell 550a08b4a9fSPeter Maydell$(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop) 55127a296fcSPeter Maydell $(call build-manual,interop,html) 5525f71eac0SPeter Maydell 5530783a732SPeter Maydell$(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs) 55427a296fcSPeter Maydell $(call build-manual,specs,html) 55527a296fcSPeter Maydell 55609ce5f2dSPeter 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 5570928523aSPeter Maydell $(call build-manual,system,html) 5580928523aSPeter Maydell 559a08b4a9fSPeter Maydell$(MANUAL_BUILDDIR)/tools/index.html: $(call manual-deps,tools) $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc 56065c3542bSPeter Maydell $(call build-manual,tools,html) 56165c3542bSPeter Maydell 56209147930SPaolo Bonzini$(MANUAL_BUILDDIR)/user/index.html: $(call manual-deps,user) 56309147930SPaolo Bonzini $(call build-manual,user,html) 56409147930SPaolo Bonzini 565a08b4a9fSPeter Maydell$(call define-manpage-rule,interop,qemu-ga.8) 5660783a732SPeter Maydell 567d06118bfSPeter Maydell$(call define-manpage-rule,system,qemu.1 qemu-block-drivers.7 qemu-cpu-models.7) 568acab923dSPeter Maydell 569a08b4a9fSPeter Maydell$(call define-manpage-rule,tools,\ 570a08b4a9fSPeter Maydell qemu-img.1 qemu-nbd.8 qemu-trace-stap.1\ 571a08b4a9fSPeter Maydell virtiofsd.1 virtfs-proxy-helper.1,\ 572a08b4a9fSPeter Maydell $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/docs/qemu-option-trace.rst.inc) 573a08b4a9fSPeter Maydell 57422108f33SStefan Hajnoczi$(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version.h 575d83bbedaSStefan Hajnoczi @mkdir -p "$(MANUAL_BUILDDIR)" 57622108f33SStefan Hajnoczi $(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \ 57722108f33SStefan Hajnoczi "GEN","$@") 57822108f33SStefan Hajnoczi 579eb815e24SMarkus Armbrusterdocs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi 580fb0bc835SMarkus Armbruster @cp -p $< $@ 5814afeeb57SMarkus Armbruster 582f15bff25SPaolo Bonzinidocs/interop/qemu-ga-qapi.texi: qga/qga-qapi-doc.texi 583fb0bc835SMarkus Armbruster @cp -p $< $@ 58456e8bdd4SMarc-André Lureau 5855b1d0e92SPeter Maydellhtml: docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs 5865b1d0e92SPeter Maydellinfo: docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info 5875b1d0e92SPeter Maydellpdf: docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf 5885b1d0e92SPeter Maydelltxt: docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt 589818220f5Saliguori 590d59157eaSPaolo Bonzinidocs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \ 591d59157eaSPaolo Bonzini docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \ 592d59157eaSPaolo Bonzini docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \ 593d59157eaSPaolo Bonzini docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi 59456e8bdd4SMarc-André Lureau 595d59157eaSPaolo Bonzinidocs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \ 596d59157eaSPaolo Bonzini docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \ 597d59157eaSPaolo Bonzini docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \ 598d59157eaSPaolo Bonzini docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi 59956e8bdd4SMarc-André Lureau 600ae560cc3SEric Blake$(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl 601ae560cc3SEric Blake 602fe8bf5f6SAlex Bennée# Reports/Analysis 603fe8bf5f6SAlex Bennée 604fe8bf5f6SAlex Bennée%/coverage-report.html: 605fe8bf5f6SAlex Bennée @mkdir -p $* 606fe8bf5f6SAlex Bennée $(call quiet-command,\ 6075eda6e42SAlex Bennée gcovr -r $(SRC_PATH) \ 6085eda6e42SAlex Bennée $(foreach t, $(TARGET_DIRS), --object-directory $(BUILD_DIR)/$(t)) \ 6095eda6e42SAlex Bennée --object-directory $(BUILD_DIR) \ 610337f2311SAlex Bennée -p --html --html-details -o $@, \ 611fe8bf5f6SAlex Bennée "GEN", "coverage-report.html") 612fe8bf5f6SAlex Bennée 613fe8bf5f6SAlex Bennée.PHONY: coverage-report 614fe8bf5f6SAlex Bennéecoverage-report: $(CURDIR)/reports/coverage/coverage-report.html 61556e8bdd4SMarc-André Lureau 616f53ec699SStefan Weilifdef CONFIG_WIN32 617f53ec699SStefan Weil 618f53ec699SStefan WeilINSTALLER = qemu-setup-$(VERSION)$(EXESUF) 619f53ec699SStefan Weil 620f53ec699SStefan Weilnsisflags = -V2 -NOCD 621f53ec699SStefan Weil 622f53ec699SStefan Weilifneq ($(wildcard $(SRC_PATH)/dll),) 623f53ec699SStefan Weilifeq ($(ARCH),x86_64) 624f53ec699SStefan Weil# 64 bit executables 625f53ec699SStefan WeilDLL_PATH = $(SRC_PATH)/dll/w64 626f53ec699SStefan Weilnsisflags += -DW64 627f53ec699SStefan Weilelse 628f53ec699SStefan Weil# 32 bit executables 629f53ec699SStefan WeilDLL_PATH = $(SRC_PATH)/dll/w32 630f53ec699SStefan Weilendif 631f53ec699SStefan Weilendif 632f53ec699SStefan Weil 633f53ec699SStefan Weil.PHONY: installer 634f53ec699SStefan Weilinstaller: $(INSTALLER) 635f53ec699SStefan Weil 636f53ec699SStefan WeilINSTDIR=/tmp/qemu-nsis 637f53ec699SStefan Weil 6381b00a4c4SPaolo Bonzini$(INSTALLER): $(SRC_PATH)/qemu.nsi 6391b00a4c4SPaolo Bonzini $(MAKE) install DESTDIR=${INSTDIR} 640f53ec699SStefan Weilifdef SIGNCODE 6411b00a4c4SPaolo Bonzini (cd ${INSTDIR}/${bindir}; \ 642f53ec699SStefan Weil for i in *.exe; do \ 643f53ec699SStefan Weil $(SIGNCODE) $${i}; \ 644f53ec699SStefan Weil done \ 645f53ec699SStefan Weil ) 646f53ec699SStefan Weilendif # SIGNCODE 6471b00a4c4SPaolo Bonzini (cd ${INSTDIR}/${bindir}; \ 648f53ec699SStefan Weil for i in qemu-system-*.exe; do \ 649f53ec699SStefan Weil arch=$${i%.exe}; \ 650f53ec699SStefan Weil arch=$${arch#qemu-system-}; \ 651f53ec699SStefan Weil echo Section \"$$arch\" Section_$$arch; \ 652f53ec699SStefan Weil echo SetOutPath \"\$$INSTDIR\"; \ 653f53ec699SStefan Weil echo File \"\$${BINDIR}\\$$i\"; \ 654f53ec699SStefan Weil echo SectionEnd; \ 655f53ec699SStefan Weil done \ 6561b00a4c4SPaolo Bonzini ) >${INSTDIR}/${bindir}/system-emulations.nsh 657f53ec699SStefan Weil makensis $(nsisflags) \ 658f53ec699SStefan Weil $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \ 659f53ec699SStefan Weil $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \ 6601b00a4c4SPaolo Bonzini -DBINDIR="${INSTDIR}/${bindir}" \ 661f53ec699SStefan Weil $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \ 662f53ec699SStefan Weil -DSRCDIR="$(SRC_PATH)" \ 663f53ec699SStefan Weil -DOUTFILE="$(INSTALLER)" \ 664805d8a67SStefan Weil -DDISPLAYVERSION="$(VERSION)" \ 665f53ec699SStefan Weil $(SRC_PATH)/qemu.nsi 666f53ec699SStefan Weil rm -r ${INSTDIR} 667f53ec699SStefan Weilifdef SIGNCODE 668f53ec699SStefan Weil $(SIGNCODE) $(INSTALLER) 669f53ec699SStefan Weilendif # SIGNCODE 670f53ec699SStefan Weilendif # CONFIG_WIN 671f53ec699SStefan Weil 672cb5fc67dSAnthony Liguori# Add a dependency on the generated files, so that they are always 673cb5fc67dSAnthony Liguori# rebuilt before other object files 674428952cfSThomas Huthifneq ($(wildcard config-host.mak),) 675eaa2ddbbSFam Zhengifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) 6763dff199cSLaurent VivierMakefile: $(generated-files-y) 6777748b8cbSMike Frysingerendif 678428952cfSThomas Huthendif 679cb5fc67dSAnthony Liguori 6804fb240a4Sbellard# Include automatically generated dependency files 6811435ddb8SPaolo Bonzini# Dependencies in Makefile.objs files come from our recursive subdir rules 6821435ddb8SPaolo Bonzini-include $(wildcard *.d tests/*.d) 683324027c2SFam Zheng 684324027c2SFam Zhenginclude $(SRC_PATH)/tests/docker/Makefile.include 685b1fb9a63SFam Zhenginclude $(SRC_PATH)/tests/vm/Makefile.include 6860d8e065fSMarc-André Lureau 687c355de59SPhilippe Mathieu-Daudéprint-help-run = printf " %-30s - %s\\n" "$1" "$2" 688c355de59SPhilippe Mathieu-Daudéprint-help = $(quiet-@)$(call print-help-run,$1,$2) 689c355de59SPhilippe Mathieu-Daudé 6900d8e065fSMarc-André Lureau.PHONY: help 6910d8e065fSMarc-André Lureauhelp: 6920d8e065fSMarc-André Lureau @echo 'Generic targets:' 693c355de59SPhilippe Mathieu-Daudé $(call print-help,all,Build all) 6940decdfe2SMarc-André Lureauifdef CONFIG_MODULES 695c355de59SPhilippe Mathieu-Daudé $(call print-help,modules,Build all modules) 6960decdfe2SMarc-André Lureauendif 697c355de59SPhilippe Mathieu-Daudé $(call print-help,dir/file.o,Build specified target only) 698c355de59SPhilippe Mathieu-Daudé $(call print-help,install,Install QEMU, documentation and tools) 699c355de59SPhilippe Mathieu-Daudé $(call print-help,ctags/TAGS,Generate tags file for editors) 700c355de59SPhilippe Mathieu-Daudé $(call print-help,cscope,Generate cscope index) 701968b4db3SPaolo Bonzini $(call print-help,sparse,Run sparse on the QEMU source) 7020d8e065fSMarc-André Lureau @echo '' 7032b1f35b9SAlex Bennée @$(if $(TARGET_DIRS), \ 7040d8e065fSMarc-André Lureau echo 'Architecture specific targets:'; \ 7052b1f35b9SAlex Bennée $(foreach t, $(TARGET_DIRS), \ 706763815a8SPhilippe Mathieu-Daudé $(call print-help-run,$(t)/all,Build for $(t)); \ 707763815a8SPhilippe Mathieu-Daudé $(if $(CONFIG_FUZZ), \ 708763815a8SPhilippe Mathieu-Daudé $(if $(findstring softmmu,$(t)), \ 709763815a8SPhilippe Mathieu-Daudé $(call print-help-run,$(t)/fuzz,Build fuzzer for $(t)); \ 710763815a8SPhilippe Mathieu-Daudé ))) \ 7110d8e065fSMarc-André Lureau echo '') 7120d8e065fSMarc-André Lureau @echo 'Cleaning targets:' 713c355de59SPhilippe Mathieu-Daudé $(call print-help,clean,Remove most generated files but keep the config) 714c355de59SPhilippe Mathieu-Daudé $(call print-help,distclean,Remove all generated files) 715c355de59SPhilippe Mathieu-Daudé $(call print-help,dist,Build a distributable tarball) 7160d8e065fSMarc-André Lureau @echo '' 7170d8e065fSMarc-André Lureau @echo 'Test targets:' 718c355de59SPhilippe Mathieu-Daudé $(call print-help,check,Run all tests (check-help for details)) 719c355de59SPhilippe Mathieu-Daudé $(call print-help,docker,Help about targets running tests inside containers) 720c355de59SPhilippe Mathieu-Daudé $(call print-help,vm-help,Help about targets running tests inside VM) 7210d8e065fSMarc-André Lureau @echo '' 7220d8e065fSMarc-André Lureau @echo 'Documentation targets:' 723c355de59SPhilippe Mathieu-Daudé $(call print-help,html info pdf txt,Build documentation in specified format) 7240d8e065fSMarc-André Lureau @echo '' 7250d8e065fSMarc-André Lureauifdef CONFIG_WIN32 7260d8e065fSMarc-André Lureau @echo 'Windows targets:' 727c355de59SPhilippe Mathieu-Daudé $(call print-help,installer,Build NSIS-based installer for QEMU) 7280d8e065fSMarc-André Lureauifdef QEMU_GA_MSI_ENABLED 729c355de59SPhilippe Mathieu-Daudé $(call print-help,msi,Build MSI-based installer for qemu-ga) 7300d8e065fSMarc-André Lureauendif 7310d8e065fSMarc-André Lureau @echo '' 7320d8e065fSMarc-André Lureauendif 733c355de59SPhilippe Mathieu-Daudé $(call print-help,$(MAKE) [targets],(quiet build, default)) 734c355de59SPhilippe Mathieu-Daudé $(call print-help,$(MAKE) V=1 [targets],(verbose build)) 735