mirror of https://github.com/tildeclub/site.git
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:
parent
be11d6e620
commit
230f1dfe2a
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue