BUILD = build MAKEFILE = Makefile OUTPUT_FILENAME = book METADATA = metadata.yml CHAPTERS = chapters/*.md TOC = --toc --toc-depth=2 IMAGES_FOLDER = images IMAGES = $(IMAGES_FOLDER)/* COVER_IMAGE = $(IMAGES_FOLDER)/cover.png LATEX_CLASS = report MATH_FORMULAS = --webtex CSS_FILE = style.css CSS_ARG = --css=$(CSS_FILE) METADATA_ARG = --metadata-file=$(METADATA) ARGS = $(TOC) $(MATH_FORMULAS) $(CSS_ARG) $(METADATA_ARG) all: book book: html pdf clean: rm -r $(BUILD) html: $(BUILD)/html/$(OUTPUT_FILENAME).html pdf: $(BUILD)/pdf/$(OUTPUT_FILENAME).pdf $(BUILD)/html/$(OUTPUT_FILENAME).html: $(MAKEFILE) $(METADATA) $(CHAPTERS) $(CSS_FILE) $(IMAGES) mkdir -p $(BUILD)/html pandoc $(ARGS) --standalone --to=html5 -o $@ $(CHAPTERS) cp -R $(IMAGES_FOLDER)/ $(BUILD)/html/$(IMAGES_FOLDER)/ cp $(CSS_FILE) $(BUILD)/html/$(CSS_FILE) $(BUILD)/pdf/$(OUTPUT_FILENAME).pdf: $(MAKEFILE) $(METADATA) $(CHAPTERS) $(CSS_FILE) $(IMAGES) mkdir -p $(BUILD)/pdf pandoc $(ARGS) -V documentclass=$(LATEX_CLASS) -o $@ $(CHAPTERS)