-
Notifications
You must be signed in to change notification settings - Fork 371
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (56 loc) · 1.76 KB
/
Makefile
File metadata and controls
70 lines (56 loc) · 1.76 KB
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
CMAKE_COMMON_FLAGS ?= -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
CMAKE_DEBUG_FLAGS ?= '-DUSERVER_SANITIZE=addr;ub'
CMAKE_RELEASE_FLAGS ?=
KERNEL := $(shell uname -s)
NPROCS ?= $(shell nproc)
# NOTE: use Makefile.local for customization
-include Makefile.local
CMAKE_DEBUG_FLAGS += -DCMAKE_BUILD_TYPE=Debug $(CMAKE_COMMON_FLAGS)
CMAKE_RELEASE_FLAGS += -DCMAKE_BUILD_TYPE=Release $(CMAKE_COMMON_FLAGS)
.DEFAULT_GOAL := all
.PHONY: all
all: test-debug test-release
.PHONY: docs
docs:
BUILD_DIR=$(BUILD_DIR) ./scripts/docs/make_docs.sh
.PHONY: docs-upload
docs-upload:
BUILD_DIR=$(BUILD_DIR) ./scripts/docs/upload_docs.sh
.PHONY: docs-internal
docs-internal:
BUILD_DIR=$(BUILD_DIR) ../scripts/userver/docs/make_docs.sh
.PHONY: docs-internal-upload
docs-internal-upload:
BUILD_DIR=$(BUILD_DIR) OAUTH_TOKEN=$(OAUTH_TOKEN) ../scripts/userver/docs/upload_docs.sh
# Run cmake
.PHONY: cmake-debug
cmake-debug:
cmake -B build_debug $(CMAKE_DEBUG_FLAGS)
.PHONY: cmake-release
cmake-release:
cmake -B build_release $(CMAKE_RELEASE_FLAGS)
# Build using cmake
.PHONY: build-debug build-release
build-debug build-release: build-%: cmake-%
cmake --build build_$* -j $(NPROCS)
# Test
.PHONY: test-debug test-release
test-debug test-release: test-%: build-%
ulimit -n 4096
cd build_$* && ((test -t 1 && GTEST_COLOR=1 PYTEST_ADDOPTS="--color=yes" ctest -V) || ctest -V)
# clean build folders
.PHONY: dist-clean
dist-clean:
rm -rf build_*/
rm -rf debian/
rm -rf .ruff_cache/
rm -rf _CPack_Packages/
find -name .mypy_cache | xargs rm -rf
find -name __pycache__ | xargs rm -rf
.PHONY: gen-debian-directory
gen-debian-directory:
scripts/generate-debian-directory.sh
.PHONY: cmake-format
cmake-format:
find $$(ls */ -d | grep -v ^build) -name '*.cmake' -o -name 'CMakeLists.txt' | \
xargs cmake-format -i