articles = $(patsubst %.md,%,$(wildcard public/*.md))

.DELETE_ON_ERROR:
.SECONDARY:

all: public/index.html $(addsuffix .html,$(articles))

public/%.html: public/%.md pagerender.rb template.erb Makefile
	./pagerender.rb $< > $@
public/index.html: $(addsuffix .md,$(articles)) index.rb template.erb Makefile
	./index.rb $(sort $(filter-out Makefile index.rb template.erb,$^)) > $@
clean:
	rm -- public/*.html