-
Notifications
You must be signed in to change notification settings - Fork 62
/
Makefile
64 lines (53 loc) · 1.86 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
MINIMUM_RUST_VERSION := 1.73.0
CURRENT_RUST_VERSION := $(shell rustc -V | sed -E 's/rustc ([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
RUSTUP := $(shell command -v rustup 2> /dev/null)
UNAME_S := $(shell uname -s)
# Executable used to execute the compatibility tests.
SQLITE_EXEC ?= ./target/debug/limbo
# Static library to use for SQLite C API compatibility tests.
BASE_SQLITE_LIB = ./target/debug/liblimbo_sqlite3.a
# On darwin link core foundation
ifeq ($(UNAME_S),Darwin)
SQLITE_LIB ?= ../../$(BASE_SQLITE_LIB) -framework CoreFoundation
else
SQLITE_LIB ?= ../../$(BASE_SQLITE_LIB)
endif
all: check-rust-version check-wasm-target limbo limbo-wasm
.PHONY: all
check-rust-version:
@echo "Checking Rust version..."
@if [ "$(shell printf '%s\n' "$(MINIMUM_RUST_VERSION)" "$(CURRENT_RUST_VERSION)" | sort -V | head -n1)" = "$(CURRENT_RUST_VERSION)" ]; then \
echo "Rust version greater than $(MINIMUM_RUST_VERSION) is required. Current version is $(CURRENT_RUST_VERSION)."; \
if [ -n "$(RUSTUP)" ]; then \
echo "Updating Rust..."; \
rustup update stable; \
else \
echo "Please update Rust manually to a version greater than $(MINIMUM_RUST_VERSION)."; \
exit 1; \
fi; \
else \
echo "Rust version $(CURRENT_RUST_VERSION) is acceptable."; \
fi
.PHONY: check-rust-version
check-wasm-target:
@echo "Checking wasm32-wasi target..."
@if ! rustup target list | grep -q "wasm32-wasi (installed)"; then \
echo "Installing wasm32-wasi target..."; \
rustup target add wasm32-wasi; \
fi
.PHONY: check-wasm-target
limbo:
cargo build
.PHONY: limbo
limbo-wasm:
rustup target add wasm32-wasi
cargo build --package limbo-wasm --target wasm32-wasi
.PHONY: limbo-wasm
test: limbo test-compat test-sqlite3
.PHONY: test
test-compat:
SQLITE_EXEC=$(SQLITE_EXEC) ./testing/all.test
.PHONY: test-compat
test-sqlite3:
LIBS="$(SQLITE_LIB)" make -C sqlite3/tests test
.PHONY: test-sqlite3