LAPACK  3.5.0
LAPACK: Linear Algebra PACKage
 All Classes Files Functions Variables Typedefs Macros
rules
Go to the documentation of this file.
1 #!/usr/bin/make -f
2 
3 # Uncomment this to turn on verbose mode.
4 #export DH_VERBOSE=1
5 
6 SO:=3
7 MN:=0
8 VERS:=$(SO).$(MN)
9 
10 # xerblas_ and LAPACK_xerblas must be overrideable by applications
11 # --dynamic-list does not work with gold, so drop the flag completely
12 BUILDFLAGS_ENV:=DEB_LDFLAGS_MAINT_STRIP="-Wl,-Bsymbolic-functions"
13 LDFLAGS:=$(shell $(BUILDFLAGS_ENV) dpkg-buildflags --get LDFLAGS)
14 
15 F77:=gfortran
16 FFLAGS:=$(shell dpkg-buildflags --get FFLAGS)
17 FFLAGS_NOOPT:=$(shell DEB_BUILD_OPTIONS=noopt dpkg-buildflags --get FFLAGS)
18 
19 CC:=/usr/bin/cc
20 CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
21 CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
22 
23 ARCH:=$(shell dpkg --print-architecture)
24 
25 ifeq ($(ARCH),alpha)
26  FFLAGS += -mieee
27  FFLAGS_NOOPT += -mieee
28 endif
29 
30 # Using the -frecursive flag is the solution recommended by upstream for #693269
31 # However, we don't want to use -frecursive for the testsuite, it leads to
32 # segfaults on mips{,el} (xeigtstz allocates too much space on the stack)
33 FFLAGS_TESTSUITE := $(FFLAGS)
34 FFLAGS += -frecursive
35 FFLAGS_NOOPT += -frecursive
36 
37 # Support parallel build
38 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
39  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
40  MAKEFLAGS += -j$(NUMJOBS)
41 endif
42 
43 #
44 #
45 # Configure
46 #
47 #
48 
49 make.inc: install/make.inc.gfortran
50  cat $< | sed -e "s,\(^NOOPT *=\).*,\1 \$$(PICOPTS) $(FFLAGS_NOOPT),1" \
51  -e "s,\(^OPTS *=\).*,\1 \$$(PICOPTS) $(FFLAGS),1" \
52  -e "s/\(^LOADOPTS *=\).*/\1 $(LDFLAGS)/1" \
53  -e "s,\(^CFLAGS *=\).*,\1 $(CPPFLAGS) \$$(PICOPTS) $(CFLAGS),1" \
54  -e "s,[^ ]*blas[^ ]*\.a,-lblas,1" > $@
55 
56 #
57 #
58 # Build rules for libraries
59 #
60 #
61 
62 liblapack_pic.a: make.inc testing/Makefile
63  echo "Building liblapack_pic.a"
64  $(MAKE) cleanlib
65  $(MAKE) lapack_install PICOPTS=-fPIC
66  $(MAKE) lib PICOPTS=-fPIC
67  mv liblapack.a $@
68 
69 liblapack.so.$(VERS): liblapack_pic.a
70  echo "Building liblapack.so.$(VERS) from liblapack_pic.a"
71  mkdir -p tmp
72  cd tmp && ar x ../$<
73  $(F77) -shared -Wl,-soname=liblapack.so.$(SO) -o $@ tmp/*.o -L. -lblas $(LDFLAGS)
74  rm -rf tmp
75 
76 liblapack.so.$(SO): liblapack.so.$(VERS)
77  ln -snf $< $@
78 
79 liblapack.so: liblapack.so.$(SO)
80  ln -snf $< $@
81 
82 liblapack.a: make.inc
83  echo "Building liblapack.a"
84  $(MAKE) lapack_install
85  $(MAKE) lib
86 
87 lapacke/liblapacke_pic.a: make.inc
88  echo "Building liblapacke_pic.a"
89  cd lapacke; \
90  $(MAKE) cleanlib; \
91  $(MAKE) PICOPTS=-fPIC; \
92  mv ../liblapacke.a $(@F)
93 
94 lapacke/liblapacke.so.$(VERS): lapacke/liblapacke_pic.a
95  echo "Building liblapacke.so.$(VERS) from liblapacke_pic.a"
96  cd lapacke; \
97  mkdir -p tmp; \
98  cd tmp && ar x ../$(<F) && cd -; \
99  $(CC) -shared -Wl,-soname=liblapacke.so.$(SO) -o $(@F) tmp/*.o -L.. -lblas -llapack $(LDFLAGS); \
100  rm -rf tmp
101 
102 lapacke/liblapacke.so.$(SO): lapacke/liblapacke.so.$(VERS)
103  cd lapacke; \
104  ln -snf $(<F) $(@F)
105 
106 lapacke/liblapacke.so: lapacke/liblapacke.so.$(SO)
107  cd lapacke; \
108  ln -snf $(<F) $(@F)
109 
110 lapacke/liblapacke.a: make.inc
111  echo "Building liblapacke.a"
112  cd lapacke; \
113  $(MAKE) ; \
114  mv ../liblapacke.a $(@F)
115 
116 #
117 #
118 # Testing rules
119 #
120 #
121 
122 testing/testing_results.txt: liblapack.so
123  LD_LIBRARY_PATH=$$(pwd):$$LD_LIBRARY_PATH \
124  $(MAKE) PICOPTS= OPTS="$(FFLAGS_TESTSUITE)" \
125  LLIB="-L $$(pwd) -llapack -lblas" lapack_testing
126 
127 #
128 #
129 # Package rules
130 #
131 #
132 
133 %:
134  dh $@ --parallel
135 
136 override_dh_auto_clean: make.inc
137  dh_testdir
138  rm -rf debian/*_stamp debian/*_results lib* testing/*out
139  rm -rf *.a install/test* debian/test/ debian/time/
140  rm -f testing/tmp testing/testing_results.txt
141  cd lapacke && $(MAKE) clean
142  rm -f lapacke/*.a lapacke/*.so lapacke/*.so.* lapacke/include/lapacke_mangling.h
143  touch TESTING/xlinfoo TESTING/xeigfoo && $(MAKE) clean
144  rm -rf DOCS/explore-html/ DOCS/man/
145  rm -f output_err
146  rm -f make.inc
147 
148 # liblapack_pic.a must come before liblapack.a, otherwise the latter will be overwritten
149 # We also build the test programs, in order to avoid FTBFS if DEB_BUILD_OPTIONS contains nocheck
150 override_dh_auto_build-arch: liblapack_pic.a liblapack.a liblapack.so lapacke/liblapacke_pic.a lapacke/liblapacke.a lapacke/liblapacke.so
151  make OPTS="$(FFLAGS_TESTSUITE)" -C testing xeigtstc xeigtstd xeigtsts xeigtstz xlintstc xlintstd xlintsts xlintstz xlintstds xlintstrfc xlintstrfd xlintstrfs xlintstrfz xlintstzc
152 
153 override_dh_auto_build-indep: make.inc
154  $(MAKE) html
155  $(MAKE) man
156 
157 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
158 override_dh_auto_test-arch: testing/testing_results.txt
159 else
160 override_dh_auto_test-arch:
161  touch testing/testing_results.txt
162 endif
163 
164 override_dh_makeshlibs:
165  dh_makeshlibs -a -pliblapack3 -V "liblapack3 | liblapack.so.3" -n
166  dh_makeshlibs -a -Nliblapack3
167 
168 override_dh_shlibdeps:
169  dh_shlibdeps -a -l $$(pwd)
170 
171 # Do not compress the .map files in HTML generated documentation
172 override_dh_compress-indep:
173  dh_compress -i -X.map
174 
175 # This Makefile must be run serially (because non-PIC and PIC versions must be
176 # built sequentially), but the sub-makes can still be parallized
177 .NOTPARALLEL:
SO Bsymbolic functions LDFLAGS
Definition: rules:12
adapt the repackaging code *Remove recursive patch Replace it by the frecursive flag to gfortran
Definition: changelog:9
debian upstream
Definition: changelog:497