-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
47 lines (36 loc) · 1.13 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
TREE_SITTER=npx tree-sitter-cli
all: fmt gen test
fmt:
./node_modules/.bin/prettier --write grammar.js
.PHONY: test
test: gen
$(TREE_SITTER) test
.PHONY: test-highlight
test-highlight:
# Note: test-highlight uses a filter for non-existent corpus
# tests, so only highlights run. And does not gen.
$(TREE_SITTER) test-highlight
.PHONY: update
update: gen
$(TREE_SITTER) test -- --update
.PHONY: debug
debug: gen
$(TREE_SITTER) test -d
.PHONY: gen
gen:
$(TREE_SITTER) generate
ruby -e 'ARGV.each{|f| File.write(f, "// @"+"generated\n\n"+File.read(f))}' src/parser.c src/tree_sitter/parser.h src/tree_sitter/alloc.h src/tree_sitter/array.h
ruby -rjson -e 'ARGV.each{|f| File.write(f, JSON.pretty_generate(JSON.parse(File.read(f)).tap{|j| j["@"+"generated"] = true}))}' src/grammar.json
ruby -rjson -e 'ARGV.each{|f| File.write(f, JSON.pretty_generate(JSON.parse(File.read(f)).tap{|j| j << {"@"+"generated" => true}}))}' src/node-types.json
.PHONY: deps
deps:
npm install
.PHONY: web
web: wasm
$(TREE_SITTER) web-ui
.PHONY: wasm
wasm:
$(TREE_SITTER) build-wasm
.PHONY: publish
publish: all wasm
cp ./tree-sitter-erlang.wasm ./docs