summaryrefslogtreecommitdiff
path: root/Makefile
blob: 4e0f696266acab8a3bc9417f5cc100bdeec7e98f (plain)
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
TARGET = crep
SOURCES = $(wildcard *.c)
TS_ALIBS = $(shell find vendor -name "*.a" -print)
VENDOR_DIRS = $(wildcard vendor/*)
CFLAGS = $(EXTRA_FLAGS) -Wall -Wextra -std=gnu99 -pedantic -ggdb -O3
LIBS = -I./vendor/tree-sitter/lib/include -lpthread

$(info VENDOR_DIRS: $(VENDOR_DIRS))
$(info SOURCES: $(SOURCES))
$(info TS_ALIBS: $(TS_ALIBS))
$(info CFLAGS: $(CFLAGS))
$(info LIBS: $(LIBS))

$(TARGET):
	$(CC) $(CFLAGS) $(SOURCES) $(LIBS) -o $(TARGET) $(TS_ALIBS)

ts-build:
	-cd vendor/tree-sitter && make -B
	-cd vendor/tree-sitter-c && make -B
	-cd vendor/tree-sitter-python && make -B
	-cd vendor/tree-sitter-json && make -B

ts-clean:
	-cd vendor/tree-sitter && make clean
	-cd vendor/tree-sitter-c && make clean
	-cd vendor/tree-sitter-python && make clean
	-cd vendor/tree-sitter-json && make clean

valgrind:
	valgrind -s --leak-check=full ./$(TARGET)

clean:
	rm -f *.o $(TARGET) callgrind.out.*