summaryrefslogtreecommitdiffhomepage
path: root/Makefile
blob: 079681ff9fd6ced70978d00de31c26b6d8f852ac (plain) (blame)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.PHONY: check clean serve

gendeps   = ${filter-out %/index.gsp,${wildcard ${1}/*}}
includes := ${wildcard include/*}
srcdirs  := ${shell find src -type d}
outdirs  := ${srcdirs:src%=out%}
sources  := ${shell find src -type f -regextype egrep -regex '.*/(index\.gsp|.*\.(css|svg|png|dot))'}
outputs  := ${sources:src/%=out/%}
outputs  := ${outputs:%.gsp=%.html}
outputs  := ${outputs:%.dot=%.svg}

all: ${outdirs} ${outputs} fonts
	@cp -r fonts out
	@printf 'CP\tfonts\n'

${outdirs}:
	@mkdir -p $@
	@printf 'MKDIR\t%s\n' "$@"

out/%: src/%
	@cp $< $@
	@printf 'CP\t%s\n' "$@"

out/%.svg: src/%.dot
	@dot -Tsvg $< >$@
	@printf 'DOT\t%s\n' "$@"

out/%.html: src/%.gsp ${includes} src/style.css
	@PATH="$$PATH:./include" \
	m4 -P ${foreach dir,${^D},-I${dir}} include/lib.m4 $< | gsp >$@
	@printf 'GSP\t%s\n' "$@"

src/srp/fw-ec/index.gsp: ${call gendeps,src/srp/fw-ec}
	@touch $@
src/srp/gsp/index.gsp: ${call gendeps,src/srp/gsp}
	@touch $@
src/prj/mmv/index.gsp: ${call gendeps,src/prj/mmv}
	@touch $@
src/prj/mkpass/index.gsp: ${call gendeps,src/prj/mkpass}
	@touch $@
src/prj/totp/index.gsp: ${call gendeps,src/prj/totp}
	@touch $@

check:
	LANG=en_US.UTF-8 find src -name 'index.gsp' -exec \
		aspell --home-dir=./ --ignore-case check {} \;

clean:
	rm -rf out

serve:
	darkhttpd out --daemon

watch:
	git ls-files | entr make

push-fonts:
	./gen-fonts
	rsync -a fonts vps:/var/www/www.thomasvoss.com/out/