From 230f1dfe2ab67ad391ec8abb1c90fe8ae721ef22 Mon Sep 17 00:00:00 2001 From: saper Date: Tue, 22 Oct 2019 06:34:14 -0600 Subject: [PATCH] Makefile: static generator for index When running a copy of a wiki on tilde.club itself the webserver does not allow us to view "index.php", so generate index.html for static viewing pleasure. --- wiki/Makefile | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/wiki/Makefile b/wiki/Makefile index a79c5fc..7b6c59e 100644 --- a/wiki/Makefile +++ b/wiki/Makefile @@ -1,10 +1,16 @@ SRC_MD_FILES != find source -name '*.md' -DST_HTML_FILES := $(SRC_MD_FILES:source/%.md=%.html) +DST_HTML_FILES := index.html $(SRC_MD_FILES:source/%.md=%.html) PANDOC != command -v pandoc 2> /dev/null +PHP != command -v php 2> /dev/null all: dep-pandoc $(DST_HTML_FILES) +index.html: index.php + +%.html: %.php dep-php + php $< > $@ + %.html: source/%.md $(info building $@) @$(PANDOC) \ @@ -19,12 +25,17 @@ all: dep-pandoc $(DST_HTML_FILES) clean: $(info removing generated files) - @rm $(DST_HTML_FILES) + -rm $(DST_HTML_FILES) -dep-pandoc: +dep-pandoc:: ifndef PANDOC $(error missing dependency 'pandoc'. please install and try again) endif +dep-php:: +ifndef PHP + $(error missing dependency 'php'. please install and try again) +endif + .PHONY: clean dep-pandoc