-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
101 lines (69 loc) · 2.19 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
ROOT=.
include $(ROOT)/deps/readies/mk/main
#----------------------------------------------------------------------------------------------
define HELPTEXT
make build
DEBUG=1 # build debug variant
make clean # remove binary files
ALL=1 # remove binary directories
make all # build all libraries and packages
make test # run tests
make docker # build for specific Linux distribution
OSNICK=nick # Linux distribution to build for
REDIS_VER=ver # use Redis version `ver`
TEST=1 # test aftar build
endef
#----------------------------------------------------------------------------------------------
MK_CUSTOM_CLEAN=1
BINDIR=$(BINROOT)
include $(MK)/defs
include $(MK)/rules
#----------------------------------------------------------------------------------------------
MODULE_NAME=valkeymodule-rs.so
ifeq ($(DEBUG),1)
TARGET_DIR=target/debug
else
CARGO_FLAGS += --release
TARGET_DIR=target/release
endif
TARGET=$(TARGET_DIR)/$(MODULE_NAME)
#----------------------------------------------------------------------------------------------
lint:
cargo fmt -- --check
.PHONY: lint
#----------------------------------------------------------------------------------------------
RUST_SOEXT.linux=so
RUST_SOEXT.freebsd=so
RUST_SOEXT.macos=dylib
build:
cargo build --all --all-targets --no-default-features $(CARGO_FLAGS)
# cp $(TARGET_DIR)/librejson.$(RUST_SOEXT.$(OS)) $(TARGET)
clean:
ifneq ($(ALL),1)
cargo clean
else
rm -rf target
endif
.PHONY: build clean
#----------------------------------------------------------------------------------------------
test: cargo_test cargo_deny
cargo_deny:
cargo install --locked cargo-deny
cargo deny check licenses
cargo deny check bans
cargo_test:
cargo test --workspace --no-default-features $(CARGO_FLAGS)
cargo test --doc --workspace --no-default-features $(CARGO_FLAGS)
.PHONY: test cargo_test cargo_deny
#----------------------------------------------------------------------------------------------
docker:
@make -C build/docker build
info:
gcc --version
cmake --version
clang --version
rustc --version
cargo --version
rustup --version
rustup show
.PHONY: docker info