2008-06-24 20:53:26 +02:00
|
|
|
% Build file for Dynare MEX Librairies under Matlab
|
2008-09-19 12:45:07 +02:00
|
|
|
|
|
|
|
% Copyright (C) 2007-2008 Dynare Team
|
|
|
|
%
|
|
|
|
% This file is part of Dynare.
|
|
|
|
%
|
|
|
|
% Dynare is free software: you can redistribute it and/or modify
|
|
|
|
% it under the terms of the GNU General Public License as published by
|
|
|
|
% the Free Software Foundation, either version 3 of the License, or
|
|
|
|
% (at your option) any later version.
|
|
|
|
%
|
|
|
|
% Dynare is distributed in the hope that it will be useful,
|
|
|
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
% GNU General Public License for more details.
|
|
|
|
%
|
|
|
|
% You should have received a copy of the GNU General Public License
|
|
|
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
2007-12-28 16:37:26 +01:00
|
|
|
|
2008-07-07 19:08:55 +02:00
|
|
|
addpath '../../matlab'; % For matlab_ver_less_than
|
2007-12-28 16:37:26 +01:00
|
|
|
|
|
|
|
MATLAB_PATH = matlabroot;
|
|
|
|
|
|
|
|
COMPILE_OPTIONS = '';
|
|
|
|
|
2008-01-30 18:03:41 +01:00
|
|
|
if strcmpi('GLNX86', computer) || strcmpi('GLNXA64', computer) ...
|
2008-01-31 11:41:15 +01:00
|
|
|
|| strcmpi('MACI', computer) || strcmpi('MAC', computer)
|
|
|
|
% GNU/Linux (x86-32 or x86-64) or MacOS (Intel or PPC)
|
2007-12-28 16:37:26 +01:00
|
|
|
LAPACK_PATH = '-lmwlapack';
|
2008-07-07 19:08:55 +02:00
|
|
|
if matlab_ver_less_than('7.5')
|
2007-12-28 16:37:26 +01:00
|
|
|
BLAS_PATH = LAPACK_PATH; % On <= 7.4, BLAS in included in LAPACK
|
|
|
|
else
|
|
|
|
BLAS_PATH = '-lmwblas';
|
|
|
|
end
|
2008-01-31 11:41:15 +01:00
|
|
|
elseif strcmpi('PCWIN', computer)
|
|
|
|
% Windows (x86-32) with Microsoft or gcc compiler
|
2008-01-03 10:08:34 +01:00
|
|
|
LIBRARY_PATH = [MATLAB_PATH '/extern/lib/win32/microsoft/'];
|
|
|
|
LAPACK_PATH = ['"' LIBRARY_PATH 'libmwlapack.lib"'];
|
2008-07-07 19:08:55 +02:00
|
|
|
if matlab_ver_less_than('7.5')
|
2007-12-28 16:37:26 +01:00
|
|
|
BLAS_PATH = LAPACK_PATH; % On <= 7.4, BLAS in included in LAPACK
|
|
|
|
else
|
2008-01-03 10:08:34 +01:00
|
|
|
BLAS_PATH = ['"' LIBRARY_PATH 'libmwblas.lib"'];
|
2007-12-28 16:37:26 +01:00
|
|
|
end
|
2008-12-03 21:58:34 +01:00
|
|
|
elseif strcmpi('PCWIN64', computer)
|
|
|
|
% Windows (x86-64) with Microsoft or gcc compiler
|
|
|
|
LIBRARY_PATH = [MATLAB_PATH '/extern/lib/win64/microsoft/'];
|
|
|
|
LAPACK_PATH = ['"' LIBRARY_PATH 'libmwlapack.lib"'];
|
|
|
|
if matlab_ver_less_than('7.5')
|
|
|
|
BLAS_PATH = LAPACK_PATH; % On <= 7.4, BLAS in included in LAPACK
|
|
|
|
else
|
|
|
|
BLAS_PATH = ['"' LIBRARY_PATH 'libmwblas.lib"'];
|
|
|
|
end
|
2007-12-28 16:37:26 +01:00
|
|
|
else
|
|
|
|
error('Unsupported platform')
|
|
|
|
end
|
|
|
|
|
2008-06-24 20:53:26 +02:00
|
|
|
% mwSize and mwIndex appeared in Matlab 7.3
|
2008-07-07 19:08:55 +02:00
|
|
|
if matlab_ver_less_than('7.3')
|
2008-06-24 20:53:26 +02:00
|
|
|
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DMWTYPES_NOT_DEFINED' ];
|
|
|
|
end
|
|
|
|
|
|
|
|
% Large array dims for 64 bits platforms appeared in Matlab 7.3
|
2008-07-07 19:08:55 +02:00
|
|
|
if strcmpi('GLNXA64', computer) && ~matlab_ver_less_than('7.3')
|
2008-06-24 20:53:26 +02:00
|
|
|
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -largeArrayDims' ];
|
|
|
|
end
|
|
|
|
|
|
|
|
% blas.h and lapack.h appeared in Matlab 7.5
|
2008-07-07 19:08:55 +02:00
|
|
|
if matlab_ver_less_than('7.5')
|
2008-06-24 20:53:26 +02:00
|
|
|
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DNO_BLAS_H -DNO_LAPACK_H' ];
|
|
|
|
end
|
|
|
|
|
2008-07-07 19:08:55 +02:00
|
|
|
if matlab_ver_less_than('7.5')
|
2007-12-28 16:37:26 +01:00
|
|
|
OUTPUT_DIR = '../2007a';
|
|
|
|
else
|
|
|
|
OUTPUT_DIR = '../2007b';
|
|
|
|
end
|
|
|
|
|
|
|
|
% Comment next line to suppress compilation debugging info
|
2008-04-03 09:56:49 +02:00
|
|
|
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -v' ];
|
2007-12-28 16:37:26 +01:00
|
|
|
|
2008-06-24 20:53:26 +02:00
|
|
|
COMPILE_COMMAND = [ 'mex ' COMPILE_OPTIONS ' -outdir ' OUTPUT_DIR ];
|
2007-12-28 16:37:26 +01:00
|
|
|
|
|
|
|
disp('Compiling mjdgges...')
|
2008-02-03 17:01:05 +01:00
|
|
|
eval([ COMPILE_COMMAND ' mjdgges/mjdgges.c ' LAPACK_PATH ]);
|
2007-12-28 16:37:26 +01:00
|
|
|
disp('Compiling sparse_hessian_times_B_kronecker_C...')
|
2008-02-03 17:01:05 +01:00
|
|
|
eval([ COMPILE_COMMAND ' kronecker/sparse_hessian_times_B_kronecker_C.cc ' BLAS_PATH ]);
|
2007-12-28 16:37:26 +01:00
|
|
|
disp('Compiling A_times_B_kronecker_C...')
|
2008-02-03 17:01:05 +01:00
|
|
|
eval([ COMPILE_COMMAND ' kronecker/A_times_B_kronecker_C.cc ' BLAS_PATH ]);
|
2007-12-28 16:37:26 +01:00
|
|
|
disp('Compiling gensylv...')
|
2008-09-19 12:45:07 +02:00
|
|
|
eval([ COMPILE_COMMAND ' -DMATLAB -Igensylv/cc ' ...
|
|
|
|
'gensylv/matlab/gensylv.cpp ' ...
|
|
|
|
'gensylv/cc/BlockDiagonal.cpp ' ...
|
|
|
|
'gensylv/cc/GeneralMatrix.cpp ' ...
|
|
|
|
'gensylv/cc/GeneralSylvester.cpp ' ...
|
|
|
|
'gensylv/cc/IterativeSylvester.cpp ' ...
|
|
|
|
'gensylv/cc/KronUtils.cpp ' ...
|
|
|
|
'gensylv/cc/KronVector.cpp ' ...
|
|
|
|
'gensylv/cc/QuasiTriangular.cpp ' ...
|
|
|
|
'gensylv/cc/QuasiTriangularZero.cpp ' ...
|
|
|
|
'gensylv/cc/SchurDecomp.cpp ' ...
|
|
|
|
'gensylv/cc/SchurDecompEig.cpp ' ...
|
|
|
|
'gensylv/cc/SimilarityDecomp.cpp ' ...
|
|
|
|
'gensylv/cc/SylvException.cpp ' ...
|
|
|
|
'gensylv/cc/SylvMatrix.cpp ' ...
|
|
|
|
'gensylv/cc/SylvMemory.cpp ' ...
|
|
|
|
'gensylv/cc/SylvParams.cpp ' ...
|
|
|
|
'gensylv/cc/TriangularSylvester.cpp ' ...
|
|
|
|
'gensylv/cc/Vector.cpp ' ...
|
2008-09-18 14:56:31 +02:00
|
|
|
BLAS_PATH ' ' LAPACK_PATH ]);
|
2008-01-25 17:48:55 +01:00
|
|
|
disp('Compiling simulate...')
|
2008-10-22 17:42:02 +02:00
|
|
|
eval([ COMPILE_COMMAND ' -Isimulate -I../../preprocessor/include simulate/simulate.cc simulate/Interpreter.cc simulate/Mem_Mngr.cc simulate/SparseMatrix.cc' ]);
|