-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
78 lines (62 loc) · 1.49 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
# This makefile is only used to build unit tests for the pure C++
# code in this library - the main build uses setup.py.
# For an optimized, stripped build, use:
#
# $ make OPTIMIZE=-O3 SYMBOLS=""
#
# For a C++14 build, use:
#
# $ make COMPILER=g++-5 STDLIB=c++14
#
# Optional command line arguments:
# see http://stackoverflow.com/a/24264930/43839
#
OPTIMIZE ?= -O0
STDLIB ?= c++11
SYMBOLS ?= -g
#
# Compilation variables.
#
CODE_GENERATION = $(OPTIMIZE) $(SYMBOLS) -std=$(STDLIB) -pthread
DEPENDENCIES = -MMD -MP -MF
INCLUDES = -Isrc/cpp
LIBRARIES = -lm -lstdc++
WARNINGS = -Wall -Wextra -Wno-strict-aliasing -Wpedantic
DEFINES = -DDEBUG -DCATCH_CONFIG_COLOUR_NONE
CXXFLAGS_BASE += \
$(CODE_GENERATION) \
$(DEFINES) \
$(INCLUDES) \
$(LIBRARIES) \
$(WARNINGS) \
$(DEPENDENCIES)
CXXFLAGS = $(CXXFLAGS_BASE) $(DEPENDENCIES)
CXXFLAGS_TEST = $(CXXFLAGS_BASE)
BINARIES = build/tests
OBJ = build/obj
DIRECTORIES = build $(OBJ) build/.deps
# Full build and test commands on my machine:
#
# $ source /development/env/cython/bin/activate && \
# rm -Rf build *.so && \
# python setup.py clean && \
# python setup.py build_ext && \
# make && \
# build/tests
#
#
# Build rules
#
.PHONY: all binaries
.SUFFIXES:
.SECONDARY:
all: binaries
pre-build:
mkdir -p $(DIRECTORIES)
binaries: pre-build
@$(MAKE) --no-print-directory $(BINARIES)
build/%: src/cpp/%.cpp
$(CXX) -o $@ $< $(CXXFLAGS) build/.deps/$*.d
clean:
rm -Rf $(DIRECTORIES)
-include build/.deps/*.d