File: rules

package info (click to toggle)
dh-make 0.42
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 308 kB
  • ctags: 20
  • sloc: perl: 607; makefile: 276; sh: 147
file content (218 lines) | stat: -rw-r--r-- 6,085 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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#!/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.
#
# This version is for a hypothetical package that can build a kernel modules
# architecture-dependant package via make-kpkg, as well as an
# architecture-independent module source package, and other packages
# either dep/indep for things like common files or userspace components
# needed for the kernel modules.

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


#DPKG_ARCH#

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

# some default definitions, important!
# 
# Name of the source package
psource:=#PACKAGE#-source

# The short upstream name, used for the module source directory
sname:=#PACKAGE#

### KERNEL SETUP
### Setup the stuff needed for making kernel module packages
### taken from /usr/share/kernel-package/sample.module.rules

# prefix of the target package name
PACKAGE=#PACKAGE#-modules
# modifieable for experiments or debugging m-a
MA_DIR ?= /usr/share/modass
# load generic variable handling
-include $(MA_DIR)/include/generic.make
# load default rules, including kdist, kdist_image, ...
-include $(MA_DIR)/include/common-rules.make
  
# module assistant calculates all needed things for us and sets
# following variables:
# KSRC (kernel source directory), KVERS (kernel version string), KDREV
# (revision of the Debian kernel-image package), CC (the correct
# compiler), VERSION (the final package version string), PKGNAME (full
# package name with KVERS included), DEB_DESTDIR (path to store DEBs)
  
# The kdist_configure target is called by make-kpkg modules_config and
# by kdist* rules by dependency. It should configure the module so it is
# ready for compilation (mostly useful for calling configure).
# prep-deb-files from module-assistant creates the neccessary debian/ files 
kdist_configure: 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
	$(MAKE) $(MFLAGS) -f debian/rules clean
#	rm -f driver/*.o driver/*.ko
#
### end  KERNEL SETUP

#CONFIGURE#

build-arch: #CONFIGURE_STAMP# #CONFIG_STATUS# build-arch-stamp
build-arch-stamp:
	dh_testdir

	# Add here command to compile/build the package.
	$(MAKE)

	touch $@

#k = $(shell echo $(KVERS) | grep -q ^2.6 && echo k)

# 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:
	dh_testroot
	dh_clean -k
	dh_installdirs lib/modules/$(KVERS)/misc

	# Build the module
	$(MAKE) -C drivers KERNEL_DIR=$(KSRC) KVERS=$(KVERS)

	# Install the module
	cp drivers/slusb.$ko drivers/slamr.$ko debian/$(PKGNAME)/lib/modules/$(KVERS)/misc

	dh_installdocs
	dh_installchangelogs
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol -- -v$(VERSION)
	dh_md5sums
	dh_builddeb --destdir=$(DEB_DESTDIR)
	dh_clean -k

build-indep: #CONFIG_STATUS# #CONFIGURE_STAMP# build-indep-stamp
build-indep-stamp:
	dh_testdir

	# Add here command to compile/build the arch indep package.
	# It's ok not to do anything here, if you don't need to build
	#  anything for this package.
	#docbook-to-man debian/#PACKAGE#.sgml > #PACKAGE#.1

	touch $@

build: build-arch build-indep

clean:
	dh_testdir
	#dh_testroot
	rm -f build-arch-stamp build-indep-stamp #CONFIGURE_STAMP#

	# Add here commands to clean up after the build process.
	-#CLEAN#

	dh_clean

install: DH_OPTIONS=
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Create the directories to install the source into
	dh_installdirs -p$(psource)  usr/src/modules/$(sname)/debian

	# Copy only the driver source to the proper location
	cp -s driver/*  debian/$(psource)/usr/src/modules/$(sname)
	# Copy the needed debian/ pieces to the proper location
	cp debian/*modules.in* \
		debian/$(psource)/usr/src/modules/$(sname)/debian
	cp debian/*_KVERS_* debian/rules debian/changelog debian/copyright \
		debian/compat debian/$(psource)/usr/src/modules/$(sname)/debian/
	cd debian/$(psource)/usr/src && tar c modules | bzip2 -9 > $(sname).tar.bz2 && rm -rf modules

	# Add here commands to install the package into debian/#PACKAGE#.
	#INSTALL#

	dh_install

# Build architecture-independent files here.
# Pass -i to all debhelper commands in this target to reduce clutter.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_installchangelogs #CHANGELOGS# -i
	dh_installdocs -i
	dh_installexamples -i
#	dh_install -i
#	dh_installmenu -i
#	dh_installdebconf -i
#	dh_installlogrotate -i
#	dh_installemacsen -i
#	dh_installpam -i
#	dh_installmime -i
#	dh_installinit -i
#	dh_installcron -i
#	dh_installinfo -i
	dh_installman -i
	dh_link -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
#	dh_perl -i
#	dh_python -i
#	dh_makeshlibs -i
	dh_installdeb -i
	dh_shlibdeps -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_installdebconf -s
	dh_installdocs -s
	dh_installexamples -s
	dh_installmenu -s
#	dh_installlogrotate -s
#	dh_installemacsen -s
#	dh_installpam -s
#	dh_installmime -s
#	dh_installinit -s
	dh_installcron -s
#	dh_installman -s
	dh_installinfo -s
	dh_installchangelogs #CHANGELOGS# -s
	dh_strip -s
	dh_link -s
	dh_compress -s
	dh_fixperms -s
#	dh_makeshlibs -s
	dh_installdeb -s
#	dh_perl -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 #PHONY_CONFIGURE# binary-modules kdist kdist_configure kdist_image kdist_clean