File: rules

package info (click to toggle)
i2c 2.6.3-5
  • links: PTS
  • area: main
  • in suites: woody
  • size: 592 kB
  • ctags: 1,051
  • sloc: ansic: 6,419; perl: 637; makefile: 186
file content (114 lines) | stat: -rwxr-xr-x 3,220 bytes parent folder | download
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
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatability version to use.
export DH_COMPAT=1

# Strip epoch.
baseepoch=$(shell expr $(KDREV) : '\([0-9]*\):.*' 2>/dev/null )
ifneq ($(baseepoch),)
EPOCH=$(baseepoch):
endif
REV=$(shell expr $(KDREV) : '[0-9]*:\(.*\)' 2>/dev/null)
ifeq ($(REV),)
REV=$(KDREV)
endif
VERSION=$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
KSRC:=/usr/src/linux
ARCH=$(shell dpkg --print-architecture)
PKG_VERSION=$(EPOCH)$(VERSION)+$(REV)
CHFILE=$(KSRC)/../i2c-$(KVERS)_$(PKG_VERSION)_$(ARCH).changes

# Build the source package only.
build:
# Nothing to do.

# Build the kernel modules themselves.
build-modules:
	dh_testdir
	$(MAKE) LINUX=$(KSRC)

clean:
	dh_testdir
	dh_testroot
	-$(MAKE) LINUX=$(KSRC) clean
	dh_clean debian/i2c-$(KVERS).*
	-mv debian/control.save debian/control

# Build architecture-independent files here.
binary-indep: build
# Nothing to d.

# Build the source package (it is marked as architecture-dependant)
# and the headers package.
binary-arch: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Copy most of the source tree into the temp directory and clean it.
	find . -path ./debian/tmp -prune -o -print | egrep -v 'RPM|CVS' | \
		cpio -admp debian/tmp/usr/src/modules/i2c
	cd debian/tmp/usr/src/modules/i2c && $(MAKE) -f debian/rules clean
	chown -R root.root debian/tmp/usr/src/modules

	# This link is used by lm-sensors when it builds its modules.
	dh_link usr/src/modules/i2c/kernel usr/src/modules/i2c/linux

	# Pack this up into a tarball.
	(cd debian/tmp/usr/src && tar czf i2c.tar.gz modules && rm -rf modules)

	dh_installdocs README TODO IMPORTANT_CHANGES INSTALL
	dh_installchangelogs CHANGES
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build the kernel module .deb.
binary-modules: build-modules
	dh_testdir
	dh_testroot
	dh_clean -k

	# Set up control file with proper modules version in it.
	rm -f debian/control.save
	cp debian/control debian/control.save
	rm -f debian/control
	sed -e 's/#KVERS#/$(KVERS)/g' -e 's/#KDREV#/$(KDREV)/' \
		debian/control.modules > debian/control
	# And set up files so debhelper can find them.
	ln -sf i2c-modules.modules debian/i2c-$(KVERS).modules

	$(MAKE) install DESTDIR=debian/tmp MODDIR=/lib/modules/$(KVERS)/misc \
		LINUX=$(KSRC)
	dh_installdocs README TODO IMPORTANT_CHANGES doc/*
	dh_installchangelogs CHANGES
	dh_installmodules
	dh_compress
	dh_fixperms
	echo /etc/modutils/i2c-$(KVERS) > debian/i2c-$(KVERS).conffiles
	dh_installdeb
	dh_gencontrol -- -v$(PKG_VERSION)
	dh_md5sums
	dh_builddeb --destdir=$(KSRC)/..

# These targets are called when kernel-package is building the package.
kdist_image: binary-modules clean
	# The dependancies take care of building the module package.
kdist: clean binary-modules
	# Build a .changes file.
	dpkg-genchanges -b -e"$(KMAINT) <$(KEMAIL)>" -u"$(KSRC)/.." > $(CHFILE)
	debsign -e"$(KMAINT) <$(KEMAIL)>" $(CHFILE)
	debian/rules clean
kdist_configure:
	# Nothing to do when configured.
kdist_clean: clean

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary kdist kdist_image kdist_configure