-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
24 lines (18 loc) · 748 Bytes
/
Makefile
File metadata and controls
24 lines (18 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
CC=gcc
CFLAGS=-fPIC -Wall $(shell pkg-config --cflags libpq)
LDFLAGS=-ldl -lsqlite3 $(shell pkg-config --libs libpq)
RUST_LIB=sql_translator/target/debug/libsql_translator.a
all: sqlite_hook.so test_sqlite
$(RUST_LIB): sql_translator/src/lib.rs sql_translator/Cargo.toml
cd sql_translator && cargo build
sqlite_hook.so: sqlite_hook.c $(RUST_LIB)
$(CC) $(CFLAGS) -shared -o sqlite_hook.so sqlite_hook.c $(RUST_LIB) $(LDFLAGS) -lpthread -lm -lrt
test_sqlite: test_sqlite.c
$(CC) -o test_sqlite test_sqlite.c -lsqlite3
test: all
cd sql_translator && cargo test
# Run C test (might fail PG connect but checks hook integrity)
LD_PRELOAD=./sqlite_hook.so ./test_sqlite || true
clean:
rm -f *.so test_sqlite
cd sql_translator && cargo clean