Statistics
| Branch: | Revision:

root / Makefile @ feature-archipelago

History | View | Annotate | Download (18.4 kB)

1 0cb3fb1e pbrook
# Makefile for QEMU.
2 0cb3fb1e pbrook
3 519e1693 Stefan Weil
# Always point to the root of the build tree (needs GNU make).
4 519e1693 Stefan Weil
BUILD_DIR=$(CURDIR)
5 388d4758 Lluís Vilanova
6 250b086e Lluís Vilanova
# All following code might depend on configuration variables
7 55d7e8f6 aurel32
ifneq ($(wildcard config-host.mak),)
8 1ad2134f Paul Brook
# Put the all: rule here so that config-host.mak can contain dependencies.
9 8f67aa82 Stefan Weil
all:
10 ad064840 pbrook
include config-host.mak
11 d1bd2423 Peter Maydell
12 d1bd2423 Peter Maydell
# Check that we're not trying to do an out-of-tree build from
13 d1bd2423 Peter Maydell
# a tree that's been used for an in-tree build.
14 d1bd2423 Peter Maydell
ifneq ($(realpath $(SRC_PATH)),$(realpath .))
15 d1bd2423 Peter Maydell
ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
16 d1bd2423 Peter Maydell
$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
17 d1bd2423 Peter Maydell
seems to have been used for an in-tree build. You can fix this by running \
18 d1bd2423 Peter Maydell
"make distclean && rm -rf *-linux-user *-softmmu" in your source tree)
19 d1bd2423 Peter Maydell
endif
20 d1bd2423 Peter Maydell
endif
21 d1bd2423 Peter Maydell
22 f3aa844b Paolo Bonzini
CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
23 f3aa844b Paolo Bonzini
CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
24 f3aa844b Paolo Bonzini
CONFIG_ALL=y
25 f3aa844b Paolo Bonzini
-include config-all-devices.mak
26 f3aa844b Paolo Bonzini
-include config-all-disas.mak
27 f3aa844b Paolo Bonzini
28 17759187 aliguori
include $(SRC_PATH)/rules.mak
29 59bc10ee Paolo Bonzini
config-host.mak: $(SRC_PATH)/configure
30 e5efe7f5 Juan Quintela
	@echo $@ is out-of-date, running configure
31 bdf523e6 Stefan Weil
	@# TODO: The next lines include code which supports a smooth
32 bdf523e6 Stefan Weil
	@# transition from old configurations without config.status.
33 bdf523e6 Stefan Weil
	@# This code can be removed after QEMU 1.7.
34 bdf523e6 Stefan Weil
	@if test -x config.status; then \
35 bdf523e6 Stefan Weil
	    ./config.status; \
36 bdf523e6 Stefan Weil
        else \
37 bdf523e6 Stefan Weil
	    sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh; \
38 bdf523e6 Stefan Weil
	fi
39 55d7e8f6 aurel32
else
40 55d7e8f6 aurel32
config-host.mak:
41 7748b8cb Mike Frysinger
ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
42 55d7e8f6 aurel32
	@echo "Please call configure before running make!"
43 55d7e8f6 aurel32
	@exit 1
44 55d7e8f6 aurel32
endif
45 7748b8cb Mike Frysinger
endif
46 766a487a bellard
47 eac236ea Lluís Vilanova
GENERATED_HEADERS = config-host.h qemu-options.def
48 eac236ea Lluís Vilanova
GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h
49 eac236ea Lluís Vilanova
GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c
50 eac236ea Lluís Vilanova
51 45be2f5d Lluís Vilanova
GENERATED_HEADERS += trace/generated-events.h
52 45be2f5d Lluís Vilanova
GENERATED_SOURCES += trace/generated-events.c
53 45be2f5d Lluís Vilanova
54 eac236ea Lluís Vilanova
GENERATED_HEADERS += trace/generated-tracers.h
55 250b086e Lluís Vilanova
ifeq ($(TRACE_BACKEND),dtrace)
56 eac236ea Lluís Vilanova
GENERATED_HEADERS += trace/generated-tracers-dtrace.h
57 250b086e Lluís Vilanova
endif
58 eac236ea Lluís Vilanova
GENERATED_SOURCES += trace/generated-tracers.c
59 250b086e Lluís Vilanova
60 e6bf23f8 Mohamad Gebai
ifeq ($(TRACE_BACKEND),ust)
61 e6bf23f8 Mohamad Gebai
GENERATED_HEADERS += trace/generated-ust-provider.h
62 e6bf23f8 Mohamad Gebai
GENERATED_SOURCES += trace/generated-ust.c
63 e6bf23f8 Mohamad Gebai
endif
64 e6bf23f8 Mohamad Gebai
65 d9ace8b3 Juan Quintela
# Don't try to regenerate Makefile or configure
66 d9ace8b3 Juan Quintela
# We don't generate any of them
67 d9ace8b3 Juan Quintela
Makefile: ;
68 d9ace8b3 Juan Quintela
configure: ;
69 d9ace8b3 Juan Quintela
70 818220f5 aliguori
.PHONY: all clean cscope distclean dvi html info install install-doc \
71 34bb443e Anthony Liguori
	pdf recurse-all speed test dist
