File: rules

package info (click to toggle)
vpb-driver 4.2.59-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 3,520 kB
  • ctags: 5,835
  • sloc: cpp: 26,247; ansic: 18,763; sh: 3,402; perl: 1,132; makefile: 752; asm: 182
file content (319 lines) | stat: -rwxr-xr-x 10,488 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
#!/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.
#
# Modified to suit the Voicetronix vpb-driver package by Ron Lee, July 2006.

SHELL = /bin/bash

NUM_CPUS = $(shell getconf _NPROCESSORS_ONLN 2>/dev/null)
PARALLEL = $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NJOBS    = -j$(or $(PARALLEL),$(NUM_CPUS),1)


export DH_OPTIONS

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
    # No optimisation, with debug syms
    DEBUG_OPTS = --enable-debug
else
    # Optimise, but include debug syms, detached in the -dbg package
    DEBUG_OPTS = --enable-debug-syms
endif


# Name of the source package
psource:=vpb-driver-source

# The short upstream name, used for the module source directory
sname:=vpb-driver

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)


### 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=vpb-driver-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)
# NOTE that removing debian control here is dangerous if this is ever called
# from outside the module source dist.  Don't do that.  We need to update it
# if the kernel version changes though and this is one simple way to ensure
# that happens.  There may be a better one.
pre-clean:
	$(RM) debian/control

kdist_clean: pre-clean clean
	$(MAKE) -f debian/rules clean
#	rm -f driver/*.o driver/*.ko
#
### end  KERNEL SETUP

clean: debian/control
	dh_testdir

#	Drop the old binary blob from the debian source during initial export.
	$(RM) -r firmware

	[ ! -e Makefile ] || $(MAKE) distclean
	[ ! -e obj_shared/Makefile ] || $(MAKE) -C obj_shared distclean
	$(RM) build-arch-stamp build-indep-stamp
	$(RM) -r obj_shared obj_static

	dh_clean

#	We don't need to run this in the module build, there are no templates
#	for that package and this will error out if it doesn't find the po dir.
	[ ! -d debian/po ] || debconf-updatepo


debian/control:
	sed -e 's/_KVERS_/$(KVERS)/' debian/control.modules.in > debian/control


obj_shared/config.status: configure
	dh_testdir

	mkdir obj_shared
	cd obj_shared && ../configure --host=$(DEB_HOST_GNU_TYPE)   \
				      --build=$(DEB_BUILD_GNU_TYPE) \
				      --prefix=/usr                 \
				      --enable-shared               \
				      $(DEBUG_OPTS)

obj_static/config.status: configure
	dh_testdir

	mkdir obj_static
	cd obj_static && ../configure --host=$(DEB_HOST_GNU_TYPE)   \
				      --build=$(DEB_BUILD_GNU_TYPE) \
				      --prefix=/usr                 \
				      $(DEBUG_OPTS)

build: build-arch

build-arch: build-arch-stamp
build-arch-stamp: obj_shared/config.status obj_static/config.status
	dh_testdir

	$(MAKE) $(NJOBS) -C obj_shared/src/libtoneg
	$(MAKE) $(NJOBS) -C obj_shared/src/libvpb
	$(MAKE) $(NJOBS) -C obj_shared/src/utils
	$(MAKE) $(NJOBS) -C obj_shared/vpb-detect

	$(MAKE) $(NJOBS) -C obj_static/src/libtoneg
	$(MAKE) $(NJOBS) -C obj_static/src/libvpb
	touch $@

build-indep:  build-indep-stamp
build-indep-stamp: build-arch-stamp obj_shared/config.status
	dh_testdir

	$(MAKE) $(NJOBS) -C obj_shared doc
	touch $@


install: install-arch install-indep

install-arch: install-libvpb install-libvpb-dev install-vpb-utils
install-indep: install-vpb-driver-source install-libvpb-doc

install-vpb-driver-source: DH_OPTIONS=-p$(psource)
install-vpb-driver-source:
	dh_testdir
	dh_testroot
	dh_clean -k

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

	cp obj_shared/Version debian/$(psource)/usr/src/modules/$(sname)

	# Copy only the driver source to the proper location
	cp -a src/{vtcore,vpb} debian/$(psource)/usr/src/modules/$(sname)/src

	cp src/libvpb/vtcore_ioctl.h src/libvpb/messages_dsp_pc.h \
	   debian/$(psource)/usr/src/modules/$(sname)/src/vtcore
	cp src/libvpb/vpb_ioctl.h                                 \
	   debian/$(psource)/usr/src/modules/$(sname)/src/vpb

	# 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
	cp 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

	dh_install debian/fetch-openline-firmware usr/share/vpb-driver
	chmod 755 $(CURDIR)/debian/vpb-driver-source/usr/share/vpb-driver/fetch-openline-firmware

