-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Makefile
76 lines (60 loc) · 2.7 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
DATE=$(shell date +%Y-%m-%d-%H%M)
LOGS=log
ifdef PATTERN
TESTARGS?='-p "$(PATTERN)" --hide-successes'
BENCHARGS?='--timeout=2 --pattern "$(PATTERN)" +RTS -T -RTS'
else
TESTARGS?="--hide-successes"
BENCHARGS?="--timeout=2 +RTS -T -RTS"
endif
SOURCEFILES?=$(shell find commonmark/src commonmark-cli/src commonmark-pandoc/src -name '*.hs')
GHC_OPTS=-Wall -fno-warn-unused-do-bind -Wnoncanonical-monad-instances -Wincomplete-uni-patterns -Werror=missing-home-modules -Widentities -Wcpp-undef -fhide-source-paths -fno-prof-auto
PROFTARGET?=b5.md
all:
cabal test --ghc-options="$(GHC_OPTS)" --test-option=--hide-successes all
cabal build --ghc-options="$(GHC_OPTS)" -fexecutable all
cabal list-bin commonmark-cli
prof:
cabal build --enable-profiling --ghc-options="${GHC_OPTS}" commonmark-cli
cabal run --enable-profiling --ghc-options="${GHC_OPTS}" commonmark-cli -- +RTS -hc -RTS ${PROFTARGET} >/dev/null
cat commonmark.hp
hp2ps -c commonmark.hp
ps2pdf commonmark.ps commonmark.pdf
cabal run --enable-profiling --ghc-options="${GHC_OPTS}" commonmark-cli -- +RTS -P -V0.00001 -RTS ${PROFTARGET} >/dev/null
profiterole commonmark.prof
awk '{print $$3,"\t",$$5}' commonmark.profiterole.txt | sort -n | uniq | grep '^[0-9]'
heapprof:
cabal run --enable-profiling --ghc-options="${GHC_OPTS}" commonmark-cli -- +RTS -hc -RTS ${PROFTARGET} >/dev/null
hp2ps -b -c commonmark.hp
ps2pdf commonmark.ps
open commonmark.pdf
flamegraph:
cabal run --enable-profiling --ghc-options="${GHC_OPTS}" commonmark-cli -- +RTS -pj -RTS ${PROFTARGET} >/dev/null
cat commonmark.prof | ghc-prof-aeson-flamegraph | flamegraph.pl > prof.svg
open -a Safari prof.svg
$(LOGS):
mkdir -p $(LOGS)
benchmark:
commonmark ${PROFTARGET} +RTS -s >/dev/null
sudo nice -n -20 bench "commonmark ${PROFTARGET}"
bench: $(LOGS)
set -o pipefail && \
stack bench --benchmark-arguments=$(BENCHARGS) commonmark 2>&1 \
| tee $(LOGS)/benchmark-$(DATE).out
ghci:
cabal repl commonmark
# stack ghci --ghci-options "-interactive-print=Text.Pretty.Simple.pPrint -XOverloadedStrings" --package pretty-simple
reformat:
for f in $(SOURCEFILES); do echo $$f; stylish-haskell -i $$f ; done
lint:
for f in $(SOURCEFILES); do echo $$f; hlint --verbose $$f; done
clean:
cabal clean
pathologicaltest:
python3 test/pathological_tests.py --prog commonmark
check:
cd commonmark && cabal check && packdeps commonmark.cabal
cd commonmark-extensions && cabal check && packdeps commonmark-extensions.cabal
cd commonmark-pandoc && cabal check && packdeps commonmark-pandoc.cabal
cd commonmark-cli && cabal check && packdeps commonmark-cli.cabal
.PHONY: quick ghci spectest pathologicaltest test bench prof clean all reformat lint haddock profheap flamegraph benchmark check stan