-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
130 lines (98 loc) · 2.8 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
.SECONDEXPANSION:
VER_MAJOR := 0
VER_MINOR := 0
VER_PATCH := 1
CC := clang
CXX := clang++
AS := $(CC)
LD := $(CC)
AR := ar
RB := ruby
CMAKE := cmake
TIDY := clang-tidy
MKDIR := mkdir
LN := ln
RM := rm
TOUCH := touch
PYTHON := python3
PYTEST := pytest
PYLINT := pylint
root := $(abspath $(CURDIR))
builddir := $(root)/build
dirs += $(builddir)
srcdir := $(root)/lib
scripts := $(root)/scripts
mkscripts := $(scripts)/mk
pyscripts := $(scripts)/py
TIDYFLAGS = --warnings-as-errors=* --checks=$(tidychecks)
MKDIRFLAGS := -p
LNFLAGS := -sf
RMFLAGS := -rf
TOUCHFLAGS :=
PYTESTFLAGS := -v
PYLINTFLAGS := --fail-under=10.0 --rcfile $(pyscripts)/.pylintrc --score=n
submodules := submodules/.init.stamp
scc := scc
.PHONY: all
all:
include $(wildcard $(mkscripts)/*.mk)
ASFLAGS := -c -MD -MP $(__debug_info)
CFLAGS := -std=c99 -c -MD -MP -Wall -Wextra -Wpedantic -Waggregate-return \
-Wbad-function-cast -Wcast-qual -Wfloat-equal -Wmissing-include-dirs \
-Wnested-externs -Wpointer-arith -Wshadow -Wunknown-pragmas -Wswitch \
-Wundef -Wunused -Wwrite-strings -fPIC $(__debug_info)
CXXFLAGS := -std=c++17 -c -MD -MP -Wall -Wextra -Wpedantic $(__debug_info)
CPPFLAGS += -I$(root) -DNDEBUG
LDFLAGS := -fPIC
LDLIBS :=
ARFLAGS := -rcs
sover := $(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)
socompat := $(VER_MAJOR)
solink := $(builddir)/lib$(scc).$(soext)
solinkcompat := $(solink).$(VER_MAJOR)
solib := $(solink).$(sover)
alib := $(builddir)/lib$(scc).$(aext)
.PHONY: all
all: $(alib) $(solink)
$(call include-node,arch)
$(call include-node,scc)
$(call include-node,submodules)
$(call include-node,lib)
$(call include-node,test)
$(call include-node,docs)
$(call include-node,benchmark)
$(dirs):
$(MKDIR) $(MKDIRFLAGS) $@
.PHONY: benchmark
benchmark: CFLAGS += -O3
benchmark: CXXFLAGS += -O3
.PHONY: check
check: CPPFLAGS := $(filter-out -DNDEBUG,$(CPPFLAGS))
check: $(alib) $(solib)
lit -vv --config-prefix=.lit $(root) -o $(builddir)/lit.json
.PHONY: fuzz
fuzz: CPPFLAGS := $(filter-out -DNDEBUG,$(CPPFLAGS))
.PHONY: mutate
mutate: CPPFLAGS := $(filter-out -DNDEBUG,$(CPPFLAGS))
.PHONY: lint
lint:
.PHONY: clean
clean:
$(RM) $(RMFLAGS) $(builddir)
.PHONY: distclean
distclean: clean
.PHONY: docs
docs:
tags: FORCE
$(call echo-gen,$@)
$(CTAGS) $(CTAGSFLAGS)
FORCE:
.PHONY: docker-image
docker-image:
.PHONY: docker
docker:
$(VERBOSE).SILENT:
$(__all_obj): $(config_header)
$(__all_obj): $(__all_mkfiles) $(wildcard $(mkscripts)/*.$(mkext))
$(__all_obj): $(config_stamp)
-include $(patsubst %.$(oext),%.$(dext),$(__all_obj))