72 0cb3fb1e pbrook
73 fec90ff0 Paolo Bonzini
$(call set-vpath, $(SRC_PATH))
74 8c462f8f pbrook
75 3e2e0e6b Juan Quintela
LIBS+=-lz $(LIBS_TOOLS)
76 67c0f08d Juan Quintela
77 7b93fadf Corey Bryant
HELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)
78 7b93fadf Corey Bryant
79 cc8ae6de pbrook
ifdef BUILD_DOCS
80 d076a2ad Luiz Capitulino
DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 qmp-commands.txt
81 983eef5a Meador Inge
ifdef CONFIG_VIRTFS
82 a2d8f1be M. Mohan Kumar
DOCS+=fsdev/virtfs-proxy-helper.1
83 983eef5a Meador Inge
endif
84 cc8ae6de pbrook
else
85 cc8ae6de pbrook
DOCS=
86 cc8ae6de pbrook
endif
87 aa05ae6f bellard
88 388d4758 Lluís Vilanova
SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR)
89 1f3d3c8f Juan Quintela
SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
90 88070801 Andreas Färber
SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
91 1f3d3c8f Juan Quintela
92 8bdd3d49 Stefan Weil
ifeq ($(SUBDIR_DEVICES_MAK),)
93 8bdd3d49 Stefan Weil
config-all-devices.mak:
94 8bdd3d49 Stefan Weil
	$(call quiet-command,echo '# no devices' > $@,"  GEN   $@")
95 8bdd3d49 Stefan Weil
else
96 1f3d3c8f Juan Quintela
config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
97 bb585a78 Paolo Bonzini
	$(call quiet-command, sed -n \
98 bb585a78 Paolo Bonzini
             's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
99 bb585a78 Paolo Bonzini
             $(SUBDIR_DEVICES_MAK) | sort -u > $@, \
100 bb585a78 Paolo Bonzini
             "  GEN   $@")
101 8bdd3d49 Stefan Weil
endif
102 1f3d3c8f Juan Quintela
103 bd9141bb Paul Brook
-include $(SUBDIR_DEVICES_MAK_DEP)
104 bd9141bb Paul Brook
105 a992fe3d Paul Brook
%/config-devices.mak: default-configs/%.mak
106 4c3b5a48 Blue Swirl
	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
107 012f0879 Stefan Weil
	@if test -f $@; then \
108 904fe1fb Blue Swirl
	  if cmp -s $@.old $@; then \
109 bd9141bb Paul Brook
	    mv $@.tmp $@; \
110 bd9141bb Paul Brook
	    cp -p $@ $@.old; \
111 012f0879 Stefan Weil
	  else \
112 012f0879 Stefan Weil
	    if test -f $@.old; then \
113 012f0879 Stefan Weil
	      echo "WARNING: $@ (user modified) out of date.";\
114 012f0879 Stefan Weil
	    else \
115 012f0879 Stefan Weil
	      echo "WARNING: $@ out of date.";\
116 012f0879 Stefan Weil
	    fi; \
117 012f0879 Stefan Weil
	    echo "Run \"make defconfig\" to regenerate."; \
118 012f0879 Stefan Weil
	    rm $@.tmp; \
119 012f0879 Stefan Weil
	  fi; \
120 a992fe3d Paul Brook
	 else \
121 012f0879 Stefan Weil
	  mv $@.tmp $@; \
122 012f0879 Stefan Weil
	  cp -p $@ $@.old; \
123 a992fe3d Paul Brook
	 fi
124 a992fe3d Paul Brook
125 a992fe3d Paul Brook
defconfig:
126 a992fe3d Paul Brook
	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
127 a992fe3d Paul Brook
128 992aeb8e Paolo Bonzini
ifneq ($(wildcard config-host.mak),)
129 992aeb8e Paolo Bonzini
include $(SRC_PATH)/Makefile.objs
130 ba1183da Fam Zheng
endif
131 ba1183da Fam Zheng
132 ba1183da Fam Zheng
dummy := $(call unnest-vars,, \
133 ba1183da Fam Zheng
                stub-obj-y \
134 ba1183da Fam Zheng
                util-obj-y \
135 ba1183da Fam Zheng
                qga-obj-y \
136 ba1183da Fam Zheng
                block-obj-y \
137 cc475698 Fam Zheng
                block-obj-m \
138 cc475698 Fam Zheng
                common-obj-y \
139 cc475698 Fam Zheng
                common-obj-m)
