1# Makefile for QEMU. 2 3# Always point to the root of the build tree (needs GNU make). 4BUILD_DIR=$(CURDIR) 5 6# Before including a proper config-host.mak, assume we are in the source tree 7SRC_PATH=. 8 9UNCHECKED_GOALS := %clean TAGS cscope ctags dist \ 10 html info pdf txt \ 11 help check-help print-% \ 12 docker docker-% vm-test vm-build-% 13 14print-%: 15 @echo '$*=$($*)' 16 17# All following code might depend on configuration variables 18ifneq ($(wildcard config-host.mak),) 19# Put the all: rule here so that config-host.mak can contain dependencies. 20all: 21include config-host.mak 22 23git-submodule-update: 24 25.PHONY: git-submodule-update 26 27git_module_status := $(shell \ 28 cd '$(SRC_PATH)' && \ 29 GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \ 30 echo $$?; \ 31) 32 33ifeq (1,$(git_module_status)) 34ifeq (no,$(GIT_UPDATE)) 35git-submodule-update: 36 $(call quiet-command, \ 37 echo && \ 38 echo "GIT submodule checkout is out of date. Please run" && \ 39 echo " scripts/git-submodule.sh update $(GIT_SUBMODULES)" && \ 40 echo "from the source directory checkout $(SRC_PATH)" && \ 41 echo && \ 42 exit 1) 43else 44git-submodule-update: 45 $(call quiet-command, \ 46 (cd $(SRC_PATH) && GIT="$(GIT)" ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \ 47 "GIT","$(GIT_SUBMODULES)") 48endif 49endif 50 51.git-submodule-status: git-submodule-update config-host.mak 52 53# Check that we're not trying to do an out-of-tree build from 54# a tree that's been used for an in-tree build. 55ifneq ($(realpath $(SRC_PATH)),$(realpath .)) 56ifneq ($(wildcard $(SRC_PATH)/config-host.mak),) 57$(error This is an out of tree build but your source tree ($(SRC_PATH)) \ 58seems to have been used for an in-tree build. You can fix this by running \ 59"$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree) 60endif 61endif 62 63CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y) 64CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y) 65CONFIG_XEN := $(CONFIG_XEN_BACKEND) 66CONFIG_ALL=y 67-include config-all-devices.mak 68-include config-all-disas.mak 69 70config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION 71 @echo $@ is out-of-date, running configure 72 @# TODO: The next lines include code which supports a smooth 73 @# transition from old configurations without config.status. 74 @# This code can be removed after QEMU 1.7. 75 @if test -x config.status; then \ 76 ./config.status; \ 77 else \ 78 sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh; \ 79 fi 80else 81config-host.mak: 82ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) 83 @echo "Please call configure before running make!" 84 @exit 1 85endif 86endif 87 88include $(SRC_PATH)/rules.mak 89 90GENERATED_FILES = qemu-version.h config-host.h qemu-options.def 91 92#see Makefile.objs for the definition of QAPI_MODULES 93GENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c 94GENERATED_QAPI_FILES += qapi/qapi-types.h qapi/qapi-types.c 95GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.h) 96GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-types-%.c) 97GENERATED_QAPI_FILES += qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c 98GENERATED_QAPI_FILES += qapi/qapi-visit.h qapi/qapi-visit.c 99GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.h) 100GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-visit-%.c) 101GENERATED_QAPI_FILES += qapi/qapi-commands.h qapi/qapi-commands.c 102GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.h) 103GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-commands-%.c) 104GENERATED_QAPI_FILES += qapi/qapi-emit-events.h qapi/qapi-emit-events.c 105GENERATED_QAPI_FILES += qapi/qapi-events.h qapi/qapi-events.c 106GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.h) 107GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.c) 108GENERATED_QAPI_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h 109GENERATED_QAPI_FILES += qapi/qapi-doc.texi 110 111GENERATED_FILES += $(GENERATED_QAPI_FILES) 112 113GENERATED_FILES += trace/generated-tcg-tracers.h 114 115GENERATED_FILES += trace/generated-helpers-wrappers.h 116GENERATED_FILES += trace/generated-helpers.h 117GENERATED_FILES += trace/generated-helpers.c 118 119ifdef CONFIG_TRACE_UST 120GENERATED_FILES += trace-ust-all.h 121GENERATED_FILES += trace-ust-all.c 122endif 123 124GENERATED_FILES += module_block.h 125 126TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h) 127TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c) 128TRACE_DTRACE = 129ifdef CONFIG_TRACE_DTRACE 130TRACE_HEADERS += trace-dtrace-root.h $(trace-events-subdirs:%=%/trace-dtrace.h) 131TRACE_DTRACE += trace-dtrace-root.dtrace $(trace-events-subdirs:%=%/trace-dtrace.dtrace) 132endif 133ifdef CONFIG_TRACE_UST 134TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h) 135endif 136 137GENERATED_FILES += $(TRACE_HEADERS) 138GENERATED_FILES += $(TRACE_SOURCES) 139GENERATED_FILES += $(BUILD_DIR)/trace-events-all 140GENERATED_FILES += .git-submodule-status 141 142trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g') 143 144tracetool-y = $(SRC_PATH)/scripts/tracetool.py 145tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py") 146 147%/trace.h: %/trace.h-timestamp 148 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ 149%/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak 150 $(call quiet-command,$(TRACETOOL) \ 151 --group=$(call trace-group-name,$@) \ 152 --format=h \ 153 --backends=$(TRACE_BACKENDS) \ 154 $< > $@,"GEN","$(@:%-timestamp=%)") 155 156%/trace.c: %/trace.c-timestamp 157 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ 158%/trace.c-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak 159 $(call quiet-command,$(TRACETOOL) \ 160 --group=$(call trace-group-name,$@) \ 161 --format=c \ 162 --backends=$(TRACE_BACKENDS) \ 163 $< > $@,"GEN","$(@:%-timestamp=%)") 164 165%/trace-ust.h: %/trace-ust.h-timestamp 166 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ 167%/trace-ust.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak 168 $(call quiet-command,$(TRACETOOL) \ 169 --group=$(call trace-group-name,$@) \ 170 --format=ust-events-h \ 171 --backends=$(TRACE_BACKENDS) \ 172 $< > $@,"GEN","$(@:%-timestamp=%)") 173 174%/trace-dtrace.dtrace: %/trace-dtrace.dtrace-timestamp 175 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ 176%/trace-dtrace.dtrace-timestamp: $(SRC_PATH)/%/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y) 177 $(call quiet-command,$(TRACETOOL) \ 178 --group=$(call trace-group-name,$@) \ 179 --format=d \ 180 --backends=$(TRACE_BACKENDS) \ 181 $< > $@,"GEN","$(@:%-timestamp=%)") 182 183%/trace-dtrace.h: %/trace-dtrace.dtrace $(tracetool-y) 184 $(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@") 185 186%/trace-dtrace.o: %/trace-dtrace.dtrace $(tracetool-y) 187 188 189trace-root.h: trace-root.h-timestamp 190 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ 191trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak 192 $(call quiet-command,$(TRACETOOL) \ 193 --group=root \ 194 --format=h \ 195 --backends=$(TRACE_BACKENDS) \ 196 $< > $@,"GEN","$(@:%-timestamp=%)") 197 198trace-root.c: trace-root.c-timestamp 199 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ 200trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak 201 $(call quiet-command,$(TRACETOOL) \ 202 --group=root \ 203 --format=c \ 204 --backends=$(TRACE_BACKENDS) \ 205 $< > $@,"GEN","$(@:%-timestamp=%)") 206 207trace-ust-root.h: trace-ust-root.h-timestamp 208 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ 209trace-ust-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak 210 $(call quiet-command,$(TRACETOOL) \ 211 --group=root \ 212 --format=ust-events-h \ 213 --backends=$(TRACE_BACKENDS) \ 214 $< > $@,"GEN","$(@:%-timestamp=%)") 215 216trace-ust-all.h: trace-ust-all.h-timestamp 217 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ 218trace-ust-all.h-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak 219 $(call quiet-command,$(TRACETOOL) \ 220 --group=all \ 221 --format=ust-events-h \ 222 --backends=$(TRACE_BACKENDS) \ 223 $(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)") 224 225trace-ust-all.c: trace-ust-all.c-timestamp 226 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ 227trace-ust-all.c-timestamp: $(trace-events-files) $(tracetool-y) $(BUILD_DIR)/config-host.mak 228 $(call quiet-command,$(TRACETOOL) \ 229 --group=all \ 230 --format=ust-events-c \ 231 --backends=$(TRACE_BACKENDS) \ 232 $(trace-events-files) > $@,"GEN","$(@:%-timestamp=%)") 233 234trace-dtrace-root.dtrace: trace-dtrace-root.dtrace-timestamp 235 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ 236trace-dtrace-root.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y) 237 $(call quiet-command,$(TRACETOOL) \ 238 --group=root \ 239 --format=d \ 240 --backends=$(TRACE_BACKENDS) \ 241 $< > $@,"GEN","$(@:%-timestamp=%)") 242 243trace-dtrace-root.h: trace-dtrace-root.dtrace 244 $(call quiet-command,dtrace -o $@ -h -s $<, "GEN","$@") 245 246trace-dtrace-root.o: trace-dtrace-root.dtrace 247 248KEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen 249KEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv 250 251KEYCODEMAP_FILES = \ 252 ui/input-keymap-atset1-to-qcode.c \ 253 ui/input-keymap-linux-to-qcode.c \ 254 ui/input-keymap-qcode-to-atset1.c \ 255 ui/input-keymap-qcode-to-atset2.c \ 256 ui/input-keymap-qcode-to-atset3.c \ 257 ui/input-keymap-qcode-to-linux.c \ 258 ui/input-keymap-qcode-to-qnum.c \ 259 ui/input-keymap-qcode-to-sun.c \ 260 ui/input-keymap-qnum-to-qcode.c \ 261 ui/input-keymap-usb-to-qcode.c \ 262 ui/input-keymap-win32-to-qcode.c \ 263 ui/input-keymap-x11-to-qcode.c \ 264 ui/input-keymap-xorgevdev-to-qcode.c \ 265 ui/input-keymap-xorgkbd-to-qcode.c \ 266 ui/input-keymap-xorgxquartz-to-qcode.c \ 267 ui/input-keymap-xorgxwin-to-qcode.c \ 268 ui/input-keymap-osx-to-qcode.c \ 269 $(NULL) 270 271GENERATED_FILES += $(KEYCODEMAP_FILES) 272 273ui/input-keymap-%.c: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile.objs 274 $(call quiet-command,\ 275 stem=$* && src=$${stem%-to-*} dst=$${stem#*-to-} && \ 276 test -e $(KEYCODEMAP_GEN) && \ 277 $(PYTHON) $(KEYCODEMAP_GEN) \ 278 --lang glib2 \ 279 --varname qemu_input_map_$${src}_to_$${dst} \ 280 code-map $(KEYCODEMAP_CSV) $${src} $${dst} \ 281 > $@ || rm -f $@, "GEN", "$@") 282 283$(KEYCODEMAP_GEN): .git-submodule-status 284$(KEYCODEMAP_CSV): .git-submodule-status 285 286# Don't try to regenerate Makefile or configure 287# We don't generate any of them 288Makefile: ; 289configure: ; 290 291.PHONY: all clean cscope distclean html info install install-doc \ 292 pdf txt recurse-all dist msi FORCE 293 294$(call set-vpath, $(SRC_PATH)) 295 296LIBS+=-lz $(LIBS_TOOLS) 297 298HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = qemu-bridge-helper$(EXESUF) 299 300ifdef BUILD_DOCS 301DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8 302DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7 303DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7 304DOCS+=docs/qemu-block-drivers.7 305DOCS+=docs/qemu-cpu-models.7 306ifdef CONFIG_VIRTFS 307DOCS+=fsdev/virtfs-proxy-helper.1 308endif 309ifdef CONFIG_TRACE_SYSTEMTAP 310DOCS+=scripts/qemu-trace-stap.1 311endif 312else 313DOCS= 314endif 315 316SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR) 317SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS)) 318SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS)) 319 320ifeq ($(SUBDIR_DEVICES_MAK),) 321config-all-devices.mak: 322 $(call quiet-command,echo '# no devices' > $@,"GEN","$@") 323else 324config-all-devices.mak: $(SUBDIR_DEVICES_MAK) 325 $(call quiet-command, sed -n \ 326 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \ 327 $(SUBDIR_DEVICES_MAK) | sort -u > $@, \ 328 "GEN","$@") 329endif 330 331-include $(SUBDIR_DEVICES_MAK_DEP) 332 333%/config-devices.mak: default-configs/%.mak $(SRC_PATH)/scripts/make_device_config.sh 334 $(call quiet-command, \ 335 $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > $@.tmp,"GEN","$@.tmp") 336 $(call quiet-command, if test -f $@; then \ 337 if cmp -s $@.old $@; then \ 338 mv $@.tmp $@; \ 339 cp -p $@ $@.old; \ 340 else \ 341 if test -f $@.old; then \ 342 echo "WARNING: $@ (user modified) out of date.";\ 343 else \ 344 echo "WARNING: $@ out of date.";\ 345 fi; \ 346 echo "Run \"$(MAKE) defconfig\" to regenerate."; \ 347 rm $@.tmp; \ 348 fi; \ 349 else \ 350 mv $@.tmp $@; \ 351 cp -p $@ $@.old; \ 352 fi,"GEN","$@"); 353 354defconfig: 355 rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK) 356 357ifneq ($(wildcard config-host.mak),) 358include $(SRC_PATH)/Makefile.objs 359endif 360 361dummy := $(call unnest-vars,, \ 362 stub-obj-y \ 363 chardev-obj-y \ 364 util-obj-y \ 365 qga-obj-y \ 366 elf2dmp-obj-y \ 367 ivshmem-client-obj-y \ 368 ivshmem-server-obj-y \ 369 rdmacm-mux-obj-y \ 370 libvhost-user-obj-y \ 371 vhost-user-scsi-obj-y \ 372 vhost-user-blk-obj-y \ 373 qga-vss-dll-obj-y \ 374 block-obj-y \ 375 block-obj-m \ 376 crypto-obj-y \ 377 crypto-aes-obj-y \ 378 qom-obj-y \ 379 io-obj-y \ 380 common-obj-y \ 381 common-obj-m \ 382 ui-obj-y \ 383 ui-obj-m \ 384 audio-obj-y \ 385 audio-obj-m \ 386 trace-obj-y \ 387 slirp-obj-y) 388 389include $(SRC_PATH)/tests/Makefile.include 390 391all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules 392 393qemu-version.h: FORCE 394 $(call quiet-command, \ 395 (cd $(SRC_PATH); \ 396 if test -n "$(PKGVERSION)"; then \ 397 pkgvers="$(PKGVERSION)"; \ 398 else \ 399 if test -d .git; then \ 400 pkgvers=$$(git describe --match 'v*' 2>/dev/null | tr -d '\n');\ 401 if ! git diff-index --quiet HEAD &>/dev/null; then \ 402 pkgvers="$${pkgvers}-dirty"; \ 403 fi; \ 404 fi; \ 405 fi; \ 406 printf "#define QEMU_PKGVERSION \"$${pkgvers}\"\n"; \ 407 if test -n "$${pkgvers}"; then \ 408 printf '#define QEMU_FULL_VERSION QEMU_VERSION " (" QEMU_PKGVERSION ")"\n'; \ 409 else \ 410 printf '#define QEMU_FULL_VERSION QEMU_VERSION\n'; \ 411 fi; \ 412 ) > $@.tmp) 413 $(call quiet-command, if ! cmp -s $@ $@.tmp; then \ 414 mv $@.tmp $@; \ 415 else \ 416 rm $@.tmp; \ 417 fi) 418 419config-host.h: config-host.h-timestamp 420config-host.h-timestamp: config-host.mak 421qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool 422 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@") 423 424SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS)) 425SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES)) 426 427$(SOFTMMU_SUBDIR_RULES): $(block-obj-y) 428$(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y) 429$(SOFTMMU_SUBDIR_RULES): $(io-obj-y) 430$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak 431 432subdir-%: 433 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,) 434 435DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt 436DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS) 437DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt 438 439subdir-dtc: .git-submodule-status dtc/libfdt dtc/tests 440 $(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,) 441 442dtc/%: .git-submodule-status 443 @mkdir -p $@ 444 445# Overriding CFLAGS causes us to lose defines added in the sub-makefile. 446# Not overriding CFLAGS leads to mis-matches between compilation modes. 447# Therefore we replicate some of the logic in the sub-makefile. 448# Remove all the extra -Warning flags that QEMU uses that Capstone doesn't; 449# no need to annoy QEMU developers with such things. 450CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS)) 451CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM 452CAP_CFLAGS += -DCAPSTONE_HAS_ARM 453CAP_CFLAGS += -DCAPSTONE_HAS_ARM64 454CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC 455CAP_CFLAGS += -DCAPSTONE_HAS_X86 456 457subdir-capstone: .git-submodule-status 458 $(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)) 459 460$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) $(slirp-obj-y) \ 461 $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY)) 462 463ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS)) 464# Only keep -O and -g cflags 465romsubdir-%: 466 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/" CFLAGS="$(filter -O% -g%,$(CFLAGS))",) 467 468ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS)) 469 470recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES) 471 472$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h 473 $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o") 474 475Makefile: $(version-obj-y) 476 477###################################################################### 478# Build libraries 479 480libqemuutil.a: $(util-obj-y) $(trace-obj-y) $(stub-obj-y) 481libvhost-user.a: $(libvhost-user-obj-y) 482 483###################################################################### 484 485COMMON_LDADDS = libqemuutil.a 486 487qemu-img.o: qemu-img-cmds.h 488 489qemu-img$(EXESUF): qemu-img.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) 490qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) 491qemu-io$(EXESUF): qemu-io.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) 492 493qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS) 494 495qemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS) 496 497qemu-edid$(EXESUF): qemu-edid.o hw/display/edid-generate.o $(COMMON_LDADDS) 498 499fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS) 500fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap 501 502scsi/qemu-pr-helper$(EXESUF): scsi/qemu-pr-helper.o scsi/utils.o $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) 503ifdef CONFIG_MPATH 504scsi/qemu-pr-helper$(EXESUF): LIBS += -ludev -lmultipath -lmpathpersist 505endif 506 507qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool 508 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@") 509 510qemu-ga$(EXESUF): LIBS = $(LIBS_QGA) 511qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated 512 513qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS) 514qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS) 515 516qapi-py = $(SRC_PATH)/scripts/qapi/commands.py \ 517$(SRC_PATH)/scripts/qapi/events.py \ 518$(SRC_PATH)/scripts/qapi/introspect.py \ 519$(SRC_PATH)/scripts/qapi/types.py \ 520$(SRC_PATH)/scripts/qapi/visit.py \ 521$(SRC_PATH)/scripts/qapi/common.py \ 522$(SRC_PATH)/scripts/qapi/doc.py \ 523$(SRC_PATH)/scripts/qapi-gen.py 524 525qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \ 526qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h \ 527qga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \ 528qga/qapi-generated/qga-qapi-doc.texi: \ 529qga/qapi-generated/qapi-gen-timestamp ; 530qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py) 531 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \ 532 -o qga/qapi-generated -p "qga-" $<, \ 533 "GEN","$(@:%-timestamp=%)") 534 @>$@ 535 536qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json \ 537 $(QAPI_MODULES:%=$(SRC_PATH)/qapi/%.json) 538 539$(GENERATED_QAPI_FILES): qapi-gen-timestamp ; 540qapi-gen-timestamp: $(qapi-modules) $(qapi-py) 541 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \ 542 -o "qapi" -b $<, \ 543 "GEN","$(@:%-timestamp=%)") 544 @>$@ 545 546QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h) 547$(qga-obj-y): $(QGALIB_GEN) 548 549qemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS) 550 $(call LINK, $^) 551 552ifdef QEMU_GA_MSI_ENABLED 553QEMU_GA_MSI=qemu-ga-$(ARCH).msi 554 555msi: $(QEMU_GA_MSI) 556 557$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER) 558 559$(QEMU_GA_MSI): config-host.mak 560 561$(QEMU_GA_MSI): $(SRC_PATH)/qga/installer/qemu-ga.wxs 562 $(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)" \ 563 wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<,"WIXL","$@") 564else 565msi: 566 @echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)" 567endif 568 569ifneq ($(EXESUF),) 570.PHONY: qemu-ga 571qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI) 572endif 573 574elf2dmp$(EXESUF): LIBS += $(CURL_LIBS) 575elf2dmp$(EXESUF): $(elf2dmp-obj-y) 576 $(call LINK, $^) 577 578ifdef CONFIG_IVSHMEM 579ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS) 580 $(call LINK, $^) 581ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS) 582 $(call LINK, $^) 583endif 584vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a 585 $(call LINK, $^) 586vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a 587 $(call LINK, $^) 588 589rdmacm-mux$(EXESUF): LIBS += "-libumad" 590rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS) 591 $(call LINK, $^) 592 593module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak 594 $(call quiet-command,$(PYTHON) $< $@ \ 595 $(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \ 596 "GEN","$@") 597 598ifdef CONFIG_GCOV 599.PHONY: clean-coverage 600clean-coverage: 601 $(call quiet-command, \ 602 find . \( -name '*.gcda' -o -name '*.gcov' \) -type f -exec rm {} +, \ 603 "CLEAN", "coverage files") 604endif 605 606clean: 607# avoid old build problems by removing potentially incorrect old files 608 rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h 609 rm -f qemu-options.def 610 rm -f *.msi 611 find . \( -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} + 612 rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~ 613 rm -f fsdev/*.pod scsi/*.pod 614 rm -f qemu-img-cmds.h 615 rm -f ui/shader/*-vert.h ui/shader/*-frag.h 616 @# May not be present in GENERATED_FILES 617 rm -f trace/generated-tracers-dtrace.dtrace* 618 rm -f trace/generated-tracers-dtrace.h* 619 rm -f $(foreach f,$(GENERATED_FILES),$(f) $(f)-timestamp) 620 rm -f qapi-gen-timestamp 621 rm -rf qga/qapi-generated 622 for d in $(ALL_SUBDIRS); do \ 623 if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \ 624 rm -f $$d/qemu-options.def; \ 625 done 626 rm -f config-all-devices.mak 627 628VERSION ?= $(shell cat VERSION) 629 630dist: qemu-$(VERSION).tar.bz2 631 632qemu-%.tar.bz2: 633 $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)" 634 635distclean: clean 636 rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi qemu-monitor-info.texi 637 rm -f config-all-devices.mak config-all-disas.mak config.status 638 rm -f $(SUBDIR_DEVICES_MAK) 639 rm -f po/*.mo tests/qemu-iotests/common.env 640 rm -f roms/seabios/config.mak roms/vgabios/config.mak 641 rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps 642 rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys 643 rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp 644 rm -f qemu-doc.vr qemu-doc.txt 645 rm -f config.log 646 rm -f linux-headers/asm 647 rm -f docs/version.texi 648 rm -f docs/interop/qemu-ga-qapi.texi docs/interop/qemu-qmp-qapi.texi 649 rm -f docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7 650 rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt 651 rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf 652 rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html 653 rm -f docs/qemu-block-drivers.7 654 rm -f docs/qemu-cpu-models.7 655 for d in $(TARGET_DIRS); do \ 656 rm -rf $$d || exit 1 ; \ 657 done 658 rm -Rf .sdk 659 if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi 660 661KEYMAPS=da en-gb et fr fr-ch is lt no pt-br sv \ 662ar de en-us fi fr-be hr it lv nl pl ru th \ 663de-ch es fo fr-ca hu ja mk pt sl tr \ 664bepo cz 665 666ifdef INSTALL_BLOBS 667BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \ 668vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \ 669vgabios-ramfb.bin vgabios-bochs-display.bin \ 670ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \ 671pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \ 672pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \ 673efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \ 674efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \ 675efi-e1000e.rom efi-vmxnet3.rom \ 676bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \ 677multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \ 678s390-ccw.img s390-netboot.img \ 679spapr-rtas.bin slof.bin skiboot.lid \ 680palcode-clipper \ 681u-boot.e500 u-boot-sam460-20100605.bin \ 682qemu_vga.ndrv \ 683hppa-firmware.img 684else 685BLOBS= 686endif 687 688install-doc: $(DOCS) 689 $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)" 690 $(INSTALL_DATA) qemu-doc.html "$(DESTDIR)$(qemu_docdir)" 691 $(INSTALL_DATA) qemu-doc.txt "$(DESTDIR)$(qemu_docdir)" 692 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)" 693 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)" 694ifdef CONFIG_POSIX 695 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" 696 $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1" 697 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7" 698 $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7" 699 $(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7" 700 $(INSTALL_DATA) docs/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7" 701ifneq ($(TOOLS),) 702 $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1" 703 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" 704 $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" 705endif 706ifdef CONFIG_TRACE_SYSTEMTAP 707 $(INSTALL_DATA) scripts/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1" 708endif 709ifneq (,$(findstring qemu-ga,$(TOOLS))) 710 $(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8" 711 $(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)" 712 $(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)" 713 $(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7" 714endif 715endif 716ifdef CONFIG_VIRTFS 717 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" 718 $(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1" 719endif 720 721install-datadir: 722 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)" 723 724install-localstatedir: 725ifdef CONFIG_POSIX 726ifneq (,$(findstring qemu-ga,$(TOOLS))) 727 $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run 728endif 729endif 730 731ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512 732 733install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir 734ifneq ($(TOOLS),) 735 $(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir)) 736endif 737ifneq ($(CONFIG_MODULES),) 738 $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)" 739 for s in $(modules-m:.mo=$(DSOSUF)); do \ 740 t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \ 741 $(INSTALL_LIB) $$s "$$t"; \ 742 test -z "$(STRIP)" || $(STRIP) "$$t"; \ 743 done 744endif 745ifneq ($(HELPERS-y),) 746 $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir)) 747endif 748ifdef CONFIG_TRACE_SYSTEMTAP 749 $(INSTALL_PROG) "scripts/qemu-trace-stap" $(DESTDIR)$(bindir) 750endif 751ifneq ($(BLOBS),) 752 set -e; for x in $(BLOBS); do \ 753 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \ 754 done 755endif 756 for s in $(ICON_SIZES); do \ 757 mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/$${s}/apps"; \ 758 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \ 759 "$(DESTDIR)/$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \ 760 done; \ 761 mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/32x32/apps"; \ 762 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \ 763 "$(DESTDIR)/$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \ 764 mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/scalable/apps"; \ 765 $(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \ 766 "$(DESTDIR)/$(qemu_icondir)/hicolor/scalable/apps/qemu.svg" 767 mkdir -p "$(DESTDIR)/$(qemu_desktopdir)" 768 $(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \ 769 "$(DESTDIR)/$(qemu_desktopdir)/qemu.desktop" 770ifdef CONFIG_GTK 771 $(MAKE) -C po $@ 772endif 773 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps" 774 set -e; for x in $(KEYMAPS); do \ 775 $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \ 776 done 777 $(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all" 778 for d in $(TARGET_DIRS); do \ 779 $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \ 780 done 781 782.PHONY: ctags 783ctags: 784 rm -f tags 785 find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} + 786 787.PHONY: TAGS 788TAGS: 789 rm -f TAGS 790 find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} + 791 792cscope: 793 rm -f "$(SRC_PATH)"/cscope.* 794 find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files" 795 cscope -b -i"$(SRC_PATH)/cscope.files" 796 797# opengl shader programs 798ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl 799 @mkdir -p $(dir $@) 800 $(call quiet-command,\ 801 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\ 802 "VERT","$@") 803 804ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl 805 @mkdir -p $(dir $@) 806 $(call quiet-command,\ 807 perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\ 808 "FRAG","$@") 809 810ui/shader.o: $(SRC_PATH)/ui/shader.c \ 811 ui/shader/texture-blit-vert.h \ 812 ui/shader/texture-blit-flip-vert.h \ 813 ui/shader/texture-blit-frag.h 814 815# documentation 816MAKEINFO=makeinfo 817MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D) 818MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES) 819TEXI2PODFLAGS=$(MAKEINFOINCLUDES) "-DVERSION=$(VERSION)" 820TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES) 821 822docs/version.texi: $(SRC_PATH)/VERSION 823 $(call quiet-command,echo "@set VERSION $(VERSION)" > $@,"GEN","$@") 824 825%.html: %.texi docs/version.texi 826 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \ 827 --html $< -o $@,"GEN","$@") 828 829%.info: %.texi docs/version.texi 830 $(call quiet-command,$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@,"GEN","$@") 831 832%.txt: %.texi docs/version.texi 833 $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \ 834 --plaintext $< -o $@,"GEN","$@") 835 836%.pdf: %.texi docs/version.texi 837 $(call quiet-command,texi2pdf $(TEXI2PDFFLAGS) $< -o $@,"GEN","$@") 838 839qemu-options.texi: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool 840 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@") 841 842qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool 843 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@") 844 845qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool 846 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@") 847 848qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool 849 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@") 850 851docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi 852 @cp -p $< $@ 853 854docs/interop/qemu-ga-qapi.texi: qga/qapi-generated/qga-qapi-doc.texi 855 @cp -p $< $@ 856 857qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi 858qemu.1: qemu-option-trace.texi 859qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi 860fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi 861qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi 862qemu-ga.8: qemu-ga.texi 863docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi 864docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi 865scripts/qemu-trace-stap.1: scripts/qemu-trace-stap.texi 866 867html: qemu-doc.html docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html 868info: qemu-doc.info docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info 869pdf: qemu-doc.pdf docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf 870txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt 871 872qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \ 873 qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \ 874 qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \ 875 qemu-monitor-info.texi docs/qemu-block-drivers.texi \ 876 docs/qemu-cpu-models.texi 877 878docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \ 879 docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \ 880 docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7: \ 881 docs/interop/qemu-ga-ref.texi docs/interop/qemu-ga-qapi.texi 882 883docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \ 884 docs/interop/qemu-qmp-ref.info docs/interop/qemu-qmp-ref.pdf \ 885 docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \ 886 docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi 887 888$(filter %.1 %.7 %.8,$(DOCS)): scripts/texi2pod.pl 889 890# Reports/Analysis 891 892%/coverage-report.html: 893 @mkdir -p $* 894 $(call quiet-command,\ 895 gcovr -p --html --html-details -o $@, \ 896 "GEN", "coverage-report.html") 897 898.PHONY: coverage-report 899coverage-report: $(CURDIR)/reports/coverage/coverage-report.html 900 901ifdef CONFIG_WIN32 902 903INSTALLER = qemu-setup-$(VERSION)$(EXESUF) 904 905nsisflags = -V2 -NOCD 906 907ifneq ($(wildcard $(SRC_PATH)/dll),) 908ifeq ($(ARCH),x86_64) 909# 64 bit executables 910DLL_PATH = $(SRC_PATH)/dll/w64 911nsisflags += -DW64 912else 913# 32 bit executables 914DLL_PATH = $(SRC_PATH)/dll/w32 915endif 916endif 917 918.PHONY: installer 919installer: $(INSTALLER) 920 921INSTDIR=/tmp/qemu-nsis 922 923$(INSTALLER): $(SRC_PATH)/qemu.nsi 924 $(MAKE) install prefix=${INSTDIR} 925ifdef SIGNCODE 926 (cd ${INSTDIR}; \ 927 for i in *.exe; do \ 928 $(SIGNCODE) $${i}; \ 929 done \ 930 ) 931endif # SIGNCODE 932 (cd ${INSTDIR}; \ 933 for i in qemu-system-*.exe; do \ 934 arch=$${i%.exe}; \ 935 arch=$${arch#qemu-system-}; \ 936 echo Section \"$$arch\" Section_$$arch; \ 937 echo SetOutPath \"\$$INSTDIR\"; \ 938 echo File \"\$${BINDIR}\\$$i\"; \ 939 echo SectionEnd; \ 940 done \ 941 ) >${INSTDIR}/system-emulations.nsh 942 makensis $(nsisflags) \ 943 $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \ 944 $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \ 945 -DBINDIR="${INSTDIR}" \ 946 $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \ 947 -DSRCDIR="$(SRC_PATH)" \ 948 -DOUTFILE="$(INSTALLER)" \ 949 -DDISPLAYVERSION="$(VERSION)" \ 950 $(SRC_PATH)/qemu.nsi 951 rm -r ${INSTDIR} 952ifdef SIGNCODE 953 $(SIGNCODE) $(INSTALLER) 954endif # SIGNCODE 955endif # CONFIG_WIN 956 957# Add a dependency on the generated files, so that they are always 958# rebuilt before other object files 959ifneq ($(wildcard config-host.mak),) 960ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) 961Makefile: $(GENERATED_FILES) 962endif 963endif 964 965.SECONDARY: $(TRACE_HEADERS) $(TRACE_HEADERS:%=%-timestamp) \ 966 $(TRACE_SOURCES) $(TRACE_SOURCES:%=%-timestamp) \ 967 $(TRACE_DTRACE) $(TRACE_DTRACE:%=%-timestamp) 968 969# Include automatically generated dependency files 970# Dependencies in Makefile.objs files come from our recursive subdir rules 971-include $(wildcard *.d tests/*.d) 972 973include $(SRC_PATH)/tests/docker/Makefile.include 974include $(SRC_PATH)/tests/vm/Makefile.include 975 976.PHONY: help 977help: 978 @echo 'Generic targets:' 979 @echo ' all - Build all' 980ifdef CONFIG_MODULES 981 @echo ' modules - Build all modules' 982endif 983 @echo ' dir/file.o - Build specified target only' 984 @echo ' install - Install QEMU, documentation and tools' 985 @echo ' ctags/TAGS - Generate tags file for editors' 986 @echo ' cscope - Generate cscope index' 987 @echo '' 988 @$(if $(TARGET_DIRS), \ 989 echo 'Architecture specific targets:'; \ 990 $(foreach t, $(TARGET_DIRS), \ 991 printf " %-30s - Build for %s\\n" $(patsubst %,subdir-%,$(t)) $(t);) \ 992 echo '') 993 @echo 'Cleaning targets:' 994 @echo ' clean - Remove most generated files but keep the config' 995ifdef CONFIG_GCOV 996 @echo ' clean-coverage - Remove coverage files' 997endif 998 @echo ' distclean - Remove all generated files' 999 @echo ' dist - Build a distributable tarball' 1000 @echo '' 1001 @echo 'Test targets:' 1002 @echo ' check - Run all tests (check-help for details)' 1003 @echo ' docker - Help about targets running tests inside Docker containers' 1004 @echo ' vm-test - Help about targets running tests inside VM' 1005 @echo '' 1006 @echo 'Documentation targets:' 1007 @echo ' html info pdf txt' 1008 @echo ' - Build documentation in specified format' 1009ifdef CONFIG_GCOV 1010 @echo ' coverage-report - Create code coverage report' 1011endif 1012 @echo '' 1013ifdef CONFIG_WIN32 1014 @echo 'Windows targets:' 1015 @echo ' installer - Build NSIS-based installer for QEMU' 1016ifdef QEMU_GA_MSI_ENABLED 1017 @echo ' msi - Build MSI-based installer for qemu-ga' 1018endif 1019 @echo '' 1020endif 1021 @echo ' $(MAKE) [targets] (quiet build, default)' 1022 @echo ' $(MAKE) V=1 [targets] (verbose build)' 1023