Mercurial > forge
annotate extra/NaN/src/Makefile @ 8037:6a419bec96bb octave-forge
update contact e-mail and www address
author | schloegl |
---|---|
date | Wed, 20 Apr 2011 09:16:06 +0000 |
parents | eec1e8c2f373 |
children | 8d8da31799c0 |
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 |
7993 | 8 |
9 # Octave - global install (e.g. from debian package) | |
10 OCTAVE_VERSION = | |
7802
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
11 INCOCTAVE = -I /usr/include/octave |
7993 | 12 # Octave - local install (e.g. compiled from sources) |
13 OCTAVE_VERSION = -3.4.0 | |
14 INCOCTAVE = -I /usr/local/include/octave$(OCTAVE_VERSION)/octave | |
15 | |
16 # Matlab configuration | |
17 MATLABDIR = /usr/local/MATLAB/R2010b | |
7802
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
18 # 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
|
19 MEX_OPTION += -largeArrayDims |
7993 | 20 |
7912 | 21 # Mingw crosscompiler: available at http://www.nongnu.org/mingw-cross-env/ |
22 CROSS = $(HOME)/src/mingw-cross-env/usr/bin/i686-pc-mingw32- | |
7899 | 23 # include directory for Win32-Matlab include |
7912 | 24 W32MAT_INC = $(HOME)/bin/Matlab/R2010/extern/include/ |
25 # path to GNUMEX libraries, available from here http://sourceforge.net/projects/gnumex/ | |
26 GNUMEX = $(HOME)/bin/gnumex | |
7802
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
27 #################################################### |
6547 | 28 |
29 CC = gcc | |
30 CXX = g++ | |
8037 | 31 CFLAGS = -fopenmp -Wall -Wconversion -O2 -fPIC |
7993 | 32 OCTMEX = mkoctfile$(OCTAVE_VERSION) --mex |
7912 | 33 RM = rm |
3901 | 34 |
8037 | 35 MEX_OPTION += -lz -lgomp CC\#$(CXX) CXX\#$(CXX) CFLAGS\#"$(CFLAGS)" CXXFLAGS\#"$(CFLAGS)" |
7912 | 36 MATMEX = $(MATLABDIR)/bin/mex $(MEX_OPTION) |
6560 | 37 |
7899 | 38 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 | 39 |
6560 | 40 MEX_EXT = $(shell $(MATLABDIR)/bin/mexext) |
7899 | 41 octave: $(PROGS) |
6563 | 42 matlab: $(patsubst %.mex, %.$(MEX_EXT), $(PROGS)) |
7912 | 43 mexw32 win32: $(patsubst %.mex, %.mexw32, $(PROGS)) |
44 all: octave matlab win32 | |
3901 | 45 |
46 $(PROGS): Makefile | |
2414 | 47 |
7899 | 48 ######################################################### |
49 # Octave, MATLAB on Linux | |
50 ######################################################### | |
2414 | 51 %.oct: %.cc |
7993 | 52 mkoctfile$(OCTAVE_VERSION) $< |
2968
e49fc39e8ee0
Add "clean" rules to makefiles and discard exit status
goffioul
parents:
2414
diff
changeset
|
53 |
6549 | 54 %.mex: %.cpp |
8032 | 55 $(OCTMEX) $< -lz -lgomp ## Octave |
6549 | 56 %.$(MEX_EXT): %.cpp |
8032 | 57 $(MATMEX) $< -lz -lgomp ## Matlab |
6547 | 58 |
6562 | 59 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
|
60 $(CXX) $(CFLAGS) $(INCOCTAVE) -c svm.cpp |
03cd0c75b7ac
docu for ML72; highlight user-specific configuration in Makefile
schloegl
parents:
7376
diff
changeset
|
61 $(CC) $(CFLAGS) $(INCOCTAVE) -c svm_model_matlab.c |
6549 | 62 env CC=$(CXX) $(OCTMEX) svmtrain_mex.cpp svm.o svm_model_matlab.o |
6554 | 63 env CC=$(CXX) $(OCTMEX) svmpredict_mex.cpp svm.o svm_model_matlab.o |
6549 | 64 |
6562 | 65 svmtrain_mex.$(MEX_EXT) svmpredict_mex.$(MEX_EXT): svmtrain_mex.cpp svm.h svm.cpp svm_model_matlab.c |
6555 | 66 $(CXX) $(CFLAGS) -I $(MATLABDIR)/extern/include -c svm.cpp |
6586 | 67 $(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
|
68 $(MATMEX) svmtrain_mex.cpp svm.o svm_model_matlab.o |
6554 | 69 $(MATMEX) svmpredict_mex.cpp svm.o svm_model_matlab.o |
6547 | 70 |
6588 | 71 train.$(MEX_EXT) predict.$(MEX_EXT): train.c linear.h tron.o linear.o linear_model_matlab.c |
6563 | 72 $(CC) $(CFLAGS) -I $(MATLABDIR)/extern/include -c linear_model_matlab.c |
6588 | 73 $(MATMEX) -lblas train.c tron.o linear.o linear_model_matlab.o |
6563 | 74 #$(MATMEX) -lblas predict.c tron.o linear.o linear_model_matlab.o |
6560 | 75 |
6588 | 76 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
|
77 $(CC) $(CFLAGS) $(INCOCTAVE) -c linear_model_matlab.c |
6588 | 78 env CC=$(CXX) $(OCTMEX) -lblas train.c tron.o linear.o linear_model_matlab.o |
6563 | 79 #env CC=$(CXX) $(OCTMEX) -lblas predict.c tron.o linear.o linear_model_matlab.o |
6560 | 80 |
81 linear.o: linear.cpp linear.h | |
82 $(CXX) $(CFLAGS) -c linear.cpp | |
83 | |
84 tron.o: tron.cpp tron.h | |
85 $(CXX) $(CFLAGS) -c tron.cpp | |
86 | |
87 | |
7992 | 88 clean: ; -$(RM) *.o core octave-core *.oct *~ *.mex* |
89 | |
7899 | 90 ######################################################### |
91 # MATLAB/WIN32 | |
92 ######################################################### | |
93 %.obj: %.cpp | |
8037 | 94 $(CROSS)$(CXX) -fopenmp -c -DMATLAB_MEX_FILE -x c++ -o $@ -I$(W32MAT_INC) -O2 -DMX_COMPAT_32 $< |
7899 | 95 %.obj: %.c |
8037 | 96 $(CROSS)$(CXX) -fopenmp -c -DMATLAB_MEX_FILE -x c++ -o $@ -I$(W32MAT_INC) -O2 -DMX_COMPAT_32 $< |
7899 | 97 #%.obj: LAPACK/%.f |
98 # $(CROSS)$(CXX) -c -DMATLAB_MEX_FILE -o$@ -I$(W32MAT_INC) -O3 -DMX_COMPAT_32 $< | |
99 | |
100 train.mexw32 predict.mexw32: train.obj linear.obj linear_model_matlab.obj tron.obj | |
101 $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o $@ -L$(GNUMEX) -s $< linear_model_matlab.obj linear.obj tron.obj -llibmx -llibmex -llibmat -lz -lcholmod -lblas | |
102 | |
7912 | 103 svmpredict_mex.mexw32 : svmpredict_mex.obj svm.obj svm_model_matlab.obj |
7899 | 104 $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o $@ -L$(GNUMEX) -s $< svm_model_matlab.obj svm.obj -llibmx -llibmex -llibmat -lz -lcholmod |
105 svmtrain_mex.mexw32 : svmtrain_mex.obj svm.obj svm_model_matlab.obj | |
106 $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o $@ -L$(GNUMEX) -s $< svm_model_matlab.obj svm.obj -llibmx -llibmex -llibmat -lz -lcholmod | |
107 | |
7912 | 108 %.mexw32: %.obj |
8037 | 109 $(CROSS)$(CXX) -shared $(GNUMEX)/mex.def -o $@ -L$(GNUMEX) -s $< -llibmx -llibmex -llibmat -lz -lcholmod -lgomp -lpthread |
7899 | 110 |
7912 | 111 clean: |
112 -$(RM) *.o *.obj core octave-core *.oct *~ *.mex* | |
7899 | 113 |
114 | |
115 |