# this fucking sucks lol

all: build

serve:
	xdg-open http://localhost:8000/
	python3 -m http.server -d public/

watch:
	find src/ templates/ -type f | entr make build

build: # shit breaks when index.org doesnt exist idk why
	[ -f src/blog/index.org ] || touch src/blog/index.org
	@mkdir -p public/
	emacs -Q --script build-site.el

compress: build # for gzip-static, check the obsd httpd.conf(5) man page
	find public/ -type f \( -name "*.html" -o -name "*.css" -o -name "*.xml" \) \
	-exec gzip -k {} \;

publish: compress build
	rsync -rcvP --delete public/ \
	lemurianmage@slimegirl.nexus:/var/www/htdocs/slimegirl.nexus

clean:
	rm -r public/

.PHONY: serve watch build compress publish clean
