-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmakefile
31 lines (31 loc) · 954 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
CFLAGS := -Ire2/ $(shell pkg-config --cflags sqlite3) -Wall -fPIC -ansi
LDFLAGS := -Lre2/obj -lre2 $(shell pkg-config --libs sqlite3) -shared
SOURCES := kmp.c scanstr.c varint.c hash.c expr.c match.c regexp.cpp cursor.c vtable.c trilite.c
OBJECTS := $(patsubst %.cpp,%.o,$(patsubst %.c,%.o,$(SOURCES)))
all: debug
debug: CFLAGS += -g
debug: re2 re2/obj/libre2.a libtrilite.so
release: CFLAGS += -DNDEBUG -O3
release: LDFLAGS += -O3
release: re2/obj/libre2.a libtrilite.so
re2:
hg clone https://re2.googlecode.com/hg re2
re2/obj/libre2.a: re2
$(MAKE) -C re2 CXXFLAGS='-Wall -O3 -pthread -fPIC'
%.o: %.cpp
$(CXX) $(CFLAGS) -c $< -o $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
libtrilite.so: $(OBJECTS)
$(CXX) $? $(LDFLAGS) -o $@
check: all
cat test.sql | sqlite3 -bail; \
if [ "$$?" -eq "0" ]; then \
echo "Test passed"; \
else \
echo "Test failed!"; \
fi
clean:
rm -rf libtrilite.so $(OBJECTS)
dist-clean:
rm -rf libtrilite.so $(OBJECTS) re2/