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.
This commit is contained in:
saper 2019-10-22 06:34:14 -06:00 committed by Ben Harris
parent be11d6e620
commit 230f1dfe2a
1 changed files with 14 additions and 3 deletions

View File

@ -1,10 +1,16 @@
SRC_MD_FILES != find source -name '*.md' 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 PANDOC != command -v pandoc 2> /dev/null
PHP != command -v php 2> /dev/null
all: dep-pandoc $(DST_HTML_FILES) all: dep-pandoc $(DST_HTML_FILES)
index.html: index.php
%.html: %.php dep-php
php $< > $@
%.html: source/%.md %.html: source/%.md
$(info building $@) $(info building $@)
@$(PANDOC) \ @$(PANDOC) \
@ -19,12 +25,17 @@ all: dep-pandoc $(DST_HTML_FILES)
clean: clean:
$(info removing generated files) $(info removing generated files)
@rm $(DST_HTML_FILES) -rm $(DST_HTML_FILES)
dep-pandoc: dep-pandoc::
ifndef PANDOC ifndef PANDOC
$(error missing dependency 'pandoc'. please install and try again) $(error missing dependency 'pandoc'. please install and try again)
endif endif
dep-php::
ifndef PHP
$(error missing dependency 'php'. please install and try again)
endif
.PHONY: clean dep-pandoc .PHONY: clean dep-pandoc