-
Notifications
You must be signed in to change notification settings - Fork 55
/
Makefile
76 lines (68 loc) · 2.25 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
WEB_NAME := toktok.github.io
ifneq ($(GITHUB_TOKEN),)
WEB_REPO := https://$(GITHUB_TOKEN)@github.com/TokTok/$(WEB_NAME)
else
WEB_REPO := [email protected]:TokTok/$(WEB_NAME)
endif
#
# build the website with jekyll
#
toktok-site: $(shell which jekyll) $(shell find toktok -type f) changelog roadmap spec
rm -rf $@
cd toktok && jekyll build && mv _site ../$@
#
# single pages, generated from external content
#
changelog: toktok/changelog/c-toxcore.md
roadmap: toktok/roadmap/c-toxcore.md
toktok/%/c-toxcore.md: toktok/%/c-toxcore.md.dist
cp $< $@
curl https://git-critique.herokuapp.com/hello/$* >> $@
spec: toktok/spec.md
toktok/spec.md: hs-toxcore $(shell find hs-toxcore -name "*.lhs" 2> /dev/null)
cp [email protected] $@
cp -a hs-toxcore/res toktok/
! which pandoc || { \
cd hs-toxcore; \
for i in `find . -name "*.lhs"`; do \
sed -i -e 's/\.lhs\}/.tex}/' $$i; \
mv $$i $${i%.lhs}.tex; \
done; \
pandoc \
-f latex+lhs \
-t gfm \
src/Network/Tox.tex \
| sed -e '/```.*literate/,/```/d' \
>> ../$@; \
find . -name "*.lhs" -delete; \
git checkout .; \
}
grep Introduction $@
.PHONY: hs-toxcore
hs-toxcore:
if [ -d $@ ]; then \
cd $@ && if [ -e .git -a "$$(git rev-parse --abbrev-ref HEAD)" != "HEAD" ]; then git pull; fi; \
else \
git clone --depth=1 https://github.com/TokTok/hs-toxcore $@; \
fi
#
# deployment tasks
#
lint:
mdl -i -w -s .md-style.rb $$(find toktok -name "*.md" \
-and -not -wholename "toktok/spec.md" \
-and -not -wholename "toktok/changelog/c-toxcore.md" \
-and -not -wholename "toktok/roadmap/c-toxcore.md")
check:
mkdir -p ~/.linkchecker/
echo "[filtering]" > ~/.linkchecker/linkcheckerrc
echo "ignorewarnings=ignore-url,http-robots-denied,https-certificate-error" >> ~/.linkchecker/linkcheckerrc
linkchecker --ignore-url "https://toktok.ltd.*" --ignore-url "https://msgpack.org.*" --ignore-url "https://travis-ci.org.*" --ignore-url "irc://.*" --ignore-url "^javascript:" toktok-site
upload: toktok-site
@test -d $(WEB_NAME) || git clone --depth=1 $(WEB_REPO)
rm -rf $(WEB_NAME)/*
mv toktok-site/* $(WEB_NAME)/
rmdir toktok-site
cd $(WEB_NAME) && git add -A .
cd $(WEB_NAME) && git commit --amend --reset-author -m'Updated website'
cd $(WEB_NAME) && git push --force --quiet