This repository has been archived by the owner on Oct 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
executable file
·90 lines (62 loc) · 1.69 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
79
80
81
82
83
84
85
86
87
88
89
90
## Create e-books in multiple formats
# Variables
BOOKNAME = ebook
# Default targets
## all : Generate all supported document types (updated files only)
all: html epub pdf docx
## clean : Delete all generated files
clean: html_clean epub_clean pdf_clean docx_clean
# `make help` displays all lines beginning with two hash signs
help : Makefile
@sed -n 's/^##//p' $<
# Build targets
## html : Generate an HTML file.
html: $(BOOKNAME).html
html_clean:
rm -f $(BOOKNAME).html
$(BOOKNAME).html: $(BOOKNAME).md style.css
pandoc $(BOOKNAME).md \
-t html \
-o $(BOOKNAME).html \
--css="style.css" \
--table-of-contents \
--section-divs \
--standalone
## epub : Generate an EPUB file.
epub: $(BOOKNAME).epub
epub_clean:
rm -f $(BOOKNAME).epub
$(BOOKNAME).epub: $(BOOKNAME).md images/cover.jpg style-epub.css
pandoc $(BOOKNAME).md \
-t epub \
-o $(BOOKNAME).epub \
--epub-cover-image="images/cover.jpg" \
--css="style-epub.css" \
--standalone
## pdf : Generate a PDF file.
pdf: $(BOOKNAME).pdf
pdf_clean:
rm -f $(BOOKNAME).pdf
$(BOOKNAME).pdf: $(BOOKNAME).md
pandoc $(BOOKNAME).md \
-o $(BOOKNAME).pdf \
-V documentclass=scrbook \
-V indent \
-V subparagraph \
-V fontfamily="libertine" \
-V fontfamilyoptions="oldstyle,proportional" \
-V papersize=a5 \
--top-level-division=part \
--pdf-engine=lualatex \
--table-of-contents
## docx : Generate a Word file.
docx: $(BOOKNAME).docx
docx_clean:
rm -f $(BOOKNAME).docx
$(BOOKNAME).docx: $(BOOKNAME).md style.docx
pandoc $(BOOKNAME).md \
-o $(BOOKNAME).docx \
--reference-doc=style.docx \
--table-of-contents
# Actions that do not correspond to files
.PHONY: help html pdf docx epub html_clean pdf_clean docx_clean epub_clean