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
|
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
SO:=3
MN:=0
VERS:=$(SO).$(MN)
GCC:=gcc
ARCH:=$(shell dpkg --print-architecture)
F77:=gfortran
FOPTS:= #-ff90
#OPTOPTS:=-g
#UNROLL:=
OPTOPTS:=-g -O3 -Wall
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
doc:
$(MAKE) html
$(MAKE) man
#
#
# 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
echo "Building liblapack_pic.a"
$(MAKE) cleanlib
$(MAKE) lapack_install PICOPTS=-fPIC
$(MAKE) lib PICOPTS=-fPIC
mv liblapack.a $@
liblapack.so.$(VERS): liblapack_pic.a
echo "Building liblapack.so.$(VERS) from liblapack_pic.a"
mkdir -p tmp
cd tmp && ar x ../$<
$(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
echo "Building liblapack.a"
$(MAKE) lapack_install
$(MAKE) lib
# mv lapack_LINUX.a $@
liblapacke_pic.a: make.inc testing/Makefile
echo "Building liblapacke_pic.a"
cd lapacke; \
$(MAKE) cleanlib; \
$(MAKE) CFLAGS="$(OPTOPTS) -fPIC"; \
mv ../liblapacke.a $@
liblapacke.so.$(VERS): liblapacke_pic.a
echo "Building liblapacke.so.$(VERS) from liblapacke_pic.a"
cd lapacke; \
mkdir -p tmp; \
cd tmp && ar x ../$< && cd -; \
$(GCC) -shared -Wl,-soname=liblapacke.so.$(SO) -o $@ tmp/*.o -L.. -lblas -llapack; \
rm -rf tmp
liblapacke.so.$(SO): liblapacke.so.$(VERS)
cd lapacke; \
ln -snf $< $@
liblapacke.so: liblapacke.so.$(SO)
cd lapacke; \
ln -snf $< $@
liblapacke.a: make.inc testing/Makefile
echo "Building liblapacke.a"
cd lapacke; \
$(MAKE) CFLAGS="$(OPTOPTS)"; \
BF:=liblapack.a liblapack_pic.a liblapack.so liblapacke.a liblapacke_pic.a liblapacke.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)))
$(TB) $(TESF): 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
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
cd lapacke && $(MAKE) clean
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: doc install
dh_testdir -i
dh_testroot -i
dh_install -i
dh_installdocs -i
dh_installexamples -i
dh_installman -i -pliblapack-doc
dh_installchangelogs -i
dh_link -i
dh_lintian -i
dh_strip -i
dh_compress -i
dh_fixperms -i
dh_makeshlibs -i -n
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_install -a
dh_installdocs -a
dh_installdebconf -a
dh_installexamples -a
dh_installman -a -pliblapack-test
dh_installchangelogs -a
dh_link -a
dh_lintian -a
dh_strip -a
dh_compress -a
dh_fixperms -a
dh_makeshlibs -a -pliblapack3 -V "liblapack3 | liblapack.so.3 | libatlas3-base" -n
dh_makeshlibs -a -Nliblapack3
dh_installdeb -a
dh_shlibdeps -a -l $$(pwd)
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
.PHONY: clean binary-indep binary-arch binary \
doc build
|