File: rules

package info (click to toggle)
lapack 3.0.20000531a-28
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 61,920 kB
  • ctags: 46,200
  • sloc: fortran: 584,835; perl: 8,226; makefile: 2,331; awk: 71; sh: 45
file content (443 lines) | stat: -rwxr-xr-x 11,246 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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

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

# shared library versions, option 1
#version=2.0.5
#major=2
# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
#version=`ls src/.libs/lib*.so.* | \
# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
#major=`ls src/.libs/lib*.so.* | \
# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`

SO:=2
MN:=0
VERS:=$(SO).$(MN)


ARCH:=$(shell dpkg --print-architecture)
F77:=g77
FOPTS:=-ff90
OPTOPTS:=-O3
UNROLL:=-funroll-all-loops

ifeq ($(ARCH),arm)
#F77:=g77-3.0
OPTOPTS:=-O0
UNROLL:=
endif

#ifeq ($(ARCH),m68k)
#F77:=fort77
#FOPTS:=-ffloat-store
#endif

#ifeq ($(ARCH),ia64)
#F77:=g77-3.2
#endif

ifeq ($(ARCH),alpha)
#F77:=g77-3.2
FOPTS:=-ff90 -mieee
endif

ifeq ($(ARCH),s390)
OPTOPTS:=-O0
endif

#
#
# Add-on documentation from upstream
#
#


debian/lapackqref.ps debian/faq.html:
	cd $(@D) && wget -N ftp://ftp.netlib.org/lapack/$(@F)

debian/release_notes.html:
	cd $(@D) && wget -N ftp://ftp.netlib.org/lapack/$(@F)
	cat $@ | sed -e "s,/lapack/html/,,g" \
		     -e "s,errata.lug\",errata.lug.gz\",1" \
		     -e "s,installation.hints\",installation.hints.gz\",1" >tmp
	mv tmp $@

MF:=$(shell find man -type f)
MF3:=$(subst .l,.3,$(MF))
man:
	cd debian && wget -N ftp://ftp.netlib.org/lapack/manpages.tgz
	tar zxf debian/manpages.tgz
	rm -rf debian/manpages.tgz blas/man

%.3: %.l
	cat $< |sed "s,^\( *.TH  *[^ ]*  *\)l\(  *.*\),\1 3 \2,1" >$@

debian/errata.lug debian/installation.hints:
	cd $(@D) && wget -N ftp://ftp.netlib.org/lapack/html/$(@F)

lug/index.html:
	mkdir -p $(@D)
	cd $(@D) && \
		wget -r -N --no-parent -nH --cut-dirs=2 ftp://ftp.netlib.org/lapack/lug/
	cd $(@D) && \
		wget -r -N --no-parent -nH --cut-dirs=2 -A gif ftp://ftp.netlib.org/utk/icons/
	cd $(@D) && ( set -e ; \
		for i in $$(ls -1 *.html); do \
			cat $$i | sed "s,http://www.netlib.org/utk/icons/,,g" >tmp && mv tmp $$i ; \
		done )
	cd $(@D) && web2png -a && rm -f *.gif

doc: lug/index.html debian/lapackqref.ps man\
     debian/release_notes.html debian/errata.lug debian/installation.hints\
     debian/faq.html

#
#
# Upstream updates/patches
#
#


UD:=debian/updates

debian/updates/index.html:
	cd debian/updates && \
		wget -r -N -R html,gif,txt --no-parent -nH --cut-dirs=2 \
			ftp://ftp.netlib.org/lapack/patch/
	cd debian/updates && cat ../updates.patch | patch -p3
	find debian/updates -name index.html -exec rm {} \;
	find debian/updates -name robots.txt -exec rm {} \;
	find debian/updates -name MD5 -exec rm {} \;

PF:=$(shell cd $(UD) && find * -type f)

