forked from userver-framework/userver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (61 loc) · 2.11 KB
/
Makefile
File metadata and controls
78 lines (61 loc) · 2.11 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
71
72
73
74
75
76
77
78
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)
DOCKER_COMPOSE ?= docker-compose
# 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)
# Start targets makefile in docker environment
.PHONY: docker-cmake-debug docker-build-debug docker-test-debug docker-cmake-release docker-build-release docker-test-release
docker-cmake-debug docker-build-debug docker-test-debug docker-cmake-release docker-build-release docker-test-release: docker-%:
$(DOCKER_COMPOSE) run --rm userver-ubuntu make $*
# Stop docker container and remove PG data
.PHONY: docker-clean-data
docker-clean-data:
$(DOCKER_COMPOSE) down -v
.PHONY: docker-enter
docker-enter:
$(DOCKER_COMPOSE) run --rm userver-ubuntu bash
.PHONY: docker-run-ydb docker-kill
docker-run-ydb:
$(DOCKER_COMPOSE) run -d --rm --service-ports run-ydb
docker-kill:
$(DOCKER_COMPOSE) kill
# clean build folders
.PHONY: dist-clean
dist-clean:
rm -rf build_*