-
-
Notifications
You must be signed in to change notification settings - Fork 70
/
Makefile.nvcc
26 lines (19 loc) · 925 Bytes
/
Makefile.nvcc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Compile using a mix of NVCC and MEX In particular, it compiles MEX
# files using NVCC then MEX; in this manner the CUDA Devkit needs not
# matching MATLAB version.
# Prefer .cu over .cpp and .c when GPU is enabled; this rule must come
# before the following ones.
ifneq ($(ENABLE_GPU),)
matlab/mex/.build/%.o : matlab/src/bits/%.cu matlab/mex/.build/.stamp
$(NVCC) $(NVCCFLAGS) \
"$(<)" -c -o "$(@)" $(nvcc_filter)
matlab/mex/%.mex$(MEXARCH) : matlab/src/%.cu $(cpp_tgt) $(cu_tgt)
$(NVCC) $(NVCCFLAGS) -Xcompiler -fPIC \
"$(<)" -c -o "matlab/mex/.build/$(*).o" $(nvcc_filter)
$(MEX) $(MEXFLAGS_NVCC) "matlab/mex/.build/$(*).o" -output "$(@)" $(cpp_tgt) $(cu_tgt)
endif
matlab/mex/.build/%.o : matlab/src/bits/%.cpp matlab/mex/.build/.stamp
$(MEX) -c $(MEXFLAGS) "$(<)"
mv -f "$(notdir $(@))" "$(@)"
matlab/mex/%.mex$(MEXARCH) : matlab/src/%.cpp $(cpp_tgt)
$(MEX) $(MEXFLAGS) "$(<)" -output "$(@)" $(cpp_tgt)