markdowns index.html
[thefekete.net.git] / Makefile
1 # markdown sources
2 posts=$(patsubst %.md,build/%.html,$(wildcard blog/*.md))
3 # static sources
4 S=img/
5
6 all: build/index.html blog $S
7 cp -av $S build/
8
9 blog: build/blog/ $(posts)
10
11 build/:
12 mkdir -p $@
13
14 build/blog/: build/
15 mkdir -p $@
16
17 build/index.html: index.md build/ inc/head.template inc/foot.template
18 sed "s/__TITLE__/thefekete.net/; /__DATE__/d" inc/head.template >$@
19 markdown index.md >>$@
20 cat inc/foot.template >>$@
21
22 build/blog/%.html: blog/%.md build/ inc/head.template inc/foot.template
23 @# `pacman -S discount` for `markdown`
24 bin/blog.awk $< >$@
25
26 publish: _not_dirty all _rsync
27
28 clean:
29 rm -rfv build/
30
31 _rsync: all
32 rsync -vha --delete build/ root@thefekete.net:/var/www/thefekete.net/
33
34 _not_dirty:
35 @git diff-index --quiet HEAD -- && test -z "$(git ls-files --others)" || ( \
36 1>&2 echo "Index is dirty or there are uncommitted files!"; \
37 git status; \
38 exit 1; \
39 )
40
41 .PHONY: all blog view publish clean _rsync _not_dirty