Ticket #46516: patch-src_Makefile.diff
File patch-src_Makefile.diff, 7.0 KB (added by Schamschula (Marius Schamschula), 10 years ago) |
---|
-
src/Makefile
old new 15 15 # Matlab configuration 16 16 # MATLABDIR = /usr/local/MATLAB/R2010b 17 17 # comment the following line if you use MATLAB on 32-bit operating system 18 MEX_OPTION += -largeArrayDims18 # MEX_OPTION += -largeArrayDims 19 19 20 20 # Mingw crosscompiler: available at http://www.nongnu.org/mingw-cross-env/ 21 CROSS = $(HOME)/src/mxe.github.schloegl/usr/bin/i686-pc-mingw3222 CROSS64 = $(HOME)/src/mxe.github.schloegl/usr/bin/x86_64-w64-mingw3221 # CROSS = $(HOME)/src/mxe.github.schloegl/usr/bin/i686-pc-mingw32 22 # CROSS64 = $(HOME)/src/mxe.github.schloegl/usr/bin/x86_64-w64-mingw32 23 23 # include directory for Win32-Matlab include 24 W32MAT_INC = -I$(HOME)/bin/win32/Matlab/R2010b/extern/include/25 W64MAT_INC = -I$(HOME)/bin/win64/Matlab/R2010b/extern/include/24 # W32MAT_INC = -I$(HOME)/bin/win32/Matlab/R2010b/extern/include/ 25 # W64MAT_INC = -I$(HOME)/bin/win64/Matlab/R2010b/extern/include/ 26 26 # path to GNUMEX libraries, available from here http://sourceforge.net/projects/gnumex/ 27 GNUMEX = $(HOME)/bin/win32/gnumex28 GNUMEX64 = $(HOME)/bin/win64/gnumex27 # GNUMEX = $(HOME)/bin/win32/gnumex 28 # GNUMEX64 = $(HOME)/bin/win64/gnumex 29 29 # building gnumex64 was difficult, these hints were quite useful: 30 30 # http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinZvxgC9ezp2P3UCX_a7TAUYuVsp2U40MQUV6qr%40mail.gmail.com&forum_name=gnumex-users 31 31 # Instead of building "mex shortpath.c" and "mex uigetpath.c", I used empty m-functions within argout=argin; 32 # ###################################################33 W32MAT_INC += -I$(subst /usr/bin/,/usr/,$(CROSS))/include/34 W64MAT_INC += -I$(subst /usr/bin/,/usr/,$(CROSS64))/include/35 LDLIBS_W32 = $(subst /usr/bin/,/usr/,$(CROSS))/lib/36 LDLIBS_W64 = $(subst /usr/bin/,/usr/,$(CROSS64))/lib/37 W32_LIBS = $(LDLIBS_W32)liblapack.a38 W64_LIBS = $(LDLIBS_W64)liblapack.a39 W32_LIBS += $(LDLIBS_W32)libblas.a40 W64_LIBS += $(LDLIBS_W64)libblas.a32 # ################################################### 33 # W32MAT_INC += -I$(subst /usr/bin/,/usr/,$(CROSS))/include/ 34 # W64MAT_INC += -I$(subst /usr/bin/,/usr/,$(CROSS64))/include/ 35 # LDLIBS_W32 = $(subst /usr/bin/,/usr/,$(CROSS))/lib/ 36 # LDLIBS_W64 = $(subst /usr/bin/,/usr/,$(CROSS64))/lib/ 37 # W32_LIBS = $(LDLIBS_W32)liblapack.a 38 # W64_LIBS = $(LDLIBS_W64)liblapack.a 39 # W32_LIBS += $(LDLIBS_W32)libblas.a 40 # W64_LIBS += $(LDLIBS_W64)libblas.a 41 41 42 42 43 43 44 CC = gcc45 CXX = g++44 #CC = gcc 45 #CXX = g++ 46 46 CFLAGS = -fopenmp -Wall -Wextra -Wconversion -O2 -fPIC 47 47 OCTMEX = mkoctfile$(OCTAVE_VERSION) --mex 48 48 RM = rm 49 49 50 50 MEX_OPTION += -lgomp CC\#$(CXX) CXX\#$(CXX) CFLAGS\#"$(CFLAGS)" CXXFLAGS\#"$(CFLAGS)" 51 MATMEX = $(MATLABDIR)/bin/mex $(MEX_OPTION) 51 MKOCTFILE = mkoctfile$(OCTAVE_VERSION) 52 OCTMEX = $(MKOCTFILE) --mex 53 54 FLIBS = ${shell $(MKOCTFILE) -p FLIBS} 55 INCFLAGS = ${shell $(MKOCTFILE) -p INCFLAGS} 56 INC_CSTDLIB = -include cstdlib 52 57 53 58 PROGS = covm_mex.mex sumskipnan_mex.mex # 54 59 … … 56 61 mex4o octave: $(PROGS) 57 62 58 63 59 # ## Matlab configuration - search for a matlab directory if not defined above60 ifndef MATLABDIR61 ifneq ('',$(shell ls -1 /usr/local/MATLAB))62 #use oldest, typically mex-files a compatible with newer Matlab versions63 MATLABDIR=$(shell ls -dt1 /usr/local/MATLAB/R* |tail -1)64 #alternatively, use latest matlab version65 #MATLABDIR=$(shell ls -dt1 /usr/local/MATLAB/R* |head -1)66 endif67 endif68 69 # ## if the MATLABDIR has been found or defined70 ifneq ('',MATLABDIR)71 ifneq ('',$(lshell ls -1 $(MATLABDIR)))72 MEX_EXT = $(shell $(MATLABDIR)/bin/mexext)73 mex4m matlab: $(patsubst %.mex, %.$(MEX_EXT), $(PROGS))74 endif75 endif76 77 78 mexw32 win32: $(patsubst %.mex, %.mexw32, $(PROGS))79 mexw64 win64: $(patsubst %.mex, %.mexw64, $(PROGS))80 all: octave win32 win64 mex4m64 # ### Matlab configuration - search for a matlab directory if not defined above 65 # ifndef MATLABDIR 66 # ifneq ('',$(shell ls -1 /usr/local/MATLAB)) 67 # use oldest, typically mex-files a compatible with newer Matlab versions 68 # MATLABDIR=$(shell ls -dt1 /usr/local/MATLAB/R* |tail -1) 69 # alternatively, use latest matlab version 70 # MATLABDIR=$(shell ls -dt1 /usr/local/MATLAB/R* |head -1) 71 # endif 72 # endif 73 # 74 # ### if the MATLABDIR has been found or defined 75 # ifneq ('',MATLABDIR) 76 # ifneq ('',$(lshell ls -1 $(MATLABDIR))) 77 # MEX_EXT = $(shell $(MATLABDIR)/bin/mexext) 78 # mex4m matlab: $(patsubst %.mex, %.$(MEX_EXT), $(PROGS)) 79 # endif 80 # endif 81 # 82 # 83 # mexw32 win32: $(patsubst %.mex, %.mexw32, $(PROGS)) 84 # mexw64 win64: $(patsubst %.mex, %.mexw64, $(PROGS)) 85 all: octave 81 86 82 87 clean: 83 88 -$(RM) *.o *.obj *.o64 core octave-core *.oct *~ *.mex* … … 88 93 # Octave, MATLAB on Linux 89 94 ######################################################### 90 95 %.oct: %.cc 91 mkoctfile$(OCTAVE_VERSION) "$<"96 $(MKOCTFILE) $< 92 97 93 98 %.mex: %.cpp 94 $(OCTMEX) "$<" -lgomp -llapack -lblas## Octave95 %.$(MEX_EXT): %.cpp96 $(MATMEX) "$<" -lgomp -llapack -lblas ## Matlab99 INCFLAGS="$(INCFLAGS) $(INC_CSTDLIB)" $(OCTMEX) $< $(FLIBS) -lgomp ## Octave 100 # %.$(MEX_EXT): %.cpp 101 # $(MATMEX) "$<" -lgomp -llapack -lblas ## Matlab 97 102 98 103 99 104 ######################################################### 100 105 # MATLAB/WIN32 101 106 ######################################################### 102 %.obj: %.cpp103 $(CROSS)-$(CXX) -fopenmp -c -DMATLAB_MEX_FILE -x c++ -o "$@" $(W32MAT_INC) -O2 -DMX_COMPAT_32 "$<"104 %.obj: %.c105 $(CROSS)-$(CXX) -fopenmp -c -DMATLAB_MEX_FILE -x c++ -o "$@" $(W32MAT_INC) -O2 -DMX_COMPAT_32 "$<"106 107 %.mexw32: %.obj108 $(CROSS)-$(CXX) -shared $(GNUMEX)/mex.def -o "$@" -L$(GNUMEX) -s "$<" -llibmx -llibmex -llibmat -lcholmod -lgomp -lpthread -L$(LDLIBS_W32) -lblas -llapack107 # %.obj: %.cpp 108 # $(CROSS)-$(CXX) -fopenmp -c -DMATLAB_MEX_FILE -x c++ -o "$@" $(W32MAT_INC) -O2 -DMX_COMPAT_32 "$<" 109 # %.obj: %.c 110 # $(CROSS)-$(CXX) -fopenmp -c -DMATLAB_MEX_FILE -x c++ -o "$@" $(W32MAT_INC) -O2 -DMX_COMPAT_32 "$<" 111 # 112 # %.mexw32: %.obj 113 # $(CROSS)-$(CXX) -shared $(GNUMEX)/mex.def -o "$@" -L$(GNUMEX) -s "$<" -llibmx -llibmex -llibmat -lcholmod -lgomp -lpthread -L$(LDLIBS_W32) -lblas -llapack 109 114 110 115 111 116 ######################################################### … … 113 118 ######################################################### 114 119 115 120 ## ToDO: fix OpenMP support: currently -fopenmp causes Matlab to crash 116 %.o64: %.cpp117 $(CROSS64)-$(CXX) -c -DMATLAB_MEX_FILE -x c++ -o "$@" $(W64MAT_INC) -O2 "$<"118 %.o64: %.c119 $(CROSS64)-$(CXX) -c -DMATLAB_MEX_FILE -x c++ -o "$@" $(W64MAT_INC) -O2 "$<"120 121 %.mexw64: %.o64122 $(CROSS64)-$(CXX) -shared $(GNUMEX64)/mex.def -o "$@" -L$(GNUMEX64) -s "$<" -llibmx -llibmex -llibmat -lcholmod -lgomp -lpthread -L$(LDLIBS_W64) -lblas -llapack121 # %.o64: %.cpp 122 # $(CROSS64)-$(CXX) -c -DMATLAB_MEX_FILE -x c++ -o "$@" $(W64MAT_INC) -O2 "$<" 123 # %.o64: %.c 124 # $(CROSS64)-$(CXX) -c -DMATLAB_MEX_FILE -x c++ -o "$@" $(W64MAT_INC) -O2 "$<" 125 # 126 # %.mexw64: %.o64 127 # $(CROSS64)-$(CXX) -shared $(GNUMEX64)/mex.def -o "$@" -L$(GNUMEX64) -s "$<" -llibmx -llibmex -llibmat -lcholmod -lgomp -lpthread -L$(LDLIBS_W64) -lblas -llapack 123 128 124 129 125 130