-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
250 lines (204 loc) · 6.46 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
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# Makefile for Speculate
#
# Copyright: (c) 2015-2024 Rudy Matela
# License: 3-Clause BSD (see the file LICENSE)
# Maintainer: Rudy Matela <rudy@matela.com.br>
GHCIMPORTDIRS = src:eg:test
GHCFLAGS = -O2 -v0 \
$(shell grep -q "Arch Linux" /etc/lsb-release && echo -dynamic -package cmdargs -package regex-tdfa -package algebraic-graphs)
# -Wall -Wno-name-shadowing -Wno-orphans -Wno-unused-matches
# -prof -auto-all #-caf-all
# When profiling is enabled, to get the cost centres with more than 6% time:
# $ ./eg/arith +RTS -p -RTS
# $ cat arith.prof | grep -v ' [0-5].[0-9] ......$'
HADDOCKFLAGS = \
$(shell grep -q "Arch Linux" /etc/lsb-release && echo --optghc=-dynamic --optghc=-package=cmdargs --optghc=-package=regex-tdfa --optghc=-package=algebraic-graphs)
MAXTESTS = 4000
MAXSIZE = -s4
# Sets the number of jobs to the the number of processors minus one.
NJOBS := $(shell grep ^processor /proc/cpuinfo | head -n -1 | wc -l | sed 's/^0$$/1/')
LONG := $(shell which long >/dev/null 2>/dev/null && echo long)
TESTS = \
test/creason \
test/engine \
test/eval \
test/expr \
test/order \
test/reason \
test/utils
EG = \
eg/arith \
eg/arith-negate-abs \
eg/bool \
eg/binarytree \
eg/binarytree0 \
eg/colour \
eg/digraphs \
eg/fun \
eg/list \
eg/length \
eg/zip \
eg/minus \
eg/insertsort \
eg/insertsort0 \
eg/string \
eg/oddeven \
eg/plus-abs \
eg/ratio \
eg/sets \
eg/tauts \
eg/monad \
eg/tuples \
eg/speculate-reason \
bench/addition \
bench/arithficial \
bench/lowtests \
bench/nord \
bench/trilean \
bench/unit \
bench/stats
EXTRAEG = \
eg/pretty \
eg/regexes \
eg/algebraic-graphs
# regexes needs regex-tdfa, which may break the build
# speculate-reason output differs in different GHC versions
QUICKTESTS = \
test/engine \
test/eval \
test/expr \
test/order \
test/reason
QUICKEG = \
eg/arith \
eg/bool \
eg/list
BENCH = $(EG) $(wildcard bench/*-t) $(wildcard bench/*-c)
LIST_ALL_HSS = find src test eg bench/*.hs mk -name \*.hs | grep -vE 'eg/(regexes|pretty-compact|algebraic-graphs)'
LIST_LIB_HSS = find src -name \*.hs
LIB_DEPS = base template-haskell $(INSTALL_DEPS)
INSTALL_DEPS = leancheck express cmdargs containers
all: mk/toplibs
test: all test-sdist $(patsubst %,%.run,$(TESTS)) diff-test
test-with-extra-deps: test diff-test-extra
txt: $(patsubst %,%.txt,$(BENCH))
diff-test: $(patsubst %,%.diff,$(BENCH))
# Disclaimer: This bench target is not intended to generate paper-grade runtime
# datapoints as it runs each benchmark just once. This target is
# meant to track large runtime changes across different git
# versions.
.PHONY: bench
bench: $(EG) $(patsubst %,%.bench,$(BENCH))
@mkdir -p bench/runtime/$$HOSTNAME
./bench/versions $(INSTALL_DEPS) | tee bench/runtime/$$HOSTNAME/versions
txt-extra: $(EXTRAEG) $(patsubst %,%.txt,$(EXTRAEG))
diff-test-extra: $(EXTRAEG) $(patsubst %,%.diff,$(EXTRAEG))
test-sdist:
./test/sdist
test-via-cabal:
cabal configure --enable-tests --enable-benchmarks --ghc-options="$(GHCFLAGS) -O0"
cabal build
cabal test engine
test-via-stack:
stack test speculate:test:engine --ghc-options="$(GHCFLAGS) -O0" --system-ghc --no-install-ghc --no-terminal
fastest:
$(LONG) make test -j$(NJOBS)
fastestbench:
$(LONG) make test -j$(NJOBS) && $(LONG) make bench
fastxtestbench:
$(LONG) make txt -j$(NJOBS) && $(LONG) make test -j$(NJOBS) && $(LONG) make bench
legacy-test:
make clean && make -j8 GHC=ghc-8.2 && make quick-test -j8 GHC=ghc-8.2
make clean && make -j8 GHC=ghc-8.0 && make quick-test -j8 GHC=ghc-8.0
make clean && make -j8 GHC=ghc-7.10 && make quick-test -j8 GHC=ghc-7.10
make clean && make -j8 GHC=ghc-7.8 && make quick-test -j8 GHC=ghc-7.8
make clean && make -j8 && make slow-test -j8
legacy-test-via-cabal:
cabal clean && cabal-ghc-8.2 configure && cabal-ghc-8.2 test
cabal clean && cabal-ghc-8.0 configure && cabal-ghc-8.0 test
cabal clean && cabal-ghc-7.10 configure && cabal-ghc-7.10 test
cabal clean && cabal-ghc-7.8 configure && cabal-ghc-7.8 test
cabal clean && cabal test
prepare:
cabal v1-install cmdargs leancheck express regex-tdfa algebraic-graphs pretty-compact
prepare-legacy-test: \
prepare-legacy-test-8.2 \
prepare-legacy-test-8.0 \
prepare-legacy-test-7.10 \
prepare-legacy-test-7.8
prepare-legacy-test-8.2:
cabal-ghc-8.2 update
cabal-ghc-8.2 --ignore-sandbox install cmdargs leancheck
prepare-legacy-test-8.0:
cabal-ghc-8.0 update
cabal-ghc-8.0 --ignore-sandbox install cmdargs leancheck
prepare-legacy-test-7.10:
cabal-ghc-7.10 update
cabal-ghc-7.10 --ignore-sandbox install cmdargs-0.10.17 leancheck
prepare-legacy-test-7.8:
cabal-ghc-7.8 update
cabal-ghc-7.8 --ignore-sandbox install cmdargs-0.10.17 leancheck
slow-test: MAXTESTS =
slow-test: MAXSIZE =
slow-test: test
%.run: %
./$< $(MAXTESTS)
%.txt: %
./$< >$<.txt
%.diff: %
./$< | diff -rud $<.txt -
bench/%-c: eg/%
touch $@
bench/%-t: eg/%
touch $@
%.bench: %
@mkdir -p bench/runtime/$$HOSTNAME/`dirname $<`
@printf "%-20s " $<
@/usr/bin/time -f%e ./$< 2>&1 >/dev/null | \
tee bench/runtime/$$HOSTNAME/$<.runtime
update-listable-expr:
cp -rav ../express/test/Test/ListableExpr.hs test/Test/
ghci: test/Test.ghci
clean: clean-hi-o clean-haddock
rm -f $(TESTS) $(EG) eg/*.dot eg/*.pdf TAGS tags mk/toplibs mk/Toplibs.{o,hi}
rm -f doc/*.html doc/*.gif doc/*.css doc/*.js doc/*.png
test/Test.o: src/Test/Speculate.o
# NOTE: (very hacky!) the following target allows parallel compilation (-jN) of
# eg and tests programs so long as they don't share dependencies _not_ stored
# in src/ and test/. Runnable binaries should depend on mk/toplibs instead of
# actual Haskell source files
mk/toplibs: mk/Toplibs.o
touch mk/toplibs
hlint: ..hlint
test.hlint: HLINT_EXTRA = --ignore "Redundant ==" \
--ignore "Redundant lambda" \
--ignore "Use null" \
--ignore "Redundant $$" \
--ignore "Use >" \
--ignore "Use isNothing"
%.hlint:
hlint $(HLINT_EXTRA) \
--ignore "Use import/export shortcut" \
--ignore "Use lambda-case" \
--ignore "Use typeRep" \
--ignore "Use tuple-section" \
$*
.PHONY: tags
tags:
hasktags src
include mk/haskell.mk
%-3.dot: %
./$< -gv3 > $@
%.dot: %
./$< -gv2 > $@
%-2.dot: %
./$< -gv2 > $@
%-1.dot: %
./$< -gv1 > $@
%.eps: %.dot
dot -Teps $< > $@
%.pdf: %.eps
epstopdf $<
.PHONY: %.view
%.view: %.pdf
o $<