From c623de03d23da0a9f5d80160f5f88388b30f8c22 Mon Sep 17 00:00:00 2001 From: ge Date: Thu, 29 Sep 2022 23:44:55 +0300 Subject: [PATCH] add Makefile template for sites --- Makefile.jinja2 | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Makefile.jinja2 diff --git a/Makefile.jinja2 b/Makefile.jinja2 new file mode 100644 index 0000000..e0157b5 --- /dev/null +++ b/Makefile.jinja2 @@ -0,0 +1,36 @@ +# Makefile for reSW + +CONTENTDIR = {{ content_dir }} +STATICDIR = {{ static_dir }} +BUILDDIR = {{ build_dir }} +CONFIG = {{ config }} + +all: build + +help: + @echo 'Build rSW site' + @echo + @echo 'Available targets:' + @echo + @echo ' build build HTML' + @echo ' serve run local HTTP server' + @echo ' css generate Pygments stylesheet' + @echo + @echo 'Run make without target to build html' + +build: + test -d "$(BUILDDIR)" && rm -rf "$(BUILDDIR)" || true + rsw build -c "$(CONFIG)" + +serve: + python -m http.server --directory $(BUILDDIR)/ --bind 0.0.0.0 8080 + +css: + mkdir -pv "$(STATICDIR)"/css/pygments + pygmentize -f html -S $(filter-out $@,$(MAKECMDGOALS)) -a .highlight \ + > "$(STATICDIR)"/css/pygments/$(filter-out $@,$(MAKECMDGOALS)).css + +%: + @: + +.PHONY: all help build serve css