xref: /openbmc/qemu/Makefile (revision 0c0c1fd9)
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
6eaa2ddbbSFam Zheng# Before including a proper config-host.mak, assume we are in the source tree
7eaa2ddbbSFam ZhengSRC_PATH=.
8eaa2ddbbSFam Zheng
9324027c2SFam ZhengUNCHECKED_GOALS := %clean TAGS cscope ctags docker docker-%
10eaa2ddbbSFam Zheng
11250b086eSLluís Vilanova# All following code might depend on configuration variables
1255d7e8f6Saurel32ifneq ($(wildcard config-host.mak),)
131ad2134fSPaul Brook# Put the all: rule here so that config-host.mak can contain dependencies.
148f67aa82SStefan Weilall:
15ad064840Spbrookinclude config-host.mak
16d1bd2423SPeter Maydell
17d1bd2423SPeter Maydell# Check that we're not trying to do an out-of-tree build from
18d1bd2423SPeter Maydell# a tree that's been used for an in-tree build.
19d1bd2423SPeter Maydellifneq ($(realpath $(SRC_PATH)),$(realpath .))
20d1bd2423SPeter Maydellifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
21d1bd2423SPeter Maydell$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
22d1bd2423SPeter Maydellseems to have been used for an in-tree build. You can fix this by running \
23d1bd2423SPeter Maydell"make distclean && rm -rf *-linux-user *-softmmu" in your source tree)
24d1bd2423SPeter Maydellendif
25d1bd2423SPeter Maydellendif
26d1bd2423SPeter Maydell
27f3aa844bSPaolo BonziniCONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
28f3aa844bSPaolo BonziniCONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
29f3aa844bSPaolo BonziniCONFIG_ALL=y
30f3aa844bSPaolo Bonzini-include config-all-devices.mak
31f3aa844bSPaolo Bonzini-include config-all-disas.mak
32f3aa844bSPaolo Bonzini
338df42d85SGerd Hoffmannconfig-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios
34e5efe7f5SJuan Quintela	@echo $@ is out-of-date, running configure
35bdf523e6SStefan Weil	@# TODO: The next lines include code which supports a smooth
36bdf523e6SStefan Weil	@# transition from old configurations without config.status.
37bdf523e6SStefan Weil	@# This code can be removed after QEMU 1.7.
38bdf523e6SStefan Weil	@if test -x config.status; then \
39bdf523e6SStefan Weil	    ./config.status; \
40bdf523e6SStefan Weil        else \
41bdf523e6SStefan Weil	    sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh; \
42bdf523e6SStefan Weil	fi
4355d7e8f6Saurel32else
4455d7e8f6Saurel32config-host.mak:
45eaa2ddbbSFam Zhengifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
4655d7e8f6Saurel32	@echo "Please call configure before running make!"
4755d7e8f6Saurel32	@exit 1
4855d7e8f6Saurel32endif
497748b8cbSMike Frysingerendif
50766a487aSbellard
51fb57c881SFam Zhenginclude $(SRC_PATH)/rules.mak
52fb57c881SFam Zheng
5367a1de0dSFam ZhengGENERATED_HEADERS = qemu-version.h config-host.h qemu-options.def
5421cd70dfSWenchao XiaGENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h
5521cd70dfSWenchao XiaGENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
5639a18158SMarkus ArmbrusterGENERATED_HEADERS += qmp-introspect.h
5739a18158SMarkus ArmbrusterGENERATED_SOURCES += qmp-introspect.c
58eac236eaSLluís Vilanova
5945be2f5dSLluís VilanovaGENERATED_HEADERS += trace/generated-events.h
6045be2f5dSLluís VilanovaGENERATED_SOURCES += trace/generated-events.c
6145be2f5dSLluís Vilanova
62eac236eaSLluís VilanovaGENERATED_HEADERS += trace/generated-tracers.h
635b808275SLluís Vilanovaifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace)
64eac236eaSLluís VilanovaGENERATED_HEADERS += trace/generated-tracers-dtrace.h
65eac236eaSLluís Vilanovaendif
66eac236eaSLluís VilanovaGENERATED_SOURCES += trace/generated-tracers.c
67250b086eSLluís Vilanova
68465830fbSLluís VilanovaGENERATED_HEADERS += trace/generated-tcg-tracers.h
69465830fbSLluís Vilanova
70f4654226SLluís VilanovaGENERATED_HEADERS += trace/generated-helpers-wrappers.h
71707c8a98SLluís VilanovaGENERATED_HEADERS += trace/generated-helpers.h
72341ea691SLluís VilanovaGENERATED_SOURCES += trace/generated-helpers.c
73707c8a98SLluís Vilanova
745b808275SLluís Vilanovaifeq ($(findstring ust,$(TRACE_BACKENDS)),ust)
75e6bf23f8SMohamad GebaiGENERATED_HEADERS += trace/generated-ust-provider.h
76e6bf23f8SMohamad GebaiGENERATED_SOURCES += trace/generated-ust.c
77e6bf23f8SMohamad Gebaiendif
78e6bf23f8SMohamad Gebai
79*0c0c1fd9SMarc MariGENERATED_HEADERS += module_block.h
80*0c0c1fd9SMarc Mari
81d9ace8b3SJuan Quintela# Don't try to regenerate Makefile or configure
82d9ace8b3SJuan Quintela# We don't generate any of them
83d9ace8b3SJuan QuintelaMakefile: ;
84d9ace8b3SJuan Quintelaconfigure: ;
85d9ace8b3SJuan Quintela
86818220f5Saliguori.PHONY: all clean cscope distclean dvi html info install install-doc \
87d41d4da3SFam Zheng	pdf recurse-all speed test dist msi FORCE
880cb3fb1eSpbrook
89fec90ff0SPaolo Bonzini$(call set-vpath, $(SRC_PATH))
908c462f8fSpbrook
913e2e0e6bSJuan QuintelaLIBS+=-lz $(LIBS_TOOLS)
9267c0f08dSJuan Quintela
937b93fadfSCorey BryantHELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)
947b93fadfSCorey Bryant
95cc8ae6deSpbrookifdef BUILD_DOCS
96665b5d0dSMarc-André LureauDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8
97983eef5aSMeador Ingeifdef CONFIG_VIRTFS
98a2d8f1beSM. Mohan KumarDOCS+=fsdev/virtfs-proxy-helper.1
99983eef5aSMeador Ingeendif
100cc8ae6deSpbrookelse
101cc8ae6deSpbrookDOCS=
102cc8ae6deSpbrookendif
1037d13299dSbellard
104388d4758SLluís VilanovaSUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR)
1051f3d3c8fSJuan QuintelaSUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
10688070801SAndreas FärberSUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
1071f3d3c8fSJuan Quintela
1088bdd3d49SStefan Weilifeq ($(SUBDIR_DEVICES_MAK),)
1098bdd3d49SStefan Weilconfig-all-devices.mak:
1108bdd3d49SStefan Weil	$(call quiet-command,echo '# no devices' > $@,"  GEN   $@")
1118bdd3d49SStefan Weilelse
1121f3d3c8fSJuan Quintelaconfig-all-devices.mak: $(SUBDIR_DEVICES_MAK)
113bb585a78SPaolo Bonzini	$(call quiet-command, sed -n \
114bb585a78SPaolo Bonzini             's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
115bb585a78SPaolo Bonzini             $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
116bb585a78SPaolo Bonzini             "  GEN   $@")
1178bdd3d49SStefan Weilendif
1181f3d3c8fSJuan Quintela
119bd9141bbSPaul Brook-include $(SUBDIR_DEVICES_MAK_DEP)
120bd9141bbSPaul Brook
1210ab0c998SPaolo Bonzini%/config-devices.mak: default-configs/%.mak $(SRC_PATH)/scripts/make_device_config.sh
12215564d85SPaolo Bonzini	$(call quiet-command, \
12315564d85SPaolo Bonzini            $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > $@.tmp, "  GEN   $@.tmp")
12412ccfec9SMichael S. Tsirkin	$(call quiet-command, if test -f $@; then \
125904fe1fbSBlue Swirl	  if cmp -s $@.old $@; then \
126012f0879SStefan Weil	    mv $@.tmp $@; \
127012f0879SStefan Weil	    cp -p $@ $@.old; \
128012f0879SStefan Weil	  else \
129012f0879SStefan Weil	    if test -f $@.old; then \
130012f0879SStefan Weil	      echo "WARNING: $@ (user modified) out of date.";\
131012f0879SStefan Weil	    else \
132a992fe3dSPaul Brook	      echo "WARNING: $@ out of date.";\
133012f0879SStefan Weil	    fi; \
13463e86b2eSStefan Weil	    echo "Run \"make defconfig\" to regenerate."; \
135a992fe3dSPaul Brook	    rm $@.tmp; \
136012f0879SStefan Weil	  fi; \
137a992fe3dSPaul Brook	 else \
138a992fe3dSPaul Brook	  mv $@.tmp $@; \
139012f0879SStefan Weil	  cp -p $@ $@.old; \
14012ccfec9SMichael S. Tsirkin	 fi, "  GEN   $@");
141a992fe3dSPaul Brook
142a992fe3dSPaul Brookdefconfig:
143a992fe3dSPaul Brook	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
144a992fe3dSPaul Brook
145992aeb8eSPaolo Bonziniifneq ($(wildcard config-host.mak),)
146992aeb8eSPaolo Bonziniinclude $(SRC_PATH)/Makefile.objs
147ba1183daSFam Zhengendif
148ba1183daSFam Zheng
149ba1183daSFam Zhengdummy := $(call unnest-vars,, \
150ba1183daSFam Zheng                stub-obj-y \
151ba1183daSFam Zheng                util-obj-y \
152ba1183daSFam Zheng                qga-obj-y \
153a75eb03bSDavid Marchand                ivshmem-client-obj-y \
154a75eb03bSDavid Marchand                ivshmem-server-obj-y \
155577a6723STomoki Sekiyama                qga-vss-dll-obj-y \
156ba1183daSFam Zheng                block-obj-y \
157cc475698SFam Zheng                block-obj-m \
158fb37726dSDaniel P. Berrange                crypto-obj-y \
159fb37726dSDaniel P. Berrange                crypto-aes-obj-y \
1600c7012e0SDaniel P. Berrange                qom-obj-y \
161666a3af9SDaniel P. Berrange                io-obj-y \
162cc475698SFam Zheng                common-obj-y \
163cc475698SFam Zheng                common-obj-m)
164ba1183daSFam Zheng
165ba1183daSFam Zhengifneq ($(wildcard config-host.mak),)
16646e7b706SFam Zhenginclude $(SRC_PATH)/tests/Makefile.include
167992aeb8eSPaolo Bonziniendif
168992aeb8eSPaolo Bonzini
16917969268SFam Zhengall: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules
170b9dea4fbSpbrook
17167a1de0dSFam Zhengqemu-version.h: FORCE
17267a1de0dSFam Zheng	$(call quiet-command, \
17367a1de0dSFam Zheng		(cd $(SRC_PATH); \
17467a1de0dSFam Zheng		printf '#define QEMU_PKGVERSION '; \
17567a1de0dSFam Zheng		if test -n "$(PKGVERSION)"; then \
17667a1de0dSFam Zheng			printf '"$(PKGVERSION)"\n'; \
17767a1de0dSFam Zheng		else \
17867a1de0dSFam Zheng			if test -d .git; then \
17967a1de0dSFam Zheng				printf '" ('; \
18067a1de0dSFam Zheng				git describe --match 'v*' 2>/dev/null | tr -d '\n'; \
18167a1de0dSFam Zheng				if ! git diff-index --quiet HEAD &>/dev/null; then \
18267a1de0dSFam Zheng					printf -- '-dirty'; \
18367a1de0dSFam Zheng				fi; \
18467a1de0dSFam Zheng				printf ')"\n'; \
18567a1de0dSFam Zheng			else \
18667a1de0dSFam Zheng				printf '""\n'; \
18767a1de0dSFam Zheng			fi; \
18867a1de0dSFam Zheng		fi) > $@.tmp)
189540aecd0SSean Bruno	$(call quiet-command, cmp -s $@ $@.tmp || mv $@.tmp $@)
19067a1de0dSFam Zheng
1911215c6e7SJuan Quintelaconfig-host.h: config-host.h-timestamp
1921215c6e7SJuan Quintelaconfig-host.h-timestamp: config-host.mak
193077de81aSPaolo Bonziniqemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
1944c3b5a48SBlue Swirl	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
1951215c6e7SJuan Quintela
196cec7d0b6SpbrookSUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
197916359f6SAndreas FärberSOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
198916359f6SAndreas Färber
19957f45b62SStefan Weil$(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
200fb37726dSDaniel P. Berrange$(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
201666a3af9SDaniel P. Berrange$(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
202916359f6SAndreas Färber$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
203cec7d0b6Spbrook
2044115852bSPaolo Bonzinisubdir-%:
2050087375eSPaul Brook	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
2064aa42531Spbrook
207e2134eb9SGerd Hoffmannsubdir-pixman: pixman/Makefile
208e2134eb9SGerd Hoffmann	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pixman V="$(V)" all,)
209e2134eb9SGerd Hoffmann
210e2134eb9SGerd Hoffmannpixman/Makefile: $(SRC_PATH)/pixman/configure
211f9943cd5SGerd Hoffmann	(cd pixman; CFLAGS="$(CFLAGS) -fPIC $(extra_cflags) $(extra_ldflags)" $(SRC_PATH)/pixman/configure $(AUTOCONF_HOST) --disable-gtk --disable-shared --enable-static)
212e2134eb9SGerd Hoffmann
213e2134eb9SGerd Hoffmann$(SRC_PATH)/pixman/configure:
214e2134eb9SGerd Hoffmann	(cd $(SRC_PATH)/pixman; autoreconf -v --install)
215e2134eb9SGerd Hoffmann
216a540f158SPeter CrosthwaiteDTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
217965f486cSPeter MaydellDTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
218965f486cSPeter MaydellDTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
219a540f158SPeter Crosthwaite
220a540f158SPeter Crosthwaitesubdir-dtc:dtc/libfdt dtc/tests
221965f486cSPeter 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,)
222a540f158SPeter Crosthwaite
223a540f158SPeter Crosthwaitedtc/%:
224a540f158SPeter Crosthwaite	mkdir -p $@
225a540f158SPeter Crosthwaite
22657f54629SDaniel P. Berrange$(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
227add16157SBlue Swirl
228c05ac895SPaul BrookROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
229a9c87304SMarc-André Lureau# Only keep -O and -g cflags
230c05ac895SPaul Brookromsubdir-%:
231a9c87304SMarc-André Lureau	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
232c05ac895SPaul Brook
233c05ac895SPaul BrookALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
234c05ac895SPaul Brook
235c05ac895SPaul Brookrecurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
2364aa42531Spbrook
23723cab7b7SVasily Efimov$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h | $(BUILD_DIR)/version.lo
2387e75e33eSStefan Weil	$(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"  RC    version.o")
23923cab7b7SVasily Efimov$(BUILD_DIR)/version.lo: $(SRC_PATH)/version.rc config-host.h
2407e75e33eSStefan Weil	$(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"  RC    version.lo")
2415354e4d2SMarc-André Lureau
242fba90ac1SPaolo BonziniMakefile: $(version-obj-y) $(version-lobj-y)
2433bc2f570SPaolo Bonzini
2443bc2f570SPaolo Bonzini######################################################################
2458a090705SPaolo Bonzini# Build libraries
2463bc2f570SPaolo Bonzini
2473bc2f570SPaolo Bonzinilibqemustub.a: $(stub-obj-y)
248169a24aeSFam Zhenglibqemuutil.a: $(util-obj-y)
2493bc2f570SPaolo Bonzini
250e26110cfSFam Zhengblock-modules = $(foreach o,$(block-obj-m),"$(basename $(subst /,-,$o))",) NULL
251e26110cfSFam Zhengutil/module.o-cflags = -D'CONFIG_BLOCK_MODULES=$(block-modules)'
252e26110cfSFam Zheng
2534fb240a4Sbellard######################################################################
2544fb240a4Sbellard
2553c089e15SJuan Quintelaqemu-img.o: qemu-img-cmds.h
256153859beSStuart Brady
257064097d9SDaniel P. Berrangeqemu-img$(EXESUF): qemu-img.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) libqemuutil.a libqemustub.a
258064097d9SDaniel P. Berrangeqemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) libqemuutil.a libqemustub.a
259064097d9SDaniel P. Berrangeqemu-io$(EXESUF): qemu-io.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) libqemuutil.a libqemustub.a
2600a8e1acdSaliguori
261a2d96af4SDaniel P. Berrangeqemu-bridge-helper$(EXESUF): qemu-bridge-helper.o libqemuutil.a libqemustub.a
2627b93fadfSCorey Bryant
2632209bd05SWei Liufsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o libqemuutil.a libqemustub.a
26417bff52bSM. Mohan Kumarfsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
26517bff52bSM. Mohan Kumar
266077de81aSPaolo Bonziniqemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
2674c3b5a48SBlue Swirl	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
268153859beSStuart Brady
269957f1f99SMichael Rothqemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
27054c2e502SDunrong Huangqemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
271640e5404SMichael Roth
27219bf7c87SAvi Kivitygen-out-type = $(subst .,-,$(suffix $@))
2738d3bc517SAvi Kivity
2740521d375SStefan Hajnocziqapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
2750521d375SStefan Hajnoczi
27654c2e502SDunrong Huangqga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
2772870dc34SPaolo Bonzini$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
2780a607749SLluís Vilanova	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
27916d80f61SMarkus Armbruster		$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
2800a607749SLluís Vilanova		"  GEN   $@")
28154c2e502SDunrong Huangqga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
2822870dc34SPaolo Bonzini$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
2830a607749SLluís Vilanova	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
28416d80f61SMarkus Armbruster		$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
2850a607749SLluís Vilanova		"  GEN   $@")
28654c2e502SDunrong Huangqga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
2872870dc34SPaolo Bonzini$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
2880a607749SLluís Vilanova	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
28916d80f61SMarkus Armbruster		$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
2900a607749SLluís Vilanova		"  GEN   $@")
291e3d4d252SMichael Roth
292be13d46dSMax Reitzqapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
293f668470fSWenchao Xia               $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
29448befbc3SDaniel P. Berrange               $(SRC_PATH)/qapi/event.json $(SRC_PATH)/qapi/introspect.json \
295423aeaf2SLluís Vilanova               $(SRC_PATH)/qapi/crypto.json $(SRC_PATH)/qapi/rocker.json \
296423aeaf2SLluís Vilanova               $(SRC_PATH)/qapi/trace.json
297be13d46dSMax Reitz
298599825c5SMichael S. Tsirkinqapi-types.c qapi-types.h :\
299be13d46dSMax Reitz$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
3000a607749SLluís Vilanova	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
30116d80f61SMarkus Armbruster		$(gen-out-type) -o "." -b $<, \
3020a607749SLluís Vilanova		"  GEN   $@")
303599825c5SMichael S. Tsirkinqapi-visit.c qapi-visit.h :\
304be13d46dSMax Reitz$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
3050a607749SLluís Vilanova	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
30616d80f61SMarkus Armbruster		$(gen-out-type) -o "." -b $<, \
3070a607749SLluís Vilanova		"  GEN   $@")
30821cd70dfSWenchao Xiaqapi-event.c qapi-event.h :\
30921cd70dfSWenchao Xia$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
31021cd70dfSWenchao Xia	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
31116d80f61SMarkus Armbruster		$(gen-out-type) -o "." $<, \
31221cd70dfSWenchao Xia		"  GEN   $@")
313599825c5SMichael S. Tsirkinqmp-commands.h qmp-marshal.c :\
314be13d46dSMax Reitz$(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
3150a607749SLluís Vilanova	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
316c823501eSMarc-André Lureau		$(gen-out-type) -o "." $<, \
3170a607749SLluís Vilanova		"  GEN   $@")
31839a18158SMarkus Armbrusterqmp-introspect.h qmp-introspect.c :\
31939a18158SMarkus Armbruster$(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
32039a18158SMarkus Armbruster	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
32139a18158SMarkus Armbruster		$(gen-out-type) -o "." $<, \
32239a18158SMarkus Armbruster		"  GEN   $@")
323e3193601SAnthony Liguori
32454c2e502SDunrong HuangQGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
3254115852bSPaolo Bonzini$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
326957f1f99SMichael Roth
327fafcaf1dSMichael Rothqemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
328fafcaf1dSMichael Roth	$(call LINK, $^)
32948ff7a62SMichael Roth
3309dacf32dSYossi Hindinifdef QEMU_GA_MSI_ENABLED
3319dacf32dSYossi HindinQEMU_GA_MSI=qemu-ga-$(ARCH).msi
3329dacf32dSYossi Hindin
3330a18750fSLeonid Blochmsi: $(QEMU_GA_MSI)
3349dacf32dSYossi Hindin
335fafcaf1dSMichael Roth$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
3369dacf32dSYossi Hindin
3379dacf32dSYossi Hindin$(QEMU_GA_MSI): config-host.mak
3389dacf32dSYossi Hindin
339decdfbd2SLeonid Bloch$(QEMU_GA_MSI):  $(SRC_PATH)/qga/installer/qemu-ga.wxs
340decdfbd2SLeonid Bloch	$(call quiet-command,QEMU_GA_VERSION="$(QEMU_GA_VERSION)" QEMU_GA_MANUFACTURER="$(QEMU_GA_MANUFACTURER)" QEMU_GA_DISTRO="$(QEMU_GA_DISTRO)" BUILD_DIR="$(BUILD_DIR)" \
3419dacf32dSYossi Hindin	wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<, "  WIXL  $@")
3429dacf32dSYossi Hindinelse
3439dacf32dSYossi Hindinmsi:
34415b19ed8SMichael Roth	@echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
3459dacf32dSYossi Hindinendif
3469dacf32dSYossi Hindin
347fafcaf1dSMichael Rothifneq ($(EXESUF),)
348fafcaf1dSMichael Roth.PHONY: qemu-ga
349fafcaf1dSMichael Rothqemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
350fafcaf1dSMichael Rothendif
351fafcaf1dSMichael Roth
352a2d96af4SDaniel P. Berrangeivshmem-client$(EXESUF): $(ivshmem-client-obj-y) libqemuutil.a libqemustub.a
353a75eb03bSDavid Marchand	$(call LINK, $^)
354a75eb03bSDavid Marchandivshmem-server$(EXESUF): $(ivshmem-server-obj-y) libqemuutil.a libqemustub.a
355a75eb03bSDavid Marchand	$(call LINK, $^)
356a75eb03bSDavid Marchand
357*0c0c1fd9SMarc Marimodule_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
358*0c0c1fd9SMarc Mari	$(call quiet-command,$(PYTHON) $< $@ \
359*0c0c1fd9SMarc Mari	$(addprefix $(SRC_PATH)/,$(patsubst %.mo,%.c,$(block-obj-m))), \
360*0c0c1fd9SMarc Mari	"  GEN   $@")
361*0c0c1fd9SMarc Mari
36231e31b8aSbellardclean:
3632d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files
36425be210fSJuan 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
365df2943baSMichael S. Tsirkin	rm -f qemu-options.def
3669dacf32dSYossi Hindin	rm -f *.msi
367f4b11eeeSFam Zheng	find . \( -name '*.l[oa]' -o -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} +
368b39297aeSTomoki Sekiyama	rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
3698b6bfc77SStefan Weil	rm -f fsdev/*.pod
3708b6bfc77SStefan Weil	rm -rf .libs */.libs
37107b44ce9SBlue Swirl	rm -f qemu-img-cmds.h
372d98bc0b6SGerd Hoffmann	rm -f ui/shader/*-vert.h ui/shader/*-frag.h
37319ac36b5SLluís Vilanova	@# May not be present in GENERATED_HEADERS
374eac236eaSLluís Vilanova	rm -f trace/generated-tracers-dtrace.dtrace*
375eac236eaSLluís Vilanova	rm -f trace/generated-tracers-dtrace.h*
37619ac36b5SLluís Vilanova	rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
37719ac36b5SLluís Vilanova	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
3788f0e5c6bSStefan Weil	rm -rf qapi-generated
37954c2e502SDunrong Huang	rm -rf qga/qapi-generated
380781c0c33SStefan Hajnoczi	for d in $(ALL_SUBDIRS); do \
381fc8e320eSMagnus Damm	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
382df2943baSMichael S. Tsirkin	rm -f $$d/qemu-options.def; \
383626df76aSbellard        done
384168340b6SPeter Maydell	rm -f $(SUBDIR_DEVICES_MAK) config-all-devices.mak
38531e31b8aSbellard
38634bb443eSAnthony LiguoriVERSION ?= $(shell cat VERSION)
38734bb443eSAnthony Liguori
38834bb443eSAnthony Liguoridist: qemu-$(VERSION).tar.bz2
38934bb443eSAnthony Liguori
39034bb443eSAnthony Liguoriqemu-%.tar.bz2:
39134bb443eSAnthony Liguori	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
39234bb443eSAnthony Liguori
3937d13299dSbellarddistclean: clean
3942cd8af2dSPavel Butsykin	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
395ae219359SThomas Huth	rm -f config-all-devices.mak config-all-disas.mak config.status
396ae219359SThomas Huth	rm -f po/*.mo tests/qemu-iotests/common.env
397fc8e320eSMagnus Damm	rm -f roms/seabios/config.mak roms/vgabios/config.mak
3987a734b8fSBrad Hards	rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps qemu-doc.dvi
3997a734b8fSBrad Hards	rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
4007a734b8fSBrad Hards	rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
4017a734b8fSBrad Hards	rm -f qemu-doc.vr
402793553acSAlexandre Raymond	rm -f config.log
40367ed96f9SPeter Maydell	rm -f linux-headers/asm
404e1a068b2SHidetoshi 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
4058e98e2e8SPaolo Bonzini	for d in $(TARGET_DIRS); do \
406bc1b050dSbellard	rm -rf $$d || exit 1 ; \
40776bc6838Sbellard        done
408d9840e25STomoki Sekiyama	rm -Rf .sdk
409fb8597bbSEd Maste	if test -f pixman/config.log; then $(MAKE) -C pixman distclean; fi
410fb8597bbSEd Maste	if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
4117d13299dSbellard
412fed4a9adSbellardKEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
413fed4a9adSbellardar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
414471fbf4aSFrédéric Boiteuxcommon  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr \
4153751e722SJan Krupabepo    cz
416fed4a9adSbellard
41777755340Sthsifdef INSTALL_BLOBS
4183b1154ffSGerd HoffmannBLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
4197a4dfd1eSGerd Hoffmannvgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
42075fb3d28SEduardo Habkostacpi-dsdt.aml \
4219eb08a43SMark Cave-Aylandppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
4225ee8ad71SAlex Williamsonpxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
4235ee8ad71SAlex Williamsonpxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
4249fd02979SSander Eikelenboomefi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
4259fd02979SSander Eikelenboomefi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
42645027808SGerd Hoffmannefi-e1000e.rom efi-vmxnet3.rom \
427f7da9c17SAnthony Liguoriqemu-icon.bmp qemu_logo_no_text.svg \
42800914b7dSMichal Simekbamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
429b2a575a1SMarc Marímultiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \
4300c1fecddSAlexander Grafs390-ccw.img \
431753d11f2SRichard Hendersonspapr-rtas.bin slof.bin \
4320c6ab8c9SCole Robinsonpalcode-clipper \
4330c6ab8c9SCole Robinsonu-boot.e500
43477755340Sthselse
43577755340SthsBLOBS=
43677755340Sthsendif
43777755340Sths
43838954dcaSpbrookinstall-doc: $(DOCS)
439d7dd65baSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
440d7dd65baSEduardo Habkost	$(INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(qemu_docdir)"
441a008535bSRiku Voipio	$(INSTALL_DATA) $(SRC_PATH)/docs/qmp-commands.txt "$(DESTDIR)$(qemu_docdir)"
44296d409ebSJuan Quintelaifdef CONFIG_POSIX
44358f8aeadSaliguori	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
4448a3e8f7fSAndreas Färber	$(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
4458a3e8f7fSAndreas Färberifneq ($(TOOLS),)
4468a3e8f7fSAndreas Färber	$(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
44758f8aeadSaliguori	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
44858f8aeadSaliguori	$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
44938954dcaSpbrookendif
450665b5d0dSMarc-André Lureauifneq (,$(findstring qemu-ga,$(TOOLS)))
451665b5d0dSMarc-André Lureau	$(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
452665b5d0dSMarc-André Lureauendif
4538a3e8f7fSAndreas Färberendif
454a2d8f1beSM. Mohan Kumarifdef CONFIG_VIRTFS
455a2d8f1beSM. Mohan Kumar	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
456a2d8f1beSM. Mohan Kumar	$(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
457a2d8f1beSM. Mohan Kumarendif
458b5ec5ce0Sjohn cooper
459e2d87bffSEduardo Habkostinstall-datadir:
460e2d87bffSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
461e2d87bffSEduardo Habkost
462f2e3978bSLaszlo Ersekinstall-localstatedir:
463f2e3978bSLaszlo Ersekifdef CONFIG_POSIX
464f2e3978bSLaszlo Ersekifneq (,$(findstring qemu-ga,$(TOOLS)))
465f2e3978bSLaszlo Ersek	$(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
466f2e3978bSLaszlo Ersekendif
467f2e3978bSLaszlo Ersekendif
468f2e3978bSLaszlo Ersek
469e2d87bffSEduardo Habkost
4701b93c9a1SIkey Dohertyinstall: all $(if $(BUILD_DOCS),install-doc) \
471f2e3978bSLaszlo Ersekinstall-datadir install-localstatedir
472932a79dfSthsifneq ($(TOOLS),)
47368aa262aSMichael Roth	$(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
474932a79dfSthsendif
475e3be6f0eSFam Zhengifneq ($(CONFIG_MODULES),)
476e3be6f0eSFam Zheng	$(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
4772115182fSMichael Tokarev	for s in $(modules-m:.mo=$(DSOSUF)); do \
4782115182fSMichael Tokarev		t="$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
479264f8b4fSMichael Tokarev		$(INSTALL_LIB) $$s "$$t"; \
4802115182fSMichael Tokarev		test -z "$(STRIP)" || $(STRIP) "$$t"; \
481e3be6f0eSFam Zheng	done
482e3be6f0eSFam Zhengendif
4837b93fadfSCorey Bryantifneq ($(HELPERS-y),)
4840d659426SMichael Tokarev	$(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
4857b93fadfSCorey Bryantendif
48677755340Sthsifneq ($(BLOBS),)
48777755340Sths	set -e; for x in $(BLOBS); do \
4886aae2a2eSEduardo Habkost		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
489ad064840Spbrook	done
49077755340Sthsendif
491834574eaSAnthony Liguoriifeq ($(CONFIG_GTK),y)
492834574eaSAnthony Liguori	$(MAKE) -C po $@
493834574eaSAnthony Liguoriendif
4946aae2a2eSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
49518be8d77Sblueswir1	set -e; for x in $(KEYMAPS); do \
4966aae2a2eSEduardo Habkost		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
497ad064840Spbrook	done
4981412cf58SDaniel P. Berrange	$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
499626df76aSbellard	for d in $(TARGET_DIRS); do \
5006570025eSLluís Vilanova	$(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
501626df76aSbellard        done
502612384d7Sbellard
503367e86e8Sbellard# various test targets
5049b0b8203Sbellardtest speed: all
505c09015ddSAnthony Liguori	$(MAKE) -C tests/tcg $@
50631e31b8aSbellard
507ae5fdc81SFam Zheng.PHONY: ctags
508ae5fdc81SFam Zhengctags:
509ac99c624SSergey Fedorov	rm -f tags
510ae5fdc81SFam Zheng	find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
511ae5fdc81SFam Zheng
51221d4e8e3SAlexandre Bique.PHONY: TAGS
513367e86e8SbellardTAGS:
514ac99c624SSergey Fedorov	rm -f TAGS
515b1999e87SDavid Gibson	find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
51631e31b8aSbellard
5176688bc6dSbellardcscope:
518eaa2ddbbSFam Zheng	rm -f "$(SRC_PATH)"/cscope.*
519eaa2ddbbSFam Zheng	find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
520eaa2ddbbSFam Zheng	cscope -b -i"$(SRC_PATH)/cscope.files"
5216688bc6dSbellard
522d98bc0b6SGerd Hoffmann# opengl shader programs
523d98bc0b6SGerd Hoffmannui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
524d98bc0b6SGerd Hoffmann	@mkdir -p $(dir $@)
525d98bc0b6SGerd Hoffmann	$(call quiet-command,\
526d98bc0b6SGerd Hoffmann		perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
527d98bc0b6SGerd Hoffmann		"  VERT  $@")
528d98bc0b6SGerd Hoffmann
529d98bc0b6SGerd Hoffmannui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
530d98bc0b6SGerd Hoffmann	@mkdir -p $(dir $@)
531d98bc0b6SGerd Hoffmann	$(call quiet-command,\
532d98bc0b6SGerd Hoffmann		perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
533d98bc0b6SGerd Hoffmann		"  FRAG  $@")
534d98bc0b6SGerd Hoffmann
535cd2bc889SGerd Hoffmannui/console-gl.o: $(SRC_PATH)/ui/console-gl.c \
536cd2bc889SGerd Hoffmann	ui/shader/texture-blit-vert.h ui/shader/texture-blit-frag.h
537cd2bc889SGerd Hoffmann
5383ef693a0Sbellard# documentation
53901668d98SStefan WeilMAKEINFO=makeinfo
54001668d98SStefan WeilMAKEINFOFLAGS=--no-headers --no-split --number-sections
54120cc9997SStefan WeilTEXIFLAG=$(if $(V),,--quiet)
54220cc9997SStefan Weil%.dvi: %.texi
54320cc9997SStefan Weil	$(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<,"  GEN   $@")
54420cc9997SStefan Weil
5451f673135Sbellard%.html: %.texi
546952ef67cSStefan Weil	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \
54701668d98SStefan Weil	"  GEN   $@")
5483ef693a0Sbellard
549f3548328Sbellard%.info: %.texi
55001668d98SStefan Weil	$(call quiet-command,$(MAKEINFO) $< -o $@,"  GEN   $@")
551f3548328Sbellard
55220cc9997SStefan Weil%.pdf: %.texi
55320cc9997SStefan Weil	$(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<,"  GEN   $@")
5545824d651Sblueswir1
555077de81aSPaolo Bonziniqemu-options.texi: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
5564c3b5a48SBlue Swirl	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
557f3548328Sbellard
558077de81aSPaolo Bonziniqemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
5594c3b5a48SBlue Swirl	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
5602313086aSBlue Swirl
561077de81aSPaolo Bonziniqemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
5622cd8af2dSPavel Butsykin	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
5632cd8af2dSPavel Butsykin
564077de81aSPaolo Bonziniqemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
5654c3b5a48SBlue Swirl	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
566153859beSStuart Brady
5672cd8af2dSPavel Butsykinqemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
5680d00e563Saliguori	$(call quiet-command, \
5694c3b5a48SBlue Swirl	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
5703179d694SMichael Tokarev	  $(POD2MAN) --section=1 --center=" " --release=" " qemu.pod > $@, \
5710d00e563Saliguori	  "  GEN   $@")
572eeb2b8f7SDenis V. Lunevqemu.1: qemu-option-trace.texi
5735a67135aSbellard
57406a1e0c1SDenis V. Lunevqemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
5750d00e563Saliguori	$(call quiet-command, \
5764c3b5a48SBlue Swirl	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-img.pod && \
5773179d694SMichael Tokarev	  $(POD2MAN) --section=1 --center=" " --release=" " qemu-img.pod > $@, \
5780d00e563Saliguori	  "  GEN   $@")
579acd935efSbellard
580a2d8f1beSM. Mohan Kumarfsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
581a2d8f1beSM. Mohan Kumar	$(call quiet-command, \
582a2d8f1beSM. Mohan Kumar	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< fsdev/virtfs-proxy-helper.pod && \
5833179d694SMichael Tokarev	  $(POD2MAN) --section=1 --center=" " --release=" " fsdev/virtfs-proxy-helper.pod > $@, \
584a2d8f1beSM. Mohan Kumar	  "  GEN   $@")
585a2d8f1beSM. Mohan Kumar
58639ca463eSDenis V. Lunevqemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
5870d00e563Saliguori	$(call quiet-command, \
5884c3b5a48SBlue Swirl	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-nbd.pod && \
5893179d694SMichael Tokarev	  $(POD2MAN) --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
5900d00e563Saliguori	  "  GEN   $@")
5917a5ca864Sbellard
592665b5d0dSMarc-André Lureauqemu-ga.8: qemu-ga.texi
593665b5d0dSMarc-André Lureau	$(call quiet-command, \
594665b5d0dSMarc-André Lureau	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-ga.pod && \
595665b5d0dSMarc-André Lureau	  $(POD2MAN) --section=8 --center=" " --release=" " qemu-ga.pod > $@, \
596665b5d0dSMarc-André Lureau	  "  GEN   $@")
597665b5d0dSMarc-André Lureau
5980cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi
5990cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html
60020cc9997SStefan Weilinfo: qemu-doc.info qemu-tech.info
60120cc9997SStefan Weilpdf: qemu-doc.pdf qemu-tech.pdf
6020cb3fb1eSpbrook
60320cc9997SStefan Weilqemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
604eeb2b8f7SDenis V. Lunev	qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \
6052cd8af2dSPavel Butsykin	qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
6062cd8af2dSPavel Butsykin	qemu-monitor-info.texi
607818220f5Saliguori
608f53ec699SStefan Weilifdef CONFIG_WIN32
609f53ec699SStefan Weil
610f53ec699SStefan WeilINSTALLER = qemu-setup-$(VERSION)$(EXESUF)
611f53ec699SStefan Weil
612f53ec699SStefan Weilnsisflags = -V2 -NOCD
613f53ec699SStefan Weil
614f53ec699SStefan Weilifneq ($(wildcard $(SRC_PATH)/dll),)
615f53ec699SStefan Weilifeq ($(ARCH),x86_64)
616f53ec699SStefan Weil# 64 bit executables
617f53ec699SStefan WeilDLL_PATH = $(SRC_PATH)/dll/w64
618f53ec699SStefan Weilnsisflags += -DW64
619f53ec699SStefan Weilelse
620f53ec699SStefan Weil# 32 bit executables
621f53ec699SStefan WeilDLL_PATH = $(SRC_PATH)/dll/w32
622f53ec699SStefan Weilendif
623f53ec699SStefan Weilendif
624f53ec699SStefan Weil
625f53ec699SStefan Weil.PHONY: installer
626f53ec699SStefan Weilinstaller: $(INSTALLER)
627f53ec699SStefan Weil
628f53ec699SStefan WeilINSTDIR=/tmp/qemu-nsis
629f53ec699SStefan Weil
630f53ec699SStefan Weil$(INSTALLER): $(SRC_PATH)/qemu.nsi
631fb8597bbSEd Maste	$(MAKE) install prefix=${INSTDIR}
632f53ec699SStefan Weilifdef SIGNCODE
633f53ec699SStefan Weil	(cd ${INSTDIR}; \
634f53ec699SStefan Weil         for i in *.exe; do \
635f53ec699SStefan Weil           $(SIGNCODE) $${i}; \
636f53ec699SStefan Weil         done \
637f53ec699SStefan Weil        )
638f53ec699SStefan Weilendif # SIGNCODE
639f53ec699SStefan Weil	(cd ${INSTDIR}; \
640f53ec699SStefan Weil         for i in qemu-system-*.exe; do \
641f53ec699SStefan Weil           arch=$${i%.exe}; \
642f53ec699SStefan Weil           arch=$${arch#qemu-system-}; \
643f53ec699SStefan Weil           echo Section \"$$arch\" Section_$$arch; \
644f53ec699SStefan Weil           echo SetOutPath \"\$$INSTDIR\"; \
645f53ec699SStefan Weil           echo File \"\$${BINDIR}\\$$i\"; \
646f53ec699SStefan Weil           echo SectionEnd; \
647f53ec699SStefan Weil         done \
648f53ec699SStefan Weil        ) >${INSTDIR}/system-emulations.nsh
649f53ec699SStefan Weil	makensis $(nsisflags) \
650f53ec699SStefan Weil                $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
651f53ec699SStefan Weil                $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
652f53ec699SStefan Weil                -DBINDIR="${INSTDIR}" \
653f53ec699SStefan Weil                $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
654f53ec699SStefan Weil                -DSRCDIR="$(SRC_PATH)" \
655f53ec699SStefan Weil                -DOUTFILE="$(INSTALLER)" \
656805d8a67SStefan Weil                -DDISPLAYVERSION="$(VERSION)" \
657f53ec699SStefan Weil                $(SRC_PATH)/qemu.nsi
658f53ec699SStefan Weil	rm -r ${INSTDIR}
659f53ec699SStefan Weilifdef SIGNCODE
660f53ec699SStefan Weil	$(SIGNCODE) $(INSTALLER)
661f53ec699SStefan Weilendif # SIGNCODE
662f53ec699SStefan Weilendif # CONFIG_WIN
663f53ec699SStefan Weil
664cb5fc67dSAnthony Liguori# Add a dependency on the generated files, so that they are always
665cb5fc67dSAnthony Liguori# rebuilt before other object files
666eaa2ddbbSFam Zhengifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
667cb5fc67dSAnthony LiguoriMakefile: $(GENERATED_HEADERS)
6687748b8cbSMike Frysingerendif
669cb5fc67dSAnthony Liguori
6704fb240a4Sbellard# Include automatically generated dependency files
6711435ddb8SPaolo Bonzini# Dependencies in Makefile.objs files come from our recursive subdir rules
6721435ddb8SPaolo Bonzini-include $(wildcard *.d tests/*.d)
673324027c2SFam Zheng
674324027c2SFam Zhenginclude $(SRC_PATH)/tests/docker/Makefile.include
6750d8e065fSMarc-André Lureau
6760d8e065fSMarc-André Lureau.PHONY: help
6770d8e065fSMarc-André Lureauhelp:
6780d8e065fSMarc-André Lureau	@echo  'Generic targets:'
6790d8e065fSMarc-André Lureau	@echo  '  all             - Build all'
6800d8e065fSMarc-André Lureau	@echo  '  dir/file.o      - Build specified target only'
6810d8e065fSMarc-André Lureau	@echo  '  install         - Install QEMU, documentation and tools'
6820d8e065fSMarc-André Lureau	@echo  '  ctags/TAGS      - Generate tags file for editors'
6830d8e065fSMarc-André Lureau	@echo  '  cscope          - Generate cscope index'
6840d8e065fSMarc-André Lureau	@echo  ''
6850d8e065fSMarc-André Lureau	@$(if $(TARGET_DIRS), \
6860d8e065fSMarc-André Lureau		echo 'Architecture specific targets:'; \
6870d8e065fSMarc-André Lureau		$(foreach t, $(TARGET_DIRS), \
6880d8e065fSMarc-André Lureau		printf "  %-30s - Build for %s\\n" $(patsubst %,subdir-%,$(t)) $(t);) \
6890d8e065fSMarc-André Lureau		echo '')
6900d8e065fSMarc-André Lureau	@echo  'Cleaning targets:'
6910d8e065fSMarc-André Lureau	@echo  '  clean           - Remove most generated files but keep the config'
6920d8e065fSMarc-André Lureau	@echo  '  distclean       - Remove all generated files'
6930d8e065fSMarc-André Lureau	@echo  '  dist            - Build a distributable tarball'
6940d8e065fSMarc-André Lureau	@echo  ''
6950d8e065fSMarc-André Lureau	@echo  'Test targets:'
6960d8e065fSMarc-André Lureau	@echo  '  check           - Run all tests (check-help for details)'
6970d8e065fSMarc-André Lureau	@echo  '  docker          - Help about targets running tests inside Docker containers'
6980d8e065fSMarc-André Lureau	@echo  ''
6990d8e065fSMarc-André Lureau	@echo  'Documentation targets:'
7000d8e065fSMarc-André Lureau	@echo  '  dvi html info pdf'
7010d8e065fSMarc-André Lureau	@echo  '                  - Build documentation in specified format'
7020d8e065fSMarc-André Lureau	@echo  ''
7030d8e065fSMarc-André Lureauifdef CONFIG_WIN32
7040d8e065fSMarc-André Lureau	@echo  'Windows targets:'
7050d8e065fSMarc-André Lureau	@echo  '  installer       - Build NSIS-based installer for qemu-ga'
7060d8e065fSMarc-André Lureauifdef QEMU_GA_MSI_ENABLED
7070d8e065fSMarc-André Lureau	@echo  '  msi             - Build MSI-based installer for qemu-ga'
7080d8e065fSMarc-André Lureauendif
7090d8e065fSMarc-André Lureau	@echo  ''
7100d8e065fSMarc-André Lureauendif
7110d8e065fSMarc-André Lureau	@echo  '  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
712