wiki/Makefile
2025-03-07 22:53:04 +01:00

46 lines
915 B
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/
lowdown $< > $@
.PHONY: clean
clean:
$(RM) $(targets)