-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (48 loc) · 1.49 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
# Makefile
#
# Run "make" (or "make all") to convert to all other formats
#
# Run "make clean" to delete converted files
#
MD_FILES = $(wildcard md/*.md)
PDF_FILES = $(patsubst md/%.md,pdf/%.pdf,$(MD_FILES))
HTML_FILES = $(patsubst md/%.md,html/%.html,$(MD_FILES))
OUTPUT_FILES = $HTML_FILES $PDF_FILES
#
# Options
#
RM=/bin/rm
PANDOC=/usr/local/bin/pandoc
PANDOC_OPTIONS=--number-sections
PANDOC_HTML_OPTIONS=--standalone --default-image-extension=png --mathjax -M fontsize=18px -M maxwidth=50em
# removed --template=easy_template.html
PANDOC_PDF_OPTIONS=--default-image-extension=pdf
PANDOC_EPUB_OPTIONS=--to epub3
PANDOC_BOOK_OPTIONS=--top-level-division=chapter --toc --toc-depth=2
#
# Pattern matching rules
#
html/%.html: md/%.md Makefile
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_HTML_OPTIONS) -o $@ $<
pdf/%.pdf: md/%.md Makefile
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_PDF_OPTIONS) -o $@ $<
#
# Targets and dependencies
#
.PHONY: all html pdf books
# Chapters
all: html pdf
html : $(HTML_FILES)
pdf : $(PDF_FILES)
# Whole book
bookhtml : $(SOURCE_DOCS)
rm -rf Book
$(PANDOC) -t chunkedhtml $(PANDOC_OPTIONS) ${PANDOC_BOOK_OPTIONS} ${PANDOC_HTML_OPTIONS} -o Book $(MD_FILES)
bookpdf : ${SOURCE_DOCS}
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_BOOK_OPTIONS) $(PANDOC_PDF_OPTIONS) -o pdf/Book.pdf $(MD_FILES)
books: bookhtml bookpdf
# clean:
# - $(RM) $(OUTPUT_DOCS)
# publish: all
# rsync -avu $(OUTPUT_DOCS) ../Web/notes
# rsync -avru Fig/*.pdf Fig/*.png Fig/derived-maps ../Web/notes/Fig/