140 ba1183da Fam Zheng
141 ba1183da Fam Zheng
ifneq ($(wildcard config-host.mak),)
142 992aeb8e Paolo Bonzini
include $(SRC_PATH)/tests/Makefile
143 992aeb8e Paolo Bonzini
endif
144 992aeb8e Paolo Bonzini
ifeq ($(CONFIG_SMARTCARD_NSS),y)
145 992aeb8e Paolo Bonzini
include $(SRC_PATH)/libcacard/Makefile
146 992aeb8e Paolo Bonzini
endif
147 992aeb8e Paolo Bonzini
148 17969268 Fam Zheng
all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules
149 b9dea4fb pbrook
150 ba1183da Fam Zheng
vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
151 ba1183da Fam Zheng
152 ba1183da Fam Zheng
vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)
153 b9dea4fb pbrook
154 1215c6e7 Juan Quintela
config-host.h: config-host.h-timestamp
155 1215c6e7 Juan Quintela
config-host.h-timestamp: config-host.mak
156 e14056ad Blue Swirl
qemu-options.def: $(SRC_PATH)/qemu-options.hx
157 4c3b5a48 Blue Swirl
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
158 1215c6e7 Juan Quintela
159 cec7d0b6 pbrook
SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
160 916359f6 Andreas Färber
SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
161 916359f6 Andreas Färber
162 57f45b62 Stefan Weil
$(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
163 916359f6 Andreas Färber
$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
164 cec7d0b6 pbrook
165 4115852b Paolo Bonzini
subdir-%:
166 0087375e Paul Brook
	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
167 4aa42531 pbrook
168 e2134eb9 Gerd Hoffmann
subdir-pixman: pixman/Makefile
169 e2134eb9 Gerd Hoffmann
	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pixman V="$(V)" all,)
170 e2134eb9 Gerd Hoffmann
171 e2134eb9 Gerd Hoffmann
pixman/Makefile: $(SRC_PATH)/pixman/configure
172 f9943cd5 Gerd Hoffmann
	(cd pixman; CFLAGS="$(CFLAGS) -fPIC $(extra_cflags) $(extra_ldflags)" $(SRC_PATH)/pixman/configure $(AUTOCONF_HOST) --disable-gtk --disable-shared --enable-static)
173 e2134eb9 Gerd Hoffmann
174 e2134eb9 Gerd Hoffmann
$(SRC_PATH)/pixman/configure:
175 e2134eb9 Gerd Hoffmann
	(cd $(SRC_PATH)/pixman; autoreconf -v --install)
176 e2134eb9 Gerd Hoffmann
177 a540f158 Peter Crosthwaite
DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
178 965f486c Peter Maydell
DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
179 965f486c Peter Maydell
DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
180 a540f158 Peter Crosthwaite
181 a540f158 Peter Crosthwaite
subdir-dtc:dtc/libfdt dtc/tests
182 965f486c Peter 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,)
183 a540f158 Peter Crosthwaite
184 a540f158 Peter Crosthwaite
dtc/%:
185 a540f158 Peter Crosthwaite
	mkdir -p $@
186 a540f158 Peter Crosthwaite
187 82cb6b04 Paolo Bonzini
$(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y)
188 add16157 Blue Swirl
189 c05ac895 Paul Brook
ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
190 c05ac895 Paul Brook
romsubdir-%:
191 c05ac895 Paul Brook
	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
192 c05ac895 Paul Brook
193 c05ac895 Paul Brook
ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
194 c05ac895 Paul Brook
195 c05ac895 Paul Brook
recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
196 83f64091 bellard
197 a558ee17 Juan Quintela
bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
198 4fb240a4 bellard
199 0b516ef0 Stefan Weil
$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc $(BUILD_DIR)/config-host.h | $(BUILD_DIR)/version.lo
200 7e75e33e Stefan Weil
	$(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"  RC    version.o")
201 0b516ef0 Stefan Weil
$(BUILD_DIR)/version.lo: $(SRC_PATH)/version.rc $(BUILD_DIR)/config-host.h
202 7e75e33e Stefan Weil
	$(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"  RC    version.lo")
