forked from JakeWheat/simple-sql-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
99 lines (75 loc) · 3.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
# quick makefile to document how to do the various tasks
# there is no real reason to actually use the makefile except for a
# very small amount of convenience, apart from the website build
# and website consistency checks
.PHONY : build
build :
cabal build
.PHONY : test
test :
cabal run test:Tests -- -f failed-examples +RTS -N
.PHONY : fast-test
fast-test :
cabal run test:Tests -- -f failed-examples --skip ansiLexerTests --skip postgresLexerTests +RTS -N
.PHONY : test-coverage
test-coverage :
cabal test --enable-coverage
.PHONY : clean
clean :
cabal clean
cd website && cabal clean
rm -Rf build/
.PHONY : parserexe
parserexe :
cabal build -fparserexe SimpleSQLParserTool
.PHONY : all
all : build test parserexe website
###############################################
# website
# it's a bit crap, run cabal test or make test or something at least once
# to get the website build to work
.PHONY : website
website : website-non-haddock build-haddock
.PHONY : website-non-haddock
website-non-haddock : build/main.css build/main1.css build/index.html \
build/supported_sql.html build/test_cases.html
build/main.css : website/main.css
mkdir -p build
cp website/main.css build
# todo: combine main and main1, change the one bit they can't share with sed
# to create the additional main1 as part of the build
build/main1.css : website/main1.css
mkdir -p build
cp website/main1.css build
build/index.html : website/index.md website/template.pandoc
mkdir -p build
pandoc -s --template website/template.pandoc -V toc-title:"Table of contents" -c main.css -f markdown -t html --toc=true --metadata title="Simple SQL Parser" website/index.md > build/index.html
build/supported_sql.html : website/supported_sql.md website/template.pandoc
mkdir -p build
pandoc -s --template website/template.pandoc -V toc-title:"Table of contents" -c main.css -f markdown -t html --toc=true --metadata title="Simple SQL Parser supported SQL" website/supported_sql.md > build/supported_sql.html
build/test_cases.html : website/RenderTestCases.hs website/template1.pandoc
mkdir -p build
# no idea why not using --disable-optimisation on cabal build, but putting -O0
# in the cabal file (and then cabal appears to say it's still using -O1
# is faster
echo Entering directory \`website/\'
cd website/ && cabal build RenderTestCases && cabal run RenderTestCases | pandoc -s -N --template template1.pandoc -V toc-title:"Simple SQL Parser test case examples" -c main1.css -f markdown -t html --toc=true --metadata title="Simple SQL Parse test case examples" > ../build/test_cases.html
echo Leaving directory \`website/\'
# works here, but not in a recipe. amazing
# GHC_VER="$(shell ghc --numeric-version)"
.PHONY : build-haddock
build-haddock :
cabal haddock --haddock-option="--hyperlinked-source"
# todo: handle the deps properly
rm -Rf build/haddock
mkdir build/haddock/
$(eval GHC_VER="$(shell ghc --numeric-version)")
$(eval SSP_VER="$(shell cat simple-sql-parser.cabal |grep -P '^version:' | awk '{print $$2}')")
cp -R dist-newstyle/build/x86_64-linux/ghc-${GHC_VER}/simple-sql-parser-${SSP_VER}/doc/html/simple-sql-parser/* build/haddock/
# check the website pages code snippets
.PHONY : doctool
doctool :
cabal build -fparserexe SimpleSQLParserTool
silverbane website/index.md
.PHONY : really-all
really-all : build test parserexe website doctool