forked from sean-dougherty/accneat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
86 lines (66 loc) · 2.05 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
include Makefile.conf
CC_CUDA=nvcc -DENABLE_CUDA ${NVCC_FLAGS} -arch=sm_13 --compiler-bindir ${PFM_NVCC_CCBIN} -Xcompiler "${OPT} ${INCLUDES} ${OPENMP}"
INCLUDES=$(patsubst %,-I%,$(shell find src -type d))
SOURCES=$(shell find src -name "*.cpp")
CXX_SOURCES=$(shell find src -name "*.cxx")
OBJECTS=${SOURCES:src/%.cpp=obj/cpp/%.o}
LIBS=-lgomp
DEFINES=
ifeq (${ENABLE_CUDA}, true)
CUDA_SOURCES=$(shell find src -name "*.cu")
CUDA_OBJECTS=${CUDA_SOURCES:src/%.cu=obj/cu/%.o}
CUDA_OBJECTS+=${CXX_SOURCES:src/%.cxx=obj/cu/cxx/%.o}
LIBS+=-lcudart
DEFINES+=-DENABLE_CUDA
else
OBJECTS+=${CXX_SOURCES:src/%.cxx=obj/cpp/cxx/%.o}
endif
DEPENDS=${OBJECTS:%.o=%.d}
DEPENDS+=${CUDA_OBJECTS:%.o=%.d}
ifeq (${DEVMODE}, true)
OPT=-O0
#OPENMP=-fopenmp
MISC_FLAGS=
NVCC_FLAGS=-G -g
else
OPT=-O3
OPENMP=-fopenmp
MISC_FLAGS=-Werror
endif
CC_FLAGS=-Wall ${DEFINES} ${MISC_FLAGS} ${PROFILE} ${INCLUDES} ${OPENMP} ${OPT} -c -g -gdwarf-3
.PHONY: clean default
default: ./neat
clean:
rm -rf obj
rm -f ./neat
rm -f src/util/std.h.gch
./neat: ${OBJECTS} ${CUDA_OBJECTS}
g++ ${PROFILE} ${OBJECTS} ${CUDA_OBJECTS} ${PFM_LD_FLAGS} ${LIBS} -o $@
src/util/std.h.gch: src/util/std.h Makefile.conf Makefile
g++ ${CC_FLAGS} -std=c++11 $< -o $@
ifeq (${ENABLE_CUDA}, true)
obj/cu/cxx/%.o: src/%.cxx Makefile.conf Makefile
@mkdir -p $(shell dirname $@)
${CC_CUDA} -c -x cu $< -o $@
obj/cu/cxx/%.d: src/%.cxx
@mkdir -p $(dir $@)
@${CC_CUDA} -M -x cu $< > [email protected]
@cat [email protected] | sed 's,.*\.o[[:space:]]*:,$@:,g' | sed 's,\.d,\.o,' > $@
obj/cu/%.o: src/%.cu Makefile.conf Makefile
@mkdir -p $(shell dirname $@)
${CC_CUDA} -c $< -o $@
obj/cu/%.d: src/%.cu
@mkdir -p $(dir $@)
@${CC_CUDA} -M $< > [email protected]
@cat [email protected] | sed 's,.*\.o[[:space:]]*:,$@:,g' | sed 's,\.d,\.o,' > $@
else
obj/cpp/cxx/%.o: src/%.cxx Makefile.conf Makefile
@mkdir -p $(shell dirname $@)
g++ ${CC_FLAGS} -std=c++98 -MMD $< -o $@
endif
obj/cpp/%.o: src/%.cpp Makefile.conf Makefile src/util/std.h.gch
@mkdir -p $(shell dirname $@)
g++ ${CC_FLAGS} -std=c++11 -MMD $< -o $@
-include ${DEPENDS}