forked from RedisJSON/RedisJSON
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
178 lines (120 loc) · 4.13 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
ROOT=.
MK.pyver:=3
ifeq ($(wildcard $(ROOT)/deps/readies/mk),)
$(error Submodules not present. Please run 'git submodule update --init --recursive')
endif
include $(ROOT)/deps/readies/mk/main
#----------------------------------------------------------------------------------------------
define HELP
make setup # install prerequisites
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 pytest # run tests
TEST=name # run test matching 'name'
TEST_ARGS="..." # RLTest arguments
GEN=0|1 # run general tests on a standalone Redis topology
AOF=0|1 # run AOF persistency tests on a standalone Redis topology
SLAVES=0|1 # run replication tests on standalone Redis topology
CLUSTER=0|1 # run general tests on a OSS Redis Cluster topology
VALGRIND|VD=1 # run specified tests with Valgrind
make pack # build package (RAMP file)
make docker
make docker_push
make platform # build for specific Linux distribution
OSNICK=nick # Linux distribution to build for
REDIS_VER=ver # use Redis version `ver`
TEST=1 # test aftar build
PACK=1 # create packages
ARTIFACTS=1 # copy artifacts from docker image
PUBLISH=1 # publish (i.e. docker push) after build
make builddocs
make localdocs
make deploydocs
endef
#----------------------------------------------------------------------------------------------
MK_CUSTOM_CLEAN=1
BINDIR=$(BINROOT)
include $(MK)/defs
include $(MK)/rules
#----------------------------------------------------------------------------------------------
MODULE_NAME=rejson.so
ifeq ($(DEBUG),1)
TARGET_DIR=target/debug
else
CARGO_FLAGS += --release
TARGET_DIR=target/release
endif
TARGET=$(TARGET_DIR)/$(MODULE_NAME)
#----------------------------------------------------------------------------------------------
all: build
.PHONY: all
#----------------------------------------------------------------------------------------------
setup:
./deps/readies/bin/getpy3
./system-setup.py
.PHONY: setup
#----------------------------------------------------------------------------------------------
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)
cp $(TARGET_DIR)/librejson.$(RUST_SOEXT.$(OS)) $(TARGET)
clean:
ifneq ($(ALL),1)
cargo clean
else
rm -rf target
endif
.PHONY: build clean
#----------------------------------------------------------------------------------------------
test: pytest
pytest:
MODULE=$(abspath $(TARGET)) ./tests/pytest/tests.sh
cargo_test:
cargo test --features test --all
.PHONY: pytest cargo_test
#----------------------------------------------------------------------------------------------
BENCHMARK_ARGS = redisbench-admin run-local
ifneq ($(REMOTE),)
BENCHMARK_ARGS = redisbench-admin run-remote
endif
BENCHMARK_ARGS += --module_path $(realpath $(TARGET)) \
--required-module ReJSON
ifneq ($(BENCHMARK),)
BENCHMARK_ARGS += --test $(BENCHMARK)
endif
benchmark: $(TARGET)
cd ./tests/benchmarks; $(BENCHMARK_ARGS) ; cd ../../
.PHONY: benchmark
#----------------------------------------------------------------------------------------------
pack:
./sbin/pack.sh
.PHONY: pack
#----------------------------------------------------------------------------------------------
docker:
docker build --pull -t rejson:latest .
docker_push:
docker push redislabs/rejson:latest
.PHONY: docker docker_push
#----------------------------------------------------------------------------------------------
platform:
@make -C build/platforms build
ifeq ($(PUBLISH),1)
@make -C build/platforms publish
endif
#----------------------------------------------------------------------------------------------
builddocs:
mkdocs build
localdocs: builddocs
mkdocs serve
deploydocs: builddocs
mkdocs gh-deploy
.PHONY: builddocs localdocs deploydocs