aboutsummaryrefslogtreecommitdiffstats
path: root/buildconfigs/Rules.mk
diff options
context:
space:
mode:
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2004-11-02 22:21:07 +0000
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2004-11-02 22:21:07 +0000
commitee5293cc5f5a9f7f336b870264f5bb38b6eaff06 (patch)
tree5ac489e2a282cb48a41976d58bc795b3a6e5bb68 /buildconfigs/Rules.mk
parent3910bfff7f6fb22cd747b10db846cd75211ad64a (diff)
downloadxen-ee5293cc5f5a9f7f336b870264f5bb38b6eaff06.tar.gz
xen-ee5293cc5f5a9f7f336b870264f5bb38b6eaff06.tar.bz2
xen-ee5293cc5f5a9f7f336b870264f5bb38b6eaff06.zip
bitkeeper revision 1.1159.151.2 (41880853o8v3vRZnyX0vFPNvy-RJ8A)
Makefile improvements
Diffstat (limited to 'buildconfigs/Rules.mk')
-rw-r--r--buildconfigs/Rules.mk64
1 files changed, 64 insertions, 0 deletions
diff --git a/buildconfigs/Rules.mk b/buildconfigs/Rules.mk
new file mode 100644
index 0000000000..6f1caf7d67
--- /dev/null
+++ b/buildconfigs/Rules.mk
@@ -0,0 +1,64 @@
+
+LINUX_26VER ?= $(shell ( /bin/ls -ld linux-2.6.*-xen-sparse ) \
+ 2>/dev/null | sed -e 's!^.*linux-\(.\+\)-xen-sparse!\1!' )
+
+LINUX_24VER ?= $(shell ( /bin/ls -ld linux-2.4.*-xen-sparse ) \
+ 2>/dev/null | sed -e 's!^.*linux-\(.\+\)-xen-sparse!\1!' )
+
+LINUX_SRC_PATH ?= .:..
+
+LINUX_26SRC ?= $(firstword $(foreach dir,$(subst :, ,$(LINUX_SRC_PATH)),\
+ $(wildcard $(dir)/linux-$(LINUX_26VER).tar.*z*)))
+
+LINUX_24SRC ?= $(firstword $(foreach dir,$(subst :, ,$(LINUX_SRC_PATH)),\
+ $(wildcard $(dir)/linux-$(LINUX_24VER).tar.*z*)))
+
+.PHONY: mkpatches linux-$(LINUX_24VER)-xen.patch linux-$(LINUX_26VER)-xen.patch mrproper
+
+# search for a pristine kernel tar ball, or try downloading one
+linux-$(LINUX_26VER).tar.bz2:
+ifeq ($(LINUX_26SRC),)
+ echo "Cannot find linux-$(LINUX_26VER).tar.bz2 in path $(LINUX_SRC_PATH)"
+ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-$(LINUX_26VER).tar.bz2 -O./linux-$(LINUX_26VER).tar.bz2
+LINUX_26SRC := ./linux-$(LINUX_26VER).tar.bz2
+endif
+
+pristine-linux-$(LINUX_26VER): $(LINUX_26SRC)
+ rm -rf tmp $@ && mkdir -p tmp && tar -C tmp -jxf $(LINUX_26SRC) && mv tmp/* $@
+ touch $@ # update timestamp to avoid rebuild
+
+
+# search for a pristine kernel tar ball, or try downloading one
+linux-$(LINUX_24VER).tar.bz2:
+ifeq ($(LINUX_24SRC),)
+ echo "Cannot find linux-$(LINUX_24VER).tar.bz2 in path $(LINUX_SRC_PATH)"
+ wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-$(LINUX_24VER).tar.bz2 -O./linux-$(LINUX_24VER).tar.bz2
+LINUX_24SRC := ./linux-$(LINUX_24VER).tar.bz2
+endif
+
+pristine-linux-$(LINUX_24VER): $(LINUX_24SRC)
+ rm -rf tmp $@ && mkdir -p tmp && tar -C tmp -jxf $(LINUX_24SRC) && mv tmp/* $@
+ touch $@ # update timestamp to avoid rebuild
+
+linux-$(LINUX_24VER)-xen.patch: pristine-linux-$(LINUX_24VER)
+ rm -rf tmp-$@
+ cp -al pristine-linux-$(LINUX_24VER) tmp-$@
+ ( cd linux-$(LINUX_24VER)-xen-sparse ; \
+ ./mkbuildtree ../tmp-$@ )
+ diff -Nurp pristine-linux-$(LINUX_24VER) tmp-$@ > $@ || true
+ rm -rf tmp-$@
+
+linux-$(LINUX_26VER)-xen.patch: pristine-linux-$(LINUX_26VER)
+ rm -rf tmp-$@
+ cp -al pristine-linux-$(LINUX_26VER) tmp-$@
+ ( cd linux-$(LINUX_26VER)-xen-sparse ; \
+ ./mkbuildtree ../tmp-$@ )
+ diff -Nurp pristine-linux-$(LINUX_26VER) tmp-$@ > $@ || true
+ rm -rf tmp-$@
+
+mkpatches: linux-$(LINUX_24VER)-xen.patch linux-$(LINUX_26VER)-xen.patch
+
+mrproper:
+ rm -rf pristine-linux-$(LINUX_24VER) linux-$(LINUX_24VER).tar.bz2
+ rm -rf pristine-linux-$(LINUX_26VER) linux-$(LINUX_26VER).tar.bz2
+ rm -rf linux-$(LINUX_24VER)-xen.patch linux-$(LINUX_26VER)-xen.patch \ No newline at end of file