-
Notifications
You must be signed in to change notification settings - Fork 38
/
Makefile
73 lines (63 loc) · 1.58 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
all: run
# run app server
run:
ink src/main.ink
# build dependencies
build-libs:
september translate \
lib/stub.ink \
vendor/std.ink \
vendor/str.ink \
vendor/quicksort.ink \
lib/fastsort.js.ink \
> static/ink/lib.js
build-monocle:
september translate \
lib/tokenizer.ink \
lib/indexer.ink \
lib/ranker.ink \
lib/stemmer.ink \
lib/searcher.ink \
> static/ink/monocle.js
# build app clients
build:
cat static/js/ink.js \
static/js/torus.min.js \
> static/ink/vendor.js
september translate \
lib/torus.js.ink \
src/app.js.ink \
| tee /dev/stderr > static/ink/common.js
cat \
static/ink/vendor.js \
static/ink/lib.js \
static/ink/monocle.js \
static/ink/common.js \
> static/ink/bundle.js
b: build
# run all builds from scratch
build-all: build-libs build-monocle build
# re-build document indexes
index:
ink src/index.ink
# remove control characters that sneak into content. These are filtered out
# in the index but not in doc sources, and trips up JSON parsers.
LC_ALL=C tr -d '[:cntrl:]' < static/indexes/docs.json > /tmp/docs.json
mv /tmp/docs.json static/indexes/docs.json
# gzip
gzip --best < static/indexes/docs.json > static/indexes/docs.json.gz
gzip --best < static/indexes/index.json > static/indexes/index.json.gz
# brotli
brotli -kZf static/indexes/docs.json
brotli -kZf static/indexes/index.json
# build whenever Ink sources change
watch:
ls lib/*.ink src/*.ink modules/*.ink | entr make build
w: watch
# run all tests under test/
check:
ink ./test/main.ink
t: check
fmt:
inkfmt fix lib/*.ink src/*.ink modules/*.ink test/*.ink
f: fmt