debian/patches/%: $(UD)/% debian/unapplied/%
	[ -e $* ]
	mkdir -m 777 -p $(@D)
	i=$$(dirname $(@D));while [ "$$i" != "debian" ] ; do chmod go+rw $$i;i=$$(dirname $$i);done
	diff -uN $* $(UD)/$* >$@ || [ $$? -le 1 ]

debian/patches_created: debian/patches_unapplied $(addprefix debian/patches/,$(PF))
	touch $@ && chmod go+rw $@

debian/applied/%: 
	! [ -e debian/patches/$* ] || patch -p0 < debian/patches/$*
	mkdir -m 777 -p $(@D)
	i=$$(dirname $(@D));while [ "$$i" != "debian" ] ; do chmod go+rw $$i;i=$$(dirname $$i);done
	rm -f debian/unapplied/$*
	touch $@ && chmod go+rw $@

debian/arch_patch_applied:
	! [ -e debian/$(ARCH)/patch ] || patch -p1 <debian/$(ARCH)/patch
	mkdir -m 777 -p $(@D)
	rm -f debian/arch_patch_unapplied
	touch $@ && chmod go+rw $@

debian/makes: make.inc testing/Makefile timing/Makefile
	rm -f debian/unmakes
	touch $@

debian/patches_applied: $(addprefix debian/applied/,$(PF)) debian/arch_patch_applied debian/makes
	rm -f debian/patches_unapplied
	touch $@ && chmod go+rw $@

debian/unapplied/%: 
	! [ -e debian/patches/$* ] || ! [ -e debian/applied/$* ] || patch -p0 -R < debian/patches/$*
	mkdir -m 777 -p $(@D)
	i=$$(dirname $(@D));while [ "$$i" != "debian" ] ; do chmod go+rw $$i;i=$$(dirname $$i);done
	rm -f debian/applied/$*
	touch $@ && chmod go+rw $@

debian/arch_patch_unapplied:
	! [ -e debian/$(ARCH)/patch ] || ! [ -e debian/arch_patch_applied ] || patch -p1 -R <debian/$(ARCH)/patch
	mkdir -m 777 -p $(@D)
	rm -f debian/arch_patch_applied
	touch $@ && chmod go+rw $@

debian/unmakes:
	! [ -e make.inc.ori ] || mv make.inc.ori make.inc
	! [ -e testing/Makefile.ori ] || mv testing/Makefile.ori testing/Makefile
	! [ -e timing/Makefile.ori ] || mv timing/Makefile.ori timing/Makefile
	rm -f debian/makes
	touch $@

debian/patches_unapplied: debian/unmakes debian/arch_patch_unapplied $(addprefix debian/unapplied/,$(PF)) 
	rm -f debian/patches_applied
	touch $@ && chmod go+rw $@

#
#
# Configure
#
#


make.inc.ori: 
	cp -p make.inc $@

make.inc: install/make.inc.LINUX make.inc.ori 
	cat $< | sed -e "s,g77,$(F77),g" \
		     -e "s,\(^NOOPT  *=\),\1 \$$(PICOPTS) $(FOPTS),1" \
		     -e "s,-O3,\$$(PICOPTS) $(FOPTS) $(OPTOPTS),1" \
		     -e "s,-funroll-all-loops,$(UNROLL),g" \
		     -e "s,[^ ]*blas[^ ]*\.a,-lblas,1" > $@

TIMEOUT:=1800

testing/Makefile.ori: 
	cp testing/Makefile $@

testing/Makefile: testing/Makefile.ori 
	cat $< | sed -e "s,\./x,../debian/trun $(TIMEOUT) ./x,g" >$@

timing/Makefile.ori: 
	cp timing/Makefile $@

timing/Makefile: timing/Makefile.ori 
	cat $< | sed -e "s,\./x,../debian/trun $(TIMEOUT) ./x,g" >$@

#
#
# Build rules for libraries
#
#


liblapack_pic.a: debian/patches_applied make.inc testing/Makefile timing/Makefile
	$(MAKE) cleanlib
	$(MAKE) do_install PICOPTS=-fPIC
	$(MAKE) lib        PICOPTS=-fPIC
	mv lapack_LINUX.a $@

