ia64/xen-unstable

view buildconfigs/Rules.mk @ 4897:8d8e644fea51

bitkeeper revision 1.1159.258.121 (4284a2fe8e-teEoJtU8EYiHY0jsBdg)

Fix construction of ref directories when no patches are present
author mafetter@fleming.research
date Fri May 13 12:52:14 2005 +0000 (2005-05-13)
parents 783e437809b6
children d3b5e4a7d853
line source
2 # We expect these two to already be set if people
3 # are using the top-level Makefile
4 DISTDIR ?= $(CURDIR)/dist
5 DESTDIR ?= $(DISTDIR)/install
7 ALLKERNELS = $(patsubst buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.*))
8 ALLSPARSETREES = $(patsubst %-xen-sparse,%,$(wildcard *-xen-sparse))
10 .PHONY: mkpatches mrproper
12 # Setup pristine search path
13 PRISTINE_SRC_PATH ?= .:..
14 vpath pristine-% $(PRISTINE_SRC_PATH)
16 # Expand Linux series to Linux version
17 LINUX_SERIES ?= 2.6
18 LINUX_VER ?= $(patsubst linux-%-xen-sparse,%,$(wildcard linux-$(LINUX_SERIES)*-xen-sparse))
20 # Setup Linux search path
21 LINUX_SRC_PATH ?= .:..
22 vpath linux-%.tar.bz2 $(LINUX_SRC_PATH)
24 # download a pristine Linux kernel tarball if there isn't one in LINUX_SRC_PATH
25 linux-%.tar.bz2: override _LINUX_VDIR = $(word 1,$(subst ., ,$*)).$(word 2,$(subst ., ,$*))
26 linux-%.tar.bz2:
27 @echo "Cannot find $@ in path $(LINUX_SRC_PATH)"
28 wget http://www.kernel.org/pub/linux/kernel/v$(_LINUX_VDIR)/$@ -O./$@
30 # Expand NetBSD release to NetBSD version
31 NETBSD_RELEASE ?= 2.0
32 NETBSD_VER ?= $(patsubst netbsd-%-xen-sparse,%,$(wildcard netbsd-$(NETBSD_RELEASE)*-xen-sparse))
33 NETBSD_CVSSNAP ?= 20050309
35 # Setup NetBSD search path
36 NETBSD_SRC_PATH ?= .:..
37 vpath netbsd-%.tar.bz2 $(NETBSD_SRC_PATH)
39 # download a pristine NetBSD tarball if there isn't one in NETBSD_SRC_PATH
40 netbsd-%-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2:
41 @echo "Cannot find $@ in path $(NETBSD_SRC_PATH)"
42 wget http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/$@ -O./$@
44 netbsd-%.tar.bz2: netbsd-%-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2
45 ln -fs $< $@
47 ifeq ($(OS),linux)
48 OS_VER = $(LINUX_VER)
49 else
50 OS_VER = $(NETBSD_VER)
51 endif
53 $(patsubst %,pristine-%/.valid-pristine,$(ALLSPARSETREES)) : pristine-%/.valid-pristine: %.tar.bz2
54 rm -rf tmp-pristine-$* $(@D)
55 mkdir -p tmp-pristine-$*
56 tar -C tmp-pristine-$* -jxf $<
57 mv tmp-pristine-$*/* $(@D)
58 @rm -rf tmp-pristine-$*
59 touch $@ # update timestamp to avoid rebuild
61 PATCHDIRS := $(wildcard patches/*-*)
63 -include $(patsubst %,%/.makedep,$(PATCHDIRS))
65 $(patsubst patches/%,patches/%/.makedep,$(PATCHDIRS)): patches/%/.makedep:
66 @echo 'ref-$*/.valid-ref: $$(wildcard patches/$*/*.patch)' >$@
68 clean::
69 rm -f patches/*/.makedep
71 ref-%/.valid-ref: pristine-%/.valid-pristine
72 rm -rf $(@D)
73 cp -al $(<D) $(@D)
74 ([ -d patches/$* ] && \
75 for i in patches/$*/*.patch ; do ( cd $(@D) ; patch -p1 <../$$i || exit 1 ) ; done) || true
76 touch $@ # update timestamp to avoid rebuild
78 %-build:
79 $(MAKE) -f buildconfigs/mk.$* build
81 %-delete:
82 $(MAKE) -f buildconfigs/mk.$* delete
84 %-clean:
85 $(MAKE) -f buildconfigs/mk.$* clean
87 %-xen.patch: ref-%/.valid-ref
88 rm -rf tmp-$@
89 cp -al $(<D) tmp-$@
90 ( cd $*-xen-sparse && ./mkbuildtree ../tmp-$@ )
91 diff -Nurp $(<D) tmp-$@ > $@ || true
92 rm -rf tmp-$@
94 %-mrproper: %-mrproper-extra
95 rm -rf pristine-$* ref-$* $*.tar.bz2
96 rm -rf $*-xen.patch
98 netbsd-%-mrproper-extra:
99 rm -rf netbsd-$*-tools netbsd-$*-tools.tar.bz2
100 rm -f netbsd-$*-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2
102 %-mrproper-extra:
103 @: # do nothing
105 # never delete any intermediate files.
106 .SECONDARY: