File: rules

package info (click to toggle)
lapack 3.2.1-8
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 55,196 kB
  • ctags: 33,064
  • sloc: fortran: 448,214; perl: 8,226; makefile: 1,528; sh: 87; awk: 70
file content (327 lines) | stat: -rwxr-xr-x 7,615 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
#!/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=2

SO:=3gf
MN:=0
VERS:=$(SO).$(MN)

GCC:=gcc

ARCH:=$(shell dpkg --print-architecture)
F77:=gfortran
FOPTS:= #-ff90
#OPTOPTS:=-g
#UNROLL:=
OPTOPTS:=-g -O3
UNROLL:=-funroll-all-loops
ifneq (,$(filter $(ARCH), arm armel))
  OPTOPTS:=-g -O0
  UNROLL:=
endif

ifneq (,$(filter $(ARCH), m68k))
  #FOPTS:=-ffloat-store
  UNROLL:=
endif

ifeq ($(ARCH),alpha)
  FOPTS:=-mieee
endif

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

ifneq (,$(filter $(ARCH), none))
  export ignore_testing_failures = -
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)
MANEXT:=3lapack
MF3:=$(subst .l,.$(MANEXT),$(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

%.$(MANEXT): %.l
	cat $< | sed "s,^.TH  *\([^ ]*\)  *.  *\(.*\),.TH \1 $(MANEXT) \2,1" >$@
	@echo Converted $< to $@, diff:
	diff -u $< $@ || true

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 -d

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

#
#
# Configure
#
#

make.inc: install/make.inc.gfortran
	cat $< | sed -e "s,g77,$(F77),g" \
		     -e "s,\(^NOOPT  *=\),\1 \$$(PICOPTS) $(FOPTS),1" \
		     -e "s,-O3,\$$(PICOPTS) $(FOPTS) $(OPTOPTS),1" \
		     -e "s,\(^OPTS  *=\).*,\1 $(UNROLL) \$$(PICOPTS) $(OPTOPTS),1" \
		     -e "s,[^ ]*blas[^ ]*\.a,-lblas,1" \
		     -e "s,TIMER. *,#&," > $@
	echo "TIMER = INT_ETIME" >> $@

TIMEOUT:=1800

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

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

#
#
# Build rules for libraries
#
#


liblapack_pic.a: make.inc testing/Makefile
	$(MAKE) cleanlib
	$(MAKE) lapack_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 ../$<
# Cannot link against blas -- causes circular dependency in atlas packages.
	$(F77) -shared -Wl,-soname=liblapack.so.$(SO) -o $@ tmp/*.o  -L. -lblas
	rm -rf tmp

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

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

liblapack.a: make.inc testing/Makefile
	$(MAKE) cleanlib
	$(MAKE) lapack_install
	$(MAKE) lib
	mv lapack_LINUX.a $@

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


#
#
# Testing rules
#
#

TB:=s d c z
TB:=$(addprefix tst,$(TB))
TB:=$(addprefix eig,$(TB)) $(addprefix lin,$(TB))
TB:=$(addprefix testing/x,$(TB))
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
#
# FIXME: filtering here has no effect; all tests are run.
#ifeq ($(ARCH),alpha)
#  TESF:=$(filter-out cgqr,$(TESF))
#endif

TESF:=$(addprefix testing/,$(addsuffix .out,$(TESF)))

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

$(TB) $(TESF): libblas.so liblapack.so
	chmod +x debian/trun
	grep -q debian/trun testing/Makefile \
	    || sed -i -e "s,\./x,$(ignore_testing_failures)../debian/trun $(TIMEOUT) ./x,g" testing/Makefile
	$(ignore_testing_failures)LD_LIBRARY_PATH=$$(pwd):$$LD_LIBRARY_PATH \
	    $(MAKE) PICOPTS= \
		LLIB="-L $$(pwd) -llapack -lblas" lapack_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 $^ >>$@

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

#
#
# Install
#
#

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

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

$(addprefix debian/tmp/usr/lib/liblapack3gf/,$(subst testing/,,$(TB))): \
	debian/tmp/usr/lib/liblapack3gf/%: testing/%
	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/lapack/,$(IF))
IF:=$(IF) $(addprefix debian/tmp/usr/lib/liblapack3gf/,$(subst testing/,,$(TB)))

install: $(IF) $(MF3) debian/test_results debian/liblapack3gf.templates
# Delete the empty man page
	rm man/manl/zbcon.$(MANEXT)
	dh_testdir
	dh_testroot
	dh_movefiles


#
#
# Clean
#
#


clean:: make.inc
	dh_testdir
	dh_testroot
	rm -rf debian/*_stamp debian/*_results lib* testing/*out
	find man -name "*.$(MANEXT)" -exec rm {} \;
	rm -rf *.a install/test* debian/test/ debian/time/
	rm -f debian/test_results debian/liblapack3gf.templates
	rm -f testing/tmp

	touch TESTING/xlinfoo TESTING/xeigfoo  && $(MAKE) clean
	rm -f make.inc

	-[ -e testing/Makefile.ori ] \
		&& mv testing/Makefile.ori testing/Makefile

	dh_clean

#
#
# Package rules
#
#


# Build architecture-independent files here.
binary-indep: install
	dh_testdir -i
	dh_testroot -i
	rm -f debian/liblapack-doc/usr/share/doc/liblapack-doc/lug/index.html
	rm -f debian/liblapack-doc/usr/share/doc/liblapack-doc/lug/robots.txt
	dh_installdocs -i
	dh_installexamples -i
	dh_installman -i -pliblapack-doc
	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_installman -a -pliblapack-test
	dh_installchangelogs -a
	dh_link -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -a -V "liblapack3gf | liblapack.so.3gf | libatlas3gf-base"
	dh_installdeb -a
	dh_shlibdeps -a -l $$(pwd)
	dh_gencontrol -a #-u"-Vg77=$(F77)"
	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  doc\
	build