xref: /openbmc/qemu/Makefile (revision f7da9c17)
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
31e5efe7f5SJuan Quintela	@sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
3255d7e8f6Saurel32else
3355d7e8f6Saurel32config-host.mak:
347748b8cbSMike Frysingerifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
3555d7e8f6Saurel32	@echo "Please call configure before running make!"
3655d7e8f6Saurel32	@exit 1
3755d7e8f6Saurel32endif
387748b8cbSMike Frysingerendif
39766a487aSbellard
40eac236eaSLluís VilanovaGENERATED_HEADERS = config-host.h qemu-options.def
41250b086eSLluís VilanovaGENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h
42eac236eaSLluís VilanovaGENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c
43eac236eaSLluís Vilanova
4445be2f5dSLluís VilanovaGENERATED_HEADERS += trace/generated-events.h
4545be2f5dSLluís VilanovaGENERATED_SOURCES += trace/generated-events.c
4645be2f5dSLluís Vilanova
47eac236eaSLluís VilanovaGENERATED_HEADERS += trace/generated-tracers.h
48eac236eaSLluís Vilanovaifeq ($(TRACE_BACKEND),dtrace)
49eac236eaSLluís VilanovaGENERATED_HEADERS += trace/generated-tracers-dtrace.h
50eac236eaSLluís Vilanovaendif
51eac236eaSLluís VilanovaGENERATED_SOURCES += trace/generated-tracers.c
52250b086eSLluís Vilanova
53d9ace8b3SJuan Quintela# Don't try to regenerate Makefile or configure
54d9ace8b3SJuan Quintela# We don't generate any of them
55d9ace8b3SJuan QuintelaMakefile: ;
56d9ace8b3SJuan Quintelaconfigure: ;
57d9ace8b3SJuan Quintela
58818220f5Saliguori.PHONY: all clean cscope distclean dvi html info install install-doc \
5934bb443eSAnthony Liguori	pdf recurse-all speed test dist
600cb3fb1eSpbrook
61fec90ff0SPaolo Bonzini$(call set-vpath, $(SRC_PATH))
628c462f8fSpbrook
633e2e0e6bSJuan QuintelaLIBS+=-lz $(LIBS_TOOLS)
6467c0f08dSJuan Quintela
657b93fadfSCorey BryantHELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)
667b93fadfSCorey Bryant
67cc8ae6deSpbrookifdef BUILD_DOCS
68b40292e7SJan KiszkaDOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
69983eef5aSMeador Ingeifdef CONFIG_VIRTFS
70a2d8f1beSM. Mohan KumarDOCS+=fsdev/virtfs-proxy-helper.1
71983eef5aSMeador Ingeendif
72cc8ae6deSpbrookelse
73cc8ae6deSpbrookDOCS=
74cc8ae6deSpbrookendif
757d13299dSbellard
76388d4758SLluís VilanovaSUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR)
771f3d3c8fSJuan QuintelaSUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
7888070801SAndreas FärberSUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
791f3d3c8fSJuan Quintela
808bdd3d49SStefan Weilifeq ($(SUBDIR_DEVICES_MAK),)
818bdd3d49SStefan Weilconfig-all-devices.mak:
828bdd3d49SStefan Weil	$(call quiet-command,echo '# no devices' > $@,"  GEN   $@")
838bdd3d49SStefan Weilelse
841f3d3c8fSJuan Quintelaconfig-all-devices.mak: $(SUBDIR_DEVICES_MAK)
85bb585a78SPaolo Bonzini	$(call quiet-command, sed -n \
86bb585a78SPaolo Bonzini             's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
87bb585a78SPaolo Bonzini             $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
88bb585a78SPaolo Bonzini             "  GEN   $@")
898bdd3d49SStefan Weilendif
901f3d3c8fSJuan Quintela
91bd9141bbSPaul Brook-include $(SUBDIR_DEVICES_MAK_DEP)
92bd9141bbSPaul Brook
93a992fe3dSPaul Brook%/config-devices.mak: default-configs/%.mak
944c3b5a48SBlue Swirl	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
95a992fe3dSPaul Brook	@if test -f $@; then \
96904fe1fbSBlue Swirl	  if cmp -s $@.old $@; then \
97012f0879SStefan Weil	    mv $@.tmp $@; \
98012f0879SStefan Weil	    cp -p $@ $@.old; \
99012f0879SStefan Weil	  else \
100012f0879SStefan Weil	    if test -f $@.old; then \
101012f0879SStefan Weil	      echo "WARNING: $@ (user modified) out of date.";\
102012f0879SStefan Weil	    else \
103a992fe3dSPaul Brook	      echo "WARNING: $@ out of date.";\
104012f0879SStefan Weil	    fi; \
10563e86b2eSStefan Weil	    echo "Run \"make defconfig\" to regenerate."; \
106a992fe3dSPaul Brook	    rm $@.tmp; \
107012f0879SStefan Weil	  fi; \
108a992fe3dSPaul Brook	 else \
109a992fe3dSPaul Brook	  mv $@.tmp $@; \
110012f0879SStefan Weil	  cp -p $@ $@.old; \
111a992fe3dSPaul Brook	 fi
112a992fe3dSPaul Brook
113a992fe3dSPaul Brookdefconfig:
114a992fe3dSPaul Brook	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
115a992fe3dSPaul Brook
116992aeb8eSPaolo Bonziniifneq ($(wildcard config-host.mak),)
117992aeb8eSPaolo Bonziniinclude $(SRC_PATH)/Makefile.objs
118992aeb8eSPaolo Bonziniinclude $(SRC_PATH)/tests/Makefile
119992aeb8eSPaolo Bonziniendif
120992aeb8eSPaolo Bonziniifeq ($(CONFIG_SMARTCARD_NSS),y)
121992aeb8eSPaolo Bonziniinclude $(SRC_PATH)/libcacard/Makefile
122992aeb8eSPaolo Bonziniendif
123992aeb8eSPaolo Bonzini
1248f67aa82SStefan Weilall: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all
125b9dea4fbSpbrook
1261215c6e7SJuan Quintelaconfig-host.h: config-host.h-timestamp
1271215c6e7SJuan Quintelaconfig-host.h-timestamp: config-host.mak
128e14056adSBlue Swirlqemu-options.def: $(SRC_PATH)/qemu-options.hx
1294c3b5a48SBlue Swirl	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
1301215c6e7SJuan Quintela
131cec7d0b6SpbrookSUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
132916359f6SAndreas FärberSOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
133916359f6SAndreas Färber
134916359f6SAndreas Färber$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
135cec7d0b6Spbrook
1364115852bSPaolo Bonzinisubdir-%:
1370087375eSPaul Brook	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
1384aa42531Spbrook
139e2134eb9SGerd Hoffmannsubdir-pixman: pixman/Makefile
140e2134eb9SGerd Hoffmann	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pixman V="$(V)" all,)
141e2134eb9SGerd Hoffmann
142e2134eb9SGerd Hoffmannpixman/Makefile: $(SRC_PATH)/pixman/configure
143f9943cd5SGerd Hoffmann	(cd pixman; CFLAGS="$(CFLAGS) -fPIC $(extra_cflags) $(extra_ldflags)" $(SRC_PATH)/pixman/configure $(AUTOCONF_HOST) --disable-gtk --disable-shared --enable-static)
144e2134eb9SGerd Hoffmann
145e2134eb9SGerd Hoffmann$(SRC_PATH)/pixman/configure:
146e2134eb9SGerd Hoffmann	(cd $(SRC_PATH)/pixman; autoreconf -v --install)
147e2134eb9SGerd Hoffmann
148a540f158SPeter CrosthwaiteDTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
149e3351000SPeter CrosthwaiteDTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS) -I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
150a540f158SPeter Crosthwaite
151a540f158SPeter Crosthwaitesubdir-dtc:dtc/libfdt dtc/tests
152e3351000SPeter Crosthwaite	$(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,)
153a540f158SPeter Crosthwaite
154a540f158SPeter Crosthwaitedtc/%:
155a540f158SPeter Crosthwaite	mkdir -p $@
156a540f158SPeter Crosthwaite
15782cb6b04SPaolo Bonzini$(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y)
158add16157SBlue Swirl
159c05ac895SPaul BrookROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
160c05ac895SPaul Brookromsubdir-%:
161c05ac895SPaul Brook	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
162c05ac895SPaul Brook
163c05ac895SPaul BrookALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
164c05ac895SPaul Brook
165c05ac895SPaul Brookrecurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
1664aa42531Spbrook
167a558ee17SJuan Quintelabt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
1684fb240a4Sbellard
1695354e4d2SMarc-André Lureauversion.o: $(SRC_PATH)/version.rc config-host.h | version.lo
1705354e4d2SMarc-André Lureauversion.lo: $(SRC_PATH)/version.rc config-host.h
1719fe6de94SBlue Swirl
1729fe6de94SBlue Swirlversion-obj-$(CONFIG_WIN32) += version.o
173c02817e5SPaolo Bonziniversion-lobj-$(CONFIG_WIN32) += version.lo
1745354e4d2SMarc-André Lureau
175fba90ac1SPaolo BonziniMakefile: $(version-obj-y) $(version-lobj-y)
1763bc2f570SPaolo Bonzini
1773bc2f570SPaolo Bonzini######################################################################
1788a090705SPaolo Bonzini# Build libraries
1793bc2f570SPaolo Bonzini
1803bc2f570SPaolo Bonzinilibqemustub.a: $(stub-obj-y)
1810b400e79SMichael Rothlibqemuutil.a: $(util-obj-y) qapi-types.o qapi-visit.o
1823bc2f570SPaolo Bonzini
1834fb240a4Sbellard######################################################################
1844fb240a4Sbellard
1853c089e15SJuan Quintelaqemu-img.o: qemu-img-cmds.h
186153859beSStuart Brady
187ff667e2eSPaolo Bonziniqemu-img$(EXESUF): qemu-img.o $(block-obj-y) libqemuutil.a libqemustub.a
188ff667e2eSPaolo Bonziniqemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) libqemuutil.a libqemustub.a
189587da2c3SKevin Wolfqemu-io$(EXESUF): qemu-io.o $(block-obj-y) libqemuutil.a libqemustub.a
1900a8e1acdSaliguori
1917b93fadfSCorey Bryantqemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
1927b93fadfSCorey Bryant
193ff667e2eSPaolo Bonzinifsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/virtio-9p-marshal.o libqemuutil.a libqemustub.a
19417bff52bSM. Mohan Kumarfsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
19517bff52bSM. Mohan Kumar
196153859beSStuart Bradyqemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
1974c3b5a48SBlue Swirl	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
198153859beSStuart Brady
199957f1f99SMichael Rothqemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
20054c2e502SDunrong Huangqemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
201640e5404SMichael Roth
20219bf7c87SAvi Kivitygen-out-type = $(subst .,-,$(suffix $@))
2038d3bc517SAvi Kivity
2040521d375SStefan Hajnocziqapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
2050521d375SStefan Hajnoczi
20654c2e502SDunrong Huangqga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
2072870dc34SPaolo Bonzini$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
20854c2e502SDunrong Huang	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
20954c2e502SDunrong Huangqga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
2102870dc34SPaolo Bonzini$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
21154c2e502SDunrong Huang	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
21254c2e502SDunrong Huangqga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
2132870dc34SPaolo Bonzini$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
21454c2e502SDunrong Huang	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
215e3d4d252SMichael Roth
216599825c5SMichael S. Tsirkinqapi-types.c qapi-types.h :\
2170521d375SStefan Hajnoczi$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
2180b400e79SMichael Roth	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "." -b < $<, "  GEN   $@")
219599825c5SMichael S. Tsirkinqapi-visit.c qapi-visit.h :\
2200521d375SStefan Hajnoczi$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
2210b400e79SMichael Roth	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o "." -b < $<, "  GEN   $@")
222599825c5SMichael S. Tsirkinqmp-commands.h qmp-marshal.c :\
2230521d375SStefan Hajnoczi$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
2248d3bc517SAvi Kivity	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -m -o "." < $<, "  GEN   $@")
225e3193601SAnthony Liguori
22654c2e502SDunrong HuangQGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
2274115852bSPaolo Bonzini$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
228957f1f99SMichael Roth
229ff667e2eSPaolo Bonziniqemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
2302870dc34SPaolo Bonzini	$(call LINK, $^)
23148ff7a62SMichael Roth
23231e31b8aSbellardclean:
2332d80ae89Sbellard# avoid old build problems by removing potentially incorrect old files
23425be210fSJuan 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
235df2943baSMichael S. Tsirkin	rm -f qemu-options.def
2360c3c89d6SPaolo Bonzini	find . -name '*.[oda]' -type f -exec rm -f {} +
2370c3c89d6SPaolo Bonzini	find . -name '*.l[oa]' -type f -exec rm -f {} +
2380c3c89d6SPaolo Bonzini	rm -f $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
23944dc0ca3SAlon Levy	rm -Rf .libs
24007b44ce9SBlue Swirl	rm -f qemu-img-cmds.h
24119ac36b5SLluís Vilanova	@# May not be present in GENERATED_HEADERS
242eac236eaSLluís Vilanova	rm -f trace/generated-tracers-dtrace.dtrace*
243eac236eaSLluís Vilanova	rm -f trace/generated-tracers-dtrace.h*
24419ac36b5SLluís Vilanova	rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
24519ac36b5SLluís Vilanova	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
2468f0e5c6bSStefan Weil	rm -rf qapi-generated
24754c2e502SDunrong Huang	rm -rf qga/qapi-generated
248c09015ddSAnthony Liguori	$(MAKE) -C tests/tcg clean
249781c0c33SStefan Hajnoczi	for d in $(ALL_SUBDIRS); do \
250fc8e320eSMagnus Damm	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
251df2943baSMichael S. Tsirkin	rm -f $$d/qemu-options.def; \
252626df76aSbellard        done
25331e31b8aSbellard
25434bb443eSAnthony LiguoriVERSION ?= $(shell cat VERSION)
25534bb443eSAnthony Liguori
25634bb443eSAnthony Liguoridist: qemu-$(VERSION).tar.bz2
25734bb443eSAnthony Liguori
25834bb443eSAnthony Liguoriqemu-%.tar.bz2:
25934bb443eSAnthony Liguori	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
26034bb443eSAnthony Liguori
2617d13299dSbellarddistclean: clean
262fc8e320eSMagnus Damm	rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
26376cad711SPaolo Bonzini	rm -f config-all-devices.mak config-all-disas.mak
264fc8e320eSMagnus Damm	rm -f roms/seabios/config.mak roms/vgabios/config.mak
2657a734b8fSBrad Hards	rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps qemu-doc.dvi
2667a734b8fSBrad Hards	rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
2677a734b8fSBrad Hards	rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
2687a734b8fSBrad Hards	rm -f qemu-doc.vr
269793553acSAlexandre Raymond	rm -f config.log
27067ed96f9SPeter Maydell	rm -f linux-headers/asm
271e1a068b2SHidetoshi 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
2728e98e2e8SPaolo Bonzini	for d in $(TARGET_DIRS); do \
273bc1b050dSbellard	rm -rf $$d || exit 1 ; \
27476bc6838Sbellard        done
275a85903ffSWenchao Xia	if test -f pixman/config.log; then make -C pixman distclean; fi
276a540f158SPeter Crosthwaite	if test -f dtc/version_gen.h; then make $(DTC_MAKE_ARGS) clean; fi
2777d13299dSbellard
278fed4a9adSbellardKEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
279fed4a9adSbellardar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
280471fbf4aSFrédéric Boiteuxcommon  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr \
281471fbf4aSFrédéric Boiteuxbepo
282fed4a9adSbellard
28377755340Sthsifdef INSTALL_BLOBS
2846329866fSPaolo BonziniBLOBS=bios.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
2857943a2faSGerd Hoffmannvgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \
2867e973bb2SLaszlo Ersekacpi-dsdt.aml q35-acpi-dsdt.aml \
2873b3d448eSGerd Hoffmannppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc \
2885ee8ad71SAlex Williamsonpxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
2895ee8ad71SAlex Williamsonpxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
2909fd02979SSander Eikelenboomefi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
2919fd02979SSander Eikelenboomefi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
292*f7da9c17SAnthony Liguoriqemu-icon.bmp qemu_logo_no_text.svg \
29300914b7dSMichal Simekbamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
2942a2af967SJan Kiszkamultiboot.bin linuxboot.bin kvmvapic.bin \
29539ac8455SDavid Gibsons390-zipl.rom \
2960c1fecddSAlexander Grafs390-ccw.img \
297753d11f2SRichard Hendersonspapr-rtas.bin slof.bin \
298753d11f2SRichard Hendersonpalcode-clipper
29977755340Sthselse
30077755340SthsBLOBS=
30177755340Sthsendif
30277755340Sths
30338954dcaSpbrookinstall-doc: $(DOCS)
304d7dd65baSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
305d7dd65baSEduardo Habkost	$(INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(qemu_docdir)"
3060cd23fccSBruce Rogers	$(INSTALL_DATA) QMP/qmp-commands.txt "$(DESTDIR)$(qemu_docdir)"
30796d409ebSJuan Quintelaifdef CONFIG_POSIX
30858f8aeadSaliguori	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
30958f8aeadSaliguori	$(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
31058f8aeadSaliguori	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
31158f8aeadSaliguori	$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
31238954dcaSpbrookendif
313a2d8f1beSM. Mohan Kumarifdef CONFIG_VIRTFS
314a2d8f1beSM. Mohan Kumar	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
315a2d8f1beSM. Mohan Kumar	$(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
316a2d8f1beSM. Mohan Kumarendif
317b5ec5ce0Sjohn cooper
318e2d87bffSEduardo Habkostinstall-datadir:
319e2d87bffSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
320e2d87bffSEduardo Habkost
321f2e3978bSLaszlo Ersekinstall-localstatedir:
322f2e3978bSLaszlo Ersekifdef CONFIG_POSIX
323f2e3978bSLaszlo Ersekifneq (,$(findstring qemu-ga,$(TOOLS)))
324f2e3978bSLaszlo Ersek	$(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
325f2e3978bSLaszlo Ersekendif
326f2e3978bSLaszlo Ersekendif
327f2e3978bSLaszlo Ersek
328e2d87bffSEduardo Habkostinstall-confdir:
329e2d87bffSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_confdir)"
330e2d87bffSEduardo Habkost
331e2d87bffSEduardo Habkostinstall-sysconfig: install-datadir install-confdir
332e2d87bffSEduardo Habkost	$(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(qemu_confdir)"
333e2d87bffSEduardo Habkost
334f2e3978bSLaszlo Ersekinstall: all $(if $(BUILD_DOCS),install-doc) install-sysconfig \
335f2e3978bSLaszlo Ersekinstall-datadir install-localstatedir
33658f8aeadSaliguori	$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
337932a79dfSthsifneq ($(TOOLS),)
33858f8aeadSaliguori	$(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
339932a79dfSthsendif
3407b93fadfSCorey Bryantifneq ($(HELPERS-y),)
3417b93fadfSCorey Bryant	$(INSTALL_DIR) "$(DESTDIR)$(libexecdir)"
3427b93fadfSCorey Bryant	$(INSTALL_PROG) $(STRIP_OPT) $(HELPERS-y) "$(DESTDIR)$(libexecdir)"
3437b93fadfSCorey Bryantendif
34477755340Sthsifneq ($(BLOBS),)
34577755340Sths	set -e; for x in $(BLOBS); do \
3466aae2a2eSEduardo Habkost		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
347ad064840Spbrook	done
34877755340Sthsendif
349834574eaSAnthony Liguoriifeq ($(CONFIG_GTK),y)
350834574eaSAnthony Liguori	$(MAKE) -C po $@
351834574eaSAnthony Liguoriendif
3526aae2a2eSEduardo Habkost	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
35318be8d77Sblueswir1	set -e; for x in $(KEYMAPS); do \
3546aae2a2eSEduardo Habkost		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
355ad064840Spbrook	done
356626df76aSbellard	for d in $(TARGET_DIRS); do \
3577d3505c5Sbellard	$(MAKE) -C $$d $@ || exit 1 ; \
358626df76aSbellard        done
359612384d7Sbellard
360367e86e8Sbellard# various test targets
3619b0b8203Sbellardtest speed: all
362c09015ddSAnthony Liguori	$(MAKE) -C tests/tcg $@
36331e31b8aSbellard
36421d4e8e3SAlexandre Bique.PHONY: TAGS
365367e86e8SbellardTAGS:
366b1999e87SDavid Gibson	rm -f $@
367b1999e87SDavid Gibson	find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
36831e31b8aSbellard
3696688bc6dSbellardcscope:
3706688bc6dSbellard	rm -f ./cscope.*
37145b75ae4SAlexandre Raymond	find "$(SRC_PATH)" -name "*.[chsS]" -print | sed 's,^\./,,' > ./cscope.files
3726688bc6dSbellard	cscope -b
3736688bc6dSbellard
3743ef693a0Sbellard# documentation
37501668d98SStefan WeilMAKEINFO=makeinfo
37601668d98SStefan WeilMAKEINFOFLAGS=--no-headers --no-split --number-sections
37720cc9997SStefan WeilTEXIFLAG=$(if $(V),,--quiet)
37820cc9997SStefan Weil%.dvi: %.texi
37920cc9997SStefan Weil	$(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<,"  GEN   $@")
38020cc9997SStefan Weil
3811f673135Sbellard%.html: %.texi
382952ef67cSStefan Weil	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \
38301668d98SStefan Weil	"  GEN   $@")
3843ef693a0Sbellard
385f3548328Sbellard%.info: %.texi
38601668d98SStefan Weil	$(call quiet-command,$(MAKEINFO) $< -o $@,"  GEN   $@")
387f3548328Sbellard
38820cc9997SStefan Weil%.pdf: %.texi
38920cc9997SStefan Weil	$(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<,"  GEN   $@")
3905824d651Sblueswir1
3915824d651Sblueswir1qemu-options.texi: $(SRC_PATH)/qemu-options.hx
3924c3b5a48SBlue Swirl	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
393f3548328Sbellard
394acd0a093SLuiz Capitulinoqemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
3954c3b5a48SBlue Swirl	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
3962313086aSBlue Swirl
39782a56f0dSLuiz CapitulinoQMP/qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
3984c3b5a48SBlue Swirl	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@,"  GEN   $@")
399b40292e7SJan Kiszka
400153859beSStuart Bradyqemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
4014c3b5a48SBlue Swirl	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
402153859beSStuart Brady
4032313086aSBlue Swirlqemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
4040d00e563Saliguori	$(call quiet-command, \
4054c3b5a48SBlue Swirl	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
4063179d694SMichael Tokarev	  $(POD2MAN) --section=1 --center=" " --release=" " qemu.pod > $@, \
4070d00e563Saliguori	  "  GEN   $@")
4085a67135aSbellard
409153859beSStuart Bradyqemu-img.1: qemu-img.texi qemu-img-cmds.texi
4100d00e563Saliguori	$(call quiet-command, \
4114c3b5a48SBlue Swirl	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-img.pod && \
4123179d694SMichael Tokarev	  $(POD2MAN) --section=1 --center=" " --release=" " qemu-img.pod > $@, \
4130d00e563Saliguori	  "  GEN   $@")
414acd935efSbellard
415a2d8f1beSM. Mohan Kumarfsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
416a2d8f1beSM. Mohan Kumar	$(call quiet-command, \
417a2d8f1beSM. Mohan Kumar	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< fsdev/virtfs-proxy-helper.pod && \
4183179d694SMichael Tokarev	  $(POD2MAN) --section=1 --center=" " --release=" " fsdev/virtfs-proxy-helper.pod > $@, \
419a2d8f1beSM. Mohan Kumar	  "  GEN   $@")
420a2d8f1beSM. Mohan Kumar
4217a5ca864Sbellardqemu-nbd.8: qemu-nbd.texi
4220d00e563Saliguori	$(call quiet-command, \
4234c3b5a48SBlue Swirl	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-nbd.pod && \
4243179d694SMichael Tokarev	  $(POD2MAN) --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
4250d00e563Saliguori	  "  GEN   $@")
4267a5ca864Sbellard
4270cb3fb1eSpbrookdvi: qemu-doc.dvi qemu-tech.dvi
4280cb3fb1eSpbrookhtml: qemu-doc.html qemu-tech.html
42920cc9997SStefan Weilinfo: qemu-doc.info qemu-tech.info
43020cc9997SStefan Weilpdf: qemu-doc.pdf qemu-tech.pdf
4310cb3fb1eSpbrook
43220cc9997SStefan Weilqemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
43320cc9997SStefan Weil	qemu-img.texi qemu-nbd.texi qemu-options.texi \
43420cc9997SStefan Weil	qemu-monitor.texi qemu-img-cmds.texi
435818220f5Saliguori
436cb5fc67dSAnthony Liguori# Add a dependency on the generated files, so that they are always
437cb5fc67dSAnthony Liguori# rebuilt before other object files
4387748b8cbSMike Frysingerifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
439cb5fc67dSAnthony LiguoriMakefile: $(GENERATED_HEADERS)
4407748b8cbSMike Frysingerendif
441cb5fc67dSAnthony Liguori
4424fb240a4Sbellard# Include automatically generated dependency files
4431435ddb8SPaolo Bonzini# Dependencies in Makefile.objs files come from our recursive subdir rules
4441435ddb8SPaolo Bonzini-include $(wildcard *.d tests/*.d)
445