-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
49 lines (35 loc) · 838 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
CHAPTERS = $(wildcard chapters/*.md)
EPUB_FILE = build/book.epub
MOBI_FILE = build/book.mobi
PDF_FILE = build/book.pdf
.PHONY: all
all: $(EPUB_FILE) $(MOBI_FILE) $(PDF_FILE)
.PHONY: clean
clean:
rm -f build/*
.PHONY: epub
epub: $(EPUB_FILE)
.PHONY: mobi
mobi: $(MOBI_FILE)
.PHONY: pdf
pdf: $(PDF_FILE)
.PHONY: preview
preview: $(MOBI_FILE)
ebook-viewer $(MOBI_FILE)
$(EPUB_FILE): clean $(CHAPTERS) meta/title.txt meta/cover.jpg meta/stylesheet.css meta/metadata.xml
pandoc \
-o $(EPUB_FILE) \
meta/title.txt \
$(CHAPTERS) \
--epub-cover-image=meta/cover.jpg \
--css=meta/stylesheet.css \
--epub-metadata=meta/metadata.xml \
--table-of-contents
$(PDF_FILE): $(CHAPTERS) meta/title.txt
pandoc \
-o $(PDF_FILE) \
meta/title.txt \
$(CHAPTERS) \
--toc
$(MOBI_FILE): $(EPUB_FILE)
kindlegen $(EPUB_FILE)