forked from LeventErkok/sbv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
176 lines (137 loc) · 5.34 KB
/
Makefile
File metadata and controls
176 lines (137 loc) · 5.34 KB
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
# (c) Copyright Levent Erkok. All rights reserved.
#
# The sbv library is distributed with the BSD3 license. See the LICENSE file
# in the distribution for details.
OS := $(shell uname)
SHELL := /usr/bin/env bash
CABAL_VERSION := $(shell cabal --numeric-version)
CONFIGOPTS = "-Wall -fhide-source-paths"
ALLSOURCES := $(shell find Data/SBV -name "*.hs") $(shell find Documentation/SBV -name "*.hs")
ifeq ($(OS), Darwin)
# OSX tends to sleep for long jobs; so run through caffeinate
TIME = /usr/bin/time caffeinate -dimsu
NO_OF_CORES = `sysctl hw.ncpu | awk '{print $$2}'`
else
TIME = /usr/bin/time
NO_OF_CORES = `grep -c "^processor" /proc/cpuinfo`
endif
ifdef TGT
TESTTARGET = -p ${TGT}
TESTHIDE = --hide-successes
else
TESTTARGET =
TESTHIDE = --hide-successes
endif
ifdef ACCEPT
TESTACCEPT = --accept
TESTHIDE =
else
TESTACCEPT = --no-create
TESTHIDE = --hide-successes
endif
# how many quick-check tests to run (default of 100 might be too slow)
ifdef QC
QCCOUNT = ${QC}
else
QCCOUNT = 100
endif
# How long to wait for each doctest to run (in seconds)
DOCTESTTIMEOUT = 300
# Allow newer versions
CABAL_OPTS=--allow-newer
.PHONY: install docs testsuite release tags clean veryclean
all: quick
configure:
@$(TIME) cabal configure --enable-tests ${CABAL_OPTS} --ghc-options=$(CONFIGOPTS)
quick: tags
@$(TIME) cabal build ${CABAL_OPTS}
install: configure quick
HADDOCK_OPTS=${CABAL_OPTS} --enable-documentation
docs:
@cabal haddock ${HADDOCK_OPTS} --haddock-option=--hyperlinked-source | ghc ./buildUtils/simpHaddock.hs -e main
# To upload docs to hackage, first run the below target, then run the command it spits out
hackage-docs:
@cabal haddock ${HADDOCK_OPTS} --haddock-for-hackage | ghc ./buildUtils/simpHaddock.hs -e main
@echo "*** If all is well, then run:"
@echo " cabal upload -d --publish ./dist-newstyle/sbv-XXX-docs.tar.gz"
@echo "*** If the above fails for some reason, use the workaround in: https://github.com/haskell/cabal/issues/10252#issuecomment-2422130252"
ghci:
ifdef TGT
cabal repl ${CABAL_OPTS} --repl-options=-Wno-unused-packages ${TGT}
else
cabal repl ${CABAL_OPTS} --repl-options=-Wno-unused-packages
endif
# Use to load in ghcid. Possibilities:
# make ghcid
# make ghcid TGT=SBVTest
# make ghcid TGT=SBVConnections
# make ghcid TGT=SBVHLint
# make ghcid TGT=SBVBench
# make ghcid TGT=SBVDocTest
ghcid:
ifdef TGT
ghcid --command="cabal repl ${CABAL_OPTS} --repl-options=-Wno-unused-packages ${TGT}"
else
ghcid --command="cabal repl ${CABAL_OPTS} --repl-options=-Wno-unused-packages"
endif
bench:
cabal bench
# Run this target, which updates the golds for those tests that rely on version updates
# for SBV and Z3. Saves time before doing "make release"
updateForVersionChange:
@cabal run SBVTest -- -p nested1 --accept --quiet
@cabal run SBVTest -- -p nested2 --accept --quiet
@cabal run SBVTest -- -p nested3 --accept --quiet
@cabal run SBVTest -- -p nested4 --accept --quiet
@cabal run SBVTest -- -p allSat8 --accept --quiet
@cabal run SBVTest -- -p query1 --accept --quiet
@cabal run SBVTest -- -p noOpt1 --accept --quiet
@cabal run SBVTest -- -p noOpt2 --accept --quiet
testsuite: updateForVersionChange lintTest test testInterfaces benchBuild docTest mkDistro checkLinks
lintTest:
@$(TIME) cabal test SBVHLint
testInterfaces:
@$(TIME) cabal test SBVConnections
benchBuild:
@$(TIME) cabal build SBVBench
DOCTEST_GOLD = SBVTestSuite/GoldFiles/doctest_sanity.gold
# If you specify TGT, it'll just run on that target. Give the full path to the haskell file with .hs extension
docTest:
ifdef TGT
cabal run SBVDocTest ${CABAL_OPTS} -fdoctest_is_running -- --timeout ${DOCTESTTIMEOUT} --module $(basename $(subst /,.,${TGT}))
else
@/bin/rm -f ${DOCTEST_GOLD}_temp
@$(TIME) cabal run SBVDocTest ${CABAL_OPTS} -fdoctest_is_running -- --timeout ${DOCTESTTIMEOUT} 2>&1 | tee ${DOCTEST_GOLD}_temp
@ghc -package process buildUtils/checkDocSpec.hs -e "start \"${DOCTEST_GOLD} ${ACCEPT}\""
endif
test:
@$(TIME) cabal run ${CABAL_OPTS} SBVTest -- -j $(NO_OF_CORES) ${TESTTARGET} ${TESTACCEPT} ${TESTHIDE} --quickcheck-tests ${QCCOUNT}
checkLinks:
@buildUtils/validate_links.py
# @brok --no-cache --only-failures $(ALLSOURCES) COPYRIGHT INSTALL LICENSE $(wildcard *.md)
mkDistro:
$(TIME) cabal sdist
fullRelease: veryclean checkExtensions install docs testsuite
@echo "*** SBV is ready for release!"
git status
release:
$(TIME) make fullRelease
checkExtensions:
@ag LANGUAGE | awk '{print $$3}' | sort | uniq | grep -v LANGUAGE | grep -v ignore | grep -v note | grep -v "^\""| grep -v "<-" > ./required_extensions
@ghc -package base -package process ./buildUtils/checkExtensions.hs -e main
@/bin/rm -f required_extensions
tags:
@fast-tags -R --nomerge .
ci:
haskell-ci github sbv.cabal --no-tests --no-benchmarks
clean:
@rm -rf dist dist-newstyle cabal.project.local*
veryclean: clean
@make -C buildUtils clean
# Just test the TP output for doctest. We give it a shorter wait time as well.
TP_FILES = $(addprefix --module ,$(basename $(subst /,.,$(wildcard Data/SBV/TP/*.hs)))) \
$(addprefix --module ,$(basename $(subst /,.,$(wildcard Documentation/SBV/Examples/TP/*.hs))))
TP_MODULES = ${TP_FILES}
TP_DOCTESTTIMEOUT = 20
tpDocTest:
cabal run SBVDocTest ${CABAL_OPTS} -fdoctest_is_running -- --timeout ${TP_DOCTESTTIMEOUT} ${TP_MODULES}