-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
149 lines (130 loc) · 4.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
# -*- indent-tabs-mode:t; -*-
VERFILE=dist/VERSION # XREF:VERSION
all: deps build sphinxbuild
.PHONY: $(VERFILE)
$(VERFILE):
mkdir -p `dirname $@`
echo "Version: Dyna 0.4 pre-release" `git describe --all` > $@
echo "Build date:" `date` >> $@
echo "Commit: https://github.com/nwf/dyna/commit/"`git rev-parse HEAD` >> $@
.PHONY: upstream
upstream:
git submodule update --init
# git submodule update external/ekmett-parsers external/ekmett-trifecta
# cabal install --user --enable-tests --only-dependencies \
# external/ekmett-parsers external/ekmett-trifecta .
# cabal install --user external/ekmett-parsers external/ekmett-trifecta
.PHONY: deps
deps:
alex --version 2>/dev/null >/dev/null || cabal install alex
happy --version 2>/dev/null >/dev/null || cabal install happy
cabal install --user --enable-tests --only-dependencies .
.PHONY: build
build: $(VERFILE)
cabal configure --user
cabal build
.PHONY: test tests
test tests:
cabal configure --user --enable-tests
cabal build
dist/build/dyna-selftests/dyna-selftests
misc/dyna-doctest.py
# cabal test
# Compilation takes a while; for faster iteration while developing,
# turn off optimization.
fcomp:
cabal configure --user --enable-tests -O0
cabal build
.PHONY: clean veryclean
clean:
rm -rf examples/*.dyna.*.plan \
examples/*.dyna.*.planc \
examples/*.dyna.plan.py \
examples/*.dyna.plan.pyc \
examples/*.dyna.*.out \
examples/*.dyna.d \
examples/*.hist
rm -rf test/*/*.out
rm -rf *.tix
rm -f tags TAGS
veryclean: clean
rm -rf dist/*
# Cabal's haddock integration is sort of sad; since I want to have
# everything we use in one place, run haddock by hand. This still isn't
# perfect, but it does OK.
HADDOCK_HTML ?= "../\\$$pkgid/html"
.PHONY: haddock
haddock:
mkdir -p dist/alldoc
haddock --html -o dist/alldoc \
--ignore-all-exports -w --optghc=-isrc --optghc=-idist/build/autogen \
-t "Dyna -- GIT `git describe --always`" \
`runghc -imisc HaddockPaths "$(HADDOCK_HTML)"` \
`grep -ie '^\( \|\t\)*main-is:' dyna.cabal | sed -e "s/^.*Is: */src\//"`
# Build our sphinx documentation
.PHONY: sphinxbuild sphinxdoc
sphinxbuild:
which sphinx-build >/dev/null && (cd docs/sphinx; make html)
sphinxdoc: sphinxbuild
python -m webbrowser "./docs/sphinx/_build/html/index.html"
doc: sphinxbuild haddock
# If the cabal file doesn't do the right thing, this tries to work through
# it all by hand. Blech! But it's better than nothing.
.PHONY: ghcbuild
ghcbuild:
mkdir -p dist/build/dyna/
mkdir -p dist/build/dyna/dyna-tmp
ghc --make -isrc \
-o dist/build/dyna/dyna \
-outputdir dist/build/dyna/dyna-tmp \
-main-is Dyna.Main.Driver Dyna.Main.Driver
mkdir -p dist/build/dyna-selftests
mkdir -p dist/build/dyna-selftests/dyna-selftests-tmp
ghc --make -isrc \
-o dist/build/dyna-selftests/dyna-selftests \
-outputdir dist/build/dyna-selftests/dyna-selftests-tmp \
-main-is Dyna.Main.TestsDriver Dyna.Main.TestsDriver
# Every now and again we need to make a profiling build of some component
# of the tree. Set MAINMOD and MAINFILE and make this target.
.PHONY: profbuild
profbuild:
mkdir -p dist/pb
ghc --make -O0 -rtsopts \
-idist/build/autogen -isrc \
-o dist/pb/a-noprof.out \
-outputdir dist/pb \
-main-is $(MAINMOD) $(MAINFILE)
ghc --make -O0 -rtsopts \
-idist/build/autogen -isrc \
-osuf p.o -hisuf p.hi \
-prof -fprof-auto -caf-all -auto-all \
-o dist/pb/a.out \
-outputdir dist/pb \
-main-is $(MAINMOD) $(MAINFILE)
.PHONY: test-hpc
test-hpc:
mkdir -p dist/selftest-hpc
ghc -O0 -fhpc -isrc -idist/build/autogen --make \
-o dist/selftest-hpc/dyna-selftests \
-outputdir dist/selftest-hpc/dyna-selftests-tmp \
-hpcdir dist/selftest-hpc/hpc \
-main-is Dyna.Main.TestsDriver Dyna.Main.TestsDriver
# Remove any old .tix files
# (prevent "module mismatch with .tix/.mix file hash number")
rm -rf dyna-selftests.tix
# Run from top-level
dist/selftest-hpc/dyna-selftests
# Then move the mix and tix files out of the way
mv dyna-selftests.tix dist/selftest-hpc
# And last, generate markup
hpc markup \
--destdir=dist/selftest-hpc-out \
--hpcdir=dist/selftest-hpc/hpc \
dist/selftest-hpc/dyna-selftests.tix
.PHONY: tags TAGS
tags TAGS:
hasktags -b src
coverage:
(coverage run --rcfile misc/coveragerc misc/dyna-doctest.py \
; coverage html --rcfile misc/coveragerc --include 'src/*' -d coverage-report \
; gnome-open coverage-report/index.html)