-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile
97 lines (75 loc) · 2.43 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
RSYNC=$(shell pwd)/sync.sh
remoteuser=rjhala
remotedir=/home/rjhala/public_html/liquid/book
remotehost=goto.ucsd.edu
# TMPDIR=~/tmp/
LIQUIDCLIENT=../liquid-client
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
PANDOC=stack exec -- pandoc
INDEXER=stack exec -- toc
##############################################
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 $(LIQUIDCLIENT)/templates/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 $(LIQUIDCLIENT)/fonts _site/
cp -r $(LIQUIDCLIENT)/css _site/
cp -r $(LIQUIDCLIENT)/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=$(LIQUIDCLIENT)/templates/code.template $(PANDOCHTML) --template=$(PAGETEMPLATE) $(PREAMBLE) $? templates/bib.lhs -o $@
clean:
rm -rf dist/* && rm -rf _site/* && rm -rf src/*.tex && rm -rf src/.liquid && rm -rf src/*.html
upload: html
git checkout master
make html
cp -r _site $(TMPDIR)
git checkout gh-pages
cp -r $(TMPDIR)/_site/* .
git commit -a
git push origin gh-pages