-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
54 lines (40 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
50
51
52
53
54
#LATEX=platex
LATEX=uplatex
PANDOC=pandoc
PANDOC_OPT=--toc --toc-depth=3 --chapters
DVIPDFMX=dvipdfmx
DVIPDFMX_OPT=-f noto
NAME=zguide-ja
TEMPLATE=template.tex
SRCS=macro.m4 meta.yaml preface.md chapter1.md chapter2.md chapter3.md chapter4.md postface.md
MD=$(NAME).md
TEX=$(NAME).tex
DVI=$(NAME).dvi
PDF=$(NAME).pdf
EPUB=$(NAME).epub
HTML=$(NAME).html
EXAMPLE_LANG=C
EXAMPLE_EXT=c
#EXAMPLE_LANG=Perl
#EXAMPLE_EXT=pl
# filter original text
ORIGINAL_FILTER=sed -e 's/^;.*//'
#ORIGINAL_FILTER=sed -e 's/^;\(.*\)/\1/'
%.dvi: %.tex
$(LATEX) $<
$(LATEX) $<
%.pdf: %.dvi
$(DVIPDFMX) $(DVIPDFMX_OPT) $^
all: $(PDF)
clean:
rm -rf *.log *.out *.aux *.toc $(MD) $(TEX) $(DVI) $(PDF) $(EPUB) $(HTML)
$(MD): $(SRCS)
m4 -DEXAMPLE_LANG=$(EXAMPLE_LANG) -DEXAMPLE_EXT=$(EXAMPLE_EXT) $^ | ${ORIGINAL_FILTER} > $@
$(EPUB): $(MD)
$(PANDOC) -o $@ $<
$(HTML): $(MD)
$(PANDOC) -o $@ $<
$(TEX): $(MD) $(TEMPLATE)
$(PANDOC) -f markdown -t latex $(PANDOC_OPT) --template=$(TEMPLATE) $< | sed -e 's/\\begin{figure}\(\[.*\]\)\?/\\begin{figure}\[H\]/g' > $@
$(DVI): $(TEX)
$(PDF): $(DVI)