-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
136 lines (106 loc) · 3.99 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
REPO_PATH := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
PATH := $(PATH)
DOCKER_IMAGE_NAME ?= p6doc
DOCKER_HOST_PORT ?= 3000
DOCKER_SELINUX_LABEL ?= 0
ifeq ($(DOCKER_SELINUX_LABEL),1)
SELINUX_OPT := :Z
else
SELINUX_OPT :=
endif
.PHONY: html init-highlights assets bigpage epub \
test xtest ctest help run clean-html clean-images \
clean-search clean test-links push \
clean-cache \
docker-image docker-test docker-xtest docker-ctest docker-testall docker-run
help:
@echo "Usage: make [html|epub|bigpage|test|xtest|ctest]"
@echo ""
@echo "Options:"
@echo " html: generate the HTML documentation"
@echo " epub: generate EPUB documentation (html/raku.epub)"
@echo "bigpage: generate HTML documentation in one large file (html/raku.html)"
@echo " assets: generate CSS/JS assets"
@echo "init-highlights: install prereqs for highlights (runs as part of 'make html')"
@echo " test: run the test suite"
@echo " xtest: run the test suite, including extra tests"
@echo " ctest: run the test suite, content tests only"
@echo " run: run the development webserver"
@echo "docker-image: build Docker image from Dockerfile"
@echo "docker-test: run the test suite (in container)"
@echo "docker-xtest: run the test suite, including extra tests (in container)"
@echo "docker-ctest: run the test suite, content tests only (in container)"
@echo "docker-testall: run all tests (in container)"
@echo "docker-run: run the development webserver (in container)"
html: for-documentable
documentable start -a -v --highlight
update-html:
documentable update --highlight
init-highlights highlights/package-lock.json:
ATOMDIR="./highlights/atom-language-perl6"; \
if [ -d "$$ATOMDIR" ]; then (cd "$$ATOMDIR" && git pull); \
else git clone https://github.com/perl6/atom-language-perl6 "$$ATOMDIR"; \
fi; cd highlights; npm install .; npm rebuild
assets assets/assetpack.db:
./app.pl assets
for-documentable: highlights/package-lock.json assets/assetpack.db
bigpage:
pod2onepage --html -v --source-path=./doc --exclude=404.pod6 > html/raku.html
epub: bigpage
pandoc html/raku.html -o raku.epub
# Common tests that are run by travis with every commit
test:
if [ "${TEST_JOBS}" != "" ]; then prove -j ${TEST_JOBS} -e raku t; else prove -e raku t; fi
# Extended tests
xtest:
if [ "${TEST_JOBS}" != "" ]; then prove -j ${TEST_JOBS} -e raku t xt; else prove -e raku t xt; fi
# Content tests
ctest:
prove --exec raku -r t/05-tabs.t xt/perl-nbsp.t xt/trailing-whitespace.t
start: run
run:
@echo "Starting local server…"
./app-start
docker-image:
docker build -t $(DOCKER_IMAGE_NAME) .
docker-test: docker-image
docker run --rm -it -v $(REPO_PATH):/Raku/doc/$(SELINUX_OPT) $(DOCKER_IMAGE_NAME) \
/bin/bash -c 'make test'
docker-xtest: docker-image
docker run --rm -it -v $(REPO_PATH):/Raku/doc/$(SELINUX_OPT) $(DOCKER_IMAGE_NAME) \
/bin/bash -c 'make xtest'
docker-ctest: docker-image
docker run --rm -it -v $(REPO_PATH):/Raku/doc/$(SELINUX_OPT) $(DOCKER_IMAGE_NAME) \
/bin/bash -c 'make ctest'
docker-testall: docker-test docker-xtest docker-ctest
docker-run: docker-image
docker run --rm -it -p $(DOCKER_HOST_PORT):3000 -v $(REPO_PATH):/Raku/doc/$(SELINUX_OPT) \
$(DOCKER_IMAGE_NAME) /bin/bash -c './app-start' &
clean-html:
rm -rf html/*.html html/.*.html \
html/.html \
html/language/ \
html/op/ \
html/programs/ \
html/routine/ \
html/syntax/ \
html/type/ \
$(NULL)
clean-images:
rm -f html/images/type-graph*
clean-search:
rm -f html/js/search.js
clean-cache:
-rm -rf .cache-doc
clean: clean-html clean-images clean-search
distclean: clean clean-cache
-rm -rf assets/assetpack.db assets/cache
-rm -rf highlights/atom-language-perl6/
-rm -rf highlights/node_modules/
-rm -rf highlights/package-lock.json
-rm -rf html/css/app.css
-rm -rf html/js
test-links: links.txt
./util/test-links.sh
push: test
git pull --rebase && git push