forked from capheind/ACKS_SRD
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
49 lines (38 loc) · 979 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
45
46
47
48
49
.SUFFIXES: .md .html
.PHONY: all clean
MD= \
Chapter00.md \
Chapter01.md \
Chapter02.md \
Chapter03.md \
Chapter04.md \
Chapter05.md \
Chapter06.md \
Chapter07.md \
Chapter08.md \
Chapter09.md \
Chapter10.md \
OGL.md
HTML= $(patsubst %.md,html/%.html,$(MD))
all: html/index.html
clean:
-rm $(HTML)
-rm html/index.html
-rm html/toc.html
-rmdir html
-rm acks.html
html/index.html: html $(HTML)
cp html/Chapter00.html html/index.html
html:
mkdir html
html/%.html : %.md acks-template.htm
cat $< | \
sed -E -e "s/Chapter([0-9][0-9])\.md/Chapter\1.html/g" -e "s/OGL.md/OGL.html/g" | \
kramdown --template acks-template.htm > $@
acks.html : $(MD)
cat $(MD) | \
awk '/\[Previous\]/ { if (++count % 2 == 0) next; } 1' | \
sed -E -e "s/Chapter([0-9][0-9])\.md//g" -e "s/OGL.md//g" | \
kramdown --template acks-template.htm > $@
toc.md : $(MD) mktoc.py
./mktoc.py Chapter0[1-9].md Chapter10.md OGL.md > toc.md