From: coha Date: Thu, 1 Sep 2011 15:43:53 +0000 (+0000) Subject: Using try and catch method to show recommend message of make.m X-Git-Tag: v190~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cf950cdcf037b54ff8eb01b5ed3458e645968108;p=liblinear Using try and catch method to show recommend message of make.m Modify README for new MATLAB make.m --- diff --git a/matlab/README b/matlab/README index 8242443..402a155 100644 --- a/matlab/README +++ b/matlab/README @@ -26,44 +26,56 @@ of LIBLINEAR. Installation ============ -On Unix systems, we recommend using GNU g++ as your compiler and type -'make' to build 'train.mexglx' and 'predict.mexglx'. Note that we -assume your MATLAB is installed in '/usr/local/matlab', if not, please -change MATLABDIR in Makefile. +On Windows systems, pre-built binary files are already in the +directory '..\windows', so no need to conduct installation. Now we +provide binary files only for 64bit MATLAB on Windows. If you would +like to re-build the package, please rely on the following steps. -Example: - linux> make +We recommend using make.m on both MATLAB and OCTAVE. Just type 'make' +to build 'libsvmread.mex', 'libsvmwrite.mex', 'train.mex', and +'predict.mex'. -To use Octave, type 'make octave': +On MATLAB or Octave: -Example: - linux> make octave + >> make -On Windows systems, pre-built 'train.mexw64' and 'predict.mexw64' are -included in this package (in ..\windows), so no need to conduct -installation unless you run 32 bit windows. If you have modified the -sources and would like to re-build the package, type 'mex -setup' in -MATLAB to choose a compiler for mex first. Then type 'make' to start -the installation. +If make.m does not work on MATLAB (especially for Windows), try 'mex +-setup' to choose a suitable compiler for mex. Make sure your compiler +is accessible and workable. Then type 'make' to start the +installation. Example: - matlab> mex -setup + + matlab>> mex -setup (ps: MATLAB will show the following messages to setup default compiler.) - Please choose your compiler for building external interface (MEX) files: + Please choose your compiler for building external interface (MEX) files: Would you like mex to locate installed compilers [y]/n? y - Select a compiler: - [1] Microsoft Visual C/C++ 2005 in C:\Program Files\Microsoft Visual Studio 8 - [0] None + Select a compiler: + [1] Microsoft Visual C/C++ version 7.1 in C:\Program Files\Microsoft Visual Studio + [0] None Compiler: 1 - Please verify your choices: - Compiler: Microsoft Visual C/C++ 2005 - Location: C:\Program Files\Microsoft Visual Studio 8 + Please verify your choices: + Compiler: Microsoft Visual C/C++ 7.1 + Location: C:\Program Files\Microsoft Visual Studio Are these correct?([y]/n): y - matlab> make + matlab>> make + +On Unix systems, if neither make.m nor 'mex -setup' works, please use +Makefile and type 'make' in a command window. Note that we assume +your MATLAB is installed in '/usr/local/matlab'. If not, please change +MATLABDIR in Makefile. + +Example: + linux> make + +To use octave, type 'make octave': + +Example: + linux> make octave -For list of supported/compatible compilers for MATLAB, please check the -following page: +For a list of supported/compatible compilers for MATLAB, please check +the following page: http://www.mathworks.com/support/compilers/current_release/ diff --git a/matlab/make.m b/matlab/make.m index 8823c80..bc7e0af 100644 --- a/matlab/make.m +++ b/matlab/make.m @@ -1,17 +1,21 @@ % This make.m is for MATLAB and OCTAVE under Windows, Mac, and Unix -Type = ver; -% This part is for OCTAVE -if(strcmp(Type(1).Name, 'Octave') == 1) - mex libsvmread.c - mex libsvmwrite.c - mex train.c linear_model_matlab.c ../linear.cpp ../tron.cpp ../blas/*.c - mex predict.c linear_model_matlab.c ../linear.cpp ../tron.cpp ../blas/*.c -% This part is for MATLAB -% Add -largeArrayDims on 64-bit machines of MATLAB -else - mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims libsvmread.c - mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims libsvmwrite.c - mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims train.c linear_model_matlab.c ../linear.cpp ../tron.cpp "../blas/*.c" - mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims predict.c linear_model_matlab.c ../linear.cpp ../tron.cpp "../blas/*.c" +try + Type = ver; + % This part is for OCTAVE + if(strcmp(Type(1).Name, 'Octave') == 1) + mex libsvmread.c + mex libsvmwrite.c + mex train.c linear_model_matlab.c ../linear.cpp ../tron.cpp ../blas/*.c + mex predict.c linear_model_matlab.c ../linear.cpp ../tron.cpp ../blas/*.c + % This part is for MATLAB + % Add -largeArrayDims on 64-bit machines of MATLAB + else + mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims libsvmread.c + mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims libsvmwrite.c + mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims train.c linear_model_matlab.c ../linear.cpp ../tron.cpp "../blas/*.c" + mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims predict.c linear_model_matlab.c ../linear.cpp ../tron.cpp "../blas/*.c" + end +catch + fprintf('If make.m failes, please check README about detailed instructions.\n'); end