0001 function naff_cc
0002
0003
0004
0005
0006
0007
0008 cd_old = pwd;
0009 cd(fileparts(which('naff_cc')))
0010
0011 disp(['Compiling NAFF routines on ', computer,'.'])
0012
0013 switch computer
0014 case 'SOL2'
0015 PLATFORMOPTION = ['-D',computer,' '];
0016 case 'GLNXA64'
0017 PLATFORMOPTION = ['-ldl -D',computer,' '];
0018 case 'GLNX86'
0019 PLATFORMOPTION = ['-ldl -D',computer,' '];
0020 case 'PCWIN64'
0021 PLATFORMOPTION = ['-D',computer,' LDFLAGS=''-pthread -shared -m64'' '];
0022 case 'PCWIN'
0023 PLATFORMOPTION = ['-D',computer,' '];
0024 case 'MACI64'
0025 PLATFORMOPTION = ['-D',computer,' LDFLAGS=''-pthread -shared -m64'' '];
0026 otherwise
0027 error('Platform not defined');
0028 end
0029
0030 disp('Compiling: modnaff.c');
0031
0032
0033 eval(['mex ', PLATFORMOPTION, '-O -c modnaff.c ']);
0034
0035
0036 disp('Compiling: example.c');
0037
0038 eval(['mex ', PLATFORMOPTION, '-O -c modnaff.c ']);
0039 eval(['mex ', PLATFORMOPTION, '-O -c complexe.c ']);
0040
0041 disp('Compiling: nafflib.c');
0042
0043 switch computer
0044 case {'MACI64', 'GLNX86', 'GLNX64', 'GLNXA64'}
0045 internal_cc('nafflib.c modnaff.o complexe.o');
0046 case {'PCWIN', 'PCWIN64'}
0047 internal_cc('nafflib.c modnaff.obj complexe.obj');
0048 end
0049
0050 cd(cd_old);
0051
0052 function internal_cc(fn)
0053
0054
0055
0056
0057
0058 disp(['Compiling: ',fn]);
0059
0060 switch computer
0061 case {'GLNX86', 'GLNX64', 'GLNXA64'}
0062 cmdstr = [ 'mex -I' matlabroot '/extern/include -fPIC -O ', fn ];
0063 case {'MACI64'}
0064 cmdstr = [ 'mex -I' matlabroot '/extern/include -O ', fn ];
0065 case {'PCWIN', 'PCWIN64'}
0066 cmdstr = [ 'mex -I' 'LDFLAGS=''-pthread -shared -m64'' -O ', fn];
0067 otherwise
0068 error('Architecture not defined')
0069 end
0070 disp(cmdstr);
0071 eval(cmdstr);