all: manual MANUALS = $(patsubst %.md,%,$(wildcard ./doc/*.[1-9].md)) manual: $(MANUALS) # upper case the headers and remove the links $(MANUALS): %: %.md pandoc -f markdown -t json -- "$<" | ./pandoc2man.jq | pandoc -s -f json -t man+smart -o "$@" test: @./tests/run-all HTML_ROOTDIR ?= ./doc CSS ?= /usr/share/javascript/bootstrap/css/bootstrap.min.css HTML_TEMPLATE ?= ./doc/template.html HTML_FILES = $(addprefix $(HTML_ROOTDIR)/,$(patsubst ./doc/%.md,%.html,$(wildcard ./doc/*.md))) html: $(HTML_FILES) ## CSS="https://guilhem.org/static/css/bootstrap.min.css" HTML_ROOTDIR="$XDG_RUNTIME_DIR/Downloads" make html $(HTML_ROOTDIR)/%.html: ./doc/%.md $(HTML_TEMPLATE) mtime="$$(git --no-pager log -1 --pretty="format:%ct" -- "$<" 2>/dev/null)"; \ [ -n "$$mtime" ] || mtime="$$(date +%s -r "$<")"; \ [ "$<" = "doc/index.md" ] && parent="" || parent="./index.html"; \ pandoc -sp -f markdown -t html+smart --css=$(CSS) --template=$(HTML_TEMPLATE) \ --variable=date:"$$(LC_TIME=C date +"Last modified on %a, %d %b %Y at %T %z" -d @"$$mtime")" \ --variable=keywords:"interimap" \ --variable=lang:"en" \ --variable=parent:"$$parent" \ --output="$@" -- "$<" doc: manual html install: clean: rm -f $(MANUALS) $(HTML_FILES) .PHONY: all manual html doc test install clean