# This blog is published using the gnu m4 preprocessor and rsync!
# Using m4 works great for most static HTML files, as long as you don't
# need iteration/looping. If you need that, it is doable, but it gets
# *really* ugly; see the definition of the fordown macro in list.m4.

LATEST=200
SRC := $(wildcard *.m4 | grep -v feed.m4)
OUTPUTS := $(patsubst %.m4,out/%.html,$(SRC))

all: $(OUTPUTS) out/atom.xml out/style.css out/assets/ads.js

out/list.html: Makefile $(SRC)
out/index.html: Makefile $(LATEST).m4
out/%.html: %.m4 header.html footer.html ; m4 -D__latest=$(LATEST) $< > $@
out/atom.xml: feed.m4 $(LATEST).m4 Makefile ; m4 -D__latest=$(LATEST) $< > $@
out/style.css: static/*.css ; cat $^ > $@
out/assets/%: static/assets/%; cp $^ $@

clean: ; rm out/*

watch: ; echo $(SRC) | tr " " "\n" | entr make
server: all ; cd out; python3 -m http.server 3001

upload: all; rsync -azPL out/ p:technomancy.us/new/

.PHONY: all clean watch server upload

Generated by Phil Hagelberg using scpaste at Sun May 19 07:26:25 2024. PDT. (original)