install-libvpb: DH_OPTIONS=-plibvpb1
install-libvpb:
	dh_testdir
	dh_testroot
	dh_clean -k

	$(MAKE) -C obj_shared/src/libtoneg install-lib DESTDIR=$(CURDIR)/debian/libvpb1
	$(MAKE) -C obj_shared/src/libvpb   install-lib DESTDIR=$(CURDIR)/debian/libvpb1
	$(MAKE) -C obj_shared/vpb-detect   install     DESTDIR=$(CURDIR)/debian/libvpb1
	dh_install src/utils/vtdeviceinfo               usr/bin
	dh_install src/utils/vtdriverinfo               usr/bin
	dh_install obj_shared/src/utils/VpbConfigurator usr/sbin
	dh_installman doc/vtdeviceinfo.1
	dh_installman doc/vtdriverinfo.1
	dh_installman doc/VpbConfigurator.8
	dh_installman doc/vpbconf.1
	dh_installman doc/vpbscan.1
	dh_installudev --name=vtcore
	dh_installdebconf

install-libvpb-dev: DH_OPTIONS=-plibvpb-dev
install-libvpb-dev:
	dh_testdir
	dh_testroot
	dh_clean -k

	$(MAKE) -C obj_shared/src/libtoneg install-dev DESTDIR=$(CURDIR)/debian/libvpb-dev
	$(MAKE) -C obj_static/src/libtoneg install-dev DESTDIR=$(CURDIR)/debian/libvpb-dev
	$(MAKE) -C obj_shared/src/libvpb   install-dev DESTDIR=$(CURDIR)/debian/libvpb-dev
	$(MAKE) -C obj_static/src/libvpb   install-dev DESTDIR=$(CURDIR)/debian/libvpb-dev

install-vpb-utils: DH_OPTIONS=-pvpb-utils
install-vpb-utils:
	dh_testdir
	dh_testroot
	dh_clean -k

	dh_install obj_shared/src/utils/dtmfcheck   usr/bin
	dh_install obj_shared/src/utils/measerl     usr/bin
	dh_install obj_shared/src/utils/playwav     usr/bin
	dh_install obj_shared/src/utils/proslicerl  usr/bin
	dh_install obj_shared/src/utils/raw2wav     usr/bin
	dh_install obj_shared/src/utils/recwav      usr/bin
	dh_install obj_shared/src/utils/ringstat    usr/bin
	dh_install obj_shared/src/utils/tonedebug   usr/bin
	dh_install obj_shared/src/utils/tonegen     usr/bin
	dh_install obj_shared/src/utils/tonetrain   usr/bin
	dh_install obj_shared/src/utils/vdaaerl     usr/bin
	dh_install obj_shared/src/utils/vpbecho     usr/bin
	dh_installman doc/dtmfcheck.1
	dh_installman doc/measerl.1
	dh_installman doc/playwav.1
	dh_installman doc/proslicerl.1
	dh_installman doc/raw2wav.1
	dh_installman doc/recwav.1
	dh_installman doc/ringstat.1
	dh_installman doc/tonedebug.1
	dh_installman doc/tonegen.1
	dh_installman doc/tonetrain.1
	dh_installman doc/vdaaerl.1
	dh_installman doc/vpbecho.1

install-libvpb-doc: DH_OPTIONS=-plibvpb-doc
install-libvpb-doc:
	dh_testdir
	dh_testroot
	dh_clean -k

	dh_install obj_shared/src/libvpb/doc/doc_user/html usr/share/doc/libvpb-doc
	#dh_installman src/libvpb/doc/doc_user/man/man3/*


binary: binary-indep binary-arch

binary-indep: build-indep install-indep
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installchangelogs -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build-arch install-arch
	dh_testdir -s
	dh_testroot -s
	dh_installdocs -s
	dh_installchangelogs -s
	dh_strip -s --dbg-package=libvpb-dbg
	dh_compress -s
	dh_fixperms -s
	dh_makeshlibs -plibvpb1 -V"libvpb1 (>=4.2.22)"
	dh_installdeb -s
	dh_shlibdeps -s
	dh_gencontrol -s
	dh_md5sums -s
	dh_builddeb -s

#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

	$(MAKE) $(NJOBS) -C src/vtcore						\
		KSRC=$(KSRC) KVERS=$(KVERS) DESTDIR=$(CURDIR)/debian/$(PKGNAME)
	$(MAKE) $(NJOBS) -C src/vpb						\
		KSRC=$(KSRC) KVERS=$(KVERS) DESTDIR=$(CURDIR)/debian/$(PKGNAME)

	$(MAKE) -C src/vtcore install						\
		KSRC=$(KSRC) KVERS=$(KVERS) DESTDIR=$(CURDIR)/debian/$(PKGNAME)
	$(MAKE) -C src/vpb install						\
		KSRC=$(KSRC) KVERS=$(KVERS) DESTDIR=$(CURDIR)/debian/$(PKGNAME)

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


.PHONY: clean build build-arch build-indep                                   \
	binary binary-indep binary-arch binary-modules                       \
	install install-arch install-indep install-libvpb install-libvpb-dev \
	install-vpb-utils install-vpb-driver-source install-libvpb-doc       \
	kdist kdist_configure kdist_image kdist_clean pre-clean