-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathmake.m
executable file
·165 lines (160 loc) · 7.15 KB
/
make.m
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
function make
%MAKE Makefile for TENSOR.
% S. Engblom 2019-01-23 (mexmaci64, mexa64, 9.6)
% S. Engblom 2015-03-20 (mexa64, 8.4)
% S. Engblom 2015-01-19 (mexmaci64, 8.4)
% S. Engblom 2012-04-16 (mexmaci64, 7.11)
% S. Engblom 2011-04-17 (mexmaci64, 7.10)
% S. Engblom 2011-03-07 (mexa64, 7.11)
% S. Engblom 2010-09-23 (mexs64, 7.7)
% S. Engblom 2010-02-02 (mexa64, 7.8)
% S. Engblom 2010-01-12 (mexmaci)
% S. Engblom 2007-05-17 (mexs64)
% S. Engblom 2006-11-09 (mexa64)
% S. Engblom 2005-04-10 (mexmac)
% Use '-DBLASINT=size_t' for the (bad!) platforms where the 'int' in
% the declaration of BLAS subroutines is in fact a 'size_t' and
% sizeof(size_t) > sizeof(int).
s = pwd;
mx = mexext;
ver = version;
if strcmp(mx,'mexglx')
if ~strncmp(version,'7.5',3) && ~strncmp(version,'7.8',3)
warning(['Extension .' mexext [' tested with Matlab version(s) ' ...
'7.5 and 7.8 only.']]);
end
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 ' ...
'-D_GNU_SOURCE -pthread -fexceptions'], ...
'-outdir',s,[s '/source/tndims.c']);
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 ' ...
'-D_GNU_SOURCE -pthread -fexceptions'], ...
'-outdir',s,[s '/source/tsize.c']);
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 ' ...
'-D_GNU_SOURCE -pthread -fexceptions'], ...
'-outdir',s,[s '/source/tsum.c']);
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 ' ...
'-D_GNU_SOURCE -pthread -fexceptions'], ...
'-outdir',s,'-lmwblas',[s '/source/tprod.c']);
elseif strcmp(mx,'mexa64')
v = version;
if v(1) == '7'
if ~strncmp(version,'7.2',3) && ~strncmp(version,'7.8',3) && ...
~strncmp(version,'7.11',4) && ~strncmp(version,'7.13',4)
warning(['Extension .' mexext [' tested with Matlab version(s) ' ...
'7.2, 7.8, 7.11 and 7.13 only.']]);
end
if ~strncmp(version,'7.11',4)
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 ' ...
'-D_GNU_SOURCE -pthread -fexceptions'], ...
'-outdir',s,[s '/source/tndims.c']);
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 ' ...
'-D_GNU_SOURCE -pthread -fexceptions'], ...
'-outdir',s,[s '/source/tsize.c']);
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 ' ...
'-D_GNU_SOURCE -pthread -fexceptions'], ...
'-outdir',s,[s '/source/tsum.c']);
if strncmp(version,'7.2',3)
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 ' ...
'-D_GNU_SOURCE -pthread -fexceptions'], ...
'-outdir',s,[s '/source/tprod.c']);
else
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 ' ...
'-D_GNU_SOURCE -pthread -fexceptions -DBLASINT=size_t'], ...
'-outdir',s,'-lmwblas',[s '/source/tprod.c']);
end
else
% apparently, the linker path is not properly set up on 7.11:
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 -O3 ' ...
'-D_GNU_SOURCE -pthread -fexceptions'], ...
['-L' matlabroot '/sys/os/glnxa64'], ...
'-outdir',s,[s '/source/tndims.c']);
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 -O3 ' ...
'-D_GNU_SOURCE -pthread -fexceptions'], ...
['-L' matlabroot '/sys/os/glnxa64'], ...
'-outdir',s,[s '/source/tsize.c']);
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 -O3 ' ...
'-D_GNU_SOURCE -pthread -fexceptions'], ...
['-L' matlabroot '/sys/os/glnxa64'], ...
'-outdir',s,[s '/source/tsum.c']);
mex(['CFLAGS=-fPIC -fno-omit-frame-pointer -std=c99 -O3 ' ...
'-D_GNU_SOURCE -pthread -fexceptions -DBLASINT=size_t'], ...
['-L' matlabroot '/sys/os/glnxa64'], ...
'-outdir',s,'-lmwblas',[s '/source/tprod.c']);
end
else
if ~strncmp(version,'8.4',3) && ~strncmp(version,'9.6',3)
warning(['Extension .' mexext ' tested with Matlab version(s) ' ...
'8.4 and 9.6 only.']);
end
% apparently, the linker path is not properly set up on 8.4 (also a
% soft link libstdc++.so inside [matlabroot '/sys/os/glnxa64'] is
% required to point to the correct shared library, in this case
% libstdc++.so.6.0.17)
mex('CFLAGS=-fPIC -std=c99 -O3',['-L' matlabroot '/sys/os/glnxa64'], ...
'-outdir',s,[s '/source/tndims.c']);
mex('CFLAGS=-fPIC -std=c99 -O3',['-L' matlabroot '/sys/os/glnxa64'], ...
'-outdir',s,[s '/source/tsize.c']);
mex('CFLAGS=-fPIC -std=c99 -O3',['-L' matlabroot '/sys/os/glnxa64'], ...
'-outdir',s,[s '/source/tsum.c']);
mex('CFLAGS=-fPIC -std=c99 -O3 -DBLASINT=size_t', ...
['-L' matlabroot '/sys/os/glnxa64'], ...
'-outdir',s,'-lmwblas',[s '/source/tprod.c']);
end
elseif strcmp(mx,'mexmac')
if ~strncmp(version,'7.0',3)
warning(['Extension .' mexext ' tested with Matlab version(s) 7.0 only.']);
end
mex('CC=gcc -std=c99','-outdir',s,[s '/source/tndims.c']);
mex('CC=gcc -std=c99','-outdir',s,[s '/source/tsize.c']);
mex('CC=gcc -std=c99','-outdir',s,[s '/source/tsum.c']);
mex('CC=gcc -std=c99','-outdir',s,[s '/source/tprod.c']);
elseif strcmp(mx,'mexmaci')
if ~strncmp(version,'7.8',3)
warning(['Extension .' mexext ' tested with Matlab version(s) 7.8 only.']);
end
mex('CC=gcc -std=c99 -fast','-outdir',s,[s '/source/tndims.c']);
mex('CC=gcc -std=c99 -fast','-outdir',s,[s '/source/tsize.c']);
mex('CC=gcc -std=c99 -fast','-outdir',s,[s '/source/tsum.c']);
mex('CC=gcc -std=c99 -fast','-outdir',s,'-lmwblas', ...
[s '/source/tprod.c']);
elseif strcmp(mx,'mexmaci64')
v = version;
if v(1) == '7'
if ~strncmp(version,'7.10',4) && ~strncmp(version,'7.11',4) && ...
~strncmp(version,'7.14',4)
warning(['Extension .' mexext ' tested with Matlab version(s) ' ...
'7.10 and 7.11 only.']);
end
mex('CC=gcc -std=c99 -fast','-outdir',s,[s '/source/tndims.c']);
mex('CC=gcc -std=c99 -fast','-outdir',s,[s '/source/tsize.c']);
mex('CC=gcc -std=c99 -fast','-outdir',s,[s '/source/tsum.c']);
mex('CC=gcc -std=c99 -fast -DBLASINT=size_t', ...
'-outdir',s,'-lmwblas', ...
[s '/source/tprod.c']);
else
if ~strncmp(version,'8.4',3) && ~strncmp(version,'9.6',3)
warning(['Extension .' mexext ' tested with Matlab version(s) ' ...
'8.4 and 9.6 only.']);
end
mex('CFLAGS= -std=c99','-outdir',s,[s '/source/tndims.c']);
mex('CFLAGS=-Wno-logical-op-parentheses -std=c99','-outdir',s,[s '/source/tsize.c']);
mex('CFLAGS=-Wno-logical-op-parentheses -std=c99','-outdir',s,[s '/source/tsum.c']);
mex('CFLAGS= -std=c99 -DBLASINT=size_t', ...
'-outdir',s,'-lmwblas', ...
[s '/source/tprod.c']);
end
elseif strcmp(mx,'mexs64')
if ~strncmp(version,'7.7',3)
warning(['Extension .' mexext ' tested with Matlab version(s) 7.7 only.']);
end
mex('-outdir',s,[s '/source/tndims.c']);
mex('-outdir',s,[s '/source/tsize.c']);
mex('-outdir',s,[s '/source/tsum.c']);
mex('-outdir',s,[s '/source/tprod.c']);
else
warning('New platform. Trying default make.');
mex('-outdir',s,[s '/source/tndims.c']);
mex('-outdir',s,[s '/source/tsize.c']);
mex('-outdir',s,[s '/source/tsum.c']);
mex('-outdir',s,[s '/source/tprod.c']);
end