0001 function [] = make_mex(id_path,filename,opts)
0002
0003
0004
0005
0006
0007 if nargin < 2,
0008 error('Wrong number of input arguments for make_mex');
0009 end
0010
0011
0012 [pathstr,name,ext] = fileparts(filename);
0013
0014 if (nargin == 2) & ~isempty(strfind(ext,'f')),
0015 error('FORTRAN files require to specify compiling options (f77 or f90) !')
0016 end
0017
0018 path_path = '../Database/PATH_files/';
0019
0020 if exist([path_path,'PATH_',id_path,'.mat']) == 0,
0021 info_dke_yp(2,[path_path,'PATH_',id_path,'.mat does not exist. Set all paths in the ~/Project_DKE/Database/PATH_files/']);
0022 return
0023 else
0024 eval(['load ',path_path,'PATH_',id_path,'.mat']);
0025 info_dke_yp(2,'Structure ''dkepath'' successfully loaded');
0026 if ~strcmp(dkepath.computer,computer),error('The path structure is not consistent with the computer !'),end
0027 end
0028
0029 ['mex -v -f ',dkepath.mex,'/mexopts_f77.sh ',filename]
0030 if isempty(opts) | ~isempty(strfind(ext,'c')),
0031 eval(['mex -v -f ',dkepath.mex,'/mexopts_f77.sh ',filename]);
0032 elseif strcmp(opts,'f77') & ~isempty(strfind(ext,'f')),
0033 eval(['mex -v -f ',dkepath.mex,'/mexopts_f90.sh ',filename]);
0034 elseif strcmp(opts,'f90') & ~isempty(strfind(ext,'f')),
0035 eval(['mex -v -f ',dkepath.mex,'/mexopts_f77.sh ',filename]);
0036 else
0037 error('The type of file is not recognized by its extension !')
0038 end
0039