From 166865149ed2f6a3b80a0065b79bbd7482a9ac13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stepan@adjemian.eu>
Date: Thu, 26 Mar 2020 11:20:24 +0100
Subject: [PATCH] Updated build for matlab R2020a.

---
 m4/ax_matlab_version.m4        | 3 +++
 macOS/build.sh                 | 4 ++--
 matlab/add_path_to_mex_files.m | 4 ++--
 windows/build.sh               | 4 ++--
 windows/dynare.nsi             | 6 +++---
 5 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/m4/ax_matlab_version.m4 b/m4/ax_matlab_version.m4
index b07d1a3ffb..a430f44812 100644
--- a/m4/ax_matlab_version.m4
+++ b/m4/ax_matlab_version.m4
@@ -22,6 +22,9 @@ AC_REQUIRE([AX_MATLAB])
 AC_MSG_CHECKING([for MATLAB version])
 if test -n "$MATLAB_VERSION"; then
   case $MATLAB_VERSION in
+    *2020a | *2020A)
+      MATLAB_VERSION="9.8"
+      ;;
     *2019b | *2019B)
       MATLAB_VERSION="9.7"
       ;;
diff --git a/macOS/build.sh b/macOS/build.sh
index 910a3515ec..55b78f7caa 100755
--- a/macOS/build.sh
+++ b/macOS/build.sh
@@ -89,7 +89,7 @@ NAME=dynare-"$VERSION"
 PKGFILES="$ROOTDIR"/macOS/pkg/"$NAME"
 mkdir -p \
       "$PKGFILES"/mex/matlab/maci64-7.9-9.3 \
-      "$PKGFILES"/mex/matlab/maci64-9.4-9.7 \
+      "$PKGFILES"/mex/matlab/maci64-9.4-9.8 \
       "$PKGFILES"/mex/octave \
       "$PKGFILES"/doc/dynare++ \
       "$PKGFILES"/dynare++ \
@@ -146,7 +146,7 @@ CC=$CC CXX=$CXX ./configure \
   --with-slicot="$LIB64"/Slicot/with-underscore \
   --with-matlab=/Applications/MATLAB_R2019b.app MATLAB_VERSION=R2019b
 make -j"$NTHREADS"
-cp -L  "$ROOTDIR"/mex/matlab/*                                       "$PKGFILES"/mex/matlab/maci64-9.4-9.7
+cp -L  "$ROOTDIR"/mex/matlab/*                                       "$PKGFILES"/mex/matlab/maci64-9.4-9.8
 
 
 ##
diff --git a/matlab/add_path_to_mex_files.m b/matlab/add_path_to_mex_files.m
index 2e0422d3ea..85f2593030 100644
--- a/matlab/add_path_to_mex_files.m
+++ b/matlab/add_path_to_mex_files.m
@@ -73,7 +73,7 @@ else
                 end
             end
         else
-            tmp = [dynareroot '../mex/matlab/win64-9.4-9.7/'];
+            tmp = [dynareroot '../mex/matlab/win64-9.4-9.8/'];
             if exist(tmp, 'dir')
                 mexpath = tmp;
                 if modifypath
@@ -93,7 +93,7 @@ else
                 end
             end
         else
-            tmp = [dynareroot '../mex/matlab/maci64-9.4-9.7'];
+            tmp = [dynareroot '../mex/matlab/maci64-9.4-9.8'];
             if exist(tmp, 'dir')
                 mexpath = tmp;
                 if modifypath
diff --git a/windows/build.sh b/windows/build.sh
index d7b3bb3f29..b402d1c2d1 100755
--- a/windows/build.sh
+++ b/windows/build.sh
@@ -167,8 +167,8 @@ build_windows_matlab_mex_64_b ()
 		     PACKAGE_STRING="dynare $VERSION"
     make -j"$NTHREADS" all
     x86_64-w64-mingw32-strip -- **/*.mexw64
-    mkdir -p "$ROOT_DIRECTORY"/../mex/matlab/win64-9.4-9.7
-    mv -- **/*.mexw64 "$ROOT_DIRECTORY"/../mex/matlab/win64-9.4-9.7
+    mkdir -p "$ROOT_DIRECTORY"/../mex/matlab/win64-9.4-9.8
+    mv -- **/*.mexw64 "$ROOT_DIRECTORY"/../mex/matlab/win64-9.4-9.8
 }
 
 # Create Windows DLL binaries for Octave/MinGW (32bit)
diff --git a/windows/dynare.nsi b/windows/dynare.nsi
index 808589225e..04a4278b64 100644
--- a/windows/dynare.nsi
+++ b/windows/dynare.nsi
@@ -96,9 +96,9 @@ Section "MEX files for MATLAB 64-bit, version 7.9 to 9.3 (R2009b to R2017b)"
  File ..\mex\matlab\win64-7.9-9.3\*.mexw64
 SectionEnd
 
-Section "MEX files for MATLAB 64-bit, version 9.4 to 9.7 (R2018a to R2019b)"
- SetOutPath $INSTDIR\mex\matlab\win64-9.4-9.7
- File ..\mex\matlab\win64-9.4-9.7\*.mexw64
+Section "MEX files for MATLAB 64-bit, version 9.4 to 9.8 (R2018a to R2020a)"
+ SetOutPath $INSTDIR\mex\matlab\win64-9.4-9.8
+ File ..\mex\matlab\win64-9.4-9.8\*.mexw64
 SectionEnd
 
 Section "MEX files for Octave 5.2.0 (64-bit)"
-- 
GitLab