1 | # |
---|
2 | # Grand Unified Makefile for Xen. |
---|
3 | # |
---|
4 | |
---|
5 | # Default target must appear before any include lines |
---|
6 | .PHONY: all |
---|
7 | all: dist |
---|
8 | |
---|
9 | export XEN_ROOT=$(CURDIR) |
---|
10 | include Config.mk |
---|
11 | |
---|
12 | SUBARCH := $(subst x86_32,i386,$(XEN_TARGET_ARCH)) |
---|
13 | export XEN_TARGET_ARCH SUBARCH XEN_SYSTYPE |
---|
14 | include buildconfigs/Rules.mk |
---|
15 | |
---|
16 | ifeq ($(XEN_TARGET_X86_PAE),y) |
---|
17 | export pae=y |
---|
18 | endif |
---|
19 | |
---|
20 | # build and install everything into the standard system directories |
---|
21 | .PHONY: install |
---|
22 | install: install-xen install-kernels install-tools install-docs |
---|
23 | |
---|
24 | .PHONY: build |
---|
25 | build: kernels |
---|
26 | $(MAKE) -C xen build |
---|
27 | $(MAKE) -C tools build |
---|
28 | $(MAKE) -C docs build |
---|
29 | |
---|
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 |
---|
32 | # handled elsewhere. |
---|
33 | .PHONY: test |
---|
34 | test: |
---|
35 | $(MAKE) -C tools/python test |
---|
36 | |
---|
37 | # build and install everything into local dist directory |
---|
38 | .PHONY: dist |
---|
39 | dist: DESTDIR=$(DISTDIR)/install |
---|
40 | dist: dist-xen dist-kernels dist-tools 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_* $(DISTDIR)/check |
---|
46 | dist-%: DESTDIR=$(DISTDIR)/install |
---|
47 | dist-%: install-% |
---|
48 | @: # do nothing |
---|
49 | |
---|
50 | # Legacy dist targets |
---|
51 | .PHONY: xen tools kernels docs |
---|
52 | xen: dist-xen |
---|
53 | tools: dist-tools |
---|
54 | kernels: dist-kernels |
---|
55 | docs: dist-docs |
---|
56 | |
---|
57 | .PHONY: prep-kernels |
---|
58 | prep-kernels: |
---|
59 | for i in $(XKERNELS) ; do $(MAKE) $$i-prep || exit 1; done |
---|
60 | |
---|
61 | .PHONY: install-xen |
---|
62 | install-xen: |
---|
63 | $(MAKE) -C xen install |
---|
64 | |
---|
65 | .PHONY: install-tools |
---|
66 | install-tools: |
---|
67 | $(MAKE) -C tools install |
---|
68 | |
---|
69 | .PHONY: install-kernels |
---|
70 | install-kernels: |
---|
71 | for i in $(XKERNELS) ; do $(MAKE) $$i-install || exit 1; done |
---|
72 | |
---|
73 | .PHONY: install-docs |
---|
74 | install-docs: |
---|
75 | sh ./docs/check_pkgs && $(MAKE) -C docs install || true |
---|
76 | |
---|
77 | .PHONY: dev-docs |
---|
78 | dev-docs: |
---|
79 | $(MAKE) -C docs dev-docs |
---|
80 | |
---|
81 | # Build all the various kernels and modules |
---|
82 | .PHONY: kbuild |
---|
83 | kbuild: kernels |
---|
84 | |
---|
85 | # Delete the kernel build trees entirely |
---|
86 | .PHONY: kdelete |
---|
87 | kdelete: |
---|
88 | for i in $(XKERNELS) ; do $(MAKE) $$i-delete ; done |
---|
89 | |
---|
90 | # Clean the kernel build trees |
---|
91 | .PHONY: kclean |
---|
92 | kclean: |
---|
93 | for i in $(XKERNELS) ; do $(MAKE) $$i-clean ; done |
---|
94 | |
---|
95 | # Make patches from kernel sparse trees |
---|
96 | .PHONY: mkpatches |
---|
97 | mkpatches: |
---|
98 | for i in $(ALLSPARSETREES) ; do $(MAKE) $$i-xen.patch; done |
---|
99 | |
---|
100 | # build xen, the tools, and a domain 0 plus unprivileged linux-xen images, |
---|
101 | # and place them in the install directory. 'make install' should then |
---|
102 | # copy them to the normal system directories |
---|
103 | .PHONY: world |
---|
104 | world: |
---|
105 | $(MAKE) clean |
---|
106 | $(MAKE) kdelete |
---|
107 | $(MAKE) dist |
---|
108 | |
---|
109 | # clean doesn't do a kclean |
---|
110 | .PHONY: clean |
---|
111 | clean:: |
---|
112 | $(MAKE) -C xen clean |
---|
113 | $(MAKE) -C tools clean |
---|
114 | $(MAKE) -C docs clean |
---|
115 | |
---|
116 | # clean, but blow away kernel build tree plus tarballs |
---|
117 | .PHONY: distclean |
---|
118 | distclean: |
---|
119 | $(MAKE) -C xen distclean |
---|
120 | $(MAKE) -C tools distclean |
---|
121 | $(MAKE) -C docs distclean |
---|
122 | rm -rf dist patches/tmp |
---|
123 | for i in $(ALLKERNELS) ; do $(MAKE) $$i-delete ; done |
---|
124 | for i in $(ALLSPARSETREES) ; do $(MAKE) $$i-mrproper ; done |
---|
125 | rm -rf patches/*/.makedep |
---|
126 | |
---|
127 | # Linux name for GNU distclean |
---|
128 | .PHONY: mrproper |
---|
129 | mrproper: distclean |
---|
130 | |
---|
131 | .PHONY: help |
---|
132 | help: |
---|
133 | @echo 'Installation targets:' |
---|
134 | @echo ' install - build and install everything' |
---|
135 | @echo ' install-xen - build and install the Xen hypervisor' |
---|
136 | @echo ' install-tools - build and install the control tools' |
---|
137 | @echo ' install-kernels - build and install guest kernels' |
---|
138 | @echo ' install-docs - build and install user documentation' |
---|
139 | @echo '' |
---|
140 | @echo 'Building targets:' |
---|
141 | @echo ' dist - build and install everything into local dist directory' |
---|
142 | @echo ' world - clean everything, delete guest kernel build' |
---|
143 | @echo ' trees then make dist' |
---|
144 | @echo ' xen - build and install Xen hypervisor' |
---|
145 | @echo ' tools - build and install tools' |
---|
146 | @echo ' kernels - build and install guest kernels' |
---|
147 | @echo ' kbuild - synonym for make kernels' |
---|
148 | @echo ' docs - build and install user documentation' |
---|
149 | @echo ' dev-docs - build developer-only documentation' |
---|
150 | @echo '' |
---|
151 | @echo 'Cleaning targets:' |
---|
152 | @echo ' clean - clean the Xen, tools and docs (but not guest kernel trees)' |
---|
153 | @echo ' distclean - clean plus delete kernel build trees and' |
---|
154 | @echo ' local downloaded files' |
---|
155 | @echo ' kdelete - delete guest kernel build trees' |
---|
156 | @echo ' kclean - clean guest kernel build trees' |
---|
157 | @echo '' |
---|
158 | @echo 'Miscellaneous targets:' |
---|
159 | @echo ' prep-kernels - prepares kernel directories, does not build' |
---|
160 | @echo ' mkpatches - make patches against vanilla kernels from' |
---|
161 | @echo ' sparse trees' |
---|
162 | @echo ' uninstall - attempt to remove installed Xen tools' |
---|
163 | @echo ' (use with extreme care!)' |
---|
164 | @echo |
---|
165 | @echo 'Environment:' |
---|
166 | @echo ' XEN_PYTHON_NATIVE_INSTALL=y' |
---|
167 | @echo ' - native python install or dist' |
---|
168 | @echo ' install into prefix/lib/python<VERSION>' |
---|
169 | @echo ' instead of <PREFIX>/lib/python' |
---|
170 | @echo ' true if set to non-empty value, false otherwise' |
---|
171 | |
---|
172 | # Use this target with extreme care! |
---|
173 | .PHONY: uninstall |
---|
174 | uninstall: D=$(DESTDIR) |
---|
175 | uninstall: |
---|
176 | [ -d $(D)/etc/xen ] && mv -f $(D)/etc/xen $(D)/etc/xen.old-`date +%s` || true |
---|
177 | rm -rf $(D)/etc/init.d/xend* |
---|
178 | rm -rf $(D)/etc/hotplug/xen-backend.agent |
---|
179 | rm -f $(D)/etc/udev/rules.d/xen-backend.rules |
---|
180 | rm -f $(D)/etc/udev/xen-backend.rules |
---|
181 | rm -f $(D)/etc/sysconfig/xendomains |
---|
182 | rm -rf $(D)/var/run/xen* $(D)/var/lib/xen* |
---|
183 | rm -rf $(D)/boot/*xen* |
---|
184 | rm -rf $(D)/lib/modules/*xen* |
---|
185 | rm -rf $(D)/usr/bin/xen* $(D)/usr/bin/lomount |
---|
186 | rm -rf $(D)/usr/bin/cpuperf-perfcntr $(D)/usr/bin/cpuperf-xen |
---|
187 | rm -rf $(D)/usr/bin/xc_shadow |
---|
188 | rm -rf $(D)/usr/bin/pygrub |
---|
189 | rm -rf $(D)/usr/bin/setsize $(D)/usr/bin/tbctl |
---|
190 | rm -rf $(D)/usr/bin/xsls |
---|
191 | rm -rf $(D)/usr/include/xenctrl.h $(D)/usr/include/xenguest.h |
---|
192 | rm -rf $(D)/usr/include/xs_lib.h $(D)/usr/include/xs.h |
---|
193 | rm -rf $(D)/usr/include/xen |
---|
194 | rm -rf $(D)/usr/$(LIBDIR)/libxenctrl* $(D)/usr/$(LIBDIR)/libxenguest* |
---|
195 | rm -rf $(D)/usr/$(LIBDIR)/libxenstore* |
---|
196 | rm -rf $(D)/usr/$(LIBDIR)/python/xen $(D)/usr/$(LIBDIR)/python/grub |
---|
197 | rm -rf $(D)/usr/$(LIBDIR)/xen/ |
---|
198 | rm -rf $(D)/usr/lib/xen/ |
---|
199 | rm -rf $(D)/usr/local/sbin/setmask $(D)/usr/local/sbin/xen* |
---|
200 | rm -rf $(D)/usr/sbin/xen* $(D)/usr/sbin/netfix $(D)/usr/sbin/xm |
---|
201 | rm -rf $(D)/usr/share/doc/xen |
---|
202 | rm -rf $(D)/usr/share/xen |
---|
203 | rm -rf $(D)/usr/share/man/man1/xen* |
---|
204 | rm -rf $(D)/usr/share/man/man8/xen* |
---|
205 | |
---|
206 | # Legacy targets for compatibility |
---|
207 | .PHONY: linux26 |
---|
208 | linux26: |
---|
209 | $(MAKE) 'KERNELS=linux-2.6*' kernels |
---|