Home > atphysics > nafflib > naff_cc.m

naff_cc

PURPOSE ^

NAFF_CC - Compile nafflibrary for Matlab

SYNOPSIS ^

function naff_cc

DESCRIPTION ^

NAFF_CC - Compile nafflibrary for Matlab

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function naff_cc
0002 %NAFF_CC - Compile nafflibrary for Matlab
0003 %
0004 
0005 % Modified by Laurent S. Nadolski
0006 % April 6th, 2007
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,' ']; % added by Laurent April 6th, 2007
0018     case 'GLNX86' 
0019         PLATFORMOPTION = ['-ldl -D',computer,' ']; % added by Laurent April 6th, 2007
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 % Object files
0030 disp('Compiling: modnaff.c');
0031 %mex LDFLAGS='-pthread -shared -m64' -I/usr/local/matlab/extern/include -O -c modnaff.c
0032 
0033 eval(['mex ', PLATFORMOPTION, '-O -c modnaff.c ']);
0034 
0035 
0036 disp('Compiling: example.c');
0037 %mex LDFLAGS='-pthread -shared -m64' -I/usr/local/matlab/extern/include -O -c complexe.c
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 % cc(filename)
0054 %
0055 % MAC 64 bits
0056 % TODO WINDOWS
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);

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005