-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
55 lines (48 loc) · 1.23 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
JQ = jq
TREE_SITTER = node_modules/.bin/tree-sitter
.PHONY: help
help:
@echo 'Make targets:'
@echo ' generate - generate parser sources'
@echo ' clean - remove build directory and intermediate files'
@echo ' tests - run all tests'
@echo ' fetch-examples - fetch example repositories'
@echo ' parse-examples - parse example files'
.PHONY: generate
generate:
$(MAKE) src/typescript-scanner.h
$(TREE_SITTER) generate
src/typescript-scanner.h: \
node_modules/tree-sitter-typescript/common/scanner.h \
node_modules/tree-sitter-typescript/LICENSE \
package.json
( \
echo '/*'; \
echo 'Source:'; \
$(JQ) -r '.devDependencies["tree-sitter-typescript"]' package.json; \
echo; \
cat node_modules/tree-sitter-typescript/LICENSE; \
echo '*/'; \
echo; \
cat $<; \
) > $@
.PHONY: clean
clean:
$(RM) -R build target
$(RM) \
src/grammar.json \
src/node-types.json \
src/parser.c \
src/tree_sitter/parser.h \
src/typescript-scanner.h
.PHONY: tests
tests:
$(TREE_SITTER) test $(TESTFLAGS)
.PHONY: fetch-examples
fetch-examples:
$(MAKE) -C examples all
.PHONY: parse-examples
parse-examples:
cat examples/known-failures.txt \
| sed 's|^|!examples/|' \
| xargs $(TREE_SITTER) parse -q 'examples/**/*.qml'