-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathMakefile
103 lines (81 loc) · 2.5 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
RSYNC=$(shell pwd)/sync.sh
METATEMPLATE=templates/pagemeta.template
INDEXTEMPLATE=templates/index.template
PREAMBLE=templates/preamble.lhs
BIB=templates/bib.lhs
# generated
PAGETEMPLATE=dist/page.template
LINKS=dist/links.txt
INDEX=dist/index.lhs
# bin
## INDEXER=stack exec -- runghc filters/Toc.hs
## PANDOC=pandoc
ifdef NO_STACK
INDEXER=filters-toc
PANDOC=pandoc
else
INDEXER=stack $(STACK_FLAGS) run filters-toc
PANDOC=stack $(STACK_FLAGS) exec -- pandoc
endif
##############################################
PANDOCPDF=$(PANDOC) \
--highlight-style=tango \
--from=markdown+lhs \
--bibliography=templates/sw.bib \
--biblatex \
--top-level-division=chapter \
--template=templates/default.latex \
--filter filters/Figures.hs \
--filter filters/Latex.hs
PANDOCHTML=$(PANDOC) \
--from=markdown+lhs+raw_html \
--to=html5 \
-s --mathjax \
--standalone \
--mathjax \
--toc \
--section-divs \
--filter filters/Codeblock.hs \
--filter filters/Figures.hs \
--filter filters/Html.hs \
--variable=notitle \
--highlight-style=tango
####################################################################
lhsObjects := $(sort $(wildcard src/*.lhs))
texObjects := $(patsubst %.lhs,%.tex,$(wildcard src/*.lhs))
htmlObjects := $(patsubst %.lhs,%.html,$(wildcard src/*.lhs))
####################################################################
all: pdf
pdf: dist/pbook.lhs
PANDOC_TARGET=pbook.pdf $(PANDOCPDF) $(PREAMBLE) $(BIB) dist/pbook.lhs -o dist/pbook.pdf
dist/pbook.lhs: $(lhsObjects)
mkdir -p dist
cat $(lhsObjects) > dist/pbook.lhs
html: indexhtml $(htmlObjects)
mv src/*.html _site/
cp -r img _site/
cp -r fonts _site/
cp -r css _site/
cp -r js _site/
thing: dist/index.lhs src/00-temp.html
mv src/00-*.html _site/
indexhtml: $(INDEX)
$(PANDOC) --from=markdown+lhs --to=html5 --template=$(INDEX) $(PREAMBLE) -o _site/index.html
$(INDEX):
$(INDEXER) src/ $(METATEMPLATE) $(INDEXTEMPLATE) $(PAGETEMPLATE) $(INDEX) $(LINKS)
src/%.html: src/%.lhs
PANDOC_TARGET=$@ PANDOC_CODETEMPLATE=templates/code.template $(PANDOCHTML) --template=$(PAGETEMPLATE) $(PREAMBLE) $? templates/bib.lhs -o $@
check:
stack build --fast --flag liquidhaskell-tutorial:build
check-cabal:
cabal v2-build
clean:
rm -rf dist/* && rm -rf _site/* && rm -rf src/*.tex && rm -rf src/.liquid && rm -rf src/*.html
upload: pdf html
cp dist/pbook.pdf _site/book.pdf
cp -r _site $(TMPDIR)
git checkout gh-pages
cp -r $(TMPDIR)/_site/* .
git commit -a -m "updating GH-PAGES"
git push origin gh-pages
git checkout main