-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
160 lines (130 loc) · 3.82 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
.SILENT:
.PHONY: all protobuf tags lint python codegen debug release cpp-test unit-test bootstrap h4-test sk-test skj-test skja-test skrj-test batch-test small-test test big-test sk skj skja skrj profile clean FORCE
THEORY = skrj
# File lists for linting and formatting.
PY_FILES := *.py $(shell find src -not -wholename 'src/third_party/*' \
-name '*.py' \
-not -name '*_pb2.py')
CPP_FILES := $(shell find src -not -wholename 'src/third_party/*' \
-regex '.*\.[ch]pp$$' \
-not -name '*.pb.*')
all: data/blob bootstrap FORCE
$(MAKE) python
$(MAKE) -C src/language
$(MAKE) codegen codegen-summary debug release
echo-py-files: FORCE
echo $(PY_FILES)
echo-cpp-files: FORCE
echo $(CPP_FILES)
protobuf: FORCE
$(MAKE) -C src protobuf
tags: protobuf FORCE
cd src ; ctags -R
cd src ; cscope -bcqR
clang-ctags:
mkdir -p build/tags
cd build/tags && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ../..
clang-ctags --output src/tags \
--compile-commands build/tags build/tags/compile_commands.json
lint: FORCE
# TODO Use clang-tidy.
$(info flake8)
@flake8 --jobs auto --ignore=E402 $(PY_FILES)
clang-format: FORCE
$(info clang-format)
@clang-format -i --style="{BasedOnStyle: Google, IndentWidth: 4}" \
$(CPP_FILES)
pyformat: FORCE
$(info pyformat)
@pyformat --jobs 0 --aggressive --in-place $(PY_FILES)
format: clang-format pyformat FORCE
python: protobuf lint FORCE
pip install -e .
codegen: FORCE
python -m pomagma.compiler batch-compile
codegen-summary: FORCE
python -m pomagma.compiler batch-extract-tasks
CMAKE = cmake
ifdef CC
CMAKE += -DCMAKE_C_COMPILER=$(shell which $(CC))
endif
ifdef CXX
CMAKE += -DCMAKE_CXX_COMPILER=$(shell which $(CXX))
endif
debug: protobuf FORCE
mkdir -p build/debug
cd build/debug \
&& $(CMAKE) -DCMAKE_BUILD_TYPE=Debug ../.. \
&& $(MAKE)
release: protobuf FORCE
mkdir -p build/release
cd build/release \
&& $(CMAKE) -DCMAKE_BUILD_TYPE=RelWithDebInfo ../.. \
&& $(MAKE)
DEBUG_LOG="$(shell pwd)/data/debug.log"
cpp-test: debug FORCE
rm -f $(DEBUG_LOG)
POMAGMA_LOG_FILE=$(DEBUG_LOG) \
CTEST_OUTPUT_ON_FAILURE=1 $(MAKE) -C build/debug test \
|| { cat $(DEBUG_LOG); exit 1; }
unit-test: all bootstrap FORCE
./vet.py check || { ./diff.py codegen; exit 1; }
POMAGMA_DEBUG=1 py.test -v --nbval --ignore=pomagma/third_party pomagma
$(MAKE) cpp-test
POMAGMA_DEBUG=1 pomagma.make profile-misc
pomagma.make profile-misc
data/blob:
mkdir -p data/blob
bootstrap: FORCE
mkdir -p data
cp -Rn bootstrap/* data/ \
|| test -e data/atlas/$(THEORY)/region.normal.2047.pb
cd data/atlas/$(THEORY) \
&& (test -e world.pb || ln region.normal.2047.pb world.pb) \
&& test -e world.normal.pb || ln region.normal.2047.pb world.normal.pb
h4-test: all FORCE
POMAGMA_DEBUG=1 pomagma.make test-atlas h4
sk-test: all FORCE
POMAGMA_DEBUG=1 pomagma.make test-atlas sk
skj-test: all FORCE
POMAGMA_DEBUG=1 pomagma.make test-atlas skj
skja-test: all FORCE
POMAGMA_DEBUG=1 pomagma.make test-atlas skja
skrj-test: all FORCE
POMAGMA_DEBUG=1 pomagma.make test-atlas skrj
batch-test: all FORCE
POMAGMA_DEBUG=1 pomagma.make test-atlas
small-test: all FORCE
$(MAKE) unit-test
$(MAKE) h4-test
@echo '----------------'
@echo 'PASSED ALL TESTS'
test: all FORCE
$(MAKE) unit-test
$(MAKE) batch-test
@echo '----------------'
@echo 'PASSED ALL TESTS'
big-test: test FORCE
$(MAKE) unit-test
$(MAKE) batch-test
POMAGMA_DEBUG=1 pomagma.make test-analyst
@echo '----------------'
@echo 'PASSED ALL TESTS'
h4: all
pomagma make h4
sk: all
pomagma make sk
skj: all
pomagma make skj
skja: all
pomagma make skja
skrj: all
pomagma make skrj
profile: release
pomagma.make profile-misc
# pomagma.make profile-surveyor
# pomagma.make profile-cartographer
clean: FORCE
rm -rf build lib
git clean -fdx -e pomagma.egg-info -e node_modules -e data
FORCE: