diff --git a/.gitignore b/.gitignore index 6feb45057..ff09453b7 100644 --- a/.gitignore +++ b/.gitignore @@ -113,8 +113,7 @@ mex/build/matlab/run_m2html.m /preprocessor/doc/ # MATLAB dir -/matlab/dynare_m -/matlab/dynare_m.exe +/matlab/preprocessor* /matlab/dynare_version.m # DLL rules diff --git a/matlab/dynare.m b/matlab/dynare.m index d72d20787..9cdf8bf37 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -16,7 +16,7 @@ function dynare(fname, varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2001-2014 Dynare Team +% Copyright (C) 2001-2015 Dynare Team % % This file is part of Dynare. % @@ -145,7 +145,21 @@ if exist(fname(1:end-4),'dir') && exist([fname(1:end-4) filesep 'hooks'],'dir') run([fname(1:end-4) filesep 'hooks/priorprocessing']) end -command = ['"' dynareroot 'dynare_m" ' fname] ; +if ispc + [junk, arch] = getenv('PROCESSOR_ARCHITECTURE'); +else + [junk, arch] = system('uname -m'); +end + +if isempty(strfind(arch, '64')) + arch_ext = '32'; + disp('Using 32-bit preprocessor'); +else + arch_ext = '64'; + disp('Using 64-bit preprocessor'); +end + +command = ['"' dynareroot 'preprocessor' arch_ext filesep 'dynare_m" ' fname] ; for i=2:nargin command = [command ' ' varargin{i-1}]; end diff --git a/preprocessor/Makefile.am b/preprocessor/Makefile.am index aea2e45a7..804282738 100644 --- a/preprocessor/Makefile.am +++ b/preprocessor/Makefile.am @@ -69,7 +69,13 @@ DynareBison.cc DynareBison.hh location.hh stack.hh position.hh: DynareBison.yy $(YACC) -o DynareBison.cc DynareBison.yy all-local: - cd ../matlab && $(LN_S) -f $(abs_srcdir)/$(PROGRAMS) $(PROGRAMS) + if [ -z "`file $(PROGRAMS) | grep x86.64`" ]; then \ + ARCH="32"; \ + else \ + ARCH="64"; \ + fi; \ + mkdir -p ../matlab/preprocessor$$ARCH ; \ + cd ../matlab/preprocessor$$ARCH && $(LN_S) -f $(abs_srcdir)/$(PROGRAMS) $(PROGRAMS) if HAVE_DOXYGEN html-local: