Ticket #50730: patch-src_Makefile.diff

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

    old new  
    1313# OCTAVE_VERSION=-3.6.3
    1414
    1515# Matlab configuration
    16 #MATLABDIR = /usr/local/MATLAB/R2010b
     16# MATLABDIR = /usr/local/MATLAB/R2010b
    1717# comment the following line if you use MATLAB on 32-bit operating system
    18 MEX_OPTION += -largeArrayDims
    19 
     18# MEX_OPTION += -largeArrayDims
     19#
    2020# Mingw crosscompiler: available at http://www.nongnu.org/mingw-cross-env/
    21 CROSS   = $(HOME)/src/mxe/usr/bin/i686-w64-mingw32.static-
    22 CROSS64 = $(HOME)/src/mxe/usr/bin/x86_64-w64-mingw32.static-
     21# CROSS   = $(HOME)/src/mxe/usr/bin/i686-w64-mingw32.static-
     22# CROSS64 = $(HOME)/src/mxe/usr/bin/x86_64-w64-mingw32.static-
    2323# include directory for Win32-Matlab include
    24 W32MAT_INC = $(HOME)/bin/win32/Matlab/R2010b/extern/include/
    25 W64MAT_INC = $(HOME)/bin/win64/Matlab/R2010b/extern/include/
     24# W32MAT_INC = $(HOME)/bin/win32/Matlab/R2010b/extern/include/
     25# W64MAT_INC = $(HOME)/bin/win64/Matlab/R2010b/extern/include/
    2626# path to GNUMEX libraries, available from here http://sourceforge.net/projects/gnumex/
    27 GNUMEX   = $(HOME)/bin/win32/gnumex
    28 GNUMEX64 = $(HOME)/bin/win64/gnumex
     27# GNUMEX   = $(HOME)/bin/win32/gnumex
     28# GNUMEX64 = $(HOME)/bin/win64/gnumex
    2929# building gnumex64 was difficult, these hints were quite useful:
    3030# http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinZvxgC9ezp2P3UCX_a7TAUYuVsp2U40MQUV6qr%40mail.gmail.com&forum_name=gnumex-users
    3131# Instead of building "mex shortpath.c" and "mex uigetpath.c", I used empty m-functions within argout=argin;
     
    3434CC      ?= gcc
    3535CXX     ?= g++
    3636CFLAGS += -fopenmp -Wall -Wextra -Wconversion -O2
    37 OCTMEX  = $(MKOCTFILE) --mex -lgomp
     37OCTMEX  = $(MKOCTFILE) --mex
    3838RM      = rm
    3939
    4040# Support Debian Hardening flags
     
    4545CFLAGS      += -fPIC
    4646endif
    4747
    48 ifneq (Darwin,$(shell uname))
    49 CFLAGS      += -fopenmp
    50 MEX_OPTION  += -lgomp
    51 MEX_OPTION  += CC\#$(CXX) CXX\#$(CXX) CFLAGS\#"$(CFLAGS) " CXXFLAGS\#"$(CFLAGS) "
    52 endif
     48# ifneq (Darwin,$(shell uname))
     49# CFLAGS      += -fopenmp
     50# MEX_OPTION  += -lgomp
     51# MEX_OPTION  += CC\#$(CXX) CXX\#$(CXX) CFLAGS\#"$(CFLAGS) " CXXFLAGS\#"$(CFLAGS) "
     52# endif
    5353 
    54 MATMEX      = $(MATLABDIR)/bin/mex $(MEX_OPTION)
     54# MATMEX      = $(MATLABDIR)/bin/mex $(MEX_OPTION)
    5555
    5656PROGS = histo_mex.mex covm_mex.mex kth_element.mex sumskipnan_mex.mex str2array.mex train.mex svmtrain_mex.mex svmpredict_mex.mex xptopen.mex
    5757
     
    5959mex4o octave: $(PROGS)
    6060
    6161
    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*
    8686
    8787#$(PROGS): Makefile
    8888
     
    123123#########################################################
    124124#       MATLAB/WIN32
    125125#########################################################
    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#
    142142
    143143
    144144#########################################################
     
    146146#########################################################
    147147
    148148## ToDO: fix OpenMP support: currently -fopenmp causes Matlab to crash
    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#