-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (78 loc) · 2.94 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
ROOT=.
include $(ROOT)/deps/readies/mk/main
#----------------------------------------------------------------------------------------------
define HELPTEXT
make build_hnsw # build hnsw crate
make build_usearch # build usearch crate
make build_faiss # build faiss crate
make build
RELEASE=1 # build release variant
make clean # remove binary files
ALL=1 # remove binary directories
make all # build all libraries and packages
make test # run tests
make info # show toolchain version
endef
#----------------------------------------------------------------------------------------------
MK_CUSTOM_CLEAN=1
BINDIR=$(BINROOT)
include $(MK)/defs
include $(MK)/rules
#----------------------------------------------------------------------------------------------
ifeq ($(RELEASE),1)
CARGO_FLAGS += --release
TARGET_DIR=target/release
else
TARGET_DIR=target/debug
endif
#----------------------------------------------------------------------------------------------
lint:
cargo fmt -- --check
.PHONY: lint
#----------------------------------------------------------------------------------------------
RUST_SOEXT.linux=so
RUST_SOEXT.freebsd=so
RUST_SOEXT.macos=dylib
build:
export LIBRARY_PATH=/usr/local/lib && RUSTFLAGS="-C link-args=-Wl,-rpath,/usr/local/lib" cargo build --all --all-targets $(CARGO_FLAGS)
build_example:
export LIBRARY_PATH=/usr/local/lib && RUSTFLAGS="-C link-args=-Wl,-rpath,/usr/local/lib" cargo build --examples
build_faiss:
export LIBRARY_PATH=/usr/local/lib && RUSTFLAGS="-C link-args=-Wl,-rpath,/usr/local/lib" cargo build --manifest-path rust/faiss/Cargo.toml $(CARGO_FLAGS)
build_hnswcore:
cargo build --manifest-path rust/hnsw/hnswcore/Cargo.toml $(CARGO_FLAGS)
build_hnsw:
cargo build --manifest-path rust/hnsw/Cargo.toml $(CARGO_FLAGS)
build_usearch:
cargo build --manifest-path rust/usearch/Cargo.toml $(CARGO_FLAGS)
clean:
ifneq ($(ALL),1)
cargo clean
else
rm -rf target
endif
.PHONY: build clean
#----------------------------------------------------------------------------------------------
test: cargo_test_workspace
cargo_test_workspace: build
export LIBRARY_PATH=/usr/local/lib && RUSTFLAGS="-C link-args=-Wl,-rpath,/usr/local/lib" cargo test --workspace \
--exclude usearch
$(CARGO_FLAGS)
# --exclude redisxann-hnsw \
# --exclude redisxann-usearch \
# --exclude redisxann-faiss \
cargo_test: build
export LIBRARY_PATH=/usr/local/lib && RUSTFLAGS="-C link-args=-Wl,-rpath,/usr/local/lib" cargo test --tests $(CARGO_FLAGS)
cargo_test_doc:
export LIBRARY_PATH=/usr/local/lib && RUSTFLAGS="-C link-args=-Wl,-rpath,/usr/local/lib" cargo test --doc --workspace $(CARGO_FLAGS)
.PHONY: test cargo_test cargo_test_workspace cargo_test_doc
#----------------------------------------------------------------------------------------------
info:
gcc --version
cmake --version
clang --version
rustc --version
cargo --version
rustup --version
rustup show
.PHONY: info