--- /dev/null
+BUILD = build
+BOOKNAME = the_mediocre_programmer
+TITLE = title.txt
+METADATA = metadata.xml
+CHAPTERS = intro.md chapter01.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
--- /dev/null
+This is the (work-in-progress) text for the upcoming book "The Mediocre Programmer".
+
+Released under a CC-BY-SA 4.0 International license.
+
+(Uses Pandoc Markdown Template / Makefile from https://github.com/evangoer/pandoc-ebook-template)
--- /dev/null
+<dc:rights>Copyright 2018, Craig Maloney and released under a CC-BY-SA International 4.0 License</dc:rights>
+<dc:language>en-US</dc:language>