1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
INSTALL=/usr/bin/install
psource:=batmand-gateway-source
dkmssource:=batmand-gateway-dkms
sname:=batmand-gateway
version:= $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2 \
| cut -d- -f1)
### KERNEL SETUP
### Setup the stuff needed for making kernel module packages
### taken from /usr/share/kernel-package/sample.module.rules
PACKAGE=batmand-gateway-modules
MA_DIR=/usr/share/modass
-include $(MA_DIR)/include/generic.make
-include $(MA_DIR)/include/common-rules.make
kdist_config: prep-deb-files
# the kdist_clean target is called by make-kpkg modules_clean and from
# kdist* rules. It is responsible for cleaning up any changes that have
# been made by the other kdist_commands (except for the .deb files created)
#kdist_clean: clean
kdist_clean:
$(MAKE) $(MFLAGS) -f debian/rules clean
$(MAKE) -C $(KSRC) M=$(CURDIR) clean
### end KERNEL SETUP
k = $(shell echo $(KVERS) | grep -q ^2.6 && echo k)
binary-modules: binary-modules-stamp
dh_testdir
# the binary-modules rule is invoked by module-assistant while processing the
# kdist* targets. It is called by module-assistant or make-kpkg and *not*
# during a normal build
binary-modules-stamp:
dh_testroot
dh_prep
dh_installdirs lib/modules/$(KVERS)/kernel/net
# Build the module
$(MAKE) -C $(KSRC) M=$(CURDIR)
# Install the module
cp batgat.$ko debian/$(PKGNAME)/lib/modules/$(KVERS)/kernel/net
dh_installdocs
dh_installchangelogs
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol -- -v$(VERSION)
dh_md5sums
dh_builddeb --destdir=$(DEB_DESTDIR)
dh_prep
touch $@
build: build-stamp
build-stamp:
dh_testdir
# Add here commands to compile the package.
$(MAKE) CFLAGS="$(CFLAGS)"
#docbook-to-man debian/batmand.sgml > batmand.1
touch $@
clean:
dh_testdir
dh_testroot
# Add here commands to clean up after the build process.
# clean can be run from module assistant or the original package rules file.
if [ ! -r mod_batman.c ]; then \
$(MAKE) clean; \
fi
dh_clean
install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
# Add here commands to install the package into debian/batmand.
$(MAKE) INSTALL_PREFIX=$(CURDIR)/debian/batmand install
$(INSTALL) -m 0644 -D $(CURDIR)/debian/batmand-default $(CURDIR)/debian/batmand/etc/default/batmand
# Create the directories to install the source into
dh_installdirs -p$(psource) usr/src/modules/$(sname)/debian
dh_installdirs -p$(dkmssource) usr/src/$(sname)-$(version)
# Copy only the driver source to the proper location
cp linux/modules/*.c linux/modules/*.h linux/modules/Makefile* \
debian/$(psource)/usr/src/modules/$(sname)
cp linux/modules/*.c linux/modules/*.h linux/modules/Makefile* \
debian/$(dkmssource)/usr/src/$(sname)-$(version)
mv debian/$(psource)/usr/src/modules/$(sname)/Makefile.kbuild \
debian/$(psource)/usr/src/modules/$(sname)/Makefile
mv debian/$(dkmssource)/usr/src/$(sname)-$(version)/Makefile.kbuild \
debian/$(dkmssource)/usr/src/$(sname)-$(version)/Makefile
# Copy the needed debian/ pieces to the proper location
cp debian/*modules.in* \
debian/$(psource)/usr/src/modules/$(sname)/debian
cp debian/changelog debian/copyright debian/rules\
debian/compat debian/control debian/$(psource)/usr/src/modules/$(sname)/debian/
mkdir -p debian/$(psource)/usr/share/doc/$(psource)
cp debian/copyright debian/$(psource)/usr/share/doc/$(psource)
mkdir -p debian/$(dkmssource)/usr/share/doc/$(dkmssource)
cp debian/copyright debian/$(dkmssource)/usr/share/doc/$(dkmssource)
mkdir -p debian/$(psource)$(MA_DIR)/packages/
cd debian/$(psource)$(MA_DIR)/packages/ && ln -sf default.sh $(psource)
cd debian/$(psource)/usr/src && tar c modules | bzip2 -9 > $(sname).tar.bz2 && rm -rf modules
dh_dkms -V
dh_install
# Build architecture-independent files here.
binary-indep: build install
dh_testdir -i
dh_testroot -i
dh_installchangelogs -i
dh_installman -i
dh_link -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir -s
dh_testroot -s
dh_installchangelogs -s CHANGELOG
dh_installdocs -s
dh_installexamples -s
dh_lintian -s
# dh_install -s
dh_installinit -s -u"start 20 2 3 4 5 . stop 20 1 ."
dh_installman -s
dh_link -s
dh_strip -s --dbg-package=batmand-dbg
dh_compress -s
dh_fixperms -s
dh_installdeb -s
dh_shlibdeps -s
dh_gencontrol -s
dh_md5sums -s
dh_builddeb -s
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install binary-modules kdist kdist_clean
|