10cb3fb1eSpbrook# Makefile for QEMU. 20cb3fb1eSpbrook 3519e1693SStefan Weil# Always point to the root of the build tree (needs GNU make). 4519e1693SStefan WeilBUILD_DIR=$(CURDIR) 5388d4758SLluís Vilanova 6250b086eSLluís Vilanova# All following code might depend on configuration variables 755d7e8f6Saurel32ifneq ($(wildcard config-host.mak),) 81ad2134fSPaul Brook# Put the all: rule here so that config-host.mak can contain dependencies. 98f67aa82SStefan Weilall: 10ad064840Spbrookinclude config-host.mak 11d1bd2423SPeter Maydell 12d1bd2423SPeter Maydell# Check that we're not trying to do an out-of-tree build from 13d1bd2423SPeter Maydell# a tree that's been used for an in-tree build. 14d1bd2423SPeter Maydellifneq ($(realpath $(SRC_PATH)),$(realpath .)) 15d1bd2423SPeter Maydellifneq ($(wildcard $(SRC_PATH)/config-host.mak),) 16d1bd2423SPeter Maydell$(error This is an out of tree build but your source tree ($(SRC_PATH)) \ 17d1bd2423SPeter Maydellseems to have been used for an in-tree build. You can fix this by running \ 18d1bd2423SPeter Maydell"make distclean && rm -rf *-linux-user *-softmmu" in your source tree) 19d1bd2423SPeter Maydellendif 20d1bd2423SPeter Maydellendif 21d1bd2423SPeter Maydell 22f3aa844bSPaolo BonziniCONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y) 23f3aa844bSPaolo BonziniCONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y) 24f3aa844bSPaolo BonziniCONFIG_ALL=y 25f3aa844bSPaolo Bonzini-include config-all-devices.mak 26f3aa844bSPaolo Bonzini-include config-all-disas.mak 27f3aa844bSPaolo Bonzini 2817759187Saliguoriinclude $(SRC_PATH)/rules.mak 2959bc10eeSPaolo Bonziniconfig-host.mak: $(SRC_PATH)/configure 30e5efe7f5SJuan Quintela @echo $@ is out-of-date, running configure 31bdf523e6SStefan Weil @# TODO: The next lines include code which supports a smooth 32bdf523e6SStefan Weil @# transition from old configurations without config.status. 33bdf523e6SStefan Weil @# This code can be removed after QEMU 1.7. 34bdf523e6SStefan Weil @if test -x config.status; then \ 35bdf523e6SStefan Weil ./config.status; \ 36bdf523e6SStefan Weil else \ 37bdf523e6SStefan Weil sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh; \ 38bdf523e6SStefan Weil fi 3955d7e8f6Saurel32else 4055d7e8f6Saurel32config-host.mak: 417748b8cbSMike Frysingerifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) 4255d7e8f6Saurel32 @echo "Please call configure before running make!" 4355d7e8f6Saurel32 @exit 1 4455d7e8f6Saurel32endif 457748b8cbSMike Frysingerendif 46766a487aSbellard 47eac236eaSLluís VilanovaGENERATED_HEADERS = config-host.h qemu-options.def 4821cd70dfSWenchao XiaGENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h 4921cd70dfSWenchao XiaGENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c 50eac236eaSLluís Vilanova 5145be2f5dSLluís VilanovaGENERATED_HEADERS += trace/generated-events.h 5245be2f5dSLluís VilanovaGENERATED_SOURCES += trace/generated-events.c 5345be2f5dSLluís Vilanova 54eac236eaSLluís VilanovaGENERATED_HEADERS += trace/generated-tracers.h 555b808275SLluís Vilanovaifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace) 56eac236eaSLluís VilanovaGENERATED_HEADERS += trace/generated-tracers-dtrace.h 57eac236eaSLluís Vilanovaendif 58eac236eaSLluís VilanovaGENERATED_SOURCES += trace/generated-tracers.c 59250b086eSLluís Vilanova 60465830fbSLluís VilanovaGENERATED_HEADERS += trace/generated-tcg-tracers.h 61465830fbSLluís Vilanova 62f4654226SLluís VilanovaGENERATED_HEADERS += trace/generated-helpers-wrappers.h 63707c8a98SLluís VilanovaGENERATED_HEADERS += trace/generated-helpers.h 64341ea691SLluís VilanovaGENERATED_SOURCES += trace/generated-helpers.c 65707c8a98SLluís Vilanova 665b808275SLluís Vilanovaifeq ($(findstring ust,$(TRACE_BACKENDS)),ust) 67e6bf23f8SMohamad GebaiGENERATED_HEADERS += trace/generated-ust-provider.h 68e6bf23f8SMohamad GebaiGENERATED_SOURCES += trace/generated-ust.c 69e6bf23f8SMohamad Gebaiendif 70e6bf23f8SMohamad Gebai 71d9ace8b3SJuan Quintela# Don't try to regenerate Makefile or configure 72d9ace8b3SJuan Quintela# We don't generate any of them 73d9ace8b3SJuan QuintelaMakefile: ; 74d9ace8b3SJuan Quintelaconfigure: ; 75d9ace8b3SJuan Quintela 76818220f5Saliguori.PHONY: all clean cscope distclean dvi html info install install-doc \ 7734bb443eSAnthony Liguori pdf recurse-all speed test dist 780cb3fb1eSpbrook 79fec90ff0SPaolo Bonzini$(call set-vpath, $(SRC_PATH)) 808c462f8fSpbrook 813e2e0e6bSJuan QuintelaLIBS+=-lz $(LIBS_TOOLS) 8267c0f08dSJuan Quintela 837b93fadfSCorey BryantHELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF) 847b93fadfSCorey Bryant 85cc8ae6deSpbrookifdef BUILD_DOCS 86d076a2adSLuiz CapitulinoDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 qmp-commands.txt 87983eef5aSMeador Ingeifdef CONFIG_VIRTFS 88a2d8f1beSM. Mohan KumarDOCS+=fsdev/virtfs-proxy-helper.1 89983eef5aSMeador Ingeendif 90cc8ae6deSpbrookelse 91cc8ae6deSpbrookDOCS= 92cc8ae6deSpbrookendif 937d13299dSbellard 94388d4758SLluís VilanovaSUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR) 951f3d3c8fSJuan QuintelaSUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS)) 9688070801SAndreas FärberSUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS)) 971f3d3c8fSJuan Quintela 988bdd3d49SStefan Weilifeq ($(SUBDIR_DEVICES_MAK),) 998bdd3d49SStefan Weilconfig-all-devices.mak: 1008bdd3d49SStefan Weil $(call quiet-command,echo '# no devices' > $@," GEN $@") 1018bdd3d49SStefan Weilelse 1021f3d3c8fSJuan Quintelaconfig-all-devices.mak: $(SUBDIR_DEVICES_MAK) 103bb585a78SPaolo Bonzini $(call quiet-command, sed -n \ 104bb585a78SPaolo Bonzini 's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \ 105bb585a78SPaolo Bonzini $(SUBDIR_DEVICES_MAK) | sort -u > $@, \ 106bb585a78SPaolo Bonzini " GEN $@") 1078bdd3d49SStefan Weilendif 1081f3d3c8fSJuan Quintela 109bd9141bbSPaul Brook-include $(SUBDIR_DEVICES_MAK_DEP) 110bd9141bbSPaul Brook 111a992fe3dSPaul Brook%/config-devices.mak: default-configs/%.mak 1124c3b5a48SBlue Swirl $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, " GEN $@") 113a992fe3dSPaul Brook @if test -f $@; then \ 114904fe1fbSBlue Swirl if cmp -s $@.old $@; then \ 115012f0879SStefan Weil mv $@.tmp $@; \ 116012f0879SStefan Weil cp -p $@ $@.old; \ 117012f0879SStefan Weil else \ 118012f0879SStefan Weil if test -f $@.old; then \ 119012f0879SStefan Weil echo "WARNING: $@ (user modified) out of date.";\ 120012f0879SStefan Weil else \ 121a992fe3dSPaul Brook echo "WARNING: $@ out of date.";\ 122012f0879SStefan Weil fi; \ 12363e86b2eSStefan Weil echo "Run \"make defconfig\" to regenerate."; \ 124a992fe3dSPaul Brook rm $@.tmp; \ 125012f0879SStefan Weil fi; \ 126a992fe3dSPaul Brook else \ 127a992fe3dSPaul Brook mv $@.tmp $@; \ 128012f0879SStefan Weil cp -p $@ $@.old; \ 129a992fe3dSPaul Brook fi 130a992fe3dSPaul Brook 131a992fe3dSPaul Brookdefconfig: 132a992fe3dSPaul Brook rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK) 133a992fe3dSPaul Brook 134992aeb8eSPaolo Bonziniifneq ($(wildcard config-host.mak),) 135992aeb8eSPaolo Bonziniinclude $(SRC_PATH)/Makefile.objs 136ba1183daSFam Zhengendif 137ba1183daSFam Zheng 138ba1183daSFam Zhengdummy := $(call unnest-vars,, \ 139ba1183daSFam Zheng stub-obj-y \ 140ba1183daSFam Zheng util-obj-y \ 141ba1183daSFam Zheng qga-obj-y \ 142577a6723STomoki Sekiyama qga-vss-dll-obj-y \ 143ba1183daSFam Zheng block-obj-y \ 144cc475698SFam Zheng block-obj-m \ 145cc475698SFam Zheng common-obj-y \ 146cc475698SFam Zheng common-obj-m) 147ba1183daSFam Zheng 148ba1183daSFam Zhengifneq ($(wildcard config-host.mak),) 149992aeb8eSPaolo Bonziniinclude $(SRC_PATH)/tests/Makefile 150992aeb8eSPaolo Bonziniendif 151992aeb8eSPaolo Bonziniifeq ($(CONFIG_SMARTCARD_NSS),y) 152992aeb8eSPaolo Bonziniinclude $(SRC_PATH)/libcacard/Makefile 153992aeb8eSPaolo Bonziniendif 154992aeb8eSPaolo Bonzini 15517969268SFam Zhengall: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules 156b9dea4fbSpbrook 1571215c6e7SJuan Quintelaconfig-host.h: config-host.h-timestamp 1581215c6e7SJuan Quintelaconfig-host.h-timestamp: config-host.mak 159e14056adSBlue Swirlqemu-options.def: $(SRC_PATH)/qemu-options.hx 1604c3b5a48SBlue Swirl $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@") 1611215c6e7SJuan Quintela 162cec7d0b6SpbrookSUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS)) 163916359f6SAndreas FärberSOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES)) 164916359f6SAndreas Färber 16557f45b62SStefan Weil$(SOFTMMU_SUBDIR_RULES): $(block-obj-y) 166916359f6SAndreas Färber$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak 167cec7d0b6Spbrook 1684115852bSPaolo Bonzinisubdir-%: 1690087375eSPaul Brook $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,) 1704aa42531Spbrook 171e2134eb9SGerd Hoffmannsubdir-pixman: pixman/Makefile 172e2134eb9SGerd Hoffmann $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pixman V="$(V)" all,) 173e2134eb9SGerd Hoffmann 174e2134eb9SGerd Hoffmannpixman/Makefile: $(SRC_PATH)/pixman/configure 175f9943cd5SGerd Hoffmann (cd pixman; CFLAGS="$(CFLAGS) -fPIC $(extra_cflags) $(extra_ldflags)" $(SRC_PATH)/pixman/configure $(AUTOCONF_HOST) --disable-gtk --disable-shared --enable-static) 176e2134eb9SGerd Hoffmann 177e2134eb9SGerd Hoffmann$(SRC_PATH)/pixman/configure: 178e2134eb9SGerd Hoffmann (cd $(SRC_PATH)/pixman; autoreconf -v --install) 179e2134eb9SGerd Hoffmann 180a540f158SPeter CrosthwaiteDTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt 181965f486cSPeter MaydellDTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS) 182965f486cSPeter MaydellDTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt 183a540f158SPeter Crosthwaite 184a540f158SPeter Crosthwaitesubdir-dtc:dtc/libfdt dtc/tests 185965f486cSPeter Maydell $(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,) 186a540f158SPeter Crosthwaite 187a540f158SPeter Crosthwaitedtc/%: 188a540f158SPeter Crosthwaite mkdir -p $@ 189a540f158SPeter Crosthwaite 19082cb6b04SPaolo Bonzini$(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) 191add16157SBlue Swirl 192c05ac895SPaul BrookROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS)) 193c05ac895SPaul Brookromsubdir-%: 194c05ac895SPaul Brook $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",) 195c05ac895SPaul Brook 196c05ac895SPaul BrookALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS)) 197c05ac895SPaul Brook 198c05ac895SPaul Brookrecurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES) 1994aa42531Spbrook 2000b516ef0SStefan Weil$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc $(BUILD_DIR)/config-host.h | $(BUILD_DIR)/version.lo 2017e75e33eSStefan Weil $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<," RC version.o") 2020b516ef0SStefan Weil$(BUILD_DIR)/version.lo: $(SRC_PATH)/version.rc $(BUILD_DIR)/config-host.h 2037e75e33eSStefan Weil $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<," RC version.lo") 2045354e4d2SMarc-André Lureau 205fba90ac1SPaolo BonziniMakefile: $(version-obj-y) $(version-lobj-y) 2063bc2f570SPaolo Bonzini 2073bc2f570SPaolo Bonzini###################################################################### 2088a090705SPaolo Bonzini# Build libraries 2093bc2f570SPaolo Bonzini 2103bc2f570SPaolo Bonzinilibqemustub.a: $(stub-obj-y) 211169a24aeSFam Zhenglibqemuutil.a: $(util-obj-y) 2123bc2f570SPaolo Bonzini 213e26110cfSFam Zhengblock-modules = $(foreach o,$(block-obj-m),"$(basename $(subst /,-,$o))",) NULL 214e26110cfSFam Zhengutil/module.o-cflags = -D'CONFIG_BLOCK_MODULES=$(block-modules)' 215e26110cfSFam Zheng 2164fb240a4Sbellard###################################################################### 2174fb240a4Sbellard 2183c089e15SJuan Quintelaqemu-img.o: qemu-img-cmds.h 219153859beSStuart Brady 220ff667e2eSPaolo Bonziniqemu-img$(EXESUF): qemu-img.o $(block-obj-y) libqemuutil.a libqemustub.a 221ff667e2eSPaolo Bonziniqemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) libqemuutil.a libqemustub.a 222587da2c3SKevin Wolfqemu-io$(EXESUF): qemu-io.o $(block-obj-y) libqemuutil.a libqemustub.a 2230a8e1acdSaliguori 2247b93fadfSCorey Bryantqemu-bridge-helper$(EXESUF): qemu-bridge-helper.o 2257b93fadfSCorey Bryant 226ff667e2eSPaolo Bonzinifsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/virtio-9p-marshal.o libqemuutil.a libqemustub.a 22717bff52bSM. Mohan Kumarfsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap 22817bff52bSM. Mohan Kumar 229153859beSStuart Bradyqemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx 2304c3b5a48SBlue Swirl $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@") 231153859beSStuart Brady 232957f1f99SMichael Rothqemu-ga$(EXESUF): LIBS = $(LIBS_QGA) 23354c2e502SDunrong Huangqemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated 234640e5404SMichael Roth 23519bf7c87SAvi Kivitygen-out-type = $(subst .,-,$(suffix $@)) 2368d3bc517SAvi Kivity 2370521d375SStefan Hajnocziqapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py 2380521d375SStefan Hajnoczi 23954c2e502SDunrong Huangqga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\ 2402870dc34SPaolo Bonzini$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py) 2410a607749SLluís Vilanova $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \ 24233aaad52SLluís Vilanova $(gen-out-type) -o qga/qapi-generated -p "qga-" -i $<, \ 2430a607749SLluís Vilanova " GEN $@") 24454c2e502SDunrong Huangqga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\ 2452870dc34SPaolo Bonzini$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py) 2460a607749SLluís Vilanova $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \ 24733aaad52SLluís Vilanova $(gen-out-type) -o qga/qapi-generated -p "qga-" -i $<, \ 2480a607749SLluís Vilanova " GEN $@") 24954c2e502SDunrong Huangqga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\ 2502870dc34SPaolo Bonzini$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) 2510a607749SLluís Vilanova $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \ 25233aaad52SLluís Vilanova $(gen-out-type) -o qga/qapi-generated -p "qga-" -i $<, \ 2530a607749SLluís Vilanova " GEN $@") 254e3d4d252SMichael Roth 255be13d46dSMax Reitzqapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \ 256f668470fSWenchao Xia $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \ 25782d72d9dSWenchao Xia $(SRC_PATH)/qapi/event.json 258be13d46dSMax Reitz 259599825c5SMichael S. Tsirkinqapi-types.c qapi-types.h :\ 260be13d46dSMax Reitz$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py) 2610a607749SLluís Vilanova $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \ 26233aaad52SLluís Vilanova $(gen-out-type) -o "." -b -i $<, \ 2630a607749SLluís Vilanova " GEN $@") 264599825c5SMichael S. Tsirkinqapi-visit.c qapi-visit.h :\ 265be13d46dSMax Reitz$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py) 2660a607749SLluís Vilanova $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \ 26733aaad52SLluís Vilanova $(gen-out-type) -o "." -b -i $<, \ 2680a607749SLluís Vilanova " GEN $@") 26921cd70dfSWenchao Xiaqapi-event.c qapi-event.h :\ 27021cd70dfSWenchao Xia$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py) 27121cd70dfSWenchao Xia $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \ 27221cd70dfSWenchao Xia $(gen-out-type) -o "." -b -i $<, \ 27321cd70dfSWenchao Xia " GEN $@") 274599825c5SMichael S. Tsirkinqmp-commands.h qmp-marshal.c :\ 275be13d46dSMax Reitz$(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) 2760a607749SLluís Vilanova $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \ 27733aaad52SLluís Vilanova $(gen-out-type) -o "." -m -i $<, \ 2780a607749SLluís Vilanova " GEN $@") 279e3193601SAnthony Liguori 28054c2e502SDunrong HuangQGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h) 2814115852bSPaolo Bonzini$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) 282957f1f99SMichael Roth 283ff667e2eSPaolo Bonziniqemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a 2842870dc34SPaolo Bonzini $(call LINK, $^) 28548ff7a62SMichael Roth 28631e31b8aSbellardclean: 2872d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files 28825be210fSJuan 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 289df2943baSMichael S. Tsirkin rm -f qemu-options.def 290f4b11eeeSFam Zheng find . \( -name '*.l[oa]' -o -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} + 291b39297aeSTomoki Sekiyama rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~ 2928b6bfc77SStefan Weil rm -f fsdev/*.pod 2938b6bfc77SStefan Weil rm -rf .libs */.libs 29407b44ce9SBlue Swirl rm -f qemu-img-cmds.h 29519ac36b5SLluís Vilanova @# May not be present in GENERATED_HEADERS 296eac236eaSLluís Vilanova rm -f trace/generated-tracers-dtrace.dtrace* 297eac236eaSLluís Vilanova rm -f trace/generated-tracers-dtrace.h* 29819ac36b5SLluís Vilanova rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp) 29919ac36b5SLluís Vilanova rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp) 3008f0e5c6bSStefan Weil rm -rf qapi-generated 30154c2e502SDunrong Huang rm -rf qga/qapi-generated 302781c0c33SStefan Hajnoczi for d in $(ALL_SUBDIRS); do \ 303fc8e320eSMagnus Damm if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \ 304df2943baSMichael S. Tsirkin rm -f $$d/qemu-options.def; \ 305626df76aSbellard done 30631e31b8aSbellard 30734bb443eSAnthony LiguoriVERSION ?= $(shell cat VERSION) 30834bb443eSAnthony Liguori 30934bb443eSAnthony Liguoridist: qemu-$(VERSION).tar.bz2 31034bb443eSAnthony Liguori 31134bb443eSAnthony Liguoriqemu-%.tar.bz2: 31234bb443eSAnthony Liguori $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)" 31334bb443eSAnthony Liguori 3147d13299dSbellarddistclean: clean 315fc8e320eSMagnus Damm rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi 31676cad711SPaolo Bonzini rm -f config-all-devices.mak config-all-disas.mak 3178b6bfc77SStefan Weil rm -f po/*.mo 318fc8e320eSMagnus Damm rm -f roms/seabios/config.mak roms/vgabios/config.mak 3197a734b8fSBrad Hards rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps qemu-doc.dvi 3207a734b8fSBrad Hards rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys 3217a734b8fSBrad Hards rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp 3227a734b8fSBrad Hards rm -f qemu-doc.vr 323793553acSAlexandre Raymond rm -f config.log 32467ed96f9SPeter Maydell rm -f linux-headers/asm 325e1a068b2SHidetoshi Seto rm -f qemu-tech.info qemu-tech.aux qemu-tech.cp qemu-tech.dvi qemu-tech.fn qemu-tech.info qemu-tech.ky qemu-tech.log qemu-tech.pdf qemu-tech.pg qemu-tech.toc qemu-tech.tp qemu-tech.vr 3268e98e2e8SPaolo Bonzini for d in $(TARGET_DIRS); do \ 327bc1b050dSbellard rm -rf $$d || exit 1 ; \ 32876bc6838Sbellard done 329d9840e25STomoki Sekiyama rm -Rf .sdk 330a85903ffSWenchao Xia if test -f pixman/config.log; then make -C pixman distclean; fi 331a540f158SPeter Crosthwaite if test -f dtc/version_gen.h; then make $(DTC_MAKE_ARGS) clean; fi 3327d13299dSbellard 333fed4a9adSbellardKEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ 334fed4a9adSbellardar de en-us fi fr-be hr it lv nl pl ru th \ 335471fbf4aSFrédéric Boiteuxcommon de-ch es fo fr-ca hu ja mk nl-be pt sl tr \ 3363751e722SJan Krupabepo cz 337fed4a9adSbellard 33877755340Sthsifdef INSTALL_BLOBS 339bf2eaf71SEduardo HabkostBLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \ 3407943a2faSGerd Hoffmannvgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \ 3417e973bb2SLaszlo Ersekacpi-dsdt.aml q35-acpi-dsdt.aml \ 3429eb08a43SMark Cave-Aylandppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \ 3435ee8ad71SAlex Williamsonpxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \ 3445ee8ad71SAlex Williamsonpxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \ 3459fd02979SSander Eikelenboomefi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \ 3469fd02979SSander Eikelenboomefi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \ 347f7da9c17SAnthony Liguoriqemu-icon.bmp qemu_logo_no_text.svg \ 34800914b7dSMichal Simekbamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \ 3492a2af967SJan Kiszkamultiboot.bin linuxboot.bin kvmvapic.bin \ 35039ac8455SDavid Gibsons390-zipl.rom \ 3510c1fecddSAlexander Grafs390-ccw.img \ 352753d11f2SRichard Hendersonspapr-rtas.bin slof.bin \ 3530c6ab8c9SCole Robinsonpalcode-clipper \ 3540c6ab8c9SCole Robinsonu-boot.e500 35577755340Sthselse 35677755340SthsBLOBS= 35777755340Sthsendif 35877755340Sths 35938954dcaSpbrookinstall-doc: $(DOCS) 360d7dd65baSEduardo Habkost $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)" 361d7dd65baSEduardo Habkost $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(qemu_docdir)" 362d076a2adSLuiz Capitulino $(INSTALL_DATA) qmp-commands.txt "$(DESTDIR)$(qemu_docdir)" 36396d409ebSJuan Quintelaifdef CONFIG_POSIX 36458f8aeadSaliguori $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" 3658a3e8f7fSAndreas Färber $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1" 3668a3e8f7fSAndreas Färberifneq ($(TOOLS),) 3678a3e8f7fSAndreas Färber $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1" 36858f8aeadSaliguori $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" 36958f8aeadSaliguori $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" 37038954dcaSpbrookendif 3718a3e8f7fSAndreas Färberendif 372a2d8f1beSM. Mohan Kumarifdef CONFIG_VIRTFS 373a2d8f1beSM. Mohan Kumar $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" 374a2d8f1beSM. Mohan Kumar $(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1" 375a2d8f1beSM. Mohan Kumarendif 376b5ec5ce0Sjohn cooper 377e2d87bffSEduardo Habkostinstall-datadir: 378e2d87bffSEduardo Habkost $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)" 379e2d87bffSEduardo Habkost 380f2e3978bSLaszlo Ersekinstall-localstatedir: 381f2e3978bSLaszlo Ersekifdef CONFIG_POSIX 382f2e3978bSLaszlo Ersekifneq (,$(findstring qemu-ga,$(TOOLS))) 383f2e3978bSLaszlo Ersek $(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run 384f2e3978bSLaszlo Ersekendif 385f2e3978bSLaszlo Ersekendif 386f2e3978bSLaszlo Ersek 387e2d87bffSEduardo Habkostinstall-confdir: 388e2d87bffSEduardo Habkost $(INSTALL_DIR) "$(DESTDIR)$(qemu_confdir)" 389e2d87bffSEduardo Habkost 390e2d87bffSEduardo Habkostinstall-sysconfig: install-datadir install-confdir 391e2d87bffSEduardo Habkost $(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(qemu_confdir)" 392e2d87bffSEduardo Habkost 393f2e3978bSLaszlo Ersekinstall: all $(if $(BUILD_DOCS),install-doc) install-sysconfig \ 394f2e3978bSLaszlo Ersekinstall-datadir install-localstatedir 395932a79dfSthsifneq ($(TOOLS),) 3960d659426SMichael Tokarev $(call install-prog,$(TOOLS),$(DESTDIR)$(bindir)) 397932a79dfSthsendif 398e3be6f0eSFam Zhengifneq ($(CONFIG_MODULES),) 399e3be6f0eSFam Zheng $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)" 4002115182fSMichael Tokarev for s in $(modules-m:.mo=$(DSOSUF)); do \ 4012115182fSMichael Tokarev t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \ 402264f8b4fSMichael Tokarev $(INSTALL_LIB) $$s "$$t"; \ 4032115182fSMichael Tokarev test -z "$(STRIP)" || $(STRIP) "$$t"; \ 404e3be6f0eSFam Zheng done 405e3be6f0eSFam Zhengendif 4067b93fadfSCorey Bryantifneq ($(HELPERS-y),) 4070d659426SMichael Tokarev $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir)) 4087b93fadfSCorey Bryantendif 40977755340Sthsifneq ($(BLOBS),) 41077755340Sths set -e; for x in $(BLOBS); do \ 4116aae2a2eSEduardo Habkost $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \ 412ad064840Spbrook done 41377755340Sthsendif 414834574eaSAnthony Liguoriifeq ($(CONFIG_GTK),y) 415834574eaSAnthony Liguori $(MAKE) -C po $@ 416834574eaSAnthony Liguoriendif 4176aae2a2eSEduardo Habkost $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps" 41818be8d77Sblueswir1 set -e; for x in $(KEYMAPS); do \ 4196aae2a2eSEduardo Habkost $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \ 420ad064840Spbrook done 421*89ae5831SStefan Hajnoczi $(INSTALL_DATA) $(SRC_PATH)/trace-events "$(DESTDIR)$(qemu_datadir)/trace-events" 422626df76aSbellard for d in $(TARGET_DIRS); do \ 4236570025eSLluís Vilanova $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \ 424626df76aSbellard done 425612384d7Sbellard 426367e86e8Sbellard# various test targets 4279b0b8203Sbellardtest speed: all 428c09015ddSAnthony Liguori $(MAKE) -C tests/tcg $@ 42931e31b8aSbellard 43021d4e8e3SAlexandre Bique.PHONY: TAGS 431367e86e8SbellardTAGS: 432b1999e87SDavid Gibson rm -f $@ 433b1999e87SDavid Gibson find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} + 43431e31b8aSbellard 4356688bc6dSbellardcscope: 4366688bc6dSbellard rm -f ./cscope.* 43745b75ae4SAlexandre Raymond find "$(SRC_PATH)" -name "*.[chsS]" -print | sed 's,^\./,,' > ./cscope.files 4386688bc6dSbellard cscope -b 4396688bc6dSbellard 4403ef693a0Sbellard# documentation 44101668d98SStefan WeilMAKEINFO=makeinfo 44201668d98SStefan WeilMAKEINFOFLAGS=--no-headers --no-split --number-sections 44320cc9997SStefan WeilTEXIFLAG=$(if $(V),,--quiet) 44420cc9997SStefan Weil%.dvi: %.texi 44520cc9997SStefan Weil $(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<," GEN $@") 44620cc9997SStefan Weil 4471f673135Sbellard%.html: %.texi 448952ef67cSStefan Weil $(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \ 44901668d98SStefan Weil " GEN $@") 4503ef693a0Sbellard 451f3548328Sbellard%.info: %.texi 45201668d98SStefan Weil $(call quiet-command,$(MAKEINFO) $< -o $@," GEN $@") 453f3548328Sbellard 45420cc9997SStefan Weil%.pdf: %.texi 45520cc9997SStefan Weil $(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<," GEN $@") 4565824d651Sblueswir1 4575824d651Sblueswir1qemu-options.texi: $(SRC_PATH)/qemu-options.hx 4584c3b5a48SBlue Swirl $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@") 459f3548328Sbellard 460acd0a093SLuiz Capitulinoqemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx 4614c3b5a48SBlue Swirl $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@") 4622313086aSBlue Swirl 463d076a2adSLuiz Capitulinoqmp-commands.txt: $(SRC_PATH)/qmp-commands.hx 4644c3b5a48SBlue Swirl $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@," GEN $@") 465b40292e7SJan Kiszka 466153859beSStuart Bradyqemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx 4674c3b5a48SBlue Swirl $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@," GEN $@") 468153859beSStuart Brady 4692313086aSBlue Swirlqemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi 4700d00e563Saliguori $(call quiet-command, \ 4714c3b5a48SBlue Swirl perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \ 4723179d694SMichael Tokarev $(POD2MAN) --section=1 --center=" " --release=" " qemu.pod > $@, \ 4730d00e563Saliguori " GEN $@") 4745a67135aSbellard 475153859beSStuart Bradyqemu-img.1: qemu-img.texi qemu-img-cmds.texi 4760d00e563Saliguori $(call quiet-command, \ 4774c3b5a48SBlue Swirl perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-img.pod && \ 4783179d694SMichael Tokarev $(POD2MAN) --section=1 --center=" " --release=" " qemu-img.pod > $@, \ 4790d00e563Saliguori " GEN $@") 480acd935efSbellard 481a2d8f1beSM. Mohan Kumarfsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi 482a2d8f1beSM. Mohan Kumar $(call quiet-command, \ 483a2d8f1beSM. Mohan Kumar perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< fsdev/virtfs-proxy-helper.pod && \ 4843179d694SMichael Tokarev $(POD2MAN) --section=1 --center=" " --release=" " fsdev/virtfs-proxy-helper.pod > $@, \ 485a2d8f1beSM. Mohan Kumar " GEN $@") 486a2d8f1beSM. Mohan Kumar 4877a5ca864Sbellardqemu-nbd.8: qemu-nbd.texi 4880d00e563Saliguori $(call quiet-command, \ 4894c3b5a48SBlue Swirl perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-nbd.pod && \ 4903179d694SMichael Tokarev $(POD2MAN) --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \ 4910d00e563Saliguori " GEN $@") 4927a5ca864Sbellard 4930cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi 4940cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html 49520cc9997SStefan Weilinfo: qemu-doc.info qemu-tech.info 49620cc9997SStefan Weilpdf: qemu-doc.pdf qemu-tech.pdf 4970cb3fb1eSpbrook 49820cc9997SStefan Weilqemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \ 49920cc9997SStefan Weil qemu-img.texi qemu-nbd.texi qemu-options.texi \ 50020cc9997SStefan Weil qemu-monitor.texi qemu-img-cmds.texi 501818220f5Saliguori 502f53ec699SStefan Weilifdef CONFIG_WIN32 503f53ec699SStefan Weil 504f53ec699SStefan WeilINSTALLER = qemu-setup-$(VERSION)$(EXESUF) 505f53ec699SStefan Weil 506f53ec699SStefan Weilnsisflags = -V2 -NOCD 507f53ec699SStefan Weil 508f53ec699SStefan Weilifneq ($(wildcard $(SRC_PATH)/dll),) 509f53ec699SStefan Weilifeq ($(ARCH),x86_64) 510f53ec699SStefan Weil# 64 bit executables 511f53ec699SStefan WeilDLL_PATH = $(SRC_PATH)/dll/w64 512f53ec699SStefan Weilnsisflags += -DW64 513f53ec699SStefan Weilelse 514f53ec699SStefan Weil# 32 bit executables 515f53ec699SStefan WeilDLL_PATH = $(SRC_PATH)/dll/w32 516f53ec699SStefan Weilendif 517f53ec699SStefan Weilendif 518f53ec699SStefan Weil 519f53ec699SStefan Weil.PHONY: installer 520f53ec699SStefan Weilinstaller: $(INSTALLER) 521f53ec699SStefan Weil 522f53ec699SStefan WeilINSTDIR=/tmp/qemu-nsis 523f53ec699SStefan Weil 524f53ec699SStefan Weil$(INSTALLER): $(SRC_PATH)/qemu.nsi 525f53ec699SStefan Weil make install prefix=${INSTDIR} 526f53ec699SStefan Weilifdef SIGNCODE 527f53ec699SStefan Weil (cd ${INSTDIR}; \ 528f53ec699SStefan Weil for i in *.exe; do \ 529f53ec699SStefan Weil $(SIGNCODE) $${i}; \ 530f53ec699SStefan Weil done \ 531f53ec699SStefan Weil ) 532f53ec699SStefan Weilendif # SIGNCODE 533f53ec699SStefan Weil (cd ${INSTDIR}; \ 534f53ec699SStefan Weil for i in qemu-system-*.exe; do \ 535f53ec699SStefan Weil arch=$${i%.exe}; \ 536f53ec699SStefan Weil arch=$${arch#qemu-system-}; \ 537f53ec699SStefan Weil echo Section \"$$arch\" Section_$$arch; \ 538f53ec699SStefan Weil echo SetOutPath \"\$$INSTDIR\"; \ 539f53ec699SStefan Weil echo File \"\$${BINDIR}\\$$i\"; \ 540f53ec699SStefan Weil echo SectionEnd; \ 541f53ec699SStefan Weil done \ 542f53ec699SStefan Weil ) >${INSTDIR}/system-emulations.nsh 543f53ec699SStefan Weil makensis $(nsisflags) \ 544f53ec699SStefan Weil $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \ 545f53ec699SStefan Weil $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \ 546f53ec699SStefan Weil -DBINDIR="${INSTDIR}" \ 547f53ec699SStefan Weil $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \ 548f53ec699SStefan Weil -DSRCDIR="$(SRC_PATH)" \ 549f53ec699SStefan Weil -DOUTFILE="$(INSTALLER)" \ 550f53ec699SStefan Weil $(SRC_PATH)/qemu.nsi 551f53ec699SStefan Weil rm -r ${INSTDIR} 552f53ec699SStefan Weilifdef SIGNCODE 553f53ec699SStefan Weil $(SIGNCODE) $(INSTALLER) 554f53ec699SStefan Weilendif # SIGNCODE 555f53ec699SStefan Weilendif # CONFIG_WIN 556f53ec699SStefan Weil 557cb5fc67dSAnthony Liguori# Add a dependency on the generated files, so that they are always 558cb5fc67dSAnthony Liguori# rebuilt before other object files 5597748b8cbSMike Frysingerifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) 560cb5fc67dSAnthony LiguoriMakefile: $(GENERATED_HEADERS) 5617748b8cbSMike Frysingerendif 562cb5fc67dSAnthony Liguori 5634fb240a4Sbellard# Include automatically generated dependency files 5641435ddb8SPaolo Bonzini# Dependencies in Makefile.objs files come from our recursive subdir rules 5651435ddb8SPaolo Bonzini-include $(wildcard *.d tests/*.d) 566