-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
140 lines (118 loc) · 4.12 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
# Makefile for FitSpec
#
# Copyright: (c) 2015-2020 Rudy Matela
# License: 3-Clause BSD (see the file LICENSE)
# Maintainer: Rudy Matela <[email protected]>
#
# This is faster than Cabal:
#
# Time Scratch Already compiled
# Makefile 14s 0s
# Cabal 90s 1s
#
# Cabal tries to "sandbox" the build of every benchmark program
# rebuilding everything for each of those.
# Misc variables
GHCIMPORTDIRS = src:bench
GHCFLAGS = -v0 -O2 \
$(shell grep -q "Arch Linux" /etc/lsb-release && echo -dynamic -package leancheck -package cmdargs)
CABALOPTS=
BENCHS = \
bench/avltrees \
bench/bools \
bench/digraphs \
bench/heaps \
bench/id \
bench/list \
bench/mergeheaps \
bench/pretty \
bench/sets \
bench/setsofsets \
bench/sieve \
bench/sorting \
bench/spring
EXTRA_BENCHS = $(BENCHS) \
bench/haskell-src \
bench/haskell-src-exts
EGS = \
eg/sorting \
eg/negation
EXTRA_EGS = $(EGS) \
eg/alga
TESTS = \
test/derive \
test/mutate \
test/showmutable \
test/utils
LIST_ALL_HSS = find \( -path "./dist*" -o -path "./.stack-work" -o -path "./Setup.hs" -o -name "haskell-src*.hs" \) -prune \
-o -name "*.*hs" -print
HADDOCKFLAGS = $(shell grep -q "Arch Linux" /etc/lsb-release && echo --optghc=-dynamic)
LIB_DEPS = base $(INSTALL_DEPS)
INSTALL_DEPS = leancheck cmdargs template-haskell pretty
all: mk/toplibs
benchs: $(BENCHS) all
egs: $(EGS) all
ghci: Test/FitSpec.ghci
test: all benchs egs $(TESTS)
./test/mutate
./test/showmutable
./test/derive
./test/utils
test-with-extra-deps: all $(EXTRA_BENCHS) $(EXTRA_EGS) $(TESTS)
./test/mutate
./test/showmutable
./test/derive
./test/utils
test-via-cabal:
cabal configure --enable-tests --enable-benchmarks --ghc-options="$(GHCFLAGS) -O0"
cabal build
cabal test mutate
test-via-stack:
stack test fitspec:test:mutate --ghc-options="$(GHCFLAGS) -O0" --system-ghc --no-install-ghc --no-terminal
test-sdist:
./test/sdist
legacy-test:
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:
cabal-ghc-8.2 configure --enable-tests --enable-benchmarks --ghc-option=-dynamic && cabal-ghc-8.2 build && cabal-ghc-8.2 test
cabal-ghc-8.0 configure --enable-tests --enable-benchmarks --ghc-option=-dynamic && cabal-ghc-8.0 build && cabal-ghc-8.0 test
cabal-ghc-7.10 configure --enable-tests --enable-benchmarks --ghc-option=-dynamic && cabal-ghc-7.10 build && cabal-ghc-7.10 test
cabal-ghc-7.8 configure --enable-tests --enable-benchmarks --ghc-option=-dynamic && cabal-ghc-7.8 build && cabal-ghc-7.8 test
cabal clean
prepare-legacy-test-via-cabal:
rm -rf .cabal-sandbox cabal.sandbox.config
cabal sandbox init
cabal install --only-dependencies --enable-tests --enable-benchmarks --enable-documentation
cabal-ghc-8.2 install --only-dependencies --enable-tests --enable-benchmarks
cabal-ghc-8.0 install --only-dependencies --enable-tests --enable-benchmarks
cabal-ghc-7.10 install --only-dependencies --enable-tests --enable-benchmarks
cabal-ghc-7.8 install --only-dependencies --enable-tests --enable-benchmarks
clean: clean-hi-o clean-haddock
rm -f $(TESTS) $(BENCHS) $(EGS) {eg,bench}/*.{hi,o,dyn_hi,dyn_o} TAGS tags mk/toplibs
# Debug: just list all source files compiled normally
list-hs:
$(LISTHS)
list-libs:
$(LISTLIBS)
hlint:
hlint \
--ignore "Use import/export shortcut" \
--ignore "Use first" \
--ignore "Use second" \
--ignore "Use ***" \
FitSpec.hs FitSpec bench tests
mk/toplibs: src/Test/FitSpec.o bench/Set.o
touch mk/toplibs
bench/avltrees: bench/AVLTree.o
bench/heaps: bench/Heap.o
bench/digraphs: bench/Digraph.o
include mk/haskell.mk
# NOTE:
#
# To run make depend, you may need to pass -package now to expose a package:
#
# make depend GHCFLAGS="-package haskell-src-exts"