2015-08-15 15:17:12 +02:00
|
|
|
|
|
|
|
# quick makefile to document how to do the various tasks
|
|
|
|
|
|
|
|
# there is no real reason to actually use the makefile except for a
|
2020-04-24 19:35:38 +02:00
|
|
|
# very small amount of convenience, apart from the website build
|
2024-01-26 17:29:58 +01:00
|
|
|
# and website consistency checks
|
2015-08-15 15:17:12 +02:00
|
|
|
|
|
|
|
.PHONY : build
|
|
|
|
build :
|
2024-01-26 16:28:15 +01:00
|
|
|
cabal build
|
2015-08-15 15:17:12 +02:00
|
|
|
|
|
|
|
.PHONY : test
|
2019-07-07 12:33:02 +02:00
|
|
|
test :
|
2024-02-04 17:00:59 +01:00
|
|
|
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
|
2015-08-15 15:17:12 +02:00
|
|
|
|
2020-04-24 19:35:38 +02:00
|
|
|
.PHONY : test-coverage
|
|
|
|
test-coverage :
|
|
|
|
cabal test --enable-coverage
|
2015-08-15 15:17:12 +02:00
|
|
|
|
|
|
|
.PHONY : clean
|
|
|
|
clean :
|
2020-04-24 19:35:38 +02:00
|
|
|
cabal clean
|
2024-01-26 17:29:58 +01:00
|
|
|
cd website && cabal clean
|
2015-08-15 15:17:12 +02:00
|
|
|
rm -Rf build/
|
|
|
|
|
2020-04-24 19:35:38 +02:00
|
|
|
.PHONY : parserexe
|
2019-07-07 12:33:02 +02:00
|
|
|
parserexe :
|
2024-01-26 16:28:15 +01:00
|
|
|
cabal build -fparserexe SimpleSQLParserTool
|
2020-04-24 19:35:38 +02:00
|
|
|
|
2024-01-26 16:28:15 +01:00
|
|
|
.PHONY : all
|
2024-01-26 17:29:58 +01:00
|
|
|
all : build test parserexe website
|
2020-04-24 19:35:38 +02:00
|
|
|
|
|
|
|
###############################################
|
|
|
|
|
|
|
|
# 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
|
2024-01-26 17:29:58 +01:00
|
|
|
website-non-haddock : build/main.css build/main1.css build/index.html \
|
|
|
|
build/supported_sql.html build/test_cases.html
|
2020-04-24 19:35:38 +02:00
|
|
|
|
|
|
|
build/main.css : website/main.css
|
|
|
|
mkdir -p build
|
|
|
|
cp website/main.css build
|
|
|
|
|
2024-01-26 17:29:58 +01:00
|
|
|
# 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
|
2020-04-24 19:35:38 +02:00
|
|
|
mkdir -p build
|
2024-01-26 17:29:58 +01:00
|
|
|
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
|
2024-02-04 17:00:59 +01:00
|
|
|
echo Entering directory \`website/\'
|
2024-01-26 17:29:58 +01:00
|
|
|
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
|
2024-02-04 17:00:59 +01:00
|
|
|
echo Leaving directory \`website/\'
|
2020-04-24 19:35:38 +02:00
|
|
|
|
|
|
|
# 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)")
|
2024-01-08 13:26:44 +01:00
|
|
|
$(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/
|
2024-01-26 17:29:58 +01:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|