62 | | ### Matlab configuration - search for a matlab directory if not defined above |
63 | | ifeq (,$(MATLABDIR)) |
64 | | ifneq (,$(shell ls -1 /usr/local/ |grep MATLAB)) |
65 | | # use oldest, typically mex-files are compatible with newer Matlab versions |
66 | | MATLABDIR=/usr/local/MATLAB/$(shell ls -1rt /usr/local/MATLAB/ |grep "^R20*" |head -1) |
67 | | endif |
68 | | endif |
69 | | |
70 | | |
71 | | ### if MATLABDIR has been found or defined |
72 | | ifneq (,$(MATLABDIR)) |
73 | | ifneq (,$(shell ls -1 $(MATLABDIR)/bin/mexext)) |
74 | | MEX_EXT=$(shell $(MATLABDIR)/bin/mexext) |
75 | | mex4m matlab: $(patsubst %.mex, %.$(MEX_EXT), $(PROGS)) |
76 | | endif |
77 | | endif |
78 | | |
79 | | |
80 | | mexw32 win32: $(patsubst %.mex, %.mexw32, $(PROGS)) |
81 | | mexw64 win64: $(patsubst %.mex, %.mexw64, $(PROGS)) |
82 | | all: octave win32 win64 mex4m |
83 | | |
84 | | clean: |
85 | | -$(RM) *.o *.obj *.o64 core octave-core *.oct *~ *.mex* |
| 62 | # Matlab configuration - search for a matlab directory if not defined above |
| 63 | # ifeq (,$(MATLABDIR)) |
| 64 | # ifneq (,$(shell ls -1 /usr/local/ |grep MATLAB)) |
| 65 | # use oldest, typically mex-files are compatible with newer Matlab versions |
| 66 | # MATLABDIR=/usr/local/MATLAB/$(shell ls -1rt /usr/local/MATLAB/ |grep "^R20*" |head -1) |
| 67 | # endif |
| 68 | # endif |
| 69 | # |
| 70 | # |
| 71 | # if MATLABDIR has been found or defined |
| 72 | # ifneq (,$(MATLABDIR)) |
| 73 | # ifneq (,$(shell ls -1 $(MATLABDIR)/bin/mexext)) |
| 74 | # MEX_EXT=$(shell $(MATLABDIR)/bin/mexext) |
| 75 | # mex4m matlab: $(patsubst %.mex, %.$(MEX_EXT), $(PROGS)) |
| 76 | # endif |
| 77 | # endif |
| 78 | # |
| 79 | # |
| 80 | # mexw32 win32: $(patsubst %.mex, %.mexw32, $(PROGS)) |
| 81 | # mexw64 win64: $(patsubst %.mex, %.mexw64, $(PROGS)) |
| 82 | # all: octave win32 win64 mex4m |
| 83 | # |
| 84 | # clean: |
| 85 | # -$(RM) *.o *.obj *.o64 core octave-core *.oct *~ *.mex* |
126 | | %.obj: %.cpp |
127 | | $(CROSS)$(CXX) -fopenmp -c -DMATLAB_MEX_FILE -x c++ -o "$@" -I$(W32MAT_INC) -O2 -DMX_COMPAT_32 "$<" |
128 | | %.obj: %.c |
129 | | $(CROSS)$(CXX) -fopenmp -c -DMATLAB_MEX_FILE -x c++ -o "$@" -I$(W32MAT_INC) -O2 -DMX_COMPAT_32 "$<" |
130 | | |
131 | | train.mexw32 predict.mexw32: train.obj linear.obj linear_model_matlab.obj tron.obj |
132 | | $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o "$@" -L$(GNUMEX) -s "$<" linear_model_matlab.obj linear.obj tron.obj -llibmx -llibmex -llibmat -lcholmod -lblas |
133 | | |
134 | | svmpredict_mex.mexw32 : svmpredict_mex.obj svm.obj svm_model_matlab.obj |
135 | | $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o "$@" -L$(GNUMEX) -s "$<" svm_model_matlab.obj svm.obj -llibmx -llibmex -llibmat -lcholmod |
136 | | svmtrain_mex.mexw32 : svmtrain_mex.obj svm.obj svm_model_matlab.obj |
137 | | $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o "$@" -L$(GNUMEX) -s "$<" svm_model_matlab.obj svm.obj -llibmx -llibmex -llibmat -lcholmod |
138 | | |
139 | | %.mexw32: %.obj |
140 | | $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o "$@" -L$(GNUMEX) -s "$<" -llibmx -llibmex -llibmat -lcholmod -lgomp -lpthread |
141 | | |
| 126 | # %.obj: %.cpp |
| 127 | # $(CROSS)$(CXX) -fopenmp -c -DMATLAB_MEX_FILE -x c++ -o "$@" -I$(W32MAT_INC) -O2 -DMX_COMPAT_32 "$<" |
| 128 | # %.obj: %.c |
| 129 | # $(CROSS)$(CXX) -fopenmp -c -DMATLAB_MEX_FILE -x c++ -o "$@" -I$(W32MAT_INC) -O2 -DMX_COMPAT_32 "$<" |
| 130 | # |
| 131 | # train.mexw32 predict.mexw32: train.obj linear.obj linear_model_matlab.obj tron.obj |
| 132 | # $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o "$@" -L$(GNUMEX) -s "$<" linear_model_matlab.obj linear.obj tron.obj -llibmx -llibmex -llibmat -lcholmod -lblas |
| 133 | # |
| 134 | # svmpredict_mex.mexw32 : svmpredict_mex.obj svm.obj svm_model_matlab.obj |
| 135 | # $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o "$@" -L$(GNUMEX) -s "$<" svm_model_matlab.obj svm.obj -llibmx -llibmex -llibmat -lcholmod |
| 136 | # svmtrain_mex.mexw32 : svmtrain_mex.obj svm.obj svm_model_matlab.obj |
| 137 | # $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o "$@" -L$(GNUMEX) -s "$<" svm_model_matlab.obj svm.obj -llibmx -llibmex -llibmat -lcholmod |
| 138 | # |
| 139 | # %.mexw32: %.obj |
| 140 | # $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o "$@" -L$(GNUMEX) -s "$<" -llibmx -llibmex -llibmat -lcholmod -lgomp -lpthread |
| 141 | # |
149 | | %.o64: %.cpp |
150 | | $(CROSS64)$(CXX) -c -DMATLAB_MEX_FILE -x c++ -o "$@" -I$(W64MAT_INC) -O2 "$<" |
151 | | %.o64: %.c |
152 | | $(CROSS64)$(CXX) -c -DMATLAB_MEX_FILE -x c++ -o "$@" -I$(W64MAT_INC) -O2 "$<" |
153 | | |
154 | | train.mexw64 predict.mexw64: train.o64 linear.o64 linear_model_matlab.o64 tron.o64 |
155 | | $(CROSS64)$(CXX) -shared $(GNUMEX64)/mex.def -o "$@" -L$(GNUMEX64) -s "$<" linear_model_matlab.o64 linear.o64 tron.o64 -llibmx -llibmex -llibmat -lcholmod -lblas |
156 | | |
157 | | svmpredict_mex.mexw64 : svmpredict_mex.o64 svm.o64 svm_model_matlab.o64 |
158 | | $(CROSS64)$(CXX) -shared $(GNUMEX64)/mex.def -o "$@" -L$(GNUMEX64) -s "$<" svm_model_matlab.o64 svm.o64 -llibmx -llibmex -llibmat -lcholmod |
159 | | svmtrain_mex.mexw64 : svmtrain_mex.o64 svm.o64 svm_model_matlab.o64 |
160 | | $(CROSS64)$(CXX) -shared $(GNUMEX64)/mex.def -o "$@" -L$(GNUMEX64) -s "$<" svm_model_matlab.o64 svm.o64 -llibmx -llibmex -llibmat -lcholmod |
161 | | |
162 | | %.mexw64: %.o64 |
163 | | $(CROSS64)$(CXX) -shared $(GNUMEX64)/mex.def -o "$@" -L$(GNUMEX64) -s "$<" -llibmx -llibmex -llibmat -lcholmod -lgomp -lpthread |
164 | | |
| 149 | # %.o64: %.cpp |
| 150 | # $(CROSS64)$(CXX) -c -DMATLAB_MEX_FILE -x c++ -o "$@" -I$(W64MAT_INC) -O2 "$<" |
| 151 | # %.o64: %.c |
| 152 | # $(CROSS64)$(CXX) -c -DMATLAB_MEX_FILE -x c++ -o "$@" -I$(W64MAT_INC) -O2 "$<" |
| 153 | # |
| 154 | # train.mexw64 predict.mexw64: train.o64 linear.o64 linear_model_matlab.o64 tron.o64 |
| 155 | # $(CROSS64)$(CXX) -shared $(GNUMEX64)/mex.def -o "$@" -L$(GNUMEX64) -s "$<" linear_model_matlab.o64 linear.o64 tron.o64 -llibmx -llibmex -llibmat -lcholmod -lblas |
| 156 | # |
| 157 | # svmpredict_mex.mexw64 : svmpredict_mex.o64 svm.o64 svm_model_matlab.o64 |
| 158 | # $(CROSS64)$(CXX) -shared $(GNUMEX64)/mex.def -o "$@" -L$(GNUMEX64) -s "$<" svm_model_matlab.o64 svm.o64 -llibmx -llibmex -llibmat -lcholmod |
| 159 | # svmtrain_mex.mexw64 : svmtrain_mex.o64 svm.o64 svm_model_matlab.o64 |
| 160 | # $(CROSS64)$(CXX) -shared $(GNUMEX64)/mex.def -o "$@" -L$(GNUMEX64) -s "$<" svm_model_matlab.o64 svm.o64 -llibmx -llibmex -llibmat -lcholmod |
| 161 | # |
| 162 | # %.mexw64: %.o64 |
| 163 | # $(CROSS64)$(CXX) -shared $(GNUMEX64)/mex.def -o "$@" -L$(GNUMEX64) -s "$<" -llibmx -llibmex -llibmat -lcholmod -lgomp -lpthread |
| 164 | # |