-
Notifications
You must be signed in to change notification settings - Fork 107
/
Makefile
59 lines (49 loc) · 1.77 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
SPHINX ?= sphinx-build
SERVER ?= python3 -mhttp.server
SITEMAP ?= python3 sitemaps.py
URL ?= https://unit.nginx.org
GOOGLE ?= https://www.google.com/webmasters/tools/ping?sitemap=
BING ?= http://www.bing.com/ping?sitemap=
UNIT_SECURITY ?= https://github.com/nginx/unit/raw/master/SECURITY.md
BUILDDIR ?= build
DEPLOYDIR ?= deploy
EXCLUDE = \
--exclude='.*' \
--exclude='*.inv' \
--exclude='*/pygments.css' \
--exclude='/contents' \
--exclude='searchindex.js' \
--exclude='/search'
.PHONY: site serve check clean deploy
site: $(BUILDDIR)
@$(SPHINX) -E -b nxt_html source "$(BUILDDIR)"
# Note: copy files in _downloads/<HASH>/* to _downloads/* to maintain
# the previous webroot structure for use in internal tests.
cp $(BUILDDIR)/_downloads/*/* $(BUILDDIR)/_downloads
$(BUILDDIR):
mkdir "$(BUILDDIR)"
mkdir "$(BUILDDIR)/keys/"
serve: site
@cd "$(BUILDDIR)" && $(SERVER)
check:
@$(SPHINX) -b linkcheck -d "$(BUILDDIR)/.doctrees" source .
clean:
rm -rf $(BUILDDIR) $(DEPLOYDIR)
rm -rf source/exts/__pycache__/
rm -f output.json output.txt rss.xml
deploy: site
$(eval TMP := $(shell mktemp -d))
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
| tee "$(BUILDDIR)/keys/nginx-keyring.gpg" > /dev/null
gpg --dry-run --quiet --import --import-options import-show \
"$(BUILDDIR)/keys/nginx-keyring.gpg"
rsync -rv $(EXCLUDE) "$(BUILDDIR)/" "$(TMP)"
rsync -rcv --delete --exclude='*.gz' --exclude='tmp.*' \
--exclude='/sitemap.xml' "$(TMP)/" "$(DEPLOYDIR)"
$(SITEMAP) "$(URL)" index.html "$(DEPLOYDIR)" -e sitemapexclude.txt \
> "$(TMP)/sitemap.xml"
rsync -rcv "$(TMP)/sitemap.xml" "$(DEPLOYDIR)"
-rm -rf "$(TMP)"
mkdir $(DEPLOYDIR)/.well-known
curl -L $(UNIT_SECURITY) -o "$(DEPLOYDIR)/.well-known/security.txt" 2>/dev/null
chmod -R g=u "$(DEPLOYDIR)"