-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathMakefile
35 lines (25 loc) · 823 Bytes
/
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
BUILD = build
BOOKNAME = my-book
TITLE = title.txt
METADATA = metadata.xml
CHAPTERS = ch01.md ch02.md
TOC = --toc --toc-depth=2
COVER_IMAGE = images/cover.jpg
LATEX_CLASS = report
all: book
book: epub html pdf
clean:
rm -r $(BUILD)
epub: $(BUILD)/epub/$(BOOKNAME).epub
html: $(BUILD)/html/$(BOOKNAME).html
pdf: $(BUILD)/pdf/$(BOOKNAME).pdf
$(BUILD)/epub/$(BOOKNAME).epub: $(TITLE) $(CHAPTERS)
mkdir -p $(BUILD)/epub
pandoc $(TOC) -S --epub-metadata=$(METADATA) --epub-cover-image=$(COVER_IMAGE) -o $@ $^
$(BUILD)/html/$(BOOKNAME).html: $(CHAPTERS)
mkdir -p $(BUILD)/html
pandoc $(TOC) --standalone --to=html5 -o $@ $^
$(BUILD)/pdf/$(BOOKNAME).pdf: $(TITLE) $(CHAPTERS)
mkdir -p $(BUILD)/pdf
pandoc $(TOC) --latex-engine=xelatex -V documentclass=$(LATEX_CLASS) -o $@ $^
.PHONY: all book clean epub html pdf