update makefile
This commit is contained in:
parent
7fbd822fc3
commit
b41d4838d4
74
Makefile
74
Makefile
|
@ -2,25 +2,81 @@
|
|||
# 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
|
||||
# very small amount of convenience, apart from the website build
|
||||
|
||||
.PHONY : build
|
||||
build :
|
||||
cabal v2-build --enable-tests -fparserexe
|
||||
cabal build --enable-tests -fparserexe
|
||||
|
||||
.PHONY : test
|
||||
test :
|
||||
cabal v2-run test:Tests -- --hide-successes --ansi-tricks=false
|
||||
cabal run test:Tests -- --hide-successes --ansi-tricks=false
|
||||
|
||||
.PHONY : website
|
||||
website :
|
||||
website/make_website.sh
|
||||
|
||||
.PHONY : test-coverage
|
||||
test-coverage :
|
||||
cabal test --enable-coverage
|
||||
|
||||
.PHONY : clean
|
||||
clean :
|
||||
cabal v2-clean
|
||||
cabal clean
|
||||
rm -Rf build/
|
||||
|
||||
.PHONY: parserexe
|
||||
.PHONY : parserexe
|
||||
parserexe :
|
||||
cabal v2-build -fparserexe SimpleSqlParserTool
|
||||
cabal build -fparserexe SimpleSqlParserTool
|
||||
|
||||
|
||||
###############################################
|
||||
|
||||
# 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/ocean.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
|
||||
|
||||
build/ocean.css : website/ocean.css
|
||||
mkdir -p build
|
||||
cp website/ocean.css build
|
||||
|
||||
build/index.html : website/index.asciidoc website/AddLinks.lhs
|
||||
asciidoctor website/index.asciidoc -o - | cabal -v0 exec runhaskell website/AddLinks.lhs > build/index.html
|
||||
|
||||
build/supported_sql.html : website/supported_sql.asciidoc website/AddLinks.lhs
|
||||
asciidoctor website/supported_sql.asciidoc -o - | cabal -v0 exec runhaskell website/AddLinks.lhs > build/supported_sql.html
|
||||
|
||||
build/test_cases.html : website/RenderTestCases.lhs
|
||||
cabal -v0 exec runhaskell -- --ghc-arg=-package=pretty-show -itools website/RenderTestCases.lhs > build/test_cases.asciidoc
|
||||
asciidoctor build/test_cases.asciidoc -o - | \
|
||||
sed -e "s/max-width:62\.5em//g" > build/test_cases.html
|
||||
# TODO: reduce the text size on the test cases page
|
||||
# TODO: use scrollbars inside the tables
|
||||
# TODO: make the tables autowidth
|
||||
# -e "s/(code.*)font-size:1em/\1font-size:0.8em/g"
|
||||
rm build/test_cases.asciidoc
|
||||
|
||||
# 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/
|
||||
|
||||
#GHC_VER="$(shell ghc --numeric-version)"
|
||||
# wtf
|
||||
$(eval GHC_VER="$(shell ghc --numeric-version)")
|
||||
cp -R dist-newstyle/build/x86_64-linux/ghc-${GHC_VER}/simple-sql-parser-0.6.0/doc/html/simple-sql-parser/* build/haddock/
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
# todo: check this is run from the project root and not the website/
|
||||
# dir
|
||||
|
||||
# todo: put all this in the makefile?
|
||||
|
||||
# use make build to get the package database into the right state first
|
||||
|
||||
mkdir -p build
|
||||
cp website/main.css build
|
||||
cp website/ocean.css build
|
||||
|
||||
# index
|
||||
asciidoctor website/index.asciidoc -o - | cabal -v0 v2-exec runhaskell website/AddLinks.lhs > build/index.html
|
||||
|
||||
asciidoctor website/supported_sql.asciidoc -o - | cabal -v0 v2-exec runhaskell website/AddLinks.lhs > build/supported_sql.html
|
||||
|
||||
# tpch sql file
|
||||
# pandoc src/tpch.sql -s --highlight-style kate -o tpch.sql.html
|
||||
# rendered test cases
|
||||
# build the parserexe target first to fix the package database
|
||||
cabal -v0 v2-exec runhaskell -- --ghc-arg=-package=pretty-show -itools website/RenderTestCases.lhs > build/test_cases.asciidoc
|
||||
|
||||
asciidoctor build/test_cases.asciidoc -o - | \
|
||||
sed -e "s/max-width:62\.5em//g" \
|
||||
> build/test_cases.html
|
||||
# TODO: reduce the text size on the test cases page
|
||||
# TODO: use scrollbars inside the tables
|
||||
# TODO: make the tables autowidth
|
||||
# -e "s/(code.*)font-size:1em/\1font-size:0.8em/g"
|
||||
|
||||
rm build/test_cases.asciidoc
|
||||
# haddock
|
||||
cabal v2-haddock --haddock-option="--hyperlinked-source"
|
||||
rm -Rf build/haddock
|
||||
mkdir build/haddock/
|
||||
|
||||
GHC_VER=$(ghc --numeric-version)
|
||||
|
||||
|
||||
cp -R dist-newstyle/build/x86_64-linux/ghc-$GHC_VER/simple-sql-parser-0.6.0/doc/html/simple-sql-parser/* build/haddock/
|
Loading…
Reference in a new issue