This repository has been archived by the owner on Aug 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
61 lines (45 loc) · 1.67 KB
/
Makefile
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
CC=nvcc
gpuNUFFT_DIR=./gpuNUFFT-2.0.6rc2/CUDA
CFLAGS= -I$(gpuNUFFT_DIR)/inc -L$(gpuNUFFT_DIR)/bin
LDFLAGS=-lcublas -lgpuNUFFT_f -lgpuNUFFT_ATM_f
BINARY=grasp
SRCFILES=grasp.cu
gpuNUFFT_FILES=libgpuNUFFT_f.so libgpuNUFFT_ATM_f.so
DOWNLOAD=$(shell which wget)
EXTRACT=$(shell which unzip) -ou
CP=$(shell which cp) -f
RM=$(shell which rm) -vf
all: CFLAGS += -O3
all: depend $(BINARY)
debug: CFLAGS += -g -G -DDEBUG
debug: depend $(BINARY)
$(BINARY): gpuNUFFT $(SRCFILES)
$(CC) $(CFLAGS) $(LDFLAGS) $(SRCFILES) -o $@
#copy_files:
# $(foreach shared_lib, $(gpuNUFFT_FILES), test -f $(shared_lib) || $(CP) $(addprefix "$(gpuNUFFT_DIR)/bin/", $(shared_lib)) .)
gpuNUFFT: extract
$(foreach shared_lib, $(addprefix "$(gpuNUFFT_DIR)/bin/", $(gpuNUFFT_FILES)), test -f $(shared_lib) || \
mkdir -p "$(gpuNUFFT_DIR)/build" && \
cd "$(gpuNUFFT_DIR)/build" && \
cmake .. -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DMATLAB_ROOT_DIR=/opt/matlab \
-UCMAKE_CXX_COMPILER -UCMAKE_C_COMPILER && \
$(MAKE) -j && \
cd -)
pwd
extract: download
test -d gpuNUFFT-2.0.6rc2 || \
$(EXTRACT) gpuNUFFT-2.0.6.zip && \
$(RM) gpuNUFFT-2.0.6.zip
download:
test -d gpuNUFFT-2.0.6rc2 || test -f gpuNUFFT-2.0.6.zip || \
$(DOWNLOAD) 'http://cai2r.net/sites/default/files/software/gpuNUFFT-2.0.6.zip'
.SUFFIXES: .cu
.cu: CC=nvcc
.PHONY: clean distclean depend gpuNUFFT copy_files
clean:
$(RM) *.o $(addprefix "$(gpuNUFFT_DIR)/bin/", $(gpuNUFFT_FILES))
find ./gpuNUFFT-2.0.6rc2 -name CMakeCache.txt -delete
# the following command works correctly but prints error messages to stdout. We squash them
find ./gpuNUFFT-2.0.6rc2 -type d -name CMakeFiles -exec rm -r {} \;
distclean: clean
$(RM) $(BINARY)