forked from cilium/proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.dev
78 lines (61 loc) · 3.16 KB
/
Makefile.dev
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
# Copyright 2017-2021 Authors of Cilium
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This image is used to extract proxylib/libcilium.so only for "tests" target
# This will be changed to an official image as soon as they support multi-arch
CILIUM_REF=docker.io/jrajahalme/cilium:latest
CHECK_FORMAT ?= ./bazel-bin/check_format.py.runfiles/envoy/tools/code_format/check_format.py
BAZEL_TEST_OPTS ?= --jobs=1 --test_timeout=2000
BAZEL_CACHE ?= ~/.cache/bazel
BAZEL_ARCHIVE ?= ~/bazel-cache.tar.bz2
CLANG_FORMAT ?= clang-format
BUILDIFIER ?= buildifier
all: precheck envoy-default
api: force-non-root Makefile.api envoy-deps-fastbuild
$(MAKE) -f Makefile.api all
envoy-deps-fastbuild: $(COMPILER_DEP)
@$(ECHO_BAZEL)
$(BAZEL) $(BAZEL_OPTS) build $(BAZEL_BUILD_OPTS) //:cilium-envoy-deps $(BAZEL_FILTER)
envoy-default: $(COMPILER_DEP)
@$(ECHO_BAZEL)
$(BAZEL) $(BAZEL_OPTS) build $(BAZEL_BUILD_OPTS) //:cilium-envoy $(BAZEL_FILTER)
debug: envoy-debug
envoy-debug: $(COMPILER_DEP)
@$(ECHO_BAZEL)
$(BAZEL) $(BAZEL_OPTS) build $(BAZEL_BUILD_OPTS) -c dbg //:cilium-envoy $(BAZEL_FILTER)
$(CHECK_FORMAT): force-non-root
$(BAZEL) $(BAZEL_OPTS) build $(BAZEL_BUILD_OPTS) //:check_format.py
veryclean: force-non-root clean
-sudo $(BAZEL) $(BAZEL_OPTS) clean
-sudo rm -Rf $(BAZEL_CACHE)
precheck: force-non-root
tools/check_repositories.sh
check: $(CHECK_FORMAT) force-non-root
CLANG_FORMAT=$(CLANG_FORMAT) BUILDIFIER=$(BUILDIFIER) $(CHECK_FORMAT) --skip_envoy_build_rule_check --add-excluded-prefixes "./linux/" "./proxylib/" --build_fixer_check_excluded_paths="./" check
fix: $(CHECK_FORMAT) force-non-root
CLANG_FORMAT=$(CLANG_FORMAT) BUILDIFIER=$(BUILDIFIER) $(CHECK_FORMAT) --skip_envoy_build_rule_check --add-excluded-prefixes "./linux/" "./proxylib/" --build_fixer_check_excluded_paths="./" fix
# Run rule even if file exists, as it can be for a wrong architecture
.PHONY: proxylib/libcilium.so
proxylib/libcilium.so:
if ! file $@ | grep $(shell uname -m | tr "_" "-"); then \
docker create -ti --name cilium-proxylib $(CILIUM_REF) bash && \
docker cp -L cilium-proxylib:/usr/lib/libcilium.so $@ && \
docker rm -fv cilium-proxylib ; \
fi
# Run tests using the fastbuild by default.
tests: proxylib/libcilium.so force-non-root
$(BAZEL) $(BAZEL_OPTS) test $(BAZEL_BUILD_OPTS) -c fastbuild //:envoy_binary_test $(BAZEL_FILTER)
$(BAZEL) $(BAZEL_OPTS) test $(BAZEL_BUILD_OPTS) -c fastbuild $(BAZEL_TEST_OPTS) //tests/... $(BAZEL_FILTER)
debug-tests: proxylib/libcilium.so force-non-root
$(BAZEL) $(BAZEL_OPTS) test $(BAZEL_BUILD_OPTS) -c debug $(BAZEL_TEST_OPTS) //:envoy_binary_test $(BAZEL_FILTER)
$(BAZEL) $(BAZEL_OPTS) test $(BAZEL_BUILD_OPTS) -c debug $(BAZEL_TEST_OPTS) //tests/... $(BAZEL_FILTER)