-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (23 loc) · 912 Bytes
/
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
SRC := $(wildcard src/*.c) $(wildcard src/query/*.c) $(wildcard src/range/*.c)
SRC += tree-sitter/lib/src/lib.c
OBJ := $(SRC:.c=.o)
LUA_INC :=
LTS_INC := -Iinclude -Itree-sitter/lib/include
TS_INC := -Itree-sitter/lib/include -Itree-sitter/lib/src
CFLAGS := -O3 -fvisibility=hidden -fPIC -flto=auto
LTS_CFLAGS := -std=c11 -pedantic -Wall -Wextra -Werror
TS_CFLAGS := -std=c11 -DTREE_SITTER_HIDE_SYMBOLS -DTREE_SITTER_HIDDEN_SYMBOLS
LDFLAGS := -shared
LUA_LDFLAGS = -llua
POSIX_LDFLAGS := -ldl
lua_tree_sitter.so: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) $(LUA_LDFLAGS) $(POSIX_LDFLAGS)
lua_tree_sitter.dll: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) $(LUA_LDFLAGS)
%.o: %.c
$(CC) -c -o $@ $(CFLAGS) $(LTS_CFLAGS) $(LUA_INC) $(LTS_INC) $<
tree-sitter/%.o: tree-sitter/%.c
$(CC) -c -o $@ $(CFLAGS) $(TS_CFLAGS) $(TS_INC) $<
clean:
$(RM) $(OBJ) lua_tree_sitter.so lua_tree_sitter.dll
.PHONY: clean