-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
193 lines (146 loc) · 5.31 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
# Makefile for Extrapolate
#
# Copyright: (c) 2015-2019 Rudy Matela
# License: 3-Clause BSD (see the file LICENSE)
# Maintainer: Rudy Matela <rudy@matela.com.br>
TESTS = \
test/derive \
test/utils \
test/step-by-step \
test/extrapolate
QUICKEG = \
eg/sorting \
eg/int \
eg/list \
eg/calculator \
eg/gencalc \
eg/parser \
eg/heap \
eg/ratio \
eg/redblack \
eg/word-refinements
EG = \
bench/true \
bench/false \
bench/eq \
bench/diff \
bench/ord \
eg/overflow \
eg/overflow8 \
$(QUICKEG)
GHCIMPORTDIRS = src:test:eg
GHCEXTRAFLAGS = #-prof -fprof-auto #-caf-all
# When profiling is enabled, to get the cost centres with more than 6% time:
# $ ./eg/sorting +RTS -p -RTS
# $ cat sorting.prof | grep -v ' [0-5].[0-9] ......$'
GHCFLAGS = -O2 \
$(GHCEXTRAFLAGS) \
$(shell grep -q "Arch Linux" /etc/lsb-release && echo -dynamic)
# -Wall -Wno-name-shadowing -Wno-orphans -Wno-unused-matches
HADDOCKFLAGS = \
$(shell grep -q "Arch Linux" /etc/lsb-release && echo --optghc=-dynamic)
LIST_ALL_HSS = find src test mk eg/*.hs bench/*.hs -name "*.hs"
LIB_DEPS = base $(INSTALL_DEPS)
INSTALL_DEPS = leancheck express speculate template-haskell transformers
all: mk/toplibs
all-all: mk/All.hs
test: $(patsubst %,%.run,$(TESTS)) diff-test test-sdist
diff-test: $(patsubst %,%.diff-test,$(EG))
quick-test: $(patsubst %,%.run,$(TESTS)) quick-diff-test test-sdist
quick-diff-test: $(patsubst %,%.diff-test,$(QUICKEG))
update-diff-test: $(patsubst %,%.update-diff-test,$(EG))
egs: $(EG)
%.run: %
./$<
%.diff-test: %
./$< | diff -rud test/model/$<.out -
%.update-diff-test: %
./$< > test/model/$<.out
test-sdist:
./test/sdist
test-via-cabal:
cabal configure --enable-tests --enable-benchmarks --ghc-options="$(GHCFLAGS) -O0"
cabal build
cabal test test
test-via-stack:
stack test extrapolate:test:test --ghc-options="$(GHCFLAGS) -O0" --system-ghc --no-install-ghc --no-terminal
.PHONY: bench
bench: $(patsubst %,%.bench,$(EG))
@mkdir -p bench/runtime/$$HOSTNAME
./bench/versions | tee bench/runtime/$$HOSTNAME/versions
.PHONY: %.bench
%.bench: %
@mkdir -p bench/runtime/$$HOSTNAME
@printf "%-18s " $<
@/usr/bin/time -f%e ./$< 2>&1 >/dev/null | tee bench/runtime/$$HOSTNAME/$<.runtime
clean: clean-hi-o clean-haddock
rm -f $(TESTS) $(EG) mk/toplibs
rm -f eg/redblack-*-bug* eg/RedBlackSet*Bug.*
ghci: mk/All.ghci
ghci-test: test/Test.ghci
ghci-7.10: GHC=ghc-7.10
ghci-7.10: mk/All.ghci
ghci-7.8: GHC=ghc-7.8
ghci-7.8: mk/All.ghci
install:
@echo "use \`cabal install' instead"
legacy-test: # needs ghc-8.2 .. ghc-7.8 installed as such
make clean && make test -j8 GHC=ghc-8.2 GHCFLAGS="-Werror -dynamic"
make clean && make test -j8 GHC=ghc-8.0 GHCFLAGS="-Werror -dynamic"
make clean && make test -j8 GHC=ghc-7.10 GHCFLAGS="-Werror -dynamic"
make clean && make test -j8 GHC=ghc-7.8 GHCFLAGS="-Werror -dynamic"
make clean && make test -j8
legacy-test-via-cabal: # needs similarly named cabal wrappers
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-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 --ignore-sandbox install leancheck speculate
prepare-legacy-test-8.0:
cabal-ghc-8.0 --ignore-sandbox install leancheck speculate
prepare-legacy-test-7.10:
cabal-ghc-7.10 --ignore-sandbox install leancheck speculate
prepare-legacy-test-7.8:
cabal-ghc-7.8 --ignore-sandbox install leancheck speculate
hlint:
hlint \
--ignore "Use import/export shortcut" \
--ignore "Redundant bracket" \
src eg/sorting.hs eg/list.hs eg/word-refinements.hs
markdown:
pandoc README.md -o README.html
# NOTE: (very hacky!) the following target allows parallel compilation (-jN) of
# eg and test 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
include mk/haskell.mk
eg/RedBlackSetRemoveBug.hspp: eg/RedBlackSet.hs
$(GHCCMD) -DREMOVE_BUG -E $< -o $@
eg/RedBlackSetRemoveBug.hs: eg/RedBlackSetRemoveBug.hspp
sed -e "s/module RedBlackSet/&RemoveBug/" $< > $@
eg/redblack-remove-bug.hs: eg/redblack.hs
sed -e "s/import RedBlackSet/&RemoveBug/" $< > $@
eg/redblack-remove-bug: eg/redblack-remove-bug.hs eg/RedBlackSetRemoveBug.hs mk/toplibs
eg/RedBlackSetDeleteBug.hspp: eg/RedBlackSet.hs
$(GHCCMD) -DDELETE_BUG -E $< -o $@
eg/RedBlackSetDeleteBug.hs: eg/RedBlackSetDeleteBug.hspp
sed -e "s/module RedBlackSet/&DeleteBug/" $< > $@
eg/redblack-delete-bug.hs: eg/redblack.hs
sed -e "s/import RedBlackSet/&DeleteBug/" $< > $@
eg/redblack-delete-bug: eg/redblack-delete-bug.hs eg/RedBlackSetDeleteBug.hs mk/toplibs
eg/RedBlackSetBalanceBug.hspp: eg/RedBlackSet.hs
$(GHCCMD) -DBALANCE_BUG -E $< -o $@
eg/RedBlackSetBalanceBug.hs: eg/RedBlackSetBalanceBug.hspp
sed -e "s/module RedBlackSet/&BalanceBug/" $< > $@
eg/redblack-balance-bug.hs: eg/redblack.hs
sed -e "s/import RedBlackSet/&BalanceBug/" $< > $@
eg/redblack-balance-bug: eg/redblack-balance-bug.hs eg/RedBlackSetBalanceBug.hs mk/toplibs