-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
96 lines (79 loc) · 2.42 KB
/
GNUmakefile
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
SITE ?= localhost
posts := $(shell bin/find_posts.py)
static_files := $(shell find src/static/ -type f -printf "%P\n")
upload_destination := $(shell bin/json_query.py src/sites/$(SITE).json .uploadDestination)
.PHONY: preview
preview: generate
bin/json_query.py src/sites/$(SITE).json .urlBase
cd out/$(SITE); python3 -m http.server
.PHONY: upload
upload: generate
rsync --verbose --archive --delete out/$(SITE)/ $(upload_destination)/
.PHONY: generate
generate: $(posts:%=out/$(SITE)/%/index.html) \
$(static_files:%=out/$(SITE)/%) \
out/$(SITE)/index.html \
out/$(SITE)/atom-feed.xml
bin/copy_attachments.py
out/$(SITE)/%/index.html: int/posts/%/merged_post.json \
src/templates/post.html
mkdir -p $(dir $@)
chevron \
src/templates/post.html \
-d int/posts/$*/merged_post.json \
> out/$(SITE)/$*/index.html
int/posts/%/merged_post.json: int/posts/%/body.html \
src/blog.json \
src/posts/%/post.json
mkdir -p $(dir $@)
bin/merge_data.py \
site:json:src/sites/$(SITE).json \
blog:json:src/blog.json \
post:json:src/posts/$*/post.json \
body:str:int/posts/$*/body.html \
> int/posts/$*/merged_post.json
int/posts/%/body.html: src/posts/%/body.html
mkdir -p $(dir $@)
cp $< $@
int/posts/%/body.html: int/posts/%/body.md
mkdir -p $(dir $@)
markdown < $< > $@
int/posts/%/body.md: src/posts/%/body.md
mkdir -p $(dir $@)
cp $< $@
int/posts/%/body.md: src/posts/%/body.foot.md
mkdir -p $(dir $@)
bin/footnotes.py < $< > $@
int/index.json: FORCE
mkdir -p $(dir $@)
bin/find_posts.py | bin/index_posts.py > int/index.json
int/merged_index.json: int/index.json
mkdir -p $(dir $@)
bin/merge_data.py \
site:json:src/sites/$(SITE).json \
blog:json:src/blog.json \
index:json:int/index.json \
> int/merged_index.json
out/$(SITE)/index.html: int/merged_index.json \
src/templates/index.html
mkdir -p $(dir $@)
chevron \
src/templates/index.html \
-d int/merged_index.json \
> out/$(SITE)/index.html
out/$(SITE)/atom-feed.xml: int/merged_index.json \
src/templates/atom-feed.xml
mkdir -p $(dir $@)
chevron \
src/templates/atom-feed.xml \
-d int/merged_index.json \
> out/$(SITE)/atom-feed.xml
out/$(SITE)/%: src/static/%
mkdir -p $(dir $@)
cp $< $@
.PHONY: clean
clean:
rm -rf int
rm -rf out
.PHONY: FORCE
FORCE: