Ticket #46035: patch-src_Makefile.diff

File patch-src_Makefile.diff, 2.9 KB (added by Schamschula (Marius Schamschula), 10 years ago)
  • src/Makefile

    old new  
    3131# Instead of building "mex shortpath.c" and "mex uigetpath.c", I used empty m-functions within argout=argin;
    3232####################################################
    3333
    34 CC      = gcc
    35 CXX     = g++
     34#CC     = gcc
     35#CXX    = g++
    3636CFLAGS  = -fopenmp -Wall -Wextra -Wconversion -O2 -fPIC
    37 OCTMEX  = mkoctfile$(OCTAVE_VERSION) --mex
     37#OCTMEX = mkoctfile$(OCTAVE_VERSION) --mex
     38MKOCTFILE = mkoctfile$(OCTAVE_VERSION)
     39OCTMEX  = $(MKOCTFILE) --mex
    3840RM      = rm
    3941
    4042MEX_OPTION  += -lgomp CC\#$(CXX) CXX\#$(CXX) CFLAGS\#"$(CFLAGS) " CXXFLAGS\#"$(CFLAGS) "
    4143MATMEX      = $(MATLABDIR)/bin/mex $(MEX_OPTION)
    4244
     45FLIBS = ${shell $(MKOCTFILE) -p FLIBS}
     46INCFLAGS = ${shell $(MKOCTFILE) -p INCFLAGS}
     47INC_CSTDLIB = -include cstdlib
     48
    4349PROGS = histo_mex.mex covm_mex.mex kth_element.mex sumskipnan_mex.mex str2array.mex train.mex svmtrain_mex.mex svmpredict_mex.mex xptopen.mex
    4450
    4551### per default only the mex-files for octave are built
     
    7884#       Octave, MATLAB on Linux
    7985#########################################################
    8086%.oct: %.cc
    81         mkoctfile$(OCTAVE_VERSION) $<
     87        INCFLAGS="$(INCFLAGS) $(INC_CSTDLIB)" $(MKOCTFILE) $<
    8288
    8389%.mex: %.cpp
    84         $(OCTMEX) $<  -lgomp         ## Octave
    85 %.$(MEX_EXT): %.cpp
    86         $(MATMEX) $<  -lgomp      ## Matlab
     90        INCFLAGS="$(INCFLAGS) $(INC_CSTDLIB)" $(OCTMEX) $< $(FLIBS) -lgomp
    8791
    8892svmtrain_mex.mex svmpredict_mex.mex:     svmtrain_mex.cpp svm.h svm.cpp svm_model_matlab.c svmpredict_mex.cpp
    8993        $(CXX) $(CFLAGS) -c svm.cpp
    90         #$(CC)  $(CFLAGS) $(INCOCTAVE) -c svm_model_matlab.c
    91         env CC=$(CXX) $(OCTMEX) svmtrain_mex.cpp svm.o svm_model_matlab.c
    92         env CC=$(CXX) $(OCTMEX) svmpredict_mex.cpp svm.o svm_model_matlab.c
     94        $(CC)  $(CFLAGS) $(INCFLAGS) -c svm_model_matlab.c
     95        INCFLAGS="$(INCFLAGS) $(INC_CSTDLIB)" $(OCTMEX) svmtrain_mex.cpp svm.o svm_model_matlab.o
     96        INCFLAGS="$(INCFLAGS) $(INC_CSTDLIB)" $(OCTMEX) svmpredict_mex.cpp svm.o svm_model_matlab.o
    9397
    9498svmtrain_mex.$(MEX_EXT) svmpredict_mex.$(MEX_EXT):     svmtrain_mex.cpp svm.h svm.cpp svm_model_matlab.c svmpredict_mex.cpp
    9599        $(CXX) $(CFLAGS) -I $(MATLABDIR)/extern/include -c svm.cpp
     
    98102        $(MATMEX) svmpredict_mex.cpp svm.o svm_model_matlab.o
    99103
    100104train.$(MEX_EXT) predict.$(MEX_EXT): train.c linear.h tron.o linear.o linear_model_matlab.c
    101         $(CC) $(CFLAGS) -I $(MATLABDIR)/extern/include -c linear_model_matlab.c
     105        # $(CC) $(CFLAGS) -I $(MATLABDIR)/extern/include -c linear_model_matlab.c
    102106        $(MATMEX)  -lblas train.c tron.o linear.o linear_model_matlab.o
    103107        #$(MATMEX) -lblas predict.c tron.o linear.o linear_model_matlab.o
    104108
    105109train.mex predict.mex: train.c linear.h tron.o linear.o linear_model_matlab.c
    106         env CC=$(CXX) $(OCTMEX) -lblas train.c tron.o linear.o linear_model_matlab.c
     110        $(OCTMEX) -lblas train.c tron.o linear.o linear_model_matlab.c
    107111        #env CC=$(CXX) $(OCTMEX) -lblas predict.c tron.o linear.o linear_model_matlab.o
    108112
    109113linear.o: linear.cpp linear.h