-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (64 loc) · 1.76 KB
/
Makefile
File metadata and controls
82 lines (64 loc) · 1.76 KB
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
CC = clang-7
CXX = clang++-7
PYTHON_INCLUDES=$(shell python3.7-config --includes)
INCLUDE = $(PYTHON_INCLUDES)
#FLAGS = -fno-strict-aliasing
#FLAGS += -fno-common
FLAGS = -g
FLAGS += -O3
FLAGS += -Wall
FLAGS += -Wextra
FLAGS += -pipe
FLAGS += -pedantic
FLAGS += -ferror-limit=2
FLAGS += -Wunused-command-line-argument
#FLAGS += -fprofile-use
#FLAGS += -fprofile-generate
#FLAGS += -fprofile-dir=/tmp/gcc-prof
CYTHON = cython
CYTHON_FLAGS = -Wextra
CYTHON_FLAGS += --cplus
CYTHON_FLAGS += -3
ifeq ($(shell uname), Darwin)
LFLAGS += -bundle
LFLAGS += -undefined dynamic_lookup
LFLAGS += -arch x86_64
LFLAGS += -Wl,-F.
else
LFLAGS += -shared
LFLAGS += -g
LFLAGS += -O3
#LFLAGS += -pthread
LFLAGS += -Wl,-O0
# LFLAGS += -Wl,-Bsymbolic-functions
# LFLAGS += -Wl,-z,relro
FLAGS += -fPIC
endif
CPPFLAGS = $(FLAGS)
CPPFLAGS += -std=c++2a
#CPPFLAGS += -stdlib=libc++
#CPPFLAGS += --analyze
#LFLAGS += -lasan
#LFLAGS += -lubsan
#CPPFLAGS += -fsanitize=address
#CPPFLAGS += -O0
#CPPFLAGS += -fno-omit-frame-pointer
#CYTHON_FLAGS += --gdb
#2CYTHON_FLAGS += --gdb-outdir .
.PHONY: test
default: suffix_array.so
src/%.o: src/%.cpp src/*.hpp Makefile
$(CXX) $(CPPFLAGS) $(INCLUDE) -c $< -o $@
src/suffix_array.cpp: src/suffix_array.pyx src/suffix_array.pxd
cython $(CYTHON_FLAGS) $< -o $@
suffix_array.so: src/suffix_array.o
$(shell mkdir -p build)
$(CXX) $(CPPFLAGS) $(LFLAGS) $(INCLUDE) $^ -o $@
test: suffix_array.so test/test_basics.py
PYTHONPATH=./build/ py.test -s -- test/test_basics.py
install: suffix_array.so
cp suffix_array.so $(shell python -c 'import suffix_array; print(suffix_array.__file__)')
clean:
rm -rf suffix_array.so src/*.o build/ src/suffix_array.cpp
analyze:
/opt/local/libexec/llvm-3.5/libexec/scan-build/scan-build -enable-checker alpha -analyze-headers -V make -j