aboutsummaryrefslogtreecommitdiff
path: root/GNUmakefile
blob: e5da114b3d0b94bd19b615d61a33638260341b99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 -b localhost -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/%: 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