File: rules

package info (click to toggle)
scalapack 1.8.0-13
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 32,712 kB
  • ctags: 29,423
  • sloc: fortran: 288,069; ansic: 64,035; makefile: 1,968
file content (503 lines) | stat: -rwxr-xr-x 13,223 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
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
#! /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)

include /usr/share/mpi-default-dev/debian_defaults
SCALAPACK_MPI=$(ARCH_DEFAULT_MPI_IMPL)

# This list of archs is maintained separately from that of the mpi-defaults
# package. If there is a mismatch between the two, the package will FTBFS. This
# is on purpose, to avoid silent breakage. See #740620 for more details.
OPENMPI_ARCHS=alpha amd64 arm64 armel armhf hurd-i386 i386 kfreebsd-amd64 kfreebsd-i386 mips mipsel mips64 mips64el powerpc ppc64 ppc64el sparc s390x x32 sparc64 hppa
MPICH_ARCHS=m68k sh4

build-arch: build

build-indep: build

build: build-$(SCALAPACK_MPI) build-pvm

build-openmpi: build-stamp-openmpi

build-lam: build-stamp-lam

build-mpich: build-stamp-mpich

build-mpich2: build-stamp-mpich2

build-pvm: build-stamp-pvm

build-stamp-openmpi:
	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 $(shell pkg-config mpi-fort --libs) -lgfortran -lm;\
	  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:
	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 -lm;\
	  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:
	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 -lm;\
	  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-mpich2:
	dh_testdir

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

# build the shared libraries
	echo *** building shared libraries for mpich2 ***
	BASEDIR=$(topdir) MPI=mpich2 FPIC=-fPIC make lib
	mkdir -p tmp
	set -e ;\
	for i in scalapack ; do \
	  cd tmp ;\
	  ar x ../$${i}_mpich2.a ;\
	  cd .. ;\
	  gcc -shared -Wl,-soname=lib$$i-mpich2.so.$(version_major) -o \
	    lib$$i-mpich2.so.$(version) tmp/*.o -lblas -llapack -lblacsCinit-mpich2 -lblacs-mpich2 -lmpich -lmpl -lgfortran -lm;\
	  ln -snf lib$$i-mpich2.so.$(version) lib$$i-mpich2.so.$(version_major) ;\
	  ln -snf lib$$i-mpich2.so.$(version_major) lib$$i-mpich2.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 mpich2 ***
	BASEDIR=$(topdir) MPI=mpich2 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-mpich2 ;\
	done

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

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

	touch build-stamp-mpich2

build-stamp-pvm:
	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 -lm;\
	  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:
	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
	rm -f PBLAS/TIMING/PB_Cabort.c PBLAS/TIMING/PB_Cwarn.c PBLAS/TESTING/PB_Cabort.c PBLAS/TESTING/PB_Cwarn.c
#	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

	{ \
	  echo "# This file is autogenerated. DO NOT EDIT!" ; \
	  echo "#" ; \
	  echo "# Modifications should be made to debian/control.in instead." ; \
	  echo "# This file is regenerated automatically in the clean target." ; \
	  echo ; \
	  sed "s/@OPENMPI_ARCHS@/$(OPENMPI_ARCHS)/g;s/@MPICH_ARCHS@/$(MPICH_ARCHS)/g;" debian/control.in ; } \
	> debian/control

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-mpich2: install-stamp-mpich2

install-pvm: install-stamp-pvm

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

	# The shared library is installed via debian/*.install, to avoid
	# creating an empty package if default MPI implementation changes on
	# the arch
	dh_install

	set -e ;\
	for i in scalapack ; do \
	  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

	# The shared library is installed via debian/*.install, to avoid
	# creating an empty package if default MPI implementation changes on
	# the arch
	dh_install

	set -e ;\
	for i in scalapack ; do \
	  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-mpich2: build-stamp-mpich2
	dh_testdir
	dh_testroot

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

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

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

	touch install-stamp-mpich2

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 build-arch build-indep