1
# Define installation location for CUDA and compilation flags compatible
2
# with the CUDA include files.
4
INCLUDEDIR = -I$(CUDAHOME)/include
5
INCLUDELIB = -L$(CUDAHOME)/lib -lcufft -lcublas -Wl,-rpath,$(CUDAHOME)/lib
6
CFLAGS = -fPIC -D_GNU_SOURCE -pthread -fexceptions -Wall
7
COPTIMFLAGS = -O3 -funroll-loops -msse2
9
# Define installation location for MATLAB.
10
export MATLAB = /opt/Matlab
11
#export MATLAB = /Applications/MATLAB_R2007b
12
MEX = $(MATLAB)/bin/mex
13
MEXEXT = .$(shell $(MATLAB)/bin/mexext)
15
# nvmex is a modified mex script that knows how to handle CUDA .cu files.
18
# List the mex files to be built. The .mex extension will be replaced with the
19
# appropriate extension for this installation of MATLAB, e.g. .mexglx or
21
MEXFILES = normxcorr_hw.mex
23
all: $(MEXFILES:.mex=$(MEXEXT))
26
rm -f $(MEXFILES:.mex=$(MEXEXT)) $(MEXFILES:.mex=.linkinfo)
28
.SUFFIXES: .cu .cu_o .mexglx .mexa64 .mexmaci
31
$(MEX) CFLAGS='$(CFLAGS)' COPTIMFLAGS='$(COPTIMFLAGS)' $< \
32
$(INCLUDEDIR) $(INCLUDELIB)
35
$(NVMEX) -f nvopts.sh $< $(INCLUDEDIR) $(INCLUDELIB)
38
$(MEX) CFLAGS='$(CFLAGS)' COPTIMFLAGS='$(COPTIMFLAGS)' $< \
39
$(INCLUDEDIR) $(INCLUDELIB)
42
$(NVMEX) -v -f nvopts.sh $< $(INCLUDEDIR) $(INCLUDELIB)
45
$(MEX) CFLAGS='$(CFLAGS)' COPTIMFLAGS='$(COPTIMFLAGS)' $< \
46
$(INCLUDEDIR) $(INCLUDELIB)
49
$(NVMEX) -f nvopts.sh $< $(INCLUDEDIR) $(INCLUDELIB)