From 9bd0aba8040f335416ab1a17e8a50ee009dd0665 Mon Sep 17 00:00:00 2001
From: sebastien <sebastien@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Fri, 19 Sep 2008 11:07:46 +0000
Subject: [PATCH] 4.0: merged r2082 and r2085 changesets from trunk (bugfix for
 build_matlab.m under Matlab/R2008a, build_matlab.m no longer exits, new
 build_matlab_debian.m file)

git-svn-id: https://www.dynare.org/svn/dynare/branches/4.0@2087 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 debian/rules                      |  4 +--
 mex/sources/build_matlab.m        | 46 +++++++++++++++++++++++++------
 mex/sources/build_matlab_debian.m | 23 ++++++++++++++++
 mex/sources/build_octave.m        | 41 ++++++++++++++++++++++++---
 4 files changed, 99 insertions(+), 15 deletions(-)
 create mode 100644 mex/sources/build_matlab_debian.m

diff --git a/debian/rules b/debian/rules
index 0c77d2b4ba..071599b78e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -23,14 +23,14 @@ build-stamp:
 	# Building Matlab 7.4 MEX files
 ifeq ($(shell test -d $(MATLAB74_ROOT) && echo yes), yes)
 	$(MATLAB74_ROOT)/etc/lmboot
-	cd mex/sources && $(MATLAB74_ROOT)/bin/matlab -nodisplay -r build_matlab
+	cd mex/sources && $(MATLAB74_ROOT)/bin/matlab -nodisplay -r build_matlab_debian
 	$(MATLAB74_ROOT)/etc/lmdown
 endif
 
 	# Building Matlab 7.5 MEX files
 ifeq ($(shell test -d $(MATLAB75_ROOT) && echo yes), yes)
 	$(MATLAB75_ROOT)/etc/lmboot
-	cd mex/sources && $(MATLAB75_ROOT)/bin/matlab -nodisplay -r build_matlab
+	cd mex/sources && $(MATLAB75_ROOT)/bin/matlab -nodisplay -r build_matlab_debian
 	$(MATLAB75_ROOT)/etc/lmdown
 endif
 
diff --git a/mex/sources/build_matlab.m b/mex/sources/build_matlab.m
index d127e8e960..d1f063c193 100644
--- a/mex/sources/build_matlab.m
+++ b/mex/sources/build_matlab.m
@@ -1,6 +1,21 @@
 % Build file for Dynare MEX Librairies under Matlab
-% Copyright Dynare Team (2007-2008)
-% GNU Public License
+
+% 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/>.
 
 addpath '../../matlab'; % For matlab_ver_less_than
 
@@ -63,12 +78,25 @@ eval([ COMPILE_COMMAND ' kronecker/sparse_hessian_times_B_kronecker_C.cc ' BLAS_
 disp('Compiling A_times_B_kronecker_C...')
 eval([ COMPILE_COMMAND ' kronecker/A_times_B_kronecker_C.cc ' BLAS_PATH ]);
 disp('Compiling gensylv...')
-eval([ COMPILE_COMMAND ' -DMATLAB -Igensylv/cc gensylv/matlab/gensylv.cpp' ...
-       ' gensylv/cc/*.cpp ' BLAS_PATH ' ' LAPACK_PATH ]);
+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 ' ...
+       BLAS_PATH ' ' LAPACK_PATH ]);
 disp('Compiling simulate...')
 eval([ COMPILE_COMMAND ' -Isimulate -I../../preprocessor/include simulate/simulate.cc simulate/Interpreter.cc simulate/Mem_Mngr.cc simulate/SparseMatrix.cc simulate/linbcg.cc' ]);
-
-% Forcing exit is necessary when autobuilding MEX files for Debian packages.
-% In interactive mode, if anything fails during the compilation process,
-% this line will not be reached and the user will see the error message.
-exit
diff --git a/mex/sources/build_matlab_debian.m b/mex/sources/build_matlab_debian.m
new file mode 100644
index 0000000000..0b0967ca67
--- /dev/null
+++ b/mex/sources/build_matlab_debian.m
@@ -0,0 +1,23 @@
+% Debian build file for Dynare MEX Librairies under Matlab.
+% Exit is forced, because otherwise Matlab gives a prompt
+% at the end of the compilation.
+
+% Copyright (C) 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/>.
+
+build_matlab
+exit
diff --git a/mex/sources/build_octave.m b/mex/sources/build_octave.m
index 76bfb72f12..673edb2f73 100644
--- a/mex/sources/build_octave.m
+++ b/mex/sources/build_octave.m
@@ -1,6 +1,21 @@
 % Build file for Dynare MEX Librairies for Octave
-% Copyright Dynare Team (2008)
-% GNU Public License
+
+% Copyright (C) 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/>.
 
 COMPILE_OPTIONS = '-DNO_BLAS_H -DNO_LAPACK_H -DOCTAVE';
 
@@ -16,7 +31,25 @@ eval([ COMPILE_COMMAND ' kronecker/sparse_hessian_times_B_kronecker_C.cc -o ../o
 disp('Compiling A_times_B_kronecker_C...')
 eval([ COMPILE_COMMAND ' kronecker/A_times_B_kronecker_C.cc -o ../octave/A_times_B_kronecker_C.mex']);
 disp('Compiling gensylv...')
-% With MS Visual C++ it is necessary to list all the source file names (a wildcard will not make it)
-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 -o ../octave/gensylv.mex']);
+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 ' ...
+       '-o ../octave/gensylv.mex']);
 disp('Compiling simulate...')
 eval([ COMPILE_COMMAND ' -Isimulate -I../../preprocessor/include simulate/simulate.cc simulate/Interpreter.cc simulate/Mem_Mngr.cc simulate/SparseMatrix.cc simulate/linbcg.cc -o ../octave/simulate.mex']);
-- 
GitLab