forked from savonet/book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (63 loc) · 2.85 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
MD = $(wildcard *.md)
LIQ = $(wildcard liq/*.liq)
PANDOC = pandoc --bibliography=papers.bib --filter=pandoc-include --filter=pandoc-replace -V today="`LC_TIME=en_US date '+%A %d, %Y'`"
all: fig book.pdf language.dtd
clean:
rm -f book.pdf book.tex book.epub book.html *.aux *.idx *.ilg *.ind *.log *.out *.toc
ci:
git ci . -m "Worked on the book."
git push
book.tex: book.md style.sty $(MD) $(LIQ) liquidsoap.xml replacements
@echo "Generating $@..."
@$(PANDOC) --template=template.latex -s --top-level-division=chapter --filter=pandoc-crossref -V links-as-notes=true $< -o tmp.$@
@cat tmp.$@ \
| sed 's/\\includegraphics\([^{]*\){\(.*\)}\\\\/\\begin{center}\\includegraphics\1{\2}\\end{center}/' \
| sed 's/\\DeclareRobustCommand{\\href}\[2\]{#2\\footnote{\\url{#1}}}/\\DeclareRobustCommand{\\href}[2]{#2\\footnote{\\texttt{\\url{#1}}}}/' \
> $@
@rm -f tmp.$@
book.pdf: book.tex
@echo "Generating $@..."
pdflatex $<
makeindex book.idx
web.tex: book.md style.sty $(MD) $(LIQ) liquidsoap.xml replacements Makefile
@echo "Generating $@..."
@$(PANDOC) -s --syntax-definition=liquidsoap.xml --top-level-division=chapter -V geometry:"" -V papersize:a4 -V geometry:"margin=4cm" -V colorlinks:true $< -o $@
web.pdf: web.tex
@echo "Generating $@..."
pdflatex web.tex
makeindex web.idx
book.epub book.txt: book.md $(MD) $(LIQ) epub.css liquidsoap.xml
@echo "Generating $@..."
@$(PANDOC) -s --syntax-definition=liquidsoap.xml --filter=pandoc-pdf2png --toc --toc-depth=2 --top-level-division=chapter --css=epub.css -V links-as-notes=true $< -o $@
book.html: book.md $(MD) $(LIQ) epub.css liquidsoap.xml
@echo "Generating $@..."
@$(PANDOC) -s --syntax-definition=liquidsoap.xml --filter=pandoc-pdf2png --top-level-division=chapter --css=epub.css -V links-as-notes=true $< -o $@
@sed -i 's/<head>/<head><meta http-equiv="content-type" content="text\/html; charset=UTF-8"\/>/' $@
book.rst: book.md $(MD) $(LIQ) epub.css liquidsoap.xml
@echo "Generating $@..."
@$(PANDOC) -s --syntax-definition=liquidsoap.xml --filter=pandoc-pdf2png --top-level-division=chapter --css=epub.css -V links-as-notes=true $< -o $@
ebook.zip: fig book.html
zip $@ book.html fig/*.png
liquidsoap.xml:
wget https://raw.githubusercontent.com/savonet/liquidsoap/master/scripts/liquidsoap.xml
language.dtd:
wget https://github.com/jgm/highlighting-kate/blob/master/xml/language.dtd
fig:
@$(MAKE) -C fig
check:
$(MAKE) -C liq $@
docker-test:
docker build . -f .github/docker/Dockerfile.build
docker-run:
docker run -it --entrypoint /bin/bash --user root savonet/liquidsoap:main
%.html: %.md $(MD) liquidsoap.xml
$(PANDOC) -s $< -o $@
%.tex %.pdf: %.md liquidsoap.xml
$(PANDOC) --filter=pandoc-crossref -s $< -o $@
site: web.pdf
mkdir -p site/public
cp web.pdf site/public/book.pdf
$(MAKE) -C cover cover-ebook.svg
cp cover/cover-ebook.svg site/public/book.svg
$(MAKE) -C site
.PHONY: fig scripts site