2
2
# Grand Unified Makefile for Xen.
4
# Builds everything except Xenolinux:
5
# cd xenolinux-<version>-sparse
6
# ./mkbuildtree <build dir>
7
# cd <build dir> && make oldconfig && make dep && make bzImage
8
# (<build dir> should be a vanilla linux tree with matching version)
5
# Default target must appear before any include lines
9
export XEN_ROOT=$(CURDIR)
12
SUBARCH := $(subst x86_32,i386,$(XEN_TARGET_ARCH))
13
export XEN_TARGET_ARCH SUBARCH XEN_SYSTYPE
14
include buildconfigs/Rules.mk
16
# build and install everything into the standard system directories
18
install: install-xen install-kernels install-tools install-stubdom install-docs
23
$(MAKE) -C tools build
24
$(MAKE) -C stubdom build
25
ifeq (x86_64,$(XEN_TARGET_ARCH))
26
XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom pv-grub
30
# The test target is for unit tests that can run without an installation. Of
31
# course, many tests require a machine running Xen itself, and these are
35
$(MAKE) -C tools/python test
37
# build and install everything into local dist directory
39
dist: DESTDIR=$(DISTDIR)/install
40
dist: dist-xen dist-kernels dist-tools dist-stubdom dist-docs
41
$(INSTALL_DIR) $(DISTDIR)/check
42
$(INSTALL_DATA) ./COPYING $(DISTDIR)
43
$(INSTALL_DATA) ./README $(DISTDIR)
44
$(INSTALL_PROG) ./install.sh $(DISTDIR)
45
$(INSTALL_PROG) tools/check/chk tools/check/check_* tools/check/funcs.sh $(DISTDIR)/check
46
dist-%: DESTDIR=$(DISTDIR)/install
51
.PHONY: xen tools stubdom kernels docs
60
for i in $(XKERNELS) ; do $(MAKE) $$i-prep || exit 1; done
15
64
$(MAKE) -C xen install
67
install-tools: tools/ioemu-dir
16
68
$(MAKE) -C tools install
70
.PHONY: install-kernels
72
for i in $(XKERNELS) ; do $(MAKE) $$i-install || exit 1; done
74
.PHONY: install-stubdom
75
install-stubdom: tools/ioemu-dir
76
$(MAKE) -C stubdom install
77
ifeq (x86_64,$(XEN_TARGET_ARCH))
78
XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
82
$(MAKE) -C tools ioemu-dir-find
86
sh ./docs/check_pkgs && $(MAKE) -C docs install || true
90
$(MAKE) -C docs dev-docs
92
# Build all the various kernels and modules
96
# Delete the kernel build trees entirely
99
for i in $(XKERNELS) ; do $(MAKE) $$i-delete ; done
101
# Clean the kernel build trees
104
for i in $(XKERNELS) ; do $(MAKE) $$i-clean ; done
106
# build xen, the tools, and a domain 0 plus unprivileged linux-xen images,
107
# and place them in the install directory. 'make install' should then
108
# copy them to the normal system directories
115
# clean doesn't do a kclean
23
118
$(MAKE) -C xen clean
24
119
$(MAKE) -C tools clean
120
$(MAKE) -C stubdom crossclean
121
ifeq (x86_64,$(XEN_TARGET_ARCH))
122
XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom crossclean
124
$(MAKE) -C docs clean
126
# clean, but blow away kernel build tree plus tarballs
129
$(MAKE) -C xen distclean
130
$(MAKE) -C tools distclean
131
$(MAKE) -C stubdom distclean
132
ifeq (x86_64,$(XEN_TARGET_ARCH))
133
XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom distclean
135
$(MAKE) -C docs distclean
136
rm -rf dist patches/tmp
137
for i in $(ALLKERNELS) ; do $(MAKE) $$i-delete ; done
138
rm -rf patches/*/.makedep
140
# Linux name for GNU distclean
144
# Prepare for source tarball
146
src-tarball: distclean
147
$(MAKE) -C xen .banner
148
rm -rf xen/tools/figlet .[a-z]*
149
$(MAKE) -C xen distclean
153
@echo 'Installation targets:'
154
@echo ' install - build and install everything'
155
@echo ' install-xen - build and install the Xen hypervisor'
156
@echo ' install-tools - build and install the control tools'
157
@echo ' install-kernels - build and install guest kernels'
158
@echo ' install-stubdom - build and install the stubdomain images'
159
@echo ' install-docs - build and install user documentation'
161
@echo 'Building targets:'
162
@echo ' dist - build and install everything into local dist directory'
163
@echo ' world - clean everything, delete guest kernel build'
164
@echo ' trees then make dist'
165
@echo ' xen - build and install Xen hypervisor'
166
@echo ' tools - build and install tools'
167
@echo ' stubdom - build and install the stubdomain images'
168
@echo ' kernels - build and install guest kernels'
169
@echo ' kbuild - synonym for make kernels'
170
@echo ' docs - build and install user documentation'
171
@echo ' dev-docs - build developer-only documentation'
173
@echo 'Cleaning targets:'
174
@echo ' clean - clean the Xen, tools and docs (but not guest kernel trees)'
175
@echo ' distclean - clean plus delete kernel build trees and'
176
@echo ' local downloaded files'
177
@echo ' kdelete - delete guest kernel build trees'
178
@echo ' kclean - clean guest kernel build trees'
180
@echo 'Miscellaneous targets:'
181
@echo ' prep-kernels - prepares kernel directories, does not build'
182
@echo ' uninstall - attempt to remove installed Xen tools'
183
@echo ' (use with extreme care!)'
185
@echo 'Trusted Boot (tboot) targets:'
186
@echo ' build-tboot - download and build the tboot module'
187
@echo ' install-tboot - download, build, and install the tboot module'
188
@echo ' clean-tboot - clean the tboot module if it exists'
191
@echo ' [ this documentation is sadly not complete ]'
193
# Use this target with extreme care!
195
uninstall: D=$(DESTDIR)
197
[ -d $(D)$(XEN_CONFIG_DIR) ] && mv -f $(D)$(XEN_CONFIG_DIR) $(D)$(XEN_CONFIG_DIR).old-`date +%s` || true
198
rm -rf $(D)$(CONFIG_DIR)/init.d/xend*
199
rm -rf $(D)$(CONFIG_DIR)/hotplug/xen-backend.agent
200
rm -f $(D)$(CONFIG_DIR)/udev/rules.d/xen-backend.rules
201
rm -f $(D)$(CONFIG_DIR)/udev/xen-backend.rules
202
rm -f $(D)$(CONFIG_DIR)/udev/rules.d/xend.rules
203
rm -f $(D)$(CONFIG_DIR)/udev/xend.rules
204
rm -f $(D)$(CONFIG_DIR)/sysconfig/xendomains
205
rm -rf $(D)/var/run/xen* $(D)/var/lib/xen*
206
rm -rf $(D)/boot/*xen*
207
rm -rf $(D)/lib/modules/*xen*
208
rm -rf $(D)$(LIBDIR)/xen* $(D)$(BINDIR)/lomount
209
rm -rf $(D)$(BINDIR)/cpuperf-perfcntr $(D)$(BINDIR)/cpuperf-xen
210
rm -rf $(D)$(BINDIR)/xc_shadow
211
rm -rf $(D)$(BINDIR)/pygrub
212
rm -rf $(D)$(BINDIR)/setsize $(D)$(BINDIR)/tbctl
213
rm -rf $(D)$(BINDIR)/xsls
214
rm -rf $(D)$(INCLUDEDIR)/xenctrl.h $(D)$(INCLUDEDIR)/xenguest.h
215
rm -rf $(D)$(INCLUDEDIR)/xs_lib.h $(D)$(INCLUDEDIR)/xs.h
216
rm -rf $(D)$(INCLUDEDIR)/xen
217
rm -rf $(D)$(LIBDIR)/libxenctrl* $(D)$(LIBDIR)/libxenguest*
218
rm -rf $(D)$(LIBDIR)/libxenstore*
219
rm -rf $(D)$(LIBDIR)/python/xen $(D)$(LIBDIR)/python/grub
220
rm -rf $(D)$(LIBDIR)/xen/
221
rm -rf $(D)$(LIBEXEC)/xen*
222
rm -rf $(D)$(SBINDIR)/setmask
223
rm -rf $(D)$(SBINDIR)/xen* $(D)$(SBINDIR)/netfix $(D)$(SBINDIR)/xm
224
rm -rf $(D)$(SHAREDIR)/doc/xen
225
rm -rf $(D)$(SHAREDIR)/xen
226
rm -rf $(D)$(MAN1DIR)/xen*
227
rm -rf $(D)$(MAN8DIR)/xen*
228
rm -rf $(D)/boot/tboot*
230
# Legacy targets for compatibility
233
$(MAKE) 'KERNELS=linux-2.6*' kernels
240
TBOOT_TARFILE = tboot-20090330.tar.gz
241
#TBOOT_BASE_URL = http://downloads.sourceforge.net/tboot
242
TBOOT_BASE_URL = $(XEN_EXTFILES_URL)
245
build-tboot: download_tboot
246
$(MAKE) -C tboot build
248
.PHONY: install-tboot
249
install-tboot: download_tboot
250
$(MAKE) -C tboot install
253
dist-tboot: download_tboot
254
$(MAKE) DESTDIR=$(DISTDIR)/install -C tboot dist
258
[ ! -d tboot ] || $(MAKE) -C tboot clean
260
.PHONY: distclean-tboot
262
[ ! -d tboot ] || $(MAKE) -C tboot distclean
264
.PHONY: download_tboot
265
download_tboot: tboot/Makefile
267
tboot/Makefile: tboot/$(TBOOT_TARFILE)
268
[ -e tboot/Makefile ] || tar -xzf tboot/$(TBOOT_TARFILE) -C tboot/ --strip-components 1
270
tboot/$(TBOOT_TARFILE):
272
wget -O tboot/$(TBOOT_TARFILE) $(TBOOT_BASE_URL)/$(TBOOT_TARFILE)