# 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 PHP != command -v php 2> /dev/null # default target help: $(info all - build all formats) $(info pdf - generate all issues as pdf - requires xelatex) $(info html - generate all issues as html) $(info epub - generate all issues as epub) $(info clean - remove build artifacts) $(info serve - start local php test server - requires php) $(info note: all builds require pandoc) all: dep-pandoc pdf html epub pdf: dep-xelatex $(DEST_PDF_FILES) html: $(DEST_HTML_FILES) epub: $(DEST_EPUB_FILES) $(DEST_DIR)/issue-%.pdf: issues/% $(info building $@) @$(PANDOC) \ --file-scope \ --from markdown \ --to latex \ --pdf-engine xelatex \ --table-of-contents \ --lua-filter increase-header-levels.lua \ --variable title:"tildeverse zine $@" \ --standalone \ --output $@ \ $" \ --variable include-after:"" \ --css https://tilde.team/css/hacker.css \ --output $@ \ $