summaryrefslogtreecommitdiff
path: root/Makefile
blob: b144c89ebdfc36d929fa4e79e899dfc61bb16f01 (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
articles = $(filter-out public/index,$(patsubst %.md,%,$(wildcard public/*.md)))

.DELETE_ON_ERROR:
.SECONDARY:

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

public/%.html: public/%.md pagerender.rb template.html.erb util.rb Makefile
	./pagerender.rb html $< > $@
public/%.atom: public/%.md pagerender.rb template.atom.erb util.rb Makefile
	./pagerender.rb atom $< > $@
public/index.md: .var.articles $(addsuffix .md,$(articles)) index.rb Makefile
	./index.rb $(filter %.md,$^) > $@

.var.%: FORCE
	@printf '%s' $(call quote.shell,$($*)) | sed 's/^/#/' | ./write-ifchanged $@
-include $(wildcard .var.*)

clean:
	rm -f -- public/*.html public/*.atom public/index.md .var* .tmp*

.PHONY: FORCE
.PHONY: all clean

define nl


endef
# I put this as the last line in the file because it confuses Emacs syntax
# highlighting and makes the remainder of the file difficult to edit.
quote.shell = $(subst $(nl),'$$'\n'','$(subst ','\'',$1)')