File: Make.lib

package info (click to toggle)
atlas 3.10.3-13
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 38,316 kB
  • sloc: ansic: 486,789; fortran: 66,209; asm: 7,267; makefile: 1,466; sh: 604
file content (310 lines) | stat: -rw-r--r-- 14,909 bytes parent folder | download | duplicates (5)
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
include Make.inc
LD = ld
mySRCdir = $(SRCdir)/lib
#
# override with libatlas.so only when atlas is built to one lib
#
DYNlibs = liblapack_atlas.so libf77blas.so libcblas.so libatlas.so 
PTDYNlibs = liblapack_atlas.so libptf77blas.so libptcblas.so libatlas.so 
CDYNlibs = liblapack_atlas.so libcblas.so libatlas.so 
CPTDYNlibs = liblapack_atlas.so libptcblas.so libatlas.so 

VER=3.10.3
tmpd = RCW_tMp
tarnam = atlas$(VER)_$(ARCH)
tar : tarfile
tarfile : $(tarnam).tar.bz2
outdef=
$(tarnam).tar.bz2 :
	mkdir $(ARCH)
	cd $(ARCH) ; mkdir include lib
	cp $(TOPdir)/doc/LibReadme.txt $(ARCH)/README
	cp $(TOPdir)/Make.$(ARCH) $(ARCH)/.
	cp $(BINdir)/INSTALL_LOG/SUMMARY.LOG $(ARCH)/.
	cp $(INCSdir)/cblas.h $(ARCH)/include/.
	cp $(INCSdir)/clapack.h $(ARCH)/include/.
	cp $(LIBdir)/libatlas.a $(ARCH)/lib/.
	cp $(LIBdir)/libf77blas.a $(ARCH)/lib/.
	cp $(LIBdir)/libcblas.a $(ARCH)/lib/.
	cp $(LIBdir)/liblapack_atlas.a $(ARCH)/lib/.
	- cp $(LIBdir)/libptcblas.a $(ARCH)/lib/.
	- cp $(LIBdir)/libptf77blas.a $(ARCH)/lib/.
	$(TAR) cf $(tarnam).tar $(ARCH)
	rm -rf $(ARCH)
	$(BZIP) --best $(tarnam).tar

# ===================================================================
# The following commands are to build dynamic/shared objects on Linux
# using the gnu gcc or ld
# ===================================================================
ptshared: fat_ptshared
shared : fat_shared
cptshared : fat_cptshared
cshared : fat_cshared

#
# These are a bunch of different ways to attempt to build a .so, try them all
#
LDTRY_WIN:
	$(LD) $(LDFLAGS) -shared -soname $(LIBINSTdir)/$(outso) -o $(outso) \
           -rpath-link $(LIBINSTdir) --output-def=$(outdef) \
           --whole-archive $(libas) --no-whole-archive $(LIBS)
GCCTRY_WIN:
	$(GOODGCC) -shared -o $(outso) -Wl,--output-def=$(outdef) \
           -Wl,"-rpath-link $(LIBINSTdir)" \
           -Wl,--whole-archive $(libas) -Wl,--no-whole-archive $(LIBS)
GCCTRY_norp_WIN:
	$(GOODGCC) -shared -o $(outso) -Wl,--output-def=$(outdef) \
           -Wl,--whole-archive $(libas) -Wl,--no-whole-archive $(LIBS)
