-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakefile
79 lines (48 loc) · 2.08 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
#CMP = mpic++
#LNK = mpic++
#CXXFLAGS+=-Wall -O3 -std=c++14
#CMP = c++
#LNK = c++
CMP = g++-7
LNK = g++-7
CXXFLAGS+=-Wall -Wno-int-in-bool-context -O2 -march=native -funroll-loops -std=c++14
LDFLAGS= -fopenmp
## debug flags
#CXXFLAGS+=-Wall -Wno-int-in-bool-context -g -std=c++17 -fsanitize=address -fno-omit-frame-pointer
#CXXFLAGS+=-Wall -Wno-int-in-bool-context -g -std=c++17
#LDFLAGS= -lasan -lubsan
#pybind in macOS needs to have these additional flags
PYBINDINCLS= `python2 -m pybind11 --includes`
PYBINDFLAGS=-shared -fPIC -undefined dynamic_lookup
default: pycorgi examples
all: pycorgi
##################################################
# actual compilation & linking rules
pycorgi/corgi.o: corgi.h common.h toolbox/SparseGrid.h pycorgi/corgi.c++
${CMP} ${CXXFLAGS} ${PYBINDINCLS} -o pycorgi/corgi.o -c pycorgi/corgi.c++
pycorgi: pycorgi/corgi.o
${LNK} ${PYBINDFLAGS} ${PYBINDINCLS} ${LDFLAGS} -o pycorgi/corgi.so pycorgi/corgi.o
examples: pycorgi ex1 ex_gol
tests/example.o: tests/example.h tests/example.c++
${CMP} ${CXXFLAGS} ${PYBINDINCLS} -o tests/example.o -c tests/example.c++
tests/bindings.o: tests/bindings.c++
${CMP} ${CXXFLAGS} ${PYBINDINCLS} -o tests/bindings.o -c tests/bindings.c++
ex1: tests/example.o tests/bindings.o
${LNK} ${PYBINDFLAGS} ${PYBINDINCLS} ${LDFLAGS} -o tests/example.so tests/example.o tests/bindings.o
examples/game-of-life/gol.o: examples/game-of-life/gol.c++
${CMP} ${CXXFLAGS} ${PYBINDINCLS} -o examples/game-of-life/gol.o -c examples/game-of-life/gol.c++
examples/game-of-life/pygol.o: examples/game-of-life/pygol.c++
${CMP} ${CXXFLAGS} ${PYBINDINCLS} -o examples/game-of-life/pygol.o -c examples/game-of-life/pygol.c++
ex_gol: examples/game-of-life/gol.o examples/game-of-life/pygol.o
${LNK} ${PYBINDFLAGS} ${PYBINDINCLS} ${LDFLAGS} -o examples/game-of-life/pygol.so examples/game-of-life/pygol.o examples/game-of-life/gol.o
.PHONY: tests
tests:
python2 -m unittest discover -s tests/ -v
.PHONY: clean
clean:
-rm pycorgi/*.o
-rm pycorgi/*.so
-rm tests/*.o
-rm tests/*.so
-rm examples/game-of-life/*.o
-rm examples/game-of-life/*.so