forked from cuter-testing/cuter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
232 lines (183 loc) · 5.55 KB
/
Makefile.in
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
.PHONY: depend dialyzer clean cleandep distclean all utest ftest test suite
SHELL := /bin/bash
###----------------------------------------------------------------------
### Orientation information
###----------------------------------------------------------------------
SRC = src
INCLUDE = include
EBIN = ebin
PRIV = $(PWD)/priv
TEST = test
UTEST_SRC = $(TEST)/utest/src
UTEST_EBIN = $(TEST)/utest/ebin
FTEST_SRC = $(TEST)/ftest/src
FTEST_EBIN = $(TEST)/ftest/ebin
LIB = $(PWD)/lib
ERLC = @ERLC@
MECK = $(realpath @MECK@)
PROPER = $(realpath @PROPER@)
GPB = $(realpath @GPB@)
PROTOC-ERL = $(GPB)/bin/protoc-erl
GPB_INCLUDE = $(GPB)/include
PROTOC=@PROTOC_PATH@
###----------------------------------------------------------------------
### Set Environment Variables
###----------------------------------------------------------------------
export ERL_LIBS := $(PROPER):$(MECK):$(GPB):$$ERL_LIBS
###----------------------------------------------------------------------
### Flags
###----------------------------------------------------------------------
DIALYZER_APPS = erts kernel stdlib compiler crypto hipe syntax_tools
DIALYZER_FLAGS = -Wunmatched_returns
WARNS = +warn_exported_vars +warn_unused_import +warn_missing_spec #+warn_untyped_record
WARNS_FTEST = +warn_exported_vars +warn_unused_import #+warn_missing_spec +warn_untyped_record
ERLC_INCLUDE = -I $(INCLUDE) -I $(GPB_INCLUDE)
ERLC_FLAGS = +debug_info $(WARNS)
#-Werror
ERLC_FLAGS_PROTOBUFS = +debug_info $(WARNS_FTEST) -Werror
ERLC_FLAGS_FTEST = +debug_info $(WARNS_FTEST) -Werror
ERLC_FLAGS_NO_DBG = $(WARNS) -Werror
ERLC_MACROS = -DEBIN=\"$(PWD)/$(EBIN)\" -DPYTHON_PATH=\"@PYTHON_PATH@\" -DPRIV=\"$(PRIV)\"
HRL_FILES = \
cuter_macros \
eunit_config
SRC_MODULES = \
cuter_binlib \
cuter_lib \
cuter \
cuter_codeserver \
cuter_cerl \
cuter_monitor \
cuter_log \
cuter_iserver \
cuter_eval \
cuter_symbolic \
cuter_mock \
cuter_env \
cuter_erlang \
cuter_pp \
cuter_scheduler_maxcover \
cuter_analyzer \
cuter_solver \
cuter_merger \
cuter_types \
cuter_minheap \
cuter_poller \
cuter_debug \
cuter_callgraph \
cuter_serial \
cerl_pmatch
UTEST_MODULES = \
cuter_tests_lib \
cuter_tests \
cuter_codeserver_tests \
cuter_cerl_tests \
cuter_monitor_tests \
cuter_iserver_tests \
cuter_eval_tests \
cuter_solver_tests \
cuter_erlang_tests \
cuter_types_tests \
cuter_serial_tests \
cuter_pp_tests \
types_and_specs \
types_and_specs2
FTEST_MODULES = \
bitstr \
whitelist \
otp_int \
complex_spec \
no_debug_info \
collection \
funs \
sum
PRIV_MODULES = \
cuter_io \
cuter_z3 \
cuter_solve_offline \
cuter_representation
PROTOBUFS = \
cuter_proto_erlang_term \
cuter_proto_solver_command \
cuter_proto_solver_response \
cuter_proto_log_entry \
cuter_proto_spec
###----------------------------------------------------------------------
### Targets
###----------------------------------------------------------------------
ERL_DIRS = \
$(SRC) \
$(UTEST_SRC) \
$(FTEST_SRC)
HRL_DIRS = \
$(INCLUDE)
TARGETS = \
cuter_target \
utest_target \
ftest_target
vpath %.erl $(ERL_DIRS)
vpath %.hrl $(HRL_DIRS)
vpath %.proto $(SRC)
vpath %.py $(PRIV)
default: cuter_target
suite: utest_target ftest_target
test: utest ftest
all: $(TARGETS) dialyzer utest ftest
cuter_target: $(SRC_MODULES:%=$(EBIN)/%.beam) $(PROTOBUFS:%=$(EBIN)/%.beam) $(PROTOBUFS:%=$(PRIV)/%_pb2.py)
utest_target: $(UTEST_MODULES:%=$(UTEST_EBIN)/%.beam)
ftest_target: $(FTEST_MODULES:%=$(FTEST_EBIN)/%.beam)
$(PROTOBUFS:%=$(INCLUDE)/%.hrl): $(PROTOBUFS:%=$(SRC)/%.erl)
$(SRC)/%.erl: %.proto
@echo "PROTOC-ERL $(notdir $<)"
@$(PROTOC-ERL) -defaults-for-omitted-optionals -I $(SRC) -o-erl $(SRC) -o-hrl $(INCLUDE) $(notdir $<)
$(PRIV)/%_pb2.py: %.proto
@echo "PROTOC $(notdir $<)"
@$(PROTOC) -I $(SRC) --python_out=$(PRIV) $<
$(EBIN)/%.beam: %.erl
@echo "ERLC $<"
@if [[ "$(PROTOBUFS)" =~ "$(basename $(notdir $<))" ]]; then \
$(ERLC) $(ERLC_INCLUDE) $(ERLC_FLAGS_PROTOBUFS) $(ERLC_MACROS) -o $(EBIN) $<; \
else \
$(ERLC) $(ERLC_INCLUDE) $(ERLC_FLAGS) $(ERLC_MACROS) -o $(EBIN) $<; \
fi
$(UTEST_EBIN)/%.beam: %.erl
@echo "ERLC $<"
@$(ERLC) $(ERLC_INCLUDE) $(ERLC_FLAGS) $(ERLC_MACROS) -o $(UTEST_EBIN) $<
$(FTEST_EBIN)/no_debug_info.beam: no_debug_info.erl
@echo "ERLC $<"
@$(ERLC) $(ERLC_INCLUDE) $(ERLC_FLAGS_NO_DBG) $(ERLC_MACROS) -o $(FTEST_EBIN) $<
$(FTEST_EBIN)/%.beam: %.erl
@echo "ERLC $<"
@$(ERLC) $(ERLC_INCLUDE) $(ERLC_FLAGS_FTEST) $(ERLC_MACROS) -o $(FTEST_EBIN) $<
utest: $(TARGETS)
@(./$(TEST)/eunit_test -e $(EBIN) -u $(UTEST_EBIN) -- $(SRC_MODULES))
@(./$(TEST)/python_test -p $(PRIV) -e $(EBIN) -u $(UTEST_EBIN) -- $(PRIV_MODULES))
@(python $(TEST)/terms.py)
ftest: $(TARGETS)
@(./$(TEST)/functional_test --no=$(no))
z3py-ftest: $(TARGETS)
@(./$(TEST)/functional_test --no=$(no) --z3py)
dialyzer: .plt/.cuter_plt cuter_target
dialyzer --plt $< $(DIALYZER_FLAGS) $(EBIN)/*.beam
.plt/.cuter_plt:
@mkdir -p .plt/
dialyzer --build_plt --output_plt $@ --apps $(DIALYZER_APPS)
-include .depend
depend: cleandep $(SRC_MODULES:%=%.dep) $(HRL_FILES:%=%.hrl)
@echo ""
@echo "To build CutEr, execute:"
@echo " make"
%.dep: %.erl $(PROTOBUFS:%=$(INCLUDE)/%.hrl)
@echo "ERLC -M -MT $<"
@$(ERLC) $(ERLC_INCLUDE) -M -MT $(patsubst $(SRC)/%.erl,$(EBIN)/%.beam,$<) $< >> .depend
clean:
$(RM) $(EBIN)/*.beam
clean_tests:
$(RM) $(UTEST_EBIN)/*.beam $(FTEST_EBIN)/*.beam
cleandep:
$(RM) .depend
cleangen: cleandep cleanprotobufs
$(RM) .plt/.cuter_plt
cleanprotobufs:
$(RM) $(PROTOBUFS:%=$(SRC)/%.erl) $(PROTOBUFS:%=$(INCLUDE)/%.hrl) $(PROTOBUFS:%=$(PRIV)/%_pb2.py)
distclean: clean clean_tests cleangen cleanprotobufs