@@ -3,28 +3,37 @@ ROOT:=..
33include readies/mk/main
44
55MK.cmake: =1
6+ MK_CUSTOM_CMAKE_BUILD: =1
67MK_CUSTOM_CLEAN: =1
78
89MK_ALL_TARGETS =bindirs fetch build pack
910
11+ ifeq ($(COV ) ,1)
12+ DEBUG ?= 1
13+ endif
14+
1015# ----------------------------------------------------------------------------------------------
1116
1217define HELP
1318make setup # install prerequisited (CAUTION: THIS WILL MODIFY YOUR SYSTEM)
1419make fetch # download and prepare dependant modules
1520
16- make build # compile and link
17- DEBUG=1 # build for debugging
18- VARIANT=name # build variant `name`
19- WHY=1 # explain CMake decisions (into /tmp/cmake.why)
20- make clean # remove build artifacts
21- ALL=1 # remove entire artifacts directory
21+ make build # compile and link
22+ DEBUG=1 # build for debugging
23+ COV=1 # build for coverage analysis (implies DEBUG=1)
24+ VARIANT=name # build variant `name`
25+ WHY=1 # explain CMake decisions (into /tmp/cmake.why)
26+ make clean # remove build artifacts
27+ ALL=1 # remove entire artifacts directory
28+ make install # create ready-to-run scheme (module and engines)
2229
2330make test # run tests
2431 TEST=test # run only test `test` with Redis output
2532 TEST_ARGS=args # add extra RLTest `args`
2633 VERBOSE=1 # verbose tests output
2734 COV=1 # perform coverage analysis
35+ VALGRIND|VGD=1 # test with Valgrind (implies DEBUG=1)
36+ CALLGRIND|CGD=1 # test with Callgrind (implies DEBUG=1)
2837make cov-upload # upload coverage data to codecov.io (requires CODECOV_TOKEN)
2938
3039make pack # create installation packages
@@ -33,6 +42,7 @@ make pack # create installation packages
3342 BRANCH=name # use `name` as branch name
3443make deploy # copy packages to S3
3544make release # release a version
45+ make docker # build docker image
3646
3747fetch and build options:
3848 WITH_TF=0 # SKip TensofFlow
@@ -73,8 +83,6 @@ INSTALLED_TARGET=$(INSTALL_DIR)/redisai.so
7383
7484BACKENDS_PATH ?= $(INSTALL_DIR ) /backends
7585
76- REDIS_VALGRIND_SUPRESS =$(ROOT ) /opt/redis_valgrind.sup
77-
7886# ----------------------------------------------------------------------------------------------
7987
8088CMAKE_FILES += \
@@ -114,24 +122,21 @@ include $(MK)/defs
114122
115123# ----------------------------------------------------------------------------------------------
116124
117- .PHONY : deps prebuild fetch pack pack_ramp pack_deps test
125+ .PHONY : fetch deps pack pack_ramp pack_deps test
118126
119127include $(MK ) /rules
120128
121129# ----------------------------------------------------------------------------------------------
122130
123- prebuild :
124- $(SHOW ) if [ ! -d $( DEPS_DIR) ]; then echo $$ ' Dependencies are not in place.\nPlease run \' make fetch\' .' ; exit 1; fi
131+ # prebuild:
132+ # $(SHOW)if [ ! -d $(DEPS_DIR) ]; then echo $$'Dependencies are not in place.\nPlease run \'make fetch\'.'; exit 1; fi
125133
126- $(info $(TARGET ) : $(MK_MAKEFILES ) $(DEPS ) )
127- $(TARGET ) : $(DEPS )
128- $(SHOW ) mkdir -p $(INSTALL_DIR )
134+ cmake-build $(TARGET ) : $(MK_MAKEFILES )
129135 $(SHOW )$(MAKE ) -C $(BINDIR )
136+ $(SHOW ) mkdir -p $(INSTALL_DIR )
130137 $(SHOW )$(MAKE ) -C $(BINDIR ) install
131- # $(SHOW)cd $(ROOT) ;\
132- # if [ ! -e install ]; then ln -sf install-$(DEVICE) install; fi
133138
134- install :
139+ install $( INSTALLED_TARGET ) : $( TARGET )
135140 $(SHOW ) mkdir -p $(INSTALL_DIR )
136141 $(SHOW )$(MAKE ) -C $(BINDIR ) install
137142
@@ -146,13 +151,18 @@ endif
146151
147152# ----------------------------------------------------------------------------------------------
148153
154+ setup :
155+ @echo Setting up system...
156+ $(SHOW )$(ROOT ) /opt/readies/bin/getpy3
157+ $(SHOW )$(ROOT ) /opt/system-setup.py
158+
149159fetch deps :
150160 @echo Fetching dependencies...
151161 $(SHOW ) VERBOSE=$(_SHOW ) $(ROOT ) /get_deps.sh $(DEPS_FLAGS )
152162
153163# ----------------------------------------------------------------------------------------------
154164
155- pack :
165+ pack : $( INSTALLED_TARGET )
156166ifneq ($(PACK_DEPS ) ,0)
157167 $(SHOW)DEVICE=$(DEVICE) BINDIR=$(BINROOT) INSTALL_DIR=$(INSTALL_DIR) BRANCH=$(BRANCH) INTO=$(INTO) DEPS=1 ./pack.sh
158168else
@@ -165,15 +175,9 @@ export GEN ?= 1
165175export SLAVES ?= 1
166176export AOF ?= 1
167177
168- define VALGRIND_TEST_CMD
169- $(TEST_CMD ) \
170- --no-output-catch \
171- --use-valgrind \
172- --vg-no-fail-on-errors \
173- --vg-verbose
174- --vg-options "$(VALGRIND_OPTIONS ) " \
175- --vg-suppressions $(realpath $(REDIS_VALGRIND_SUPRESS ) )
176- endef
178+ ifneq ($(VGD ) ,)
179+ VALGRIND =$(VGD )
180+ endif
177181
178182test :
179183ifeq ($(COV ) ,1)
@@ -183,34 +187,19 @@ endif
183187 DEVICE=$(DEVICE) \
184188 MODULE=$(INSTALLED_TARGET) \
185189 GEN=$(GEN) AOF=$(AOF) SLAVES=$(SLAVES) \
190+ VALGRIND=$(VALGRIND) \
186191 $(ROOT)/test/tests.sh
187192ifeq ($(COV ) ,1)
188193 $(COVERAGE_COLLECT_REPORT)
189194endif
190195
191- # ----------------------------------------------------------------------------------------------
196+ valgrind :
197+ $(SHOW )$(ROOT ) /test/valgrind.sh $(realpath $(INSTALLED_TARGET ) )
192198
193- docker :
194- $(SHOW ) docker build -t redisai --build-arg TEST =1 --build-arg PACK=1 ..
199+ callgrind :
200+ $(SHOW ) CALLGRIND =1 $( ROOT ) /test/valgrind.sh $( realpath $( INSTALLED_TARGET ) )
195201
196202# ----------------------------------------------------------------------------------------------
197203
198- VALGRIND_ARGS =\
199- $(VALGRIND_OPTIONS ) \
200- --suppressions=$(realpath $(REDIS_VALGRIND_SUPRESS ) ) \
201- -v redis-server --protected-mode no --save "" --appendonly no
202-
203- valgrind : $(TARGET )
204- $(SHOW ) valgrind $(VALGRIND_ARGS ) --loadmodule $(realpath $(INSTALLED_TARGET ) )
205-
206- CALLGRIND_ARGS =\
207- --tool=callgrind \
208- --dump-instr=yes \
209- --simulate-cache=no \
210- --collect-jumps=no \
211- --collect-atstart=yes \
212- --instr-atstart=yes \
213- -v redis-server --protected-mode no --save "" --appendonly no
214-
215- callgrind : $(TARGET )
216- $(SHOW ) valgrind $(CALLGRIND_ARGS ) --loadmodule $(realpath $(INSTALLED_TARGET ) )
204+ docker :
205+ $(SHOW ) docker build -t redisai --build-arg TEST=1 --build-arg PACK=1 ..
0 commit comments