-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
99 lines (66 loc) · 1.98 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
ROOT=.
include $(ROOT)/deps/readies/mk/main
#----------------------------------------------------------------------------------------------
define HELPTEXT
make build_hnsw # build examples
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:
cargo build --all --all-targets $(CARGO_FLAGS)
build_example:
cargo build --examples
build_llamacpp:
cargo build --manifest-path rust/llamacpp/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
cargo test --workspace \
$(CARGO_FLAGS)
cargo_test: build
cargo test --tests $(CARGO_FLAGS)
cargo_test_doc:
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