Mercurial > forge
annotate extra/NaN/src/Makefile @ 7992:db5092052107 octave-forge
OpenMP support included
author | schloegl |
---|---|
date | Tue, 15 Mar 2011 20:31:04 +0000 |
parents | 14021a3f31a6 |
children | b670af56dd9d |
rev | line source |
---|---|
7802
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
1 #################################################### |
7899 | 2 # Copyright 2010, 2011 Alois Schloegl |
7802
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
3 # This is part of the NaN-toolbox - a statistics and machine learning toolbox for data with and without missing values. |
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
4 # http://pub.ist.ac.at/~schloegl/matlab/NaN/ |
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
5 #################################################### |
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
6 |
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
7 ### modify directories according to your needs |
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
8 INCOCTAVE = -I /usr/include/octave |
7899 | 9 MATLABDIR = /usr/local/MATLAB/R2010b/ |
7802
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
10 # comment the following line if you use MATLAB on 32-bit operating system |
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
11 MEX_OPTION += -largeArrayDims |
7912 | 12 # Mingw crosscompiler: available at http://www.nongnu.org/mingw-cross-env/ |
13 CROSS = $(HOME)/src/mingw-cross-env/usr/bin/i686-pc-mingw32- | |
7899 | 14 # include directory for Win32-Matlab include |
7912 | 15 W32MAT_INC = $(HOME)/bin/Matlab/R2010/extern/include/ |
16 # path to GNUMEX libraries, available from here http://sourceforge.net/projects/gnumex/ | |
17 GNUMEX = $(HOME)/bin/gnumex | |
7802
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
18 #################################################### |
6547 | 19 |
20 CC = gcc | |
21 CXX = g++ | |
7992 | 22 CFLAGS = -fopenmp -Wall -Wconversion -O3 -fPIC |
6547 | 23 OCTMEX = mkoctfile --mex |
7912 | 24 RM = rm |
3901 | 25 |
7992 | 26 MEX_OPTION += CC\#$(CXX) CXX\#$(CXX) CFLAGS\#"$(CFLAGS)" CXXFLAGS\#"$(CFLAGS)" |
7912 | 27 MATMEX = $(MATLABDIR)/bin/mex $(MEX_OPTION) |
6560 | 28 |
7899 | 29 PROGS = histo_mex.mex covm_mex.mex kth_element.mex sumskipnan_mex.mex str2array.mex train.mex svmtrain_mex.mex svmpredict_mex.mex xptopen.mex |
6547 | 30 |
6560 | 31 MEX_EXT = $(shell $(MATLABDIR)/bin/mexext) |
7899 | 32 octave: $(PROGS) |
6563 | 33 matlab: $(patsubst %.mex, %.$(MEX_EXT), $(PROGS)) |
7912 | 34 mexw32 win32: $(patsubst %.mex, %.mexw32, $(PROGS)) |
35 all: octave matlab win32 | |
3901 | 36 |
37 $(PROGS): Makefile | |
2414 | 38 |
7899 | 39 ######################################################### |
40 # Octave, MATLAB on Linux | |
41 ######################################################### | |
2414 | 42 %.oct: %.cc |
43 mkoctfile $< | |
2968
e49fc39e8ee0
Add "clean" rules to makefiles and discard exit status
goffioul
parents:
2414
diff
changeset
|
44 |
6549 | 45 %.mex: %.cpp |
6547 | 46 $(OCTMEX) $< ## Octave |
6549 | 47 %.$(MEX_EXT): %.cpp |
7899 | 48 $(MATMEX) $< -lz ## Matlab |
6547 | 49 |
6562 | 50 svmtrain_mex.mex svmpredict_mex.mex: svmtrain_mex.cpp svm.h svm.cpp svm_model_matlab.c |
7802
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
51 $(CXX) $(CFLAGS) $(INCOCTAVE) -c svm.cpp |
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
52 $(CC) $(CFLAGS) $(INCOCTAVE) -c svm_model_matlab.c |
6549 | 53 env CC=$(CXX) $(OCTMEX) svmtrain_mex.cpp svm.o svm_model_matlab.o |
6554 | 54 env CC=$(CXX) $(OCTMEX) svmpredict_mex.cpp svm.o svm_model_matlab.o |
6549 | 55 |
6562 | 56 svmtrain_mex.$(MEX_EXT) svmpredict_mex.$(MEX_EXT): svmtrain_mex.cpp svm.h svm.cpp svm_model_matlab.c |
6555 | 57 $(CXX) $(CFLAGS) -I $(MATLABDIR)/extern/include -c svm.cpp |
6586 | 58 $(CC) $(CFLAGS) -I $(MATLABDIR)/extern/include -c svm_model_matlab.c |
6552
37ebea0d2428
build for octave must be the default, matlab build is optional
schloegl
parents:
6549
diff
changeset
|
59 $(MATMEX) svmtrain_mex.cpp svm.o svm_model_matlab.o |
6554 | 60 $(MATMEX) svmpredict_mex.cpp svm.o svm_model_matlab.o |
6547 | 61 |
6588 | 62 train.$(MEX_EXT) predict.$(MEX_EXT): train.c linear.h tron.o linear.o linear_model_matlab.c |
6563 | 63 $(CC) $(CFLAGS) -I $(MATLABDIR)/extern/include -c linear_model_matlab.c |
6588 | 64 $(MATMEX) -lblas train.c tron.o linear.o linear_model_matlab.o |
6563 | 65 #$(MATMEX) -lblas predict.c tron.o linear.o linear_model_matlab.o |
6560 | 66 |
6588 | 67 train.mex predict.mex: train.c linear.h tron.o linear.o linear_model_matlab.c |
7802
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
68 $(CC) $(CFLAGS) $(INCOCTAVE) -c linear_model_matlab.c |
6588 | 69 env CC=$(CXX) $(OCTMEX) -lblas train.c tron.o linear.o linear_model_matlab.o |
6563 | 70 #env CC=$(CXX) $(OCTMEX) -lblas predict.c tron.o linear.o linear_model_matlab.o |
6560 | 71 |
72 linear.o: linear.cpp linear.h | |
73 $(CXX) $(CFLAGS) -c linear.cpp | |
74 | |
75 tron.o: tron.cpp tron.h | |
76 $(CXX) $(CFLAGS) -c tron.cpp | |
77 | |
78 | |
7992 | 79 clean: ; -$(RM) *.o core octave-core *.oct *~ *.mex* |
80 | |
7899 | 81 ######################################################### |
82 # MATLAB/WIN32 | |
83 ######################################################### | |
84 %.obj: %.cpp | |
85 $(CROSS)$(CXX) -c -DMATLAB_MEX_FILE -x c++ -o $@ -I$(W32MAT_INC) -O3 -DMX_COMPAT_32 $< | |
86 %.obj: %.c | |
87 $(CROSS)$(CXX) -c -DMATLAB_MEX_FILE -x c++ -o $@ -I$(W32MAT_INC) -O3 -DMX_COMPAT_32 $< | |
88 #%.obj: LAPACK/%.f | |
89 # $(CROSS)$(CXX) -c -DMATLAB_MEX_FILE -o$@ -I$(W32MAT_INC) -O3 -DMX_COMPAT_32 $< | |
90 | |
91 train.mexw32 predict.mexw32: train.obj linear.obj linear_model_matlab.obj tron.obj | |
92 $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o $@ -L$(GNUMEX) -s $< linear_model_matlab.obj linear.obj tron.obj -llibmx -llibmex -llibmat -lz -lcholmod -lblas | |
93 | |
7912 | 94 svmpredict_mex.mexw32 : svmpredict_mex.obj svm.obj svm_model_matlab.obj |
7899 | 95 $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o $@ -L$(GNUMEX) -s $< svm_model_matlab.obj svm.obj -llibmx -llibmex -llibmat -lz -lcholmod |
96 svmtrain_mex.mexw32 : svmtrain_mex.obj svm.obj svm_model_matlab.obj | |
97 $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o $@ -L$(GNUMEX) -s $< svm_model_matlab.obj svm.obj -llibmx -llibmex -llibmat -lz -lcholmod | |
98 | |
7912 | 99 %.mexw32: %.obj |
100 $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o $@ -L$(GNUMEX) -s $< -llibmx -llibmex -llibmat -lz -lcholmod | |
7899 | 101 |
7912 | 102 clean: |
103 -$(RM) *.o *.obj core octave-core *.oct *~ *.mex* | |
7899 | 104 |
105 | |
106 |