-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
56 lines (36 loc) · 1.44 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
CC = g++
LD = g++
NVCC = nvcc
# The following python variables MUST be updated for YOUR system if you wish to compile the c++ test routines
# ... Most people will not want to do this. It is intended for development
PYPATH = /Library/Frameworks/Python.framework/Versions/3.7
PYINCLUDE = $(PYPATH)/include/python3.7m
PYLIBDIR = $(PYPATH)/lib
PYLIB = python3.7m
# CUDA Objects for the nvcc compiler
CUDAOBJS = $(patsubst src/%.cu,lib/%.o,$(wildcard src/*.cu))
CUDACFLAGS = -DCUDA -cudart static -std=c++11 -shared --compiler-options '-fPIC'
# Flags for the c++ compiler
CFLAGS = -std=c++11 -fPIC -I$(PYINCLUDE) -Wall -pedantic
LDFLAGS = -L$(PYLIBDIR) -l$(PYLIB) -O3
# c++ exe file names taken from what is in directories
EXECS = $(patsubst exe/%.cc,bin/%,$(wildcard exe/*.cc))
EXEOBJS = $(patsubst exe/%.cc,lib/%.o,$(wildcard exe/*.cc))
# c++ objects based on filenames
OBJS = $(patsubst src/%.cc,lib/%.o,$(wildcard src/*.cc))
# Include the local include directory
INCLUDE = -Iinclude
# For normal compilation only compile the CUDA libraries
all: $(CUDAOBJS)
# Make "test" to compile the test execs into the bin directory
test: $(OBJS) $(EXEOBJS) $(EXECS)
lib/%.o : src/%.cu
$(NVCC) $(CUDACFLAGS) $(INCLUDE) -c $< -o $@
lib/%.o : src/%.cc
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
lib/%.o : exe/%.cc
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
bin/% : lib/%.o $(OBJS)
$(LD) $(LDFLAGS) $(OBJS) $< -o $@
clean:
rm -f $(CUDAOBJS) $(EXEOBJS) $(OBJS) $(EXECS)