-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (56 loc) · 2.03 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
CMAKE_COMMON_FLAGS ?= -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
CMAKE_DEBUG_FLAGS ?= # -DUSERVER_SANITIZE='addr ub'
CMAKE_RELEASE_FLAGS ?=
CMAKE_OS_FLAGS ?= -DUSERVER_FEATURE_CRYPTOPP_BLAKE2=0 -DUSERVER_FEATURE_REDIS_HI_MALLOC=1
NPROCS ?= $(shell nproc)
CLANG_FORMAT ?= clang-format
DOCKER_COMPOSE ?= docker-compose
# NOTE: use Makefile.local for customization
-include Makefile.local
# Debug cmake configuration
build_debug/Makefile:
@mkdir -p build_debug
@cd build_debug && \
cmake -DCMAKE_BUILD_TYPE=Debug $(CMAKE_COMMON_FLAGS) $(CMAKE_DEBUG_FLAGS) $(CMAKE_OS_FLAGS) $(CMAKE_OPTIONS) ..
# Release cmake configuration
build_release/Makefile:
@mkdir -p build_release
@cd build_release && \
cmake -DCMAKE_BUILD_TYPE=Release $(CMAKE_COMMON_FLAGS) $(CMAKE_RELEASE_FLAGS) $(CMAKE_OS_FLAGS) $(CMAKE_OPTIONS) ..
# Run cmake
.PHONY: cmake-debug cmake-release
cmake-debug cmake-release: cmake-%: build_%/Makefile
# Build using cmake
.PHONY: build-debug build-release
build-debug build-release: build-%: cmake-%
@cmake --build build_$* -j $(NPROCS) --target greeter_service
# Test
.PHONY: test-debug test-release
test-debug test-release: test-%: build-%
@cd build_$* && ((test -t 1 && GTEST_COLOR=1 PYTEST_ADDOPTS="--color=yes" ctest -V) || ctest -V)
@pep8 tests
# Start the service (via testsuite service runner)
.PHONY: service-start-debug service-start-release
service-start-debug service-start-release: service-start-%: build-%
@cd ./build_$* && $(MAKE) start-greeter_service
# Cleanup data
.PHONY: clean-debug clean-release
clean-debug clean-release: clean-%:
cd build_$* && $(MAKE) clean
.PHONY: dist-clean
dist-clean:
@rm -rf build_*
@rm -rf tests/__pycache__/
@rm -rf tests/.pytest_cache/
# Install
.PHONY: install-debug install-release
install-debug install-release: install-%: build-%
@cd build_$* && \
cmake --install . -v --component greeter_service
.PHONY: install
install: install-release
# Format the sources
.PHONY: format
format:
@find src -name '*pp' -type f | xargs $(CLANG_FORMAT) -i
@find tests -name '*.py' -type f | xargs autopep8 -i