203 5354e4d2 Marc-André Lureau
204 fba90ac1 Paolo Bonzini
Makefile: $(version-obj-y) $(version-lobj-y)
205 3bc2f570 Paolo Bonzini
206 3bc2f570 Paolo Bonzini
######################################################################
207 8a090705 Paolo Bonzini
# Build libraries
208 3bc2f570 Paolo Bonzini
209 3bc2f570 Paolo Bonzini
libqemustub.a: $(stub-obj-y)
210 0b400e79 Michael Roth
libqemuutil.a: $(util-obj-y) qapi-types.o qapi-visit.o
211 3bc2f570 Paolo Bonzini
212 e26110cf Fam Zheng
block-modules = $(foreach o,$(block-obj-m),"$(basename $(subst /,-,$o))",) NULL
213 e26110cf Fam Zheng
util/module.o-cflags = -D'CONFIG_BLOCK_MODULES=$(block-modules)'
214 e26110cf Fam Zheng
215 4fb240a4 bellard
######################################################################
216 4fb240a4 bellard
217 3c089e15 Juan Quintela
qemu-img.o: qemu-img-cmds.h
218 153859be Stuart Brady
219 ff667e2e Paolo Bonzini
qemu-img$(EXESUF): qemu-img.o $(block-obj-y) libqemuutil.a libqemustub.a
220 ff667e2e Paolo Bonzini
qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) libqemuutil.a libqemustub.a
221 587da2c3 Kevin Wolf
qemu-io$(EXESUF): qemu-io.o $(block-obj-y) libqemuutil.a libqemustub.a
222 0a8e1acd aliguori
223 7b93fadf Corey Bryant
qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
224 7b93fadf Corey Bryant
225 ff667e2e Paolo Bonzini
fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/virtio-9p-marshal.o libqemuutil.a libqemustub.a
226 17bff52b M. Mohan Kumar
fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
227 17bff52b M. Mohan Kumar
228 153859be Stuart Brady
qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
229 4c3b5a48 Blue Swirl
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
230 153859be Stuart Brady
231 957f1f99 Michael Roth
qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
232 54c2e502 Dunrong Huang
qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
233 640e5404 Michael Roth
234 19bf7c87 Avi Kivity
gen-out-type = $(subst .,-,$(suffix $@))
235 8d3bc517 Avi Kivity
236 0521d375 Stefan Hajnoczi
qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
237 0521d375 Stefan Hajnoczi
238 54c2e502 Dunrong Huang
qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
239 2870dc34 Paolo Bonzini
$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
240 54c2e502 Dunrong Huang
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
241 54c2e502 Dunrong Huang
qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
242 2870dc34 Paolo Bonzini
$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
243 54c2e502 Dunrong Huang
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
244 54c2e502 Dunrong Huang
qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
245 2870dc34 Paolo Bonzini
$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
246 54c2e502 Dunrong Huang
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
247 e3d4d252 Michael Roth
248 599825c5 Michael S. Tsirkin
qapi-types.c qapi-types.h :\
249 0521d375 Stefan Hajnoczi
$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
250 0b400e79 Michael Roth
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "." -b < $<, "  GEN   $@")
251 599825c5 Michael S. Tsirkin
qapi-visit.c qapi-visit.h :\
252 0521d375 Stefan Hajnoczi
$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
253 0b400e79 Michael Roth
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o "." -b < $<, "  GEN   $@")
254 599825c5 Michael S. Tsirkin
qmp-commands.h qmp-marshal.c :\
255 0521d375 Stefan Hajnoczi
$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
256 8d3bc517 Avi Kivity
	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -m -o "." < $<, "  GEN   $@")
257 e3193601 Anthony Liguori
258 54c2e502 Dunrong Huang
QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
259 4115852b Paolo Bonzini
$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
260 957f1f99 Michael Roth
261 ff667e2e Paolo Bonzini
qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
262 2870dc34 Paolo Bonzini
	$(call LINK, $^)
263 48ff7a62 Michael Roth
264 31e31b8a bellard
clean:
265 2d80ae89 bellard
# avoid old build problems by removing potentially incorrect old files
266 25be210f Juan 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
267 df2943ba Michael S. Tsirkin
	rm -f qemu-options.def
268 0c3c89d6 Paolo Bonzini
	find . -name '*.[oda]' -type f -exec rm -f {} +
269 0c3c89d6 Paolo Bonzini
	find . -name '*.l[oa]' -type f -exec rm -f {} +
270 17969268 Fam Zheng
	find . -name '*$(DSOSUF)' -type f -exec rm -f {} +
271 17969268 Fam Zheng
	find . -name '*.mo' -type f -exec rm -f {} +
272 b39297ae Tomoki Sekiyama
	rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
