2 # Sample debian/rules that uses debhelper.
3 # GNU copyright 1997 to 1999 by Joey Hess.
5 # Uncomment this to turn on verbose mode.
8 VERS = $(shell sed -ne '1s/.*(\(.*\)).*/\1/p' debian/changelog)
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
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
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')
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`; \
29 # KMAINT and KEMAIL should be set but in case they are not we specify
33 KMAINT = Rene Mayrhofer
36 KEMAIL = rmayr@debian.org
39 SED_SCRIPT=s!\$$KVERS!$(KVERS)!g; \
40 s!\$$KEMAIL!$(KEMAIL)!; \
41 s!\$$KMAINT!$(KMAINT)!; \
48 # Clear root command if already root
49 ifeq ($(shell id -u),0)
53 # export these variables as they are necessary for building
54 export KERNELSRC=${KSRC}
55 export OPENSWANSRCDIR=$(CURDIR)
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
61 debian/control: debian/control.in
62 if ! test -f $@; then \
63 sed -e "$(SED_SCRIPT)" debian/control.in > $@; \
66 .PHONY: debian/control
69 cp debian/docs.in debian/openswan-modules-$(KVERS).docs
71 debian/lintian-overrides:
72 sed -e "$(SED_SCRIPT)" debian/lintian-overrides.in > debian/openswan-modules-$(KVERS).lintian-overrides
74 configure: configure-stamp
77 # Add here commands to configure the package.
81 build: debian/control debian/docs debian/lintian-overrides configure-stamp build-stamp
92 rm -f build-stamp configure-stamp
99 rm -f debian/control || true
100 rm -f debian/openswan-modules-*.docs || true
101 rm -f debian/openswan-modules-*.lintian-overrides || true
103 MODDESTDIR=$(CURDIR)/debian/openswan-modules-$(KVERS)/lib/modules/$(KVERS)/kernel/net/ipsec
111 mkdir -p $(MODDESTDIR)
112 cp modobj26/ipsec.ko $(MODDESTDIR)
115 # Build architecture-independent files here.
116 binary-indep: build install
117 # We have nothing to do by default.
119 # Build architecture-dependent files here.
120 binary-arch: build install
125 dh_installchangelogs CHANGES
130 dh_gencontrol -- -v$(KDREV_EPOCH)$(VERS)+$(KDREV_REV)
132 dh_builddeb --destdir=$(DEB_DEST)
134 binary: binary-indep binary-arch
135 .PHONY: build clean binary-indep binary-arch binary install configure
137 binary-modules: binary
141 $(ROOT_CMD) $(MAKE) -f debian/rules binary-modules
142 $(ROOT_CMD) $(MAKE) -f debian/rules clean
143 kdist_clean: debian/control clean
145 $(ROOT_CMD) $(MAKE) -f debian/rules binary-modules
146 kdist_configure: configure-stamp
149 .PHONY: binary-modules kdist_image