OSDN Git Service

Update cross tools prefix
[uclinux-h8/uClinux-dist.git] / openswan / debian / openswan-modules-source.rules
1 #!/usr/bin/make -f
2 # Sample debian/rules that uses debhelper.
3 # GNU copyright 1997 to 1999 by Joey Hess.
4
5 # Uncomment this to turn on verbose mode.
6 #export DH_VERBOSE=1
7
8 VERS = $(shell sed -ne '1s/.*(\(.*\)).*/\1/p' debian/changelog)
9
10 # KSRC is the location of the kernel source. This is the default value,
11 # when make-kpkg is used it will supply to real value
12 KSRC            = /usr/src/linux
13
14 # KDREV is the package-revision, as given to make-kpkg by the user.
15 # Just put a simply default value in here which we use when we test
16 # the packagebuilding without make-kpkg
17 KDREV           = "Custom.1.00"
18
19 # Separate the epoch from the normal revision number in KDREV
20 # for use with dh_gencontrol
21 KDREV_EPOCH = $(shell echo $(KDREV) | sed -ne '1s/\([^:]*:\)\?\(.*\)/\1/p')
22 KDREV_REV   = $(shell echo $(KDREV) | sed -ne '1s/\([^:]*:\)\?\(.*\)/\2/p')
23
24 # Now we need to get the kernel-version somehow
25 if test -d $(KSRC); then \
26         KVERS=`sed -n -e '/UTS_RELEASE/s/^[^"]*"\([^"]*\)".*$$/\1/p' $(KSRC)/include/linux/version.h`; \
27 fi
28
29 # KMAINT and KEMAIL should be set but in case they are not we specify
30 # sane default values
31
32 ifeq ($(KMAINT),)
33 KMAINT = Rene Mayrhofer
34 endif
35 ifeq ($(KEMAIL),)
36 KEMAIL = rmayr@debian.org
37 endif
38
39 SED_SCRIPT=s!\$$KVERS!$(KVERS)!g; \
40        s!\$$KEMAIL!$(KEMAIL)!; \
41        s!\$$KMAINT!$(KMAINT)!; \
42        s!\$$KDREV!$(KDREV)!
43
44 ifeq ($(DEB_DEST),)
45 DEB_DEST=$(KSRC)/..
46 endif
47
48 # Clear root command if already root
49 ifeq ($(shell id -u),0)
50 ROOT_CMD=
51 endif
52
53 # export these variables as they are necessary for building
54 export KERNELSRC=${KSRC}
55 export OPENSWANSRCDIR=$(CURDIR)
56
57 # this primarily sets ARCH, we may be able to do that in another way
58 # but it also defines IPSECVERSION, which is needed below
59 include Makefile.inc
60
61 debian/control: debian/control.in
62         if ! test -f $@; then \
63                 sed -e "$(SED_SCRIPT)" debian/control.in > $@; \
64         fi
65
66 .PHONY: debian/control
67
68 debian/docs:
69         cp debian/docs.in debian/openswan-modules-$(KVERS).docs
70
71 debian/lintian-overrides:
72         sed -e "$(SED_SCRIPT)" debian/lintian-overrides.in > debian/openswan-modules-$(KVERS).lintian-overrides
73
74 configure: configure-stamp
75 configure-stamp:
76         dh_testdir
77         # Add here commands to configure the package.
78
79         touch configure-stamp
80
81 build: debian/control debian/docs debian/lintian-overrides configure-stamp build-stamp
82 build-stamp:
83         dh_testdir
84
85         $(MAKE) module
86
87         touch build-stamp
88
89 clean:
90         dh_testdir
91         dh_testroot
92         rm -f build-stamp configure-stamp
93
94         $(MAKE) moduleclean
95         rm -rf OBJ.* || true
96
97         dh_clean
98
99         rm -f debian/control || true
100         rm -f debian/openswan-modules-*.docs || true
101         rm -f debian/openswan-modules-*.lintian-overrides || true
102
103 MODDESTDIR=$(CURDIR)/debian/openswan-modules-$(KVERS)/lib/modules/$(KVERS)/kernel/net/ipsec
104 install:
105 install: build
106         dh_testdir
107         dh_testroot
108         dh_prep
109         dh_installdirs
110
111         mkdir -p $(MODDESTDIR)
112         cp modobj26/ipsec.ko $(MODDESTDIR)
113
114
115 # Build architecture-independent files here.
116 binary-indep: build install
117 # We have nothing to do by default.
118
119 # Build architecture-dependent files here.
120 binary-arch: build install
121         dh_testdir
122         dh_testroot
123         dh_installdocs
124         dh_installmodules
125         dh_installchangelogs CHANGES
126         dh_compress
127         dh_fixperms
128         dh_lintian
129         dh_installdeb
130         dh_gencontrol -- -v$(KDREV_EPOCH)$(VERS)+$(KDREV_REV)
131         dh_md5sums
132         dh_builddeb --destdir=$(DEB_DEST)
133
134 binary: binary-indep binary-arch
135 .PHONY: build clean binary-indep binary-arch binary install configure
136
137 binary-modules: binary
138
139
140 kdist_image:
141         $(ROOT_CMD) $(MAKE) -f debian/rules binary-modules
142         $(ROOT_CMD) $(MAKE) -f debian/rules clean
143 kdist_clean: debian/control clean
144 kdist:
145         $(ROOT_CMD) $(MAKE) -f debian/rules binary-modules
146 kdist_configure: configure-stamp
147
148
149 .PHONY: binary-modules kdist_image