liblapack.so.$(VERS): liblapack_pic.a libblas.so
	mkdir tmp
	cd tmp && ar x ../$<
	gcc -shared -Wl,-soname=liblapack.so.$(SO) -o $@ tmp/*.o  -L. -lblas -lg2c
	rm -rf tmp

liblapack.so.$(SO): liblapack.so.$(VERS)
	ln -snf $< $@

liblapack.so: liblapack.so.$(SO)
	ln -snf $< $@

liblapack.a: debian/patches_applied make.inc testing/Makefile timing/Makefile
	$(MAKE) cleanlib
	$(MAKE) do_install 
	$(MAKE) lib        
	mv lapack_LINUX.a $@

BF:=liblapack.a liblapack.so
build: $(BF)


#
#
# Testing/timing rules
#
#

TB:=s d c z
TB:=$(addprefix tst,$(TB))
TB:=$(addprefix eig,$(TB)) $(addprefix lin,$(TB))
TB:=$(addprefix testing/x,$(TB))
MB:=$(subst tst,tim,$(TB))
MB:=$(subst testing,timing,$(MB))
TESF:=cbak cbal cbb cec ced cgbak cgbal cgd cgg cglm cgqr cgsv\
	clse cnep csb csep csg csvd ctest dbak dbal dbb dec ded\
	dgbak dgbal dgd dgg dglm dgqr dgsv dlse dnep dsb dsep dsg\
	dsvd dtest sbak sbal sbb sec sed sgbak sgbal sgd sgg sglm\
	sgqr sgsv slse snep ssb ssep ssg ssvd stest zbak zbal zbb\
	zec zed zgbak zgbal zgd zgg zglm zgqr zgsv zlse znep zsb\
	zsep zsg zsvd ztest

#
# Work around for alpha, cgqr test fails to converge
#
# Now fixed
#
#ifeq ($(ARCHT),alpha)
#TESTF:=$(filter-out cgqr,$(TESTF))
#endif

TESF:=$(addprefix testing/,$(addsuffix .out,$(TESF)))
TIMF:=cband cgeptim cneptim cseptim csvdtim ctime ctime2 dband\
	dgeptim dneptim dseptim dsvdtim dtime dtime2 sband sgeptim\
	sneptim sseptim ssvdtim stime stime2 zband zgeptim zneptim\
	zseptim zsvdtim ztime ztime2
TIMF:=$(addprefix timing/,$(addsuffix .out,$(TIMF)))

libblas.so: 
	cp -d /usr/lib/libblas.so.$(SO).* libblas.so

$(TB) $(TESF): libblas.so liblapack.so
	chmod +x debian/trun
	LD_LIBRARY_PATH=$$(pwd):$$LD_LIBRARY_PATH \
	$(MAKE) PICOPTS= \
		LLIB="-L $$(pwd) -llapack -lblas" do_testing & \
		j=$$! ;\
		tail -f --pid=$$j --retry $(TESF) & \
		wait $$j

$(subst testing,debian/test,$(TESF)):\
	debian/test/%: testing/%
	mkdir -m 777 -p $(@D)
	echo Test file $(@F) >$@
	cat $< >> $@

debian/test_results: $(subst testing,debian/test,$(TESF))
	echo "These libraries and tests were compiled with:" >$@
	$(F77) -v >>$@
	cat $^ >>$@

$(MB) $(TIMF): libblas.so liblapack.so
	chmod +x debian/trun
	LD_LIBRARY_PATH=$$(pwd):$$LD_LIBRARY_PATH \
	$(MAKE) PICOPTS= \
		LLIB="-L $$(pwd) -llapack -lblas" do_timing & \
		j=$$! ;\
		tail -f --pid=$$j --retry $(TIMF) & \
		wait $$j

$(subst timing,debian/time,$(TIMF)):\
	debian/time/%: timing/%
	mkdir -m 777 -p $(@D)
	echo Time file $(@F) >$@
	cat $< >> $@

debian/timing_results: $(subst timing,debian/time,$(TIMF))
	echo "These libraries and tests were compiled with:" >$@
	$(F77) -v >>$@
	echo These timing results were obtained on the following machine: >>$@
	! [ -e /proc/cpuinfo ] || cat /proc/cpuinfo >>$@
	[ -e /proc/cpuinfo ] || echo "(/proc/cpuinfo not available)" >>$@
	cat $^ >>$@

debian/lapack.templates: debian/test_results debian/timing_results 
	po2debconf -o $@ debian/main_templates
	echo >>$@
	chmod +x debian/rawk
	cat $^ | debian/rawk >>$@ ; j=$$? ; echo Warning level: $$j;\
		cat debian/lapack.config | sed "s,^STAT=.,STAT=$$j,1" >tmp && mv tmp debian/lapack.config
	cat $@ debian/lapack.config

#
#
# Install
#
#

debian/tmp/usr/lib/%: %
	dh_testdir
	dh_testroot

	install -m 755 -d $(@D)
	[ -L $* ] || install -m 644 $< $(@D)
	! [ -L $* ] || cp -d $< $@

$(addprefix debian/tmp/usr/lib/lapack/,$(subst testing/,,$(TB))): \
	debian/tmp/usr/lib/lapack/%: testing/%
	dh_testdir
	dh_testroot

	install -m 755 -d $(@D)
	install -m 755 $< $(@D)

$(addprefix debian/tmp/usr/lib/lapack/,$(subst timing/,,$(MB))): \
	debian/tmp/usr/lib/lapack/%: timing/%
	dh_testdir
	dh_testroot

	install -m 755 -d $(@D)
	install -m 755 $< $(@D)

IF:=$(addprefix liblapack.,a so so.$(SO) so.$(VERS)) liblapack_pic.a
IF:=$(addprefix debian/tmp/usr/lib/,$(IF))
IF:=$(IF) $(addprefix debian/tmp/usr/lib/lapack/,$(subst testing/,,$(TB)) $(subst timing/,,$(MB)))

install: $(IF) $(MF3) debian/test_results debian/timing_results debian/lapack.templates
	dh_testdir
	dh_testroot
	dh_movefiles


#
#
# Clean
#
#


clean:  debian/patches_unapplied
	dh_testdir
	dh_testroot
	rm -rf debian/*_stamp debian/*_results lib* testing/*out timing/*out
	find man -name "*.3" -exec rm {} \;
	rm -rf *.a install/test* debian/test/ debian/time/ 
	rm -f debian/test_results debian/timing_results debian/lapack.templates
	rm -f debian/makes debian/unmakes
	debconf-updatepo
	$(MAKE) clean

	dh_clean

#
#
# Package rules
#
#


# Build architecture-independent files here.
binary-indep: install
	dh_testdir -i
	dh_testroot -i
	rm -f debian/lapack-doc/usr/share/doc/lapack-doc/lug/index.html
	dh_installdocs -i
	dh_installexamples -i
	dh_installmanpages -p lapack-doc debian/*.1 man/manl/xerbla.3 man/manl/lsame.3 man/manl/zbcon.3
	dh_installchangelogs -i
	dh_link -i
	dh_strip -i
	dh_compress -i
	dh_fixperms -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: install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a
	dh_installdebconf -a
	dh_installexamples -a
	dh_installmanpages -p lapack-test $$(find man -type f)
	dh_installchangelogs -a
	dh_link -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -a -V "atlas2-base | lapack | lapack2"
	dh_installdeb -a
	dh_shlibdeps -a -l $$(pwd)
	dh_gencontrol -a -u"-Vg77=libg2c0-dev"
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: clean binary-indep binary-arch binary \
	debian/lapackqref.ps debian/manpages.tgz lug/index.html \
	debian/release_notes.html debian/faq.html debian/errata.lug \
	debian/installation.hints debian/updates/index.html doc\
	build