273 8b6bfc77 Stefan Weil
	rm -f fsdev/*.pod
274 8b6bfc77 Stefan Weil
	rm -rf .libs */.libs
275 07b44ce9 Blue Swirl
	rm -f qemu-img-cmds.h
276 19ac36b5 Lluís Vilanova
	@# May not be present in GENERATED_HEADERS
277 eac236ea Lluís Vilanova
	rm -f trace/generated-tracers-dtrace.dtrace*
278 eac236ea Lluís Vilanova
	rm -f trace/generated-tracers-dtrace.h*
279 19ac36b5 Lluís Vilanova
	rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
280 19ac36b5 Lluís Vilanova
	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
281 8f0e5c6b Stefan Weil
	rm -rf qapi-generated
282 54c2e502 Dunrong Huang
	rm -rf qga/qapi-generated
283 781c0c33 Stefan Hajnoczi
	for d in $(ALL_SUBDIRS); do \
284 fc8e320e Magnus Damm
	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
285 df2943ba Michael S. Tsirkin
	rm -f $$d/qemu-options.def; \
286 626df76a bellard
        done
287 31e31b8a bellard
288 34bb443e Anthony Liguori
VERSION ?= $(shell cat VERSION)
289 34bb443e Anthony Liguori
290 34bb443e Anthony Liguori
dist: qemu-$(VERSION).tar.bz2
291 34bb443e Anthony Liguori
292 34bb443e Anthony Liguori
qemu-%.tar.bz2:
293 34bb443e Anthony Liguori
	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
294 34bb443e Anthony Liguori
295 7d13299d bellard
distclean: clean
296 fc8e320e Magnus Damm
	rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
297 76cad711 Paolo Bonzini
	rm -f config-all-devices.mak config-all-disas.mak
