ia64/xen-unstable

view Makefile @ 19527:0e24e9674ded

tools: Always use sane upstream (`native') python paths

Previously, by default we would install our python modules into
/usr/lib/python/xen, for example /usr/lib/python/xen/__init__.py.
Upstream python's standard install location (a) includes the Python
version number and (b) puts things in site-packages by default.

Our best conjecture for the reason for this was an attempt to make the
installs portable between different python versions. However, that
doesn't work because compiled python modules (.pyc), and C python
extensions corresponding to one version of python, are not compatible
across different versions of python.

This is why upstream include the version number.

site-packages is the standard location for locally-installed packages
and is automatically included on the python search path.

In this change, we abandon our own unusual python path setup:

* Invoke setup.py in an entirely standard manner. We pass
PREFIX and DESTDIR using the appropriate options provided by
setup.py for those purposes (adding them to setup.py calls
which were previously lacking them).

* Since the installation locations are now on the standard
python path, we no longer need to add anything to the path
in any of our python utilities. Therefore remove all that
code from every python script. (Many of these scripts
unconditionally added /usr/lib/python and /usr/lib64/python which
is wrong even in the old world.)

* There is no longer any special `Xen python path'. xen-python-path
is no longer needed. It is no longer called by anything in our
tree. However since out-of-tree callers may still invoke it, we
retain it. It now prints a fixed string referring to a directory
which does not to exist; callers (who use it to augment their
python path) will thus add a nonexistent directory to their python
path which is harmless.

* Remove various workarounds including use of setup.py --home
(which is intended for something completely different).

* Remove tests for the XEN_PYTHON_NATIVE_INSTALL build-time
environment variable. The new behaviour is the behaviour which we
should have had if this variable had been set. That is, it is now
as if this variable was always set but also bugs in the resulting
install have been fixed.

This should be a proper fix for the bug addressed by c/s 19515.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Apr 08 19:13:04 2009 +0100 (2009-04-08)
parents ff9fdd6fce1e
children ec9c4b76355b
line source
1 #
2 # Grand Unified Makefile for Xen.
3 #
5 # Default target must appear before any include lines
6 .PHONY: all
7 all: dist
9 export XEN_ROOT=$(CURDIR)
10 include Config.mk
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
17 .PHONY: install
18 install: install-xen install-kernels install-tools install-stubdom install-docs
20 .PHONY: build
21 build: kernels
22 $(MAKE) -C xen build
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
27 endif
28 $(MAKE) -C docs build
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
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-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
47 dist-%: install-%
48 @: # do nothing
50 # Legacy dist targets
51 .PHONY: xen tools stubdom kernels docs
52 xen: dist-xen
53 tools: dist-tools
54 kernels: dist-kernels
55 stubdom: dist-stubdom
56 docs: dist-docs
58 .PHONY: prep-kernels
59 prep-kernels:
60 for i in $(XKERNELS) ; do $(MAKE) $$i-prep || exit 1; done
62 .PHONY: install-xen
63 install-xen:
64 $(MAKE) -C xen install
66 .PHONY: install-tools
67 install-tools: tools/ioemu-dir
68 $(MAKE) -C tools install
70 .PHONY: install-kernels
71 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
79 endif
81 tools/ioemu-dir:
82 $(MAKE) -C tools ioemu-dir-find
84 .PHONY: install-docs
85 install-docs:
86 sh ./docs/check_pkgs && $(MAKE) -C docs install || true
88 .PHONY: dev-docs
89 dev-docs:
90 $(MAKE) -C docs dev-docs
92 # Build all the various kernels and modules
93 .PHONY: kbuild
94 kbuild: kernels
96 # Delete the kernel build trees entirely
97 .PHONY: kdelete
98 kdelete:
99 for i in $(XKERNELS) ; do $(MAKE) $$i-delete ; done
101 # Clean the kernel build trees
102 .PHONY: kclean
103 kclean:
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
109 .PHONY: world
110 world:
111 $(MAKE) clean
112 $(MAKE) kdelete
113 $(MAKE) dist
115 # clean doesn't do a kclean
116 .PHONY: clean
117 clean::
118 $(MAKE) -C xen clean
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
123 endif
124 $(MAKE) -C docs clean
126 # clean, but blow away kernel build tree plus tarballs
127 .PHONY: distclean
128 distclean:
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
134 endif
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
141 .PHONY: mrproper
142 mrproper: distclean
144 # Prepare for source tarball
145 .PHONY: src-tarball
146 src-tarball: distclean
147 $(MAKE) -C xen .banner
148 rm -rf xen/tools/figlet .[a-z]*
149 $(MAKE) -C xen distclean
151 .PHONY: help
152 help:
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'
160 @echo ''
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'
172 @echo ''
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'
179 @echo ''
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!)'
184 @echo
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'
189 @echo
190 @echo 'Environment:'
191 @echo ' [ this documentation is sadly not complete ]'
193 # Use this target with extreme care!
194 .PHONY: uninstall
195 uninstall: D=$(DESTDIR)
196 uninstall:
197 [ -d $(D)/etc/xen ] && mv -f $(D)/etc/xen $(D)/etc/xen.old-`date +%s` || true
198 rm -rf $(D)/etc/init.d/xend*
199 rm -rf $(D)/etc/hotplug/xen-backend.agent
200 rm -f $(D)/etc/udev/rules.d/xen-backend.rules
201 rm -f $(D)/etc/udev/xen-backend.rules
202 rm -f $(D)/etc/udev/rules.d/xend.rules
203 rm -f $(D)/etc/udev/xend.rules
204 rm -f $(D)/etc/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)/usr/bin/xen* $(D)/usr/bin/lomount
209 rm -rf $(D)/usr/bin/cpuperf-perfcntr $(D)/usr/bin/cpuperf-xen
210 rm -rf $(D)/usr/bin/xc_shadow
211 rm -rf $(D)/usr/bin/pygrub
212 rm -rf $(D)/usr/bin/setsize $(D)/usr/bin/tbctl
213 rm -rf $(D)/usr/bin/xsls
214 rm -rf $(D)/usr/include/xenctrl.h $(D)/usr/include/xenguest.h
215 rm -rf $(D)/usr/include/xs_lib.h $(D)/usr/include/xs.h
216 rm -rf $(D)/usr/include/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)/usr/lib/xen/
222 rm -rf $(D)/usr/local/sbin/setmask $(D)/usr/local/sbin/xen*
223 rm -rf $(D)/usr/sbin/xen* $(D)/usr/sbin/netfix $(D)/usr/sbin/xm
224 rm -rf $(D)/usr/share/doc/xen
225 rm -rf $(D)/usr/share/xen
226 rm -rf $(D)/usr/share/man/man1/xen*
227 rm -rf $(D)/usr/share/man/man8/xen*
228 rm -rf $(D)/boot/tboot*
230 # Legacy targets for compatibility
231 .PHONY: linux26
232 linux26:
233 $(MAKE) 'KERNELS=linux-2.6*' kernels
236 #
237 # tboot targets
238 #
240 TBOOT_TARFILE = tboot-20080613.tar.gz
241 #TBOOT_BASE_URL = http://downloads.sourceforge.net/tboot
242 TBOOT_BASE_URL = $(XEN_EXTFILES_URL)
244 .PHONY: build-tboot
245 build-tboot: download_tboot
246 $(MAKE) -C tboot build
248 .PHONY: install-tboot
249 install-tboot: download_tboot
250 $(MAKE) -C tboot install
252 .PHONY: dist-tboot
253 dist-tboot: download_tboot
254 $(MAKE) DESTDIR=$(DISTDIR)/install -C tboot dist
256 .PHONY: clean-tboot
257 clean-tboot:
258 [ ! -d tboot ] || $(MAKE) -C tboot clean
260 .PHONY: distclean-tboot
261 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):
271 mkdir -p tboot
272 wget -O tboot/$(TBOOT_TARFILE) $(TBOOT_BASE_URL)/$(TBOOT_TARFILE)