-
Notifications
You must be signed in to change notification settings - Fork 7
/
makefile
44 lines (36 loc) · 938 Bytes
/
makefile
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
chapters := $(shell awk '/^[0-9A-Z]+\. / {print $$2}' toc)
chapters_haml := $(chapters:%=%.haml)
chapters_html := $(chapters:%=%.html)
all: $(chapters_html)
haml := haml/bin/haml --format html5 --autofilter markdown
$(chapters_html): %.html: %.haml toc layout.html
@echo $@: $^
@set -o pipefail; \
cat $< |\
bin/footnotes |\
bin/tables |\
$(haml) |\
bin/layout layout.html |\
bin/title $< |\
bin/updated $(chapters_haml) |\
bin/toc toc $(<:%.haml=%) |\
bin/glossarylinks $(filter glossary.haml,$<) |\
bin/next toc $(<:%.haml=%) \
> $@
layout.html: layout.haml
@echo $@: $^
@$(haml) $< > $@
clean:
rm -f *.html
.PHONY: clean
wc: $(chapters_haml)
@for f in $^; do \
printf "%25s" $$f; \
sed -Ee '/^ *(\.figure|\.window|\.modeline|\.echoarea)/,/^$$/ d' \
$$f | wc; \
done; \
printf "%25s" ""; \
sed -Ee '/^ *(\.figure|\.window|\.modeline|\.echoarea)/,/^$$/ d' \
$^ | wc
.PHONY: wc
.DELETE_ON_ERROR: