MAKEFLAGS += -j1 pdfjs = https://github.com/mozilla/pdf.js/releases/download/v1.9.426/pdfjs-1.9.426-dist.zip # Default target all: out/index.html out/main.css out/pdfjs phony += all # Boilerplate phony += FORCE .DELETE_ON_ERROR: .SECONDARY: # Development server serve: serve-8000 serve-%: all dir=$$(mktemp -d -t) && trap 'fusermount -u "$$dir"; rmdir "$$dir"' EXIT && unionfs -o ro out:src "$$dir" && (cd "$$dir" && python3 -m http.server $*) phony += serve serve-% # Clean clean: rm -rf out phony += clean # Real file rules out/%.css: src/%.scss @mkdir -p $(@D) scss --stdin < $< > $@ out/$(notdir $(pdfjs)): wget -c --no-use-server-timestamp -O $@ $(pdfjs) out/pdfjs: out/$(notdir $(pdfjs)) rm -rf -- $@ mkdir -- $@ && bsdtar -xf $(abspath $<) -C $@ --exclude '*.pdf' || { rm -rf -- $@; false; } targets = $(phony) %.css out/pdfjs% $(sort $(filter-out $(targets),out/index.html $(MAKECMDGOALS))): FORCE ./bin/sitegen # Boilerplate .PHONY: $(phony)