aboutsummaryrefslogtreecommitdiff
path: root/GNUmakefile
diff options
context:
space:
mode:
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile36
1 files changed, 36 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 0000000..b56bf39
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,36 @@
+build: $(patsubst src/%.md, out/%.html, $(shell find src -type f)) \
+ $(patsubst static/%, out/%, $(shell find static -type f)) \
+ $(patsubst src/%, out/%, $(shell find src -type f ! -name "*.md"))
+
+serve:
+ xdg-open http://localhost:8000/
+ python3 -m http.server -d out/
+
+watch:
+ find . -type f ! -path "./out/*" | entr make build
+
+out/%.html: src/%.md template.html template.pl
+ @mkdir -p $(dir $@)
+ ./template.pl $< > $@
+
+out/%: src/%
+ @mkdir -p $(dir $@)
+ cp $< $@
+
+out/%: static/%
+ @mkdir -p $(dir $@)
+ cp $< $@
+
+compress: build # for gzip-static, check the openbsd httpd.conf(5) man page
+# grep -Il skips binary files
+ find out/ -type f -exec grep -Il . {} \; \
+ -exec gzip -k {} \;
+
+publish: compress build
+ rsync -rcvP --delete out/ \
+ lemurianmage@slimegirl.nexus:/var/www/htdocs/slimegirl.nexus
+
+clean:
+ rm -r out/
+
+.PHONY: build serve watch compress publish clean