articles and other creations https://zine.tildeverse.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

102 lines
2.4 KiB

# customizable output dir
DEST_DIR ?= dist
# find all issues and determine required output files
ISSUES != find ./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 \
--standalone \
--table-of-contents \
--lua-filter increase-header-levels.lua \
--variable title:"tildeverse zine $@" \
--variable geometry:margin=.75in \
--pdf-engine xelatex \
--output $@ \
$</*.md
$(DEST_DIR)/issue-%.html: issues/%
$(info building $@)
@$(PANDOC) \
--file-scope \
--from markdown \
--to html \
--standalone \
--table-of-contents \
--lua-filter header-permalinks.lua \
--lua-filter increase-header-levels.lua \
--metadata title:"tildeverse zine $@" \
--variable include-before:"<div class=\"container\">" \
--variable include-after:"</div>" \
--css https://tilde.team/css/hacker.css \
--output $@ \
$</*.md
$(DEST_DIR)/issue-%.epub: issues/%
$(info building $@)
@$(PANDOC) \
--file-scope \
--from markdown \
--to epub \
--standalone \
--table-of-contents \
--lua-filter increase-header-levels.lua \
--metadata title:"tildeverse zine $@" \
--output $@ \
$</*.md
clean:
$(info removing build artifacts)
@rm $(DEST_DIR)/issue-*
serve: dep-php
$(info starting local php server)
@$(PHP) -S localhost:9000 -t $(DEST_DIR)
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
dep-php:
ifndef PHP
$(error missing dependency 'php'. please install and try again)
endif
.PHONY: clean serve help dep-pandoc dep-xelatex dep-php