#
# TRYALL_WIN is going to just try a bunch of library combinations that may work
# on gnu platforms, hopefully one does.  It also tests doing the link by
# LD or gcc; some places don't use the gnu LD command, but gcc may still work
#
TRYALL_WIN :
	if $(MAKE) GCCTRY_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="$(F77SYSLIB) -lc $(LIBS) -lgcc" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and all libs" ; \
        elif $(MAKE) LDTRY_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="$(F77SYSLIB) -lc $(LIBS) -lgcc" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt ld and all sys libs" ; \
	elif $(MAKE) GCCTRY_norp_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="$(F77SYSLIB) -lc $(LIBS) -lgcc" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and all libs and no rpath" ; \
        elif $(MAKE) GCCTRY_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="-lc $(LIBS) -lgcc" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and all C libs" ; \
        elif $(MAKE) LDTRY_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="-lc $(LIBS) -lgcc" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt ld and -lc -lgcc" ; \
        elif $(MAKE) GCCTRY_norp_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="-lc $(LIBS) -lgcc" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and all C libs and no rpath" ; \
        elif $(MAKE) GCCTRY_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="$(F77SYSLIB) -lc $(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and all libs except -lgcc" ; \
        elif $(MAKE) LDTRY_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="$(F77SYSLIB) -lc $(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt all libs except -lgcc" ; \
        elif $(MAKE) GCCTRY_norp_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="$(F77SYSLIB) -lc $(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and all libs except -lgcc, no rpath" ; \
        elif $(MAKE) GCCTRY_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="-lc $(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and -lc" ; \
        elif $(MAKE) LDTRY_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="-lc $(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt ld and -lc" ; \
        elif $(MAKE) GCCTRY_norp_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="-lc $(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and -lc, no rpath" ; \
        elif $(MAKE) LDTRY_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="$(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt ld" ; \
        elif $(MAKE) GCCTRY_norp_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
        LIBS="$(F77SYSLIB) -lkernel32" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt fortran and kernel32, no rpath" ; \
        else \
           $(MAKE) GCCTRY_WIN outso="$(outso)" libas="$(libas)" outdef="$(outdef)" \
           LIBS="$(LIBS)" LIBINSTdir="$(LIBINSTdir)" ; \
        fi
#
# These are a bunch of different ways to attempt to build a .so, try them all
#
LDTRY:
	$(LD) $(LDFLAGS) -shared -soname $(LIBINSTdir)/$(outso) -o $(outso) \
           -rpath-link $(LIBINSTdir)  \
           --whole-archive $(libas) --no-whole-archive $(LIBS)
GCCTRY:
	$(GOODGCC) -shared -o $(outso)  \
           -Wl,"-rpath-link $(LIBINSTdir)" \
           -Wl,--whole-archive $(libas) -Wl,--no-whole-archive $(LIBS)
GCCTRY_norp:
	$(GOODGCC) -shared -o $(outso)  \
           -Wl,--whole-archive $(libas) -Wl,--no-whole-archive $(LIBS)
#
# TRYALL is going to just try a bunch of library combinations that may work
# on gnu platforms, hopefully one does.  It also tests doing the link by
# LD or gcc; some places don't use the gnu LD command, but gcc may still work
#
TRYALL :
	if $(MAKE) GCCTRY outso="$(outso)" libas="$(libas)"  \
        LIBS="$(F77SYSLIB) -lc $(LIBS) -lgcc" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and all libs" ; \
        elif $(MAKE) LDTRY outso="$(outso)" libas="$(libas)"  \
        LIBS="$(F77SYSLIB) -lc $(LIBS) -lgcc" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt ld and all sys libs" ; \
	elif $(MAKE) GCCTRY_norp outso="$(outso)" libas="$(libas)"  \
        LIBS="$(F77SYSLIB) -lc $(LIBS) -lgcc" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and all libs and no rpath" ; \
        elif $(MAKE) GCCTRY outso="$(outso)" libas="$(libas)"  \
        LIBS="-lc $(LIBS) -lgcc" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and all C libs" ; \
        elif $(MAKE) LDTRY outso="$(outso)" libas="$(libas)"  \
        LIBS="-lc $(LIBS) -lgcc" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt ld and -lc -lgcc" ; \
        elif $(MAKE) GCCTRY_norp outso="$(outso)" libas="$(libas)"  \
        LIBS="-lc $(LIBS) -lgcc" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and all C libs and no rpath" ; \
        elif $(MAKE) GCCTRY outso="$(outso)" libas="$(libas)"  \
        LIBS="$(F77SYSLIB) -lc $(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and all libs except -lgcc" ; \
        elif $(MAKE) LDTRY outso="$(outso)" libas="$(libas)"  \
        LIBS="$(F77SYSLIB) -lc $(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt all libs except -lgcc" ; \
        elif $(MAKE) GCCTRY_norp outso="$(outso)" libas="$(libas)"  \
        LIBS="$(F77SYSLIB) -lc $(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and all libs except -lgcc, no rpath" ; \
        elif $(MAKE) GCCTRY outso="$(outso)" libas="$(libas)"  \
        LIBS="-lc $(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and -lc" ; \
        elif $(MAKE) LDTRY outso="$(outso)" libas="$(libas)"  \
        LIBS="-lc $(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt ld and -lc" ; \
        elif $(MAKE) GCCTRY_norp outso="$(outso)" libas="$(libas)"  \
        LIBS="-lc $(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt gcc and -lc, no rpath" ; \
        elif $(MAKE) LDTRY outso="$(outso)" libas="$(libas)"  \
        LIBS="$(LIBS)" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt ld" ; \
        elif $(MAKE) GCCTRY_norp outso="$(outso)" libas="$(libas)"  \
        LIBS="$(F77SYSLIB) -lkernel32" LIBINSTdir="$(LIBINSTdir)"; then \
           echo "$(outso) built wt fortran and kernel32, no rpath" ; \
        else \
           $(MAKE) GCCTRY outso="$(outso)" libas="$(libas)"  \
           LIBS="$(LIBS)" LIBINSTdir="$(LIBINSTdir)" ; \
        fi

