-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
61 lines (51 loc) · 1.32 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
.POSIX:
FIND_POSTS = find . -path './20??*'
.PHONY: all
all: posts.mk index.html 404.html posts.html feed.xml
include posts.mk
.PHONY: posts.mk
posts.mk:
@{ \
tmp=$$(mktemp); \
{ \
printf 'POSTS ='; \
$(FIND_POSTS) '(' -iname '*.md' -o -iname '*.html' ')' \
|sed 's/^\.\///; s/\.[a-z][a-z]*$$/.html/i' \
|sort |uniq \
|awk '{printf " \\\n\t%s", $$0}'; \
printf "\n\n"; \
} >$$tmp; \
cmp $$tmp $@ || mv $$tmp $@; \
}
.SUFFIXES: .md .html .xml .css
.md.html:
./render.sh -t post <$< >$@
new_posts.md: $(POSTS)
ls $(POSTS) |sort -r |head -n5 |./posts.sh embed >$@
index.html: index.md new_posts.md
cat index.md new_posts.md |./render.sh -t person >$@
404.html: 404.md
./render.sh <$< >$@
posts.html: $(POSTS)
ls $(POSTS) |sort -r |./posts.sh |./render.sh -t menu >$@
feed.xml: $(POSTS)
./feed.sh >$@
.PHONY: clean
clean:
rm -f *.html {2018,2019,2020,2022,2023,2024}/*.html feed.xml
rm new_posts.md
rm -rf pub
.PHONY: pub
pub:
@echo "=> copy generated artifacts"
@find . '(' -regex '\./pub\|./drafts\|./well-known\|.*/\..*' ')' -prune -o '(' \
'(' \
-type d -exec mkdir -p pub/{} ';' \
')' , '(' \
-type f -a \! '(' \
-regex '.*/\.[^/]*\|.*\.md\|.*/Makefile\|.*\.mk' -o -executable \
')' \
-exec cp {} pub/{} ';' \
')' \
')'
@rm -rf pub/.well-known && cp -R well-known pub/.well-known