queries c.h c.scm cpp.h cpp.scm cuda.h cuda.scm glsl.h glsl.scm go.h go.scm javascript.h javascript.scm kotlin.h kotlin.scm lua.h lua.scm odin.h odin.scm php.h php.scm python.h python.scm rust.h rust.scm tcl.h tcl.scm zig.h zig.scm
tests
depth_test
sub level1.c
level0.c
test.c test.cpp test.cu test.cuh test.glsl test.go test.js test.kt test.lua test.odin test.php test.py test.rs test.tcl test.zig
vendor
tree-sitter
lib
include
tree_sitter api.h parser.h
src
unicode ICU_SHA LICENSE README.md ptypes.h umachine.h urename.h utf.h utf16.h utf8.h
alloc.c alloc.h array.h atomic.h clock.h error_costs.h get_changed_ranges.c get_changed_ranges.h host.h language.c language.h length.h lexer.c lexer.h lib.c node.c parser.c point.h query.c reduce_action.h reusable_node.h stack.c stack.h subtree.c subtree.h tree.c tree.h tree_cursor.c tree_cursor.h unicode.h
LICENSE Makefile
tree-sitter-c
src
tree_sitter parser.h
grammar.json node-types.json parser.c
LICENSE Makefile
tree-sitter-cpp
src
tree_sitter alloc.h array.h parser.h
grammar.json node-types.json parser.c scanner.c
LICENSE Makefile
tree-sitter-cuda
src
tree_sitter alloc.h array.h parser.h runtime.h
grammar.json node-types.json parser.c scanner.c
LICENSE Makefile
tree-sitter-glsl
src
tree_sitter alloc.h array.h parser.h runtime.h
grammar.json node-types.json parser.c
LICENSE Makefile
tree-sitter-go
src
tree_sitter alloc.h array.h parser.h
grammar.json node-types.json parser.c
LICENSE Makefile
tree-sitter-javascript
src
tree_sitter alloc.h array.h parser.h
grammar.json node-types.json parser.c scanner.c
LICENSE Makefile
tree-sitter-kotlin
src
tree_sitter alloc.h array.h parser.h
grammar.json node-types.json parser.c scanner.c
LICENSE Makefile
tree-sitter-lua
src
tree_sitter alloc.h array.h parser.h
grammar.json node-types.json parser.c scanner.c
LICENSE.md Makefile
tree-sitter-odin
src
tree_sitter alloc.h array.h parser.h
grammar.json node-types.json parser.c scanner.c
LICENSE Makefile
tree-sitter-php
src
common common.mak define-grammar.js scanner.h
tree_sitter alloc.h array.h parser.h
grammar.json node-types.json parser.c scanner.c
LICENSE Makefile
tree-sitter-python
src
tree_sitter parser.h
grammar.json node-types.json parser.c scanner.c
LICENSE Makefile
tree-sitter-rust
src
tree_sitter alloc.h array.h parser.h
grammar.json node-types.json parser.c scanner.c
LICENSE Makefile
tree-sitter-tcl
src
tree_sitter parser.h
grammar.json node-types.json parser.c scanner.c
LICENSE Makefile
tree-sitter-template Makefile
tree-sitter-zig
src
tree_sitter alloc.h array.h parser.h
grammar.json node-types.json parser.c
LICENSE Makefile
.clang-format .gitattributes .gitignore LICENSE Makefile README.md abicheck.c compile_flags.txt file.c file.h list.c list.h main.c tests.sh tpool.c tpool.h
Makefile raw
 1.PHONY: all queries tsbuild valgrind tests format clean
 2
 3TARGET = crep
 4ABI_CHECK_TARGET = abicheck
 5SOURCES = $(filter-out check.c abicheck.c, $(wildcard *.c *.h queries/*.h))
 6TS_ALIBS = $(shell find vendor -name "*.a" -print)
 7VENDOR_DIRS = $(wildcard vendor/*)
 8CFLAGS = $(EXTRA_FLAGS) -Wall -Wextra -std=gnu99 -pedantic -O3
 9LIBS = -I./vendor/tree-sitter/lib/include -lpthread
10
11LANGS = c cpp python php go rust javascript lua zig kotlin odin tcl glsl cuda
12QUERY_HEADERS = $(patsubst %, queries/%.h, $(LANGS))
13TS_SUBDIRS = tree-sitter $(patsubst %, tree-sitter-%, $(LANGS))
14
15$(info VENDOR_DIRS: $(VENDOR_DIRS))
16$(info LANGS: $(LANGS))
17$(info QUERY_HEADERS: $(QUERY_HEADERS))
18$(info TS_SUBDIRS: $(TS_SUBDIRS))
19$(info SOURCES: $(SOURCES))
20$(info TS_ALIBS: $(TS_ALIBS))
21$(info CFLAGS: $(CFLAGS))
22$(info LIBS: $(LIBS))
23
24all: $(QUERY_HEADERS) tsbuild $(TARGET) $(ABI_CHECK_TARGET)
25
26tsbuild:
27	$(MAKE) -C vendor/tree-sitter libtree-sitter.a
28	@for lang in $(LANGS); do \
29		$(MAKE) -C vendor/tree-sitter-$$lang libtree-sitter-$$lang.a || true; \
30	done
31
32$(TARGET): $(SOURCES) tsbuild
33	$(CC) $(CFLAGS) $(SOURCES) $(LIBS) -o $(TARGET) $(shell find vendor -name "*.a")
34
35$(ABI_CHECK_TARGET): abicheck.c tsbuild
36	$(CC) $(CFLAGS) abicheck.c $(LIBS) $(filter-out %/libtree-sitter.a, $(wildcard vendor/**/*.a)) vendor/tree-sitter/libtree-sitter.a -o $(ABI_CHECK_TARGET)
37
38queries/%.h: queries/%.scm
39	xxd -i -n query_$* $< > $@
40
41queries: $(QUERY_HEADERS)
42
43valgrind:
44	valgrind -s --leak-check=full ./$(TARGET)
45
46tests: $(TARGET)
47	sh tests.sh
48
49format:
50	clang-format -i *.c *.h
51
52clean:
53	rm -f *.o $(TARGET) $(ABI_CHECK_TARGET) callgrind.out.* queries/*.h
54	@for dir in $(TS_SUBDIRS); do \
55		$(MAKE) -C vendor/$$dir clean; \
56	done