-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
49 lines (37 loc) · 1.06 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
LATEX=platex
#LATEX=uplatex
LATEX_OPT=-shell-escape -output-directory=tex
#PANDOC=pandoc
PANDOC=~/.cabal/bin/pandoc
PANDOC_OPT=--toc --listings --chapters
DVIPDFMX=dvipdfmx
DVIPDFMX_OPT=-f ptex-hiragino
NAME=explore-flask-ja
TEMPLATE=template.tex
SRCS=meta.yaml foreword.md preface.md conventions.md environment.md organizing.md configuration.md views.md blueprints.md templates.md static.md storing.md forms.md users.md deployment.md conclusion.md
MD=$(NAME).md
TEX=tex/$(NAME).tex
DVI=tex/$(NAME).dvi
PDF=$(NAME).pdf
EPUB=$(NAME).epub
HTML=$(NAME).html
tex/%.dvi: tex/%.tex
$(LATEX) $(LATEX_OPT) $<
$(LATEX) $(LATEX_OPT) $<
%.pdf: tex/%.dvi
$(DVIPDFMX) $(DVIPDFMX_OPT) $^
all: pdf
pdf: $(PDF)
clean:
rm -rf tex $(MD) $(TEX) $(DVI) $(PDF) $(EPUB) $(HTML)
$(MD): $(SRCS)
sed -e 's|^//note\[\(.*\)\]{|**\1**|g' -e 's|^//}||g' $^ > $@
$(EPUB): $(MD)
$(PANDOC) -o $@ $<
$(HTML): $(MD)
$(PANDOC) -o $@ $<
$(TEX): $(MD) $(TEMPLATE)
mkdir -p tex
$(PANDOC) -t latex $(PANDOC_OPT) --template=$(TEMPLATE) $< | sed -e 's/\[htbp\]/\[H\]/g' > $@
$(DVI): $(TEX)
$(PDF): $(DVI)