-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (31 loc) · 1.39 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
BUILD = build
BOOKNAME = TheCrimsonKing
TITLE = title.txt
METADATA = metadata.yaml
CHAPTERS = src/HowCouldIFallIntoYourHandsRosyMaid.markdown src/LadyFair.markdown src/TheGrandBall.markdown src/OdetoaPrincess.markdown src/AWanderingStar.markdown src/LittleLight.markdown src/ASirensSong.markdown src/AllAlongTheInterlude.markdown src/IWhishICouldJustDieIWishIWasAlive.markdown src/TheCastle.markdown src/ThroneOfMight.markdown src/ICouldNotFindTheFaultsOfMyShaplessForm.markdown
TOC = --toc --toc-depth=2
COVER_IMAGE = resources/TheCrimsonKingCover.jpg
COVER = resources/cover.xhtml
LATEX_CLASS = book
EPUB_CSS = css/blitz-lite-poetry.min.css
LICENSES = license.md
all: book
book: epub html pdf
clean:
rm -r $(BUILD)
epub: $(BUILD)/$(BOOKNAME).epub
html: $(BUILD)/$(BOOKNAME).html
pdf: $(BUILD)/$(BOOKNAME).pdf
$(BUILD)/$(BOOKNAME).epub: $(CHAPTERS)
@ mkdir -p $(BUILD)
@ pandoc $(TOC) --from markdown+smart --css=$(EPUB_CSS) --epub-cover-image=$(COVER_IMAGE) $(METADATA) -o $@ $^ $(LICENSES)
@ # The next to file adds xhtml so that the cover properly rescales on all devices
@ cp $(COVER) cover.xhtml
@ zip -m $@ cover.xhtml
$(BUILD)/$(BOOKNAME).html: $(CHAPTERS)
mkdir -p $(BUILD)
pandoc $(TOC) --standalone --to=html5 -o $@ $^
$(BUILD)/$(BOOKNAME).pdf: $(TITLE) $(CHAPTERS)
mkdir -p $(BUILD)
pandoc $(TOC) --pdf-engine=xelatex -V documentclass=$(LATEX_CLASS) -o $@ $^
.PHONY: all book clean epub html pdf