#
# Builds one shared lib from all ATLAS files
#
fat_ptshared :                              # threaded target
	$(MAKE) TRYALL outso=libtatlas.so \
                libas="libptlapack.a libptf77blas.a libptcblas.a libatlas.a" \
                LIBINSTdir="$(LIBINSTdir)"
fat_shared :                                # serial target
	$(MAKE) TRYALL outso=libsatlas.so \
                libas="liblapack_atlas.a libf77blas.a libcblas.a libatlas.a" \
                LIBINSTdir="$(LIBINSTdir)"
#
# Builds shared lib, not include fortran codes from LAPACK
#
fat_cptshared : libptclapack.a              # threaded target
	$(MAKE) TRYALL outso=libtatlas.so \
                libas="libptclapack.a libptcblas.a libatlas.a" \
                LIBINSTdir="$(LIBINSTdir)"
fat_cshared : libclapack.a                  # unthreaded target
	$(MAKE) TRYALL outso=libsatlas.so \
                libas="libclapack.a libcblas.a libatlas.a" \
                LIBINSTdir="$(LIBINSTdir)"

libclapack.a : liblapack_atlas.a
	rm -rf clapack libclapack.a
	mkdir clapack
	cd clapack ; ar x ../liblapack_atlas.a
	rm -f clapack/*f77wrap* clapack/*C2F*
	ar r libclapack.a clapack/ATL_* clapack/clapack_*
	rm -rf clapack
libptclapack.a : libptlapack.a
	rm -rf clapack libptclapack.a
	mkdir clapack
	cd clapack ; ar x ../libptlapack.a
	rm -f clapack/*f77wrap* clapack/*C2F*
	ar r libptclapack.a clapack/ATL_* clapack/clapack_*
	rm -rf clapack

#  ========================================================================
#  The following commands build DLLs on Windows, as well as generating the
#  .def files that MSVC++'s LIB needs to create import libraries.  My
#  understanding is that after this process, you can issue a commands like:
#     LIB /nologo /MACHINE:[x86,X64] /def/lib[s,t]atlas.def
#  To create the import libraries.  For further details, see:
#     https://sf.net/projects/math-atlas/forums/forum/1026734/topic/5349864
#  ========================================================================
dlls: sdlls
ptdlls: tdlls
tdlls:                          # threaded target
	$(MAKE) TRYALL_WIN outso=libtatlas.dll outdef=libtatlas.def \
                libas="libptlapack.a libptf77blas.a libptcblas.a libatlas.a" \
                LIBINSTdir="$(LIBINSTdir)"
sdlls:                          # serial target
	$(MAKE) TRYALL_WIN outso=libsatlas.dll outdef=libsatlas.def \
                libas="liblapack_atlas.a libf77blas.a libcblas.a libatlas.a" \
                LIBINSTdir="$(LIBINSTdir)"
cdlls: ctdlls csdlls
ctdlls: libptclapack.a          # threaded target
	$(MAKE) TRYALL_WIN outso=libtatlas.dll outdef=libtatlas.def \
                libas="libptclapack.a libptcblas.a libatlas.a" \
                LIBINSTdir="$(LIBINSTdir)"
csdlls: libclapack.a            # serial target
	$(MAKE) TRYALL_WIN outso=libsatlas.dll outdef=libsatlas.def \
                libas="libclapack.a libcblas.a libatlas.a" \
                LIBINSTdir="$(LIBINSTdir)"

#  =======================================================================
#  The following commands are to build dynamib libraries on OS X (in BETA)
#  =======================================================================
dylib :
	rm -rf $(tmpd) ; mkdir $(tmpd)
	cd $(tmpd) ; ar x ../liblapack_atlas.a 
	cd $(tmpd) ; ar x ../libf77blas.a
	cd $(tmpd) ; ar x ../libcblas.a 
	cd $(tmpd) ; ar x ../libatlas.a
	cd $(tmpd) ; $(LIBTOOL) -dynamic -o ../libsatlas.dylib \
        -install_name $(LIBINSTdir)/libsatlas.dylib -current_version $(VER) \
        -compatibility_version $(VER) *.o $(LIBS) $(F77SYSLIB)
	rm -rf $(tmpd)
ptdylib :
	rm -rf $(tmpd) ; mkdir $(tmpd)
	cd $(tmpd) ; ar x ../libptlapack.a 
	cd $(tmpd) ; ar x ../libptf77blas.a 
	cd $(tmpd) ; ar x ../libptcblas.a 
	cd $(tmpd) ; ar x ../libatlas.a
	cd $(tmpd) ; $(LIBTOOL) -dynamic -o ../libtatlas.dylib \
        -install_name $(LIBINSTdir)/libtatlas.dylib -current_version $(VER) \
        -compatibility_version $(VER) *.o $(LIBS) $(F77SYSLIB)
	rm -rf $(tmpd)
cdylib : libclapack.a
	rm -rf $(tmpd) ; mkdir $(tmpd)
	cd $(tmpd) ; ar x ../libclapack.a 
	cd $(tmpd) ; ar x ../libcblas.a 
	cd $(tmpd) ; ar x ../libatlas.a
	cd $(tmpd) ; $(LIBTOOL) -dynamic -o ../libsatlas.dylib \
        -install_name $(LIBINSTdir)/libsatlas.dylib -current_version $(VER) \
        -compatibility_version $(VER) *.o $(LIBS)
	rm -rf $(tmpd)
ptcdylib : libptclapack.a
	rm -rf $(tmpd) ; mkdir $(tmpd)
	cd $(tmpd) ; ar x ../libptclapack.a
	cd $(tmpd) ; ar x ../libptcblas.a 
	cd $(tmpd) ; ar x ../libatlas.a
	cd $(tmpd) ; $(LIBTOOL) -dynamic -o ../libtatlas.dylib \
        -install_name $(LIBINSTdir)/libtatlas.dylib -current_version $(VER) \
        -compatibility_version $(VER) *.o $(LIBS)
	rm -rf $(tmpd)

libclapack.dylib : libcblas.dylib libatlas.dylib liblapack_atlas.a
	rm -rf $(tmpd) ; mkdir $(tmpd)
	cd $(tmpd) ; ar x ../liblapack_atlas.a
	rm -f $(tmpd)/*C2F $(tmpd)/*f77wrap*
	cd $(tmpd) ; libtool -dynamic -o ../libclapack.dylib \
           -install_name $(LIBINSTdir)/libclapack.dylib \
           -compatibility_version $(VER) -current_version $(VER) \
           *.o ../libcblas.dylib ../libatlas.dylib $(LIBS)
	rm -rf $(tmpd)
xtst_lp: $(DYNlibs)
	$(ICC) $(CDEFS) -o $@ $(mySRCdir)/qr.c $(DYNlibs) -Wl,--rpath ./
xtst : $(DYNlibs)
	$(ICC) $(CDEFS) -o $@ $(mySRCdir)/test_dynlink.c $(DYNlibs) \
           -Wl,--rpath ./

xtry_lp:
	$(ICC) $(CDEFS) -o $@ $(mySRCdir)/qr.c libsatlas.so -Wl,--rpath ./
xtry_lp_pt:
	$(ICC) $(CDEFS) -o $@ $(mySRCdir)/qr.c libtatlas.so -Wl,--rpath ./
xtry :
	$(ICC) $(CDEFS) -o $@ $(mySRCdir)/test_dynlink.c libsatlas.so \
           -Wl,--rpath ./
xtry_pt :
	$(ICC) $(CDEFS) -o $@ $(mySRCdir)/test_dynlink.c libtatlas.so \
           -Wl,--rpath ./