add friendly dep notice and help message

This commit is contained in:
Ben Harris 2019-09-26 15:16:55 -04:00
parent fd85af8e37
commit fc00bf78b3
1 changed files with 33 additions and 3 deletions

View File

@ -1,12 +1,32 @@
# customizable output dir
DEST_DIR ?= dist
# find all issues and determine required output files
ISSUES != find . -path "./issues/*" -type d
DEST_PDF_FILES := $(ISSUES:./issues/%=$(DEST_DIR)/issue-%.pdf)
DEST_HTML_FILES := $(ISSUES:./issues/%=$(DEST_DIR)/issue-%.html)
DEST_EPUB_FILES := $(ISSUES:./issues/%=$(DEST_DIR)/issue-%.epub)
# deps
PANDOC != command -v pandoc 2> /dev/null
XELATEX != command -v xelatex 2> /dev/null
all: $(DEST_PDF_FILES) $(DEST_HTML_FILES) $(DEST_EPUB_FILES)
# default target
help:
@echo "Targets:"
@echo -e "\tall - build all formats"
@echo -e "\tpdf - generate all issues as pdf"
@echo -e "\thtml - generate all issues as html"
@echo -e "\tepub - generate all issues as epub"
@echo -e "\tclean - remove build artifacts"
all: pdf html epub dep-pandoc
pdf: $(DEST_PDF_FILES) dep-xelatex
html: $(DEST_HTML_FILES)
epub: $(DEST_EPUB_FILES)
$(DEST_DIR)/issue-%.pdf: issues/%
@echo "building $@"
@ -54,7 +74,17 @@ $(DEST_DIR)/issue-%.epub: issues/%
clean:
@echo "removing build artifacts"
@rm $(DEST_PDF_FILES) $(DEST_HTML_FILES) $(DEST_EPUB_FILES)
@rm $(DEST_DIR)/*.{pdf,html,epub}
.PHONY: clean
dep-pandoc:
ifndef PANDOC
$(error missing dependency 'pandoc'. please install and try again)
endif
dep-xelatex:
ifndef XELATEX
$(error missing dependency 'xelatex'. please install and try again)
endif
.PHONY: clean help dep-pandoc dep-xelatex