ia64/xen-unstable

view Makefile @ 2828:62d5a53a46e2

bitkeeper revision 1.1159.1.338 (4187ca95yoh3y8SwBJw4uTmgIxLCTw)

A new install script to install from the intermediate 'install' subdir.
Also now a bit more careful in use of 'cp -a'. When installing to
system-wide directories we probably do not want to preserve ownership
of the random unprivileged user that originally built the binaries.
The user who does the install (probably root) is the correct person
to own the target files.
author kaf24@freefall.cl.cam.ac.uk
date Tue Nov 02 17:57:41 2004 +0000 (2004-11-02)
parents eb0280fe0abf
children 565da10c07de
line source
1 #
2 # Grand Unified Makefile for Xen.
3 #
5 INSTALL_DIR ?= $(shell pwd)/install
7 SOURCEFORGE_MIRROR := http://heanet.dl.sourceforge.net/sourceforge
8 #http://voxel.dl.sourceforge.net/sourceforge/
9 #http://easynews.dl.sourceforge.net/sourceforge
11 .PHONY: docs delete-symlinks clean
13 # a not partcularly useful but safe default target
14 all:
15 $(MAKE) prefix=$(INSTALL_DIR) dist=yes -C xen install
16 $(MAKE) prefix=$(INSTALL_DIR) dist=yes -C tools install
17 sh ./docs/check_pkgs && \
18 $(MAKE) prefix=$(INSTALL_DIR) dist=yes -C docs install
20 # install everything into the standard system directories
21 install: dist
22 $(MAKE) -C xen install
23 $(MAKE) -C tools install
24 sh ./docs/check_pkgs && $(MAKE) -C docs install
25 $(shell cp -dR install/boot/*$(LINUX_VER)* /boot/)
26 $(shell cp -dR install/lib/modules/* /lib/modules/)
28 # install xen and tools into the install directory
29 dist: all
30 $(MAKE) linux-xenU
31 $(MAKE) linux-xen0
33 LINUX_RELEASE ?= 2.6
34 LINUX_VER ?= $(shell ( /bin/ls -ld linux-$(LINUX_RELEASE).*-xen-sparse ) 2>/dev/null | \
35 sed -e 's!^.*linux-\(.\+\)-xen-sparse!\1!' )
36 LINUX26_VER ?= $(shell ( /bin/ls -ld linux-2.6.*-xen-sparse ) 2>/dev/null | \
37 sed -e 's!^.*linux-\(.\+\)-xen-sparse!\1!' )
38 LINUX_CONFIG_DIR ?= $(INSTALL_DIR)/boot
39 LINUX_SRC_PATH ?= .:..
40 LINUX_SRC ?= $(firstword $(foreach dir,$(subst :, ,$(LINUX_SRC_PATH)),\
41 $(wildcard $(dir)/linux-$(LINUX_VER).tar.*z*)))
43 # search for a pristine kernel tar ball, or try downloading one
44 pristine-linux-src:
45 ifeq ($(LINUX_SRC),)
46 @echo "Cannot find linux-$(LINUX_VER).tar.gz in path $(LINUX_SRC_PATH)"
47 @wget http://www.kernel.org/pub/linux/kernel/v$(LINUX_RELEASE)/linux-$(LINUX_VER).tar.bz2 -O./linux-$(LINUX_VER).tar.bz2
48 LINUX_SRC := ./linux-$(LINUX_VER).tar.bz2
49 endif
51 patches/ebtables.diff:
52 mkdir -p patches
53 #wget $(SOURCEFORGE_MIRROR)/ebtables/ebtables-brnf-5_vs_2.4.25.diff.gz \
54 -O- | gunzip -c > $@
55 wget http://www.cl.cam.ac.uk/netos/xen/downloads/ebtables-brnf-5_vs_2.4.27.diff.gz -O- | gunzip -c > $@
57 LINUX_TREES := linux-$(LINUX_VER)-xen0 linux-$(LINUX_VER)-xenU
59 # make a linux-xen build tree from a pristine kernel plus sparse tree
60 ifeq ($(LINUX_RELEASE),2.4)
61 mk-linux-trees: patches/ebtables.diff pristine-linux-src
62 $(RM) -rf $(LINUX_TREES)
63 echo $(LINUX_SRC) | grep -q bz2 && \
64 tar -jxf $(LINUX_SRC) || tar -zxf $(LINUX_SRC)
65 mv linux-$(LINUX_VER) linux-$(LINUX_VER)-xen0
66 ( cd linux-$(LINUX_VER)-xen-sparse ; \
67 ./mkbuildtree ../linux-$(LINUX_VER)-xen0 )
68 cp -al linux-$(LINUX_VER)-xen0 linux-$(LINUX_VER)-xenU
69 ( cd linux-$(LINUX_VER)-xen0 ; \
70 patch -p1 -F3 < ../patches/ebtables.diff ; \
71 sed -e 's/^EXTRAVERSION.*/&-xen0/' Makefile >Mk.tmp ; \
72 rm -f Makefile ; mv Mk.tmp Makefile )
73 ( cd linux-$(LINUX_VER)-xenU ; \
74 sed -e 's/^EXTRAVERSION.*/&-xenU/' Makefile >Mk.tmp ; \
75 rm -f Makefile ; mv Mk.tmp Makefile )
76 else
77 mk-linux-trees: pristine-linux-src
78 $(RM) -rf $(LINUX_TREES)
79 echo $(LINUX_SRC) | grep -q bz2 && \
80 tar -jxf $(LINUX_SRC) || tar -zxf $(LINUX_SRC)
81 mv linux-$(LINUX_VER) linux-$(LINUX_VER)-xen0
82 ( cd linux-$(LINUX_VER)-xen-sparse ; \
83 ./mkbuildtree ../linux-$(LINUX_VER)-xen0 )
84 cp -al linux-$(LINUX_VER)-xen0 linux-$(LINUX_VER)-xenU
85 ( cd linux-$(LINUX_VER)-xen0 ; \
86 sed -e 's/^EXTRAVERSION.*/&-xen0/' Makefile >Mk.tmp ; \
87 rm -f Makefile ; mv Mk.tmp Makefile )
88 ( cd linux-$(LINUX_VER)-xenU ; \
89 sed -e 's/^EXTRAVERSION.*/&-xenU/' Makefile >Mk.tmp ; \
90 rm -f Makefile ; mv Mk.tmp Makefile )
91 endif
93 # configure the specified linux tree
94 CDIR = $(subst config-,linux-$(LINUX_VER)-,$@)
95 ifeq ($(LINUX_RELEASE),2.4)
96 config-xen%:
97 $(MAKE) -C $(CDIR) ARCH=xen mrproper
98 cp $(LINUX_CONFIG_DIR)/config-$(LINUX_VER)$(subst config,,$@) \
99 $(CDIR)/.config || \
100 $(MAKE) -C $(CDIR) ARCH=xen $(subst config-,,$@)_config
101 $(MAKE) -C $(CDIR) ARCH=xen oldconfig
102 $(MAKE) -C $(CDIR) ARCH=xen dep
103 else
104 config-xen%:
105 $(MAKE) -C $(CDIR) ARCH=xen mrproper
106 @[ -e $(LINUX_CONFIG_DIR)/config-$(LINUX_VER)-$(subst config-,,$@) ] \
107 && cp $(LINUX_CONFIG_DIR)/config-$(LINUX_VER)-$(subst config-,,$@) \
108 $(CDIR)/.config || \
109 $(MAKE) -C $(CDIR) ARCH=xen $(subst config-,,$@)_defconfig
110 endif
112 # build the specified linux tree
113 BDIR = $(subst linux-,linux-$(LINUX_VER)-,$@)
114 linux-xen%:
115 $(MAKE) -C $(BDIR) ARCH=xen modules
116 $(MAKE) -C $(BDIR) ARCH=xen INSTALL_MOD_PATH=$(INSTALL_DIR) \
117 modules_install
118 $(MAKE) -C $(BDIR) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install
120 NETBSD_RELEASE ?= 2.0
121 NETBSD_VER ?= $(shell ( /bin/ls -ld netbsd-$(NETBSD_RELEASE)*-xen-sparse ) 2>/dev/null | \
122 sed -e 's!^.*netbsd-\(.\+\)-xen-sparse!\1!' )
123 NETBSD_CVSSNAP ?= 20040906
124 NETBSD_SRC_PATH ?= .:..
125 NETBSD_SRC ?= $(firstword $(foreach dir,$(subst :, ,$(NETBSD_SRC_PATH)),\
126 $(wildcard $(dir)/netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.*z*)))
127 NETBSD_TOOLS_SRC ?= $(firstword $(foreach dir,$(subst :, ,$(NETBSD_SRC_PATH)),\
128 $(wildcard $(dir)/netbsd-$(NETBSD_VER)-tools.tar.*z*)))
130 NETBSD_TREES := netbsd-$(NETBSD_VER)-xenU
132 pristine-netbsd-src:
133 ifeq ($(NETBSD_SRC),)
134 @echo "Cannot find netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.gz in path $(NETBSD_SRC_PATH)"
135 @wget http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2 -O./netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2
136 NETBSD_SRC := ./netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2
137 endif
139 pristine-netbsd-tools-src:
140 ifeq ($(NETBSD_TOOLS_SRC),)
141 @echo "Cannot find netbsd-$(NETBSD_VER)-tools.tar.gz in path $(NETBSD_SRC_PATH)"
142 @wget http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/netbsd-$(NETBSD_VER)-tools.tar.bz2 -O./netbsd-$(NETBSD_VER)-tools.tar.bz2
143 NETBSD_TOOLS_SRC := ./netbsd-$(NETBSD_VER)-tools.tar.bz2
144 endif
146 netbsd-tools: pristine-netbsd-tools-src
147 @[ -d netbsd-$(NETBSD_RELEASE)-tools ] || { \
148 echo extract $(NETBSD_TOOLS_SRC); \
149 tar -jxf $(NETBSD_TOOLS_SRC); }
151 mk-netbsd-trees: netbsd-tools pristine-netbsd-src
152 $(RM) -rf $(NETBSD_TREES)
153 echo $(NETBSD_SRC) | grep -q bz2 && \
154 tar -jxf $(NETBSD_SRC) || tar -zxf $(NETBSD_SRC)
155 mv netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP) \
156 netbsd-$(NETBSD_VER)-xenU
157 ( cd netbsd-$(NETBSD_VER)-xen-sparse ; \
158 ./mkbuildtree ../netbsd-$(NETBSD_VER)-xenU )
160 # build the specified netbsd tree
161 NBDIR = $(subst netbsd-,netbsd-$(NETBSD_VER)-,$@)
162 netbsd-xen%:
163 $(MAKE) -C $(NBDIR) config
164 $(MAKE) -C $(NBDIR) netbsd
165 $(MAKE) -C $(NBDIR) INSTALL_PATH=$(INSTALL_DIR) INSTALL_NAME=boot/netbsd-$(NETBSD_VER)-$(subst netbsd-,,$@) install
167 # build xen, the tools, and a domain 0 plus unprivileged linux-xen images,
168 # and place them in the install directory. 'make install' should then
169 # copy them to the normal system directories
170 world:
171 $(MAKE) clean
172 $(MAKE) all
173 $(MAKE) mk-linux-trees
174 $(MAKE) config-xenU
175 $(MAKE) linux-xenU
176 $(MAKE) config-xen0
177 $(MAKE) linux-xen0
178 $(MAKE) docs
180 linux26:
181 $(MAKE) LINUX_RELEASE=2.6 mk-linux-trees
182 $(MAKE) LINUX_RELEASE=2.6 config-xenU
183 $(MAKE) LINUX_RELEASE=2.6 linux-xenU
184 $(MAKE) LINUX_RELEASE=2.6 config-xen0
185 $(MAKE) LINUX_RELEASE=2.6 linux-xen0
187 linux24:
188 $(MAKE) LINUX_RELEASE=2.4 mk-linux-trees
189 $(MAKE) LINUX_RELEASE=2.4 config-xenU
190 $(MAKE) LINUX_RELEASE=2.4 linux-xenU
191 $(MAKE) LINUX_RELEASE=2.4 config-xen0
192 $(MAKE) LINUX_RELEASE=2.4 linux-xen0
194 netbsd:
195 $(MAKE) mk-netbsd-trees
196 $(MAKE) netbsd-xenU
198 clean:
199 $(MAKE) -C xen clean
200 $(MAKE) -C tools clean
201 $(MAKE) -C docs clean
203 # clean, but blow away linux build tree plus src tar ball
204 mrproper: clean
205 rm -rf install/* patches $(LINUX_TREES) linux-$(LINUX_VER).tar.*
207 install-twisted:
208 wget http://www.twistedmatrix.com/products/get-current.epy
209 tar -zxf Twisted-*.tar.gz
210 ( cd Twisted-* ; python setup.py install )
212 install-logging: LOGGING=logging-0.4.9.2
213 install-logging:
214 [ -f $(LOGGING).tar.gz ] || wget http://www.red-dove.com/$(LOGGING).tar.gz
215 tar -zxf $(LOGGING).tar.gz
216 ( cd $(LOGGING) && python setup.py install )
218 # handy target to upgrade iptables (use rpm or apt-get in preference)
219 install-iptables:
220 wget http://www.netfilter.org/files/iptables-1.2.11.tar.bz2
221 tar -jxf iptables-*.tar.bz2
222 ( cd iptables-* ; \
223 make PREFIX= KERNEL_DIR=../linux-$(LINUX_VER)-xen0 install)
225 uninstall:
226 cp -a /etc/xen /etc/xen.old && rm -rf /etc/xen
227 rm -rf "/usr/lib/python2.2/site-packages/xen* /usr/lib/libxc* /usr/lib/python2.2/site-packages/Xc*"
229 docs:
230 $(MAKE) -C docs all || true