From ac0f324d6fc73e281d46775c231f9bc0f21dc99e Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtanb@gmail.com>
Date: Tue, 13 Apr 2010 17:52:04 +0200
Subject: [PATCH] build swz standalone executables only against gsl
---
matlab/swz/c-code/Makefile | 39 +++++++++++++------
.../utilities/DWCcode/arrays/dw_array.c | 5 +++
.../c-code/utilities/TZCcode/tzmatlab_dw.h | 6 +--
matlab/swz/sz_prd.m | 2 +-
4 files changed, 37 insertions(+), 15 deletions(-)
diff --git a/matlab/swz/c-code/Makefile b/matlab/swz/c-code/Makefile
index 77cc02e5b..54dcf77ba 100644
--- a/matlab/swz/c-code/Makefile
+++ b/matlab/swz/c-code/Makefile
@@ -5,23 +5,25 @@
# All output is to OUT_DIR
# MACHINE
-USE_MICHEL_LAPTOP=USE_MICHEL_LAPTOP
-
+STANDALONE_HB = STANDALONE_HB
+MACOSX = MACOSX
# LIBRARIES
USE_TAO = USE_TAO
-USE_MKL = USE_MKL
+#USE_MKL = USE_MKL
#USE_IMSL = USE_IMSL
USE_LAPACK = USE_LAPACK
USE_FORTRAN = USE_FORTRAN
USE_MATH = USE_MATH
-USE_GSL = USE_GLS
+USE_GSL = USE_GSL
#USE_GSL_CBLAS = USE_GSL_CBLAS
WORK_DIR = .
OUT_DIR = ../bin
+CFLAGS = -g -DINTELCMATHLIBRARY
+
# MACHINE DEPENDENT DIRECTORIES
# LAPTOP
@@ -31,7 +33,7 @@ OUT_DIR = /home/kalagman/Documents/InternshipJob/Dynare/work/
CC = /usr/bin/gcc-4.3.2
FC = gfortran
-CFLAGS = -g -static
+CFLAGS := $(CFLAGS) -static
TAO_DIR = $(WORK_DIR)/utilities/TZCcode
IMSL_BASE_DIR = /opt/vni/CTT6.0
@@ -53,8 +55,7 @@ ifdef USE_MICHEL_LAPTOP
CC = gcc
#CC = /opt/intel/Compiler/11.0/074/bin/intel64/icc -no-multibyte-chars
FC = gfortran
-CFLAGS = -g -static
-#CFLAGS = -g
+CFLAGS := $(CFLAGS) -static
TAO_DIR = $(WORK_DIR)/utilities/TZCcode
@@ -65,16 +66,32 @@ INTEL_LIBS_DIR = /opt/intel/Compiler/11.0/074/lib/intel64
INTEL_LIBS = -lguide
MKL_BASE_DIR = /opt/intel/Compiler/11.0/074/mkl
MKL_LIBS_DIR = $(MKL_BASE_DIR)/lib/em64t
-MKL_LIBS = -lmkl_lapack -lmkl_em64t
+MKL_LIBS = -lmkl_lapack -lmkl_em64t
+
+endif
+
+
+ifdef STANDALONE_HB
+CC = gcc
+FC = gfortran
+
+GSL_INCLUDE_DIR = /usr/local/include/gsl
+GSL_LIBS_DIR = /usr/local/lib
+
+TAO_DIR = $(WORK_DIR)/utilities/TZCcode
+endif
+ifdef MACOSX
+MAC_LIBS = -framework Accelerate
+CFLAGS := $(CFLAGS) -DMACOSX
endif
#################################################################################
VPATH =
-INCLUDE_DIR =
+INCLUDE_DIR = -I/Applications/MatlabR2010a/MATLAB_R2010a.app/extern/include/
LIBS_DIR =
-LIBS =
+LIBS = $(MAC_LIBS)
OBJS =
#################################################################################
@@ -233,6 +250,6 @@ $(OUT_DIR)/sbvar_probabilities: $(OBJS_PROBA)
#
#################################################################################
clean:
- rm -f $(OUT_DIR)/*.o
+ rm -f $(OUT_DIR)/*.o *.o
#
#################################################################################
diff --git a/matlab/swz/c-code/utilities/DWCcode/arrays/dw_array.c b/matlab/swz/c-code/utilities/DWCcode/arrays/dw_array.c
index db0d67491..842a77dd2 100644
--- a/matlab/swz/c-code/utilities/DWCcode/arrays/dw_array.c
+++ b/matlab/swz/c-code/utilities/DWCcode/arrays/dw_array.c
@@ -4,7 +4,12 @@
#include <stdlib.h>
#include <string.h>
+
+#if defined(MACOSX)
+#include <sys/malloc.h>
+#else
#include <malloc.h>
+#endif
#include <stdarg.h>
//================================== Macros ===================================//
diff --git a/matlab/swz/c-code/utilities/TZCcode/tzmatlab_dw.h b/matlab/swz/c-code/utilities/TZCcode/tzmatlab_dw.h
index 0d2449ae0..e14ba5f8e 100644
--- a/matlab/swz/c-code/utilities/TZCcode/tzmatlab_dw.h
+++ b/matlab/swz/c-code/utilities/TZCcode/tzmatlab_dw.h
@@ -63,7 +63,7 @@
//#define USE_IMSL_MATH_LIBRARY
//#define USE_IMSL_STAT_LIBRARY
#define USE_GSL_LIBRARY
-#define USE_MKL_LIBRARY
+//#define USE_MKL_LIBRARY
/*******************************************************************************/
// #define NEWVERSIONofDW_SWITCH //If defined, using DW's new switch program (implemented in 2008),
@@ -75,7 +75,7 @@
#define SWITCHTOIMSLCMATH // define: use IMSL special functions like gammlog; undef: use my own default code if it exists.
//-------Only one of the following for math library.--------
- #define INTELCMATHLIBRARY // define: use Intel MKL LAPACK library; undef: use others.
+// #define INTELCMATHLIBRARY // define: use Intel MKL LAPACK library; undef: use others.
//#define IMSLCMATHLIBRARY // define: use IMSL C Math library; undef: use others.
//#define MATLABCMATHLIBRARY // define: use Matlab C math library; undef: use others.
@@ -107,7 +107,7 @@
#endif
#include "blas_lapack.h"
#undef SWITCHTOINTELCMATH
- #undef INTELCMATHLIBRARY
+// #undef INTELCMATHLIBRARY
#endif
#if defined(USE_GSL_LIBRARY)
diff --git a/matlab/swz/sz_prd.m b/matlab/swz/sz_prd.m
index bfd5f49c1..54f015b18 100644
--- a/matlab/swz/sz_prd.m
+++ b/matlab/swz/sz_prd.m
@@ -498,7 +498,7 @@ end
if options_.ms.estimate_msmodel == 1
if use_linux == 1
perform_estimation=[c_path,'/sbvar_estimation -ft ',options_.ms.output_file_tag];
- % system(perform_estimation);
+ system(perform_estimation);
else
perform_estimation=[c_path,'\sbvar_estimation.exe -ft ',options_.ms.output_file_tag];
dos(perform_estimation)
--
GitLab