-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
27 lines (19 loc) · 922 Bytes
/
Makefile
File metadata and controls
27 lines (19 loc) · 922 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
25
26
27
OUT=build
SQL_DYLIB=$(shell rustc --crate-file-name src/sql/lib.rs)
SQL_MACRO_DYLIB=$(shell rustc --crate-file-name src/sql_macro/lib.rs)
SQLITE_DYLIB=$(shell rustc --crate-file-name --crate-type=dylib rustsqlite/src/sqlite3/lib.rs)
RUSTFLAGS=-g -O
all: lib check
$(OUT):
mkdir -p $(OUT)
lib: $(OUT)/$(SQL_DYLIB) $(OUT)/$(SQL_MACRO_DYLIB)
$(OUT)/$(SQL_DYLIB): $(wildcard src/sql/*.rs) $(OUT)/$(SQLITE_DYLIB)
rustc $(RUSTFLAGS) -L $(OUT) --out-dir=$(OUT) src/sql/lib.rs
$(OUT)/$(SQL_MACRO_DYLIB): $(wildcard src/sql_macro/*.rs) $(OUT)
rustc $(RUSTFLAGS) --out-dir=$(OUT) src/sql_macro/lib.rs
$(OUT)/$(SQLITE_DYLIB): rustsqlite/src/sqlite3/lib.rs $(OUT)
rustc $(RUSTFLAGS) --crate-type=dylib --out-dir=$(OUT) $<
$(OUT)/test: test/test.rs $(OUT)/$(SQL_DYLIB) $(OUT)/$(SQL_MACRO_DYLIB) $(OUT)/$(SQLITE_DYLIB)
rustc $(RUSTFLAGS) --test -L $(OUT) -o $@ $<
check: $(OUT)/test
cd $(OUT) && rm -f *.sqlite3 && ./test