File: rules

package info (click to toggle)
scalapack 1.8.0-6
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 32,240 kB
  • ctags: 29,143
  • sloc: fortran: 288,069; ansic: 64,035; makefile: 1,911
file content (409 lines) | stat: -rwxr-xr-x 10,355 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
#! /usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.
# Handmodified by P. Frauenfelder for debhelper support, 5 Sept 1998


package=scalapack

version:=$(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
version_major:=$(shell echo $(version) | cut -d '.' -f 1)

topdir=$(shell pwd)

# This little hack works on mpich, lam and openmpi as of the lenny release
SCALAPACK_MPI=$(shell readlink /etc/alternatives/mpi | sed s/usr//g | sed s/include//g | sed s/lib//g | sed s/\\///g)

build: build-$(SCALAPACK_MPI) build-pvm

build-openmpi: build-stamp-openmpi

build-lam: build-stamp-lam

build-mpich: build-stamp-mpich

build-pvm: build-stamp-pvm

patch-stamp:
	patch -p1 < debian/scalapack-openmpi.patch
	touch $@

unpatch: patch-stamp
	patch -p1 -R < debian/scalapack-openmpi.patch
	rm -f patch-stamp

build-stamp-openmpi: patch-stamp
	dh_testdir

# next is a clean
	echo *** cleaning object files ***
	BASEDIR=$(topdir) make clean

# build the shared libraries
	echo *** building shared libraries for openmpi ***
	BASEDIR=$(topdir) MPI=openmpi FPIC=-fPIC make lib
	mkdir -p tmp
	set -e ;\
	for i in scalapack ; do \
	  cd tmp ;\
	  ar x ../$${i}_openmpi.a ;\
	  cd .. ;\
	  gcc -shared -Wl,-soname=lib$$i-openmpi.so.$(version_major) -o \
	    lib$$i-openmpi.so.$(version) tmp/*.o -lblas -llapack -lblacsCinit-openmpi -lblacs-openmpi -L/usr/lib/openmpi/lib -lmpi -lmpi_f77 -lgfortran;\
	  ln -snf lib$$i-openmpi.so.$(version) lib$$i-openmpi.so.$(version_major) ;\
	  ln -snf lib$$i-openmpi.so.$(version_major) lib$$i-openmpi.so ;\
	  rm tmp/* ;\
	done
	rmdir tmp
#	for i in $$(find -name "*.f"); do \
#		if grep '^[^\*].*TOTMEM *= *' $$i | grep -v 64000000 >/dev/null ; then \
#		cat $$i | sed 's,\(^[^\*].*TOTMEM *= *\)[0-9]*,\164000000,g' >tmp ;\
#		mv tmp $$i;\
#		fi;\
#	done

# the testing binaries
	echo *** building static testing binaries for openmpi ***
	BASEDIR=$(topdir) MPI=openmpi BUILD=shared make exe
	set -e ;\
	cd TESTING ;\
	for i in $$(find -name 'x*' -maxdepth 1 ! -name 'x*-lam' ! -name 'x*-mpich' ! -name 'x*-pvm'); do \
	  mv $$i $$i-openmpi ;\
	done

# next is a clean
	echo *** cleaning object files ***
	BASEDIR=$(topdir) make clean

# build the static libraries
	echo *** building static libraries for openmpi ***
	BASEDIR=$(topdir) MPI=openmpi make lib

	touch build-stamp-openmpi

build-stamp-lam: patch-stamp
	dh_testdir

# next is a clean
	echo *** cleaning object files ***
	BASEDIR=$(topdir) make clean

# build the shared libraries
	echo *** building shared libraries for lam ***
	BASEDIR=$(topdir) MPI=lam FPIC=-fPIC make lib
	mkdir -p tmp
	set -e ;\
	for i in scalapack ; do \
	  cd tmp ;\
	  ar x ../$${i}_lam.a ;\
	  cd .. ;\
	  gcc -shared -Wl,-soname=lib$$i-lam.so.$(version_major) -o \
	    lib$$i-lam.so.$(version) tmp/*.o -lblas -llapack -lblacsCinit-lam -lblacs-lam -llam -lgfortran;\
	  ln -snf lib$$i-lam.so.$(version) lib$$i-lam.so.$(version_major) ;\
	  ln -snf lib$$i-lam.so.$(version_major) lib$$i-lam.so ;\
	  rm tmp/* ;\
	done
	rmdir tmp
#	for i in $$(find -name "*.f"); do \
#		if grep '^[^\*].*TOTMEM *= *' $$i | grep -v 64000000 >/dev/null ; then \
#		cat $$i | sed 's,\(^[^\*].*TOTMEM *= *\)[0-9]*,\164000000,g' >tmp ;\
#		mv tmp $$i;\
#		fi;\
#	done

# the testing binaries
	echo *** building static testing binaries for lam ***
	BASEDIR=$(topdir) MPI=lam BUILD=shared make exe
	set -e ;\
	cd TESTING ;\
	for i in $$(find -name 'x*' -maxdepth 1 ! -name 'x*-openmpi' ! -name 'x*-mpich' ! -name 'x*-pvm'); do \
	  mv $$i $$i-lam ;\
	done

# next is a clean
	echo *** cleaning object files ***
	BASEDIR=$(topdir) make clean

# build the static libraries
	echo *** building static libraries for lam ***
	BASEDIR=$(topdir) MPI=lam make lib

	touch build-stamp-lam

build-stamp-mpich: patch-stamp
	dh_testdir

# next is a clean
	echo *** cleaning object files ***
	BASEDIR=$(topdir) make clean

# build the shared libraries
	echo *** building shared libraries for mpich ***
	BASEDIR=$(topdir) MPI=mpich FPIC=-fPIC make lib
	mkdir -p tmp
	set -e ;\
	for i in scalapack ; do \
	  cd tmp ;\
	  ar x ../$${i}_mpich.a ;\
	  cd .. ;\
	  gcc -shared -Wl,-soname=lib$$i-mpich.so.$(version_major) -o \
	    lib$$i-mpich.so.$(version) tmp/*.o -lblas -llapack -lblacsCinit-mpich -lblacs-mpich -L /usr/lib/mpich/lib/shared -lmpich -lgfortran;\
	  ln -snf lib$$i-mpich.so.$(version) lib$$i-mpich.so.$(version_major) ;\
	  ln -snf lib$$i-mpich.so.$(version_major) lib$$i-mpich.so ;\
	  rm tmp/* ;\
	done
	rmdir tmp

# the testing binaries
	echo *** building static testing binaries for mpich ***
	BASEDIR=$(topdir) MPI=mpich BUILD=shared make exe
	set -e ;\
	cd TESTING ;\
	for i in $$(find -name 'x*'  -maxdepth 1 ! -name 'x*-openmpi' ! -name 'x*-lam' ! -name 'x*-pvm'); do \
	  mv $$i $$i-mpich ;\
	done

# next is a clean
	echo *** cleaning object files ***
	BASEDIR=$(topdir) make clean

# build the static libraries
	echo *** building static libraries for mpich ***
	BASEDIR=$(topdir) MPI=mpich make lib

	touch build-stamp-mpich

build-stamp-pvm: patch-stamp
	dh_testdir

# next is a clean
	echo *** cleaning object files ***
	BASEDIR=$(topdir) make clean

# build the shared libraries
	echo *** building shared libraries for pvm ***
	BASEDIR=$(topdir) MPI=pvm FPIC=-fPIC make lib
	mkdir -p tmp
	set -e ;\
	for i in scalapack ; do \
	  cd tmp ;\
	  ar x ../$${i}_pvm.a ;\
	  cd .. ;\
	  gcc -shared -Wl,-soname=lib$$i-pvm.so.$(version_major) -o \
	    lib$$i-pvm.so.$(version) tmp/*.o -lblas -llapack -lblacs-pvm -lpvm3 -lgfortran;\
	  ln -snf lib$$i-pvm.so.$(version) lib$$i-pvm.so.$(version_major) ;\
	  ln -snf lib$$i-pvm.so.$(version_major) lib$$i-pvm.so ;\
	  rm tmp/* ;\
	done
	rmdir tmp

# the testing binaries
	echo *** building static testing binaries for pvm ***
	BASEDIR=$(topdir) MPI=pvm BUILD=shared make exe
	set -e ;\
	cd TESTING ;\
	for i in $$(find -name 'x*'  -maxdepth 1 ! -name 'x*-openmpi' ! -name 'x*-lam' ! -name 'x*-mpich'); do \
	  mv $$i $$i-pvm ;\
	done

# next is a clean
	echo *** cleaning object files ***
	BASEDIR=$(topdir) make clean

# build the static libraries
	echo *** building static libraries for pvm ***
	BASEDIR=$(topdir) MPI=pvm make lib

	touch build-stamp-pvm

clean: unpatch
	dh_testdir
	dh_testroot
	rm -f build-stamp-* install-stamp-* install-dirs-stamp
	BASEDIR=$(topdir) make clean
	rm -f *.a
	rm -f *so*
	rm -f TESTING/x*
	rm -fr tmp
#	for i in $$(find -name "*.f"); do \
#		if grep '^[^\*].*TOTMEM *= *' $$i | grep 64000000 >/dev/null ; then\
#		cat $$i | sed -e 's/\(^[^\*].*TOTMEM *= *\)[0-9]*,/\12000000,/g' -e 's/\(^[^\*].*TOTMEM *= *\)[0-9]*\( *)\)/\13000000\2/g'>tmp ;\
#		mv tmp $$i;\
#		fi;\
#	done
	dh_clean

install: install-dirs install-$(SCALAPACK_MPI) install-pvm

install-dirs: install-dirs-stamp

install-dirs-stamp:
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs -v

	touch install-dirs-stamp

install-openmpi: install-stamp-openmpi

install-lam: install-stamp-lam

install-mpich: install-stamp-mpich

install-pvm: install-stamp-pvm

install-stamp-openmpi: build-stamp-openmpi
	dh_testdir
	dh_testroot

	set -e ;\
	for i in scalapack ; do \
	  cp -a lib$$i-openmpi.so.* \
	    `pwd`/debian/libscalapack-mpi1/usr/lib/ ;\
	  cp -a lib$$i-openmpi.so \
	    `pwd`/debian/libscalapack-mpi-dev/usr/lib/ ;\
	done

	install TESTING/x*-openmpi \
	  `pwd`/debian/scalapack-mpi-test/usr/lib/scalapack

	set -e ;\
	for i in scalapack ; do \
	  install $${i}_openmpi.a \
	    `pwd`/debian/libscalapack-mpi-dev/usr/lib/lib$$i-openmpi.a ;\
	done

	touch install-stamp-openmpi

install-stamp-lam: build-stamp-lam
	dh_testdir
	dh_testroot

	set -e ;\
	for i in scalapack ; do \
	  cp -a lib$$i-lam.so.* \
	    `pwd`/debian/libscalapack-mpi1/usr/lib/ ;\
	  cp -a lib$$i-lam.so \
	    `pwd`/debian/libscalapack-mpi-dev/usr/lib/ ;\
	done

	install TESTING/x*-lam \
	  `pwd`/debian/scalapack-mpi-test/usr/lib/scalapack

	set -e ;\
	for i in scalapack ; do \
	  install $${i}_lam.a \
	    `pwd`/debian/libscalapack-mpi-dev/usr/lib/lib$$i-lam.a ;\
	done

	touch install-stamp-lam

install-stamp-mpich: build-stamp-mpich
	dh_testdir
	dh_testroot

	set -e ;\
	for i in scalapack ; do \
	  cp -a lib$$i-mpich.so.* \
	    `pwd`/debian/libscalapack-mpi1/usr/lib/ ;\
	  cp -a lib$$i-mpich.so \
	    `pwd`/debian/libscalapack-mpi-dev/usr/lib/ ;\
	done

	install TESTING/x*-mpich \
	  `pwd`/debian/scalapack-mpi-test/usr/lib/scalapack

	set -e ;\
	for i in scalapack ; do \
	  install $${i}_mpich.a \
	    `pwd`/debian/libscalapack-mpi-dev/usr/lib/lib$$i-mpich.a ;\
	done

	touch install-stamp-mpich

install-stamp-pvm: build-stamp-pvm
	dh_testdir
	dh_testroot

	set -e ;\
	for i in scalapack ; do \
	  cp -a lib$$i-pvm.so.* \
	    `pwd`/debian/libscalapack-pvm1/usr/lib/ ;\
	  cp -a lib$$i-pvm.so \
	    `pwd`/debian/libscalapack-pvm-dev/usr/lib/ ;\
	done

	install TESTING/x*-pvm \
	  `pwd`/debian/scalapack-pvm-test/usr/lib/scalapack

	set -e ;\
	for i in scalapack ; do \
	  install $${i}_pvm.a \
	    `pwd`/debian/libscalapack-pvm-dev/usr/lib/lib$$i-pvm.a ;\
	done

	touch install-stamp-pvm

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs README 
	dh_installexamples
	dh_installchangelogs
	dh_link
	dh_compress
	dh_fixperms
	dh_strip
	dh_makeshlibs -V
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

install-indep: install-stamp-indep

install-stamp-indep:
	dh_testdir -i
	dh_testroot -i
	dh_installdirs -i

	set -e ;\
	for i in $$(find TESTING -name '*.dat') ; do \
	  install -m 644 $$i \
	    `pwd`/debian/scalapack-test-common/usr/share/scalapack ;\
	done
	set -e ;\
	for i in $$(find REDIST/TESTING -name '*.dat') ; do \
	  install -m 644 $$i \
	    `pwd`/debian/scalapack-test-common/usr/share/scalapack ;\
	done
	set -e ;\
	for i in $$(find PBLAS -name '*.dat') ; do \
	  install -m 644 $$i \
	    `pwd`/debian/scalapack-test-common/usr/share/scalapack ;\
	done

	touch install-stamp-indep

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

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-arch binary-indep

.PHONY: binary binary-indep binary-arch clean build