Files
wiki/Makefile

47 lines
1.0 KiB
Makefile

vpath %.md src
########## Variables ##########
dependencies = lowdown
markdown = $(wildcard src/*.md)
pages = $(patsubst src/%.md, public/%.html, $(markdown))
targets += $(pages)
ignored += public/
ignore_file = .git/info/exclude
########## Build Instructions ##########
.PHONY: help
help: ## Print the help message.
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
sort | \
column -s ':' -t
.PHONY: check
check: ## Check you have all dependencies.
@$(foreach dep, $(dependencies), \
command -v $(dep) >/dev/null || { echo Install $(dep) && exit 1 ;} ;\
)
.PHONY: site
site: $(targets) $(ignore_file) ## Make the website in public/.
$(ignore_file): $(MAKEFILE_LIST)
echo $(ignored) | tr ' ' '\n' > $@
public/:
mkdir $@
$(pages): public/%.html: %.md | public/
sed 's/\(\[.*\)\(.*\)\.md)/\1)/g' $< |\
lowdown -m filename=$(basename $@) -s --template default.html > $@
.PHONY: clean
clean: ## Remove generated files.
$(RM) $(targets)