298 8b6bfc77 Stefan Weil
	rm -f po/*.mo
299 fc8e320e Magnus Damm
	rm -f roms/seabios/config.mak roms/vgabios/config.mak
300 7a734b8f Brad Hards
	rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps qemu-doc.dvi
301 7a734b8f Brad Hards
	rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys
302 7a734b8f Brad Hards
	rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp
303 7a734b8f Brad Hards
	rm -f qemu-doc.vr
304 793553ac Alexandre Raymond
	rm -f config.log
305 67ed96f9 Peter Maydell
	rm -f linux-headers/asm
306 e1a068b2 Hidetoshi 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
307 8e98e2e8 Paolo Bonzini
	for d in $(TARGET_DIRS); do \
308 bc1b050d bellard
	rm -rf $$d || exit 1 ; \
309 76bc6838 bellard
        done
310 d9840e25 Tomoki Sekiyama
	rm -Rf .sdk
311 a85903ff Wenchao Xia
	if test -f pixman/config.log; then make -C pixman distclean; fi
312 a540f158 Peter Crosthwaite
	if test -f dtc/version_gen.h; then make $(DTC_MAKE_ARGS) clean; fi
313 7d13299d bellard
314 fed4a9ad bellard
KEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
315 fed4a9ad bellard
ar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
316 471fbf4a Frédéric Boiteux
common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr \
317 3751e722 Jan Krupa
bepo    cz
318 fed4a9ad bellard
319 77755340 ths
ifdef INSTALL_BLOBS
320 bf2eaf71 Eduardo Habkost
BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
321 7943a2fa Gerd Hoffmann
vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \
322 7e973bb2 Laszlo Ersek
acpi-dsdt.aml q35-acpi-dsdt.aml \
323 9eb08a43 Mark Cave-Ayland
ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
324 5ee8ad71 Alex Williamson
pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
325 5ee8ad71 Alex Williamson
pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
326 9fd02979 Sander Eikelenboom
efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
327 9fd02979 Sander Eikelenboom
efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
328 f7da9c17 Anthony Liguori
qemu-icon.bmp qemu_logo_no_text.svg \
329 00914b7d Michal Simek
bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
330 2a2af967 Jan Kiszka
multiboot.bin linuxboot.bin kvmvapic.bin \
331 39ac8455 David Gibson
s390-zipl.rom \
332 0c1fecdd Alexander Graf
s390-ccw.img \
333 753d11f2 Richard Henderson
spapr-rtas.bin slof.bin \
334 753d11f2 Richard Henderson
palcode-clipper
335 77755340 ths
else
336 77755340 ths
BLOBS=
337 77755340 ths
endif
338 77755340 ths
339 38954dca pbrook
install-doc: $(DOCS)
340 d7dd65ba Eduardo Habkost
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
341 d7dd65ba Eduardo Habkost
	$(INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(qemu_docdir)"
342 d076a2ad Luiz Capitulino
	$(INSTALL_DATA) qmp-commands.txt "$(DESTDIR)$(qemu_docdir)"
343 96d409eb Juan Quintela
ifdef CONFIG_POSIX
344 58f8aead aliguori
	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
345 8a3e8f7f Andreas Färber
	$(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
346 8a3e8f7f Andreas Färber
ifneq ($(TOOLS),)
347 8a3e8f7f Andreas Färber
	$(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
348 58f8aead aliguori
	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
349 58f8aead aliguori
	$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
350 38954dca pbrook
endif
351 8a3e8f7f Andreas Färber
endif
352 a2d8f1be M. Mohan Kumar
ifdef CONFIG_VIRTFS
353 a2d8f1be M. Mohan Kumar
	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
354 a2d8f1be M. Mohan Kumar
	$(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
355 a2d8f1be M. Mohan Kumar
endif
356 e2d87bff Eduardo Habkost
357 e2d87bff Eduardo Habkost
install-datadir:
358 e2d87bff Eduardo Habkost
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
359 e2d87bff Eduardo Habkost
360 f2e3978b Laszlo Ersek
install-localstatedir:
361 f2e3978b Laszlo Ersek
ifdef CONFIG_POSIX
362 f2e3978b Laszlo Ersek
ifneq (,$(findstring qemu-ga,$(TOOLS)))
363 f2e3978b Laszlo Ersek
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
364 f2e3978b Laszlo Ersek
endif
365 f2e3978b Laszlo Ersek
endif
366 f2e3978b Laszlo Ersek
367 e2d87bff Eduardo Habkost
install-confdir:
368 80465e80 Eduardo Habkost
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_confdir)"
369 e2d87bff Eduardo Habkost
370 e2d87bff Eduardo Habkost
install-sysconfig: install-datadir install-confdir
371 80465e80 Eduardo Habkost
	$(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(qemu_confdir)"
372 b5ec5ce0 john cooper
373 f2e3978b Laszlo Ersek
install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig \
374 f2e3978b Laszlo Ersek
install-datadir install-localstatedir
375 58f8aead aliguori
	$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
376 932a79df ths
ifneq ($(TOOLS),)
377 58f8aead aliguori
	$(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
378 932a79df ths
endif
379 e3be6f0e Fam Zheng
ifneq ($(CONFIG_MODULES),)
380 e3be6f0e Fam Zheng
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
381 e3be6f0e Fam Zheng
	for s in $(patsubst %.mo,%$(DSOSUF),$(modules-m)); do \
382 e3be6f0e Fam Zheng
		$(INSTALL_PROG) $(STRIP_OPT) $$s "$(DESTDIR)$(qemu_moddir)/$${s//\//-}"; \
383 e3be6f0e Fam Zheng
	done
384 e3be6f0e Fam Zheng
endif
385 7b93fadf Corey Bryant
ifneq ($(HELPERS-y),)
386 7b93fadf Corey Bryant
	$(INSTALL_DIR) "$(DESTDIR)$(libexecdir)"
387 7b93fadf Corey Bryant
	$(INSTALL_PROG) $(STRIP_OPT) $(HELPERS-y) "$(DESTDIR)$(libexecdir)"
388 7b93fadf Corey Bryant
endif
389 77755340 ths
ifneq ($(BLOBS),)
390 77755340 ths
	set -e; for x in $(BLOBS); do \
391 6aae2a2e Eduardo Habkost
		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
392 ad064840 pbrook
	done
393 77755340 ths
endif
394 834574ea Anthony Liguori
ifeq ($(CONFIG_GTK),y)
395 834574ea Anthony Liguori
	$(MAKE) -C po $@
396 834574ea Anthony Liguori
endif
397 6aae2a2e Eduardo Habkost
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
398 18be8d77 blueswir1
	set -e; for x in $(KEYMAPS); do \
399 6aae2a2e Eduardo Habkost
		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
400 ad064840 pbrook
	done
401 626df76a bellard
	for d in $(TARGET_DIRS); do \
402 7d3505c5 bellard
	$(MAKE) -C $$d $@ || exit 1 ; \
403 626df76a bellard
        done
404 612384d7 bellard
405 367e86e8 bellard
# various test targets
406 9b0b8203 bellard
test speed: all
407 c09015dd Anthony Liguori
	$(MAKE) -C tests/tcg $@
408 31e31b8a bellard
409 21d4e8e3 Alexandre Bique
.PHONY: TAGS
410 5fafdf24 ths
TAGS:
411 b1999e87 David Gibson
	rm -f $@
412 b1999e87 David Gibson
	find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
413 31e31b8a bellard
414 6688bc6d bellard
cscope:
415 6688bc6d bellard
	rm -f ./cscope.*
416 45b75ae4 Alexandre Raymond
	find "$(SRC_PATH)" -name "*.[chsS]" -print | sed 's,^\./,,' > ./cscope.files
417 6688bc6d bellard
	cscope -b
418 6688bc6d bellard
419 3ef693a0 bellard
# documentation
420 01668d98 Stefan Weil
MAKEINFO=makeinfo
421 01668d98 Stefan Weil
MAKEINFOFLAGS=--no-headers --no-split --number-sections
422 20cc9997 Stefan Weil
TEXIFLAG=$(if $(V),,--quiet)
423 20cc9997 Stefan Weil
%.dvi: %.texi
424 20cc9997 Stefan Weil
	$(call quiet-command,texi2dvi $(TEXIFLAG) -I . $<,"  GEN   $@")
425 20cc9997 Stefan Weil
426 1f673135 bellard
%.html: %.texi
427 952ef67c Stefan Weil
	$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --html $< -o $@, \
428 01668d98 Stefan Weil
	"  GEN   $@")
429 3ef693a0 bellard
430 f3548328 bellard
%.info: %.texi
431 01668d98 Stefan Weil
	$(call quiet-command,$(MAKEINFO) $< -o $@,"  GEN   $@")
432 f3548328 bellard
433 20cc9997 Stefan Weil
%.pdf: %.texi
434 20cc9997 Stefan Weil
	$(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<,"  GEN   $@")
435 5824d651 blueswir1
436 5824d651 blueswir1
qemu-options.texi: $(SRC_PATH)/qemu-options.hx
437 4c3b5a48 Blue Swirl
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
438 f3548328 bellard
439 acd0a093 Luiz Capitulino
qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
440 4c3b5a48 Blue Swirl
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
441 2313086a Blue Swirl
442 d076a2ad Luiz Capitulino
qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
443 4c3b5a48 Blue Swirl
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@,"  GEN   $@")
444 b40292e7 Jan Kiszka
445 153859be Stuart Brady
qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
446 4c3b5a48 Blue Swirl
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
447 153859be Stuart Brady
448 2313086a Blue Swirl
qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
449 0d00e563 aliguori
	$(call quiet-command, \
450 4c3b5a48 Blue Swirl
	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
451 3179d694 Michael Tokarev
	  $(POD2MAN) --section=1 --center=" " --release=" " qemu.pod > $@, \
452 0d00e563 aliguori
	  "  GEN   $@")
453 5a67135a bellard
454 153859be Stuart Brady
qemu-img.1: qemu-img.texi qemu-img-cmds.texi
455 0d00e563 aliguori
	$(call quiet-command, \
456 4c3b5a48 Blue Swirl
	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-img.pod && \
457 3179d694 Michael Tokarev
	  $(POD2MAN) --section=1 --center=" " --release=" " qemu-img.pod > $@, \
458 0d00e563 aliguori
	  "  GEN   $@")
459 acd935ef bellard
460 a2d8f1be M. Mohan Kumar
fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
461 a2d8f1be M. Mohan Kumar
	$(call quiet-command, \
462 a2d8f1be M. Mohan Kumar
	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< fsdev/virtfs-proxy-helper.pod && \
463 3179d694 Michael Tokarev
	  $(POD2MAN) --section=1 --center=" " --release=" " fsdev/virtfs-proxy-helper.pod > $@, \
464 a2d8f1be M. Mohan Kumar
	  "  GEN   $@")
465 a2d8f1be M. Mohan Kumar
466 7a5ca864 bellard
qemu-nbd.8: qemu-nbd.texi
467 0d00e563 aliguori
	$(call quiet-command, \
468 4c3b5a48 Blue Swirl
	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-nbd.pod && \
469 3179d694 Michael Tokarev
	  $(POD2MAN) --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
470 0d00e563 aliguori
	  "  GEN   $@")
471 7a5ca864 bellard
472 0cb3fb1e pbrook
dvi: qemu-doc.dvi qemu-tech.dvi
473 0cb3fb1e pbrook
html: qemu-doc.html qemu-tech.html
474 20cc9997 Stefan Weil
info: qemu-doc.info qemu-tech.info
475 20cc9997 Stefan Weil
pdf: qemu-doc.pdf qemu-tech.pdf
476 0cb3fb1e pbrook
477 20cc9997 Stefan Weil
qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
478 20cc9997 Stefan Weil
	qemu-img.texi qemu-nbd.texi qemu-options.texi \
479 20cc9997 Stefan Weil
	qemu-monitor.texi qemu-img-cmds.texi
480 818220f5 aliguori
481 f53ec699 Stefan Weil
ifdef CONFIG_WIN32
482 f53ec699 Stefan Weil
483 f53ec699 Stefan Weil
INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
484 f53ec699 Stefan Weil
485 f53ec699 Stefan Weil
nsisflags = -V2 -NOCD
486 f53ec699 Stefan Weil
487 f53ec699 Stefan Weil
ifneq ($(wildcard $(SRC_PATH)/dll),)
488 f53ec699 Stefan Weil
ifeq ($(ARCH),x86_64)
489 f53ec699 Stefan Weil
# 64 bit executables
490 f53ec699 Stefan Weil
DLL_PATH = $(SRC_PATH)/dll/w64
491 f53ec699 Stefan Weil
nsisflags += -DW64
492 f53ec699 Stefan Weil
else
493 f53ec699 Stefan Weil
# 32 bit executables
494 f53ec699 Stefan Weil
DLL_PATH = $(SRC_PATH)/dll/w32
495 f53ec699 Stefan Weil
endif
496 f53ec699 Stefan Weil
endif
497 f53ec699 Stefan Weil
498 f53ec699 Stefan Weil
.PHONY: installer
499 f53ec699 Stefan Weil
installer: $(INSTALLER)
500 f53ec699 Stefan Weil
501 f53ec699 Stefan Weil
INSTDIR=/tmp/qemu-nsis
502 f53ec699 Stefan Weil
503 f53ec699 Stefan Weil
$(INSTALLER): $(SRC_PATH)/qemu.nsi
504 f53ec699 Stefan Weil
	make install prefix=${INSTDIR}
505 f53ec699 Stefan Weil
ifdef SIGNCODE
506 f53ec699 Stefan Weil
	(cd ${INSTDIR}; \
507 f53ec699 Stefan Weil
         for i in *.exe; do \
508 f53ec699 Stefan Weil
           $(SIGNCODE) $${i}; \
509 f53ec699 Stefan Weil
         done \
510 f53ec699 Stefan Weil
        )
511 f53ec699 Stefan Weil
endif # SIGNCODE
512 f53ec699 Stefan Weil
	(cd ${INSTDIR}; \
513 f53ec699 Stefan Weil
         for i in qemu-system-*.exe; do \
514 f53ec699 Stefan Weil
           arch=$${i%.exe}; \
515 f53ec699 Stefan Weil
           arch=$${arch#qemu-system-}; \
516 f53ec699 Stefan Weil
           echo Section \"$$arch\" Section_$$arch; \
517 f53ec699 Stefan Weil
           echo SetOutPath \"\$$INSTDIR\"; \
518 f53ec699 Stefan Weil
           echo File \"\$${BINDIR}\\$$i\"; \
519 f53ec699 Stefan Weil
           echo SectionEnd; \
520 f53ec699 Stefan Weil
         done \
521 f53ec699 Stefan Weil
        ) >${INSTDIR}/system-emulations.nsh
522 f53ec699 Stefan Weil
	makensis $(nsisflags) \
523 f53ec699 Stefan Weil
                $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
524 f53ec699 Stefan Weil
                $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
525 f53ec699 Stefan Weil
                -DBINDIR="${INSTDIR}" \
526 f53ec699 Stefan Weil
                $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
527 f53ec699 Stefan Weil
                -DSRCDIR="$(SRC_PATH)" \
528 f53ec699 Stefan Weil
                -DOUTFILE="$(INSTALLER)" \
529 f53ec699 Stefan Weil
                $(SRC_PATH)/qemu.nsi
530 f53ec699 Stefan Weil
	rm -r ${INSTDIR}
531 f53ec699 Stefan Weil
ifdef SIGNCODE
532 f53ec699 Stefan Weil
	$(SIGNCODE) $(INSTALLER)
533 f53ec699 Stefan Weil
endif # SIGNCODE
534 f53ec699 Stefan Weil
endif # CONFIG_WIN
535 f53ec699 Stefan Weil
536 cb5fc67d Anthony Liguori
# Add a dependency on the generated files, so that they are always
537 cb5fc67d Anthony Liguori
# rebuilt before other object files
538 7748b8cb Mike Frysinger
ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
539 cb5fc67d Anthony Liguori
Makefile: $(GENERATED_HEADERS)
540 7748b8cb Mike Frysinger
endif
541 cb5fc67d Anthony Liguori
542 4fb240a4 bellard
# Include automatically generated dependency files
543 1435ddb8 Paolo Bonzini
# Dependencies in Makefile.objs files come from our recursive subdir rules
544 1435ddb8 Paolo Bonzini
-include $(wildcard *.d tests/*.d)