-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathMakefile
More file actions
116 lines (99 loc) · 3.72 KB
/
Copy pathMakefile
File metadata and controls
116 lines (99 loc) · 3.72 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
.PHONY: image test e2e debs buildenv initialize vpp-base
BUILD_TYPE ?= debug
SKIP_DEPS ?= 0
CI_BUILD ?= 0
DO_PUSH ?= n
BASE_REPO ?= quay.io/travelping/fpp-vpp
BASE_TAG ?= local
BUILDER_REPO ?= quay.io/travelping/vpp-builder
QUAY_IO_IMAGE_EXPIRES_AFTER ?=
UPG_REPO ?= quay.io/travelping/cennso-dev/upg-vpp
image: vpp-base
ifeq ($(CI_BUILD), 1)
BASE_TAG=${BASE_TAG} BASE_REPO=${BASE_REPO} \
BUILD_TYPE=${BUILD_TYPE} DO_PUSH=${DO_PUSH} \
UPG_REPO=${UPG_REPO} \
QUAY_IO_IMAGE_EXPIRES_AFTER=${QUAY_IO_IMAGE_EXPIRES_AFTER} \
build/ci-build.sh
else
cd upf-plugin && \
BUILD_TYPE=${BUILD_TYPE} \
IMAGE_BASE=${UPG_REPO} \
VPP_IMAGE_BASE=${BASE_REPO}:${BASE_TAG} \
$(MAKE) image
endif
vpp-base: initialize
cd vpp-base && \
BASE_TAG=${BASE_TAG} BASE_REPO=${BASE_REPO} \
BUILD_TYPE=${BUILD_TYPE} CI_BUILD=${CI_BUILD} \
BUILDER_REPO=${BUILDER_REPO} \
$(MAKE) image
initialize:
build/ensure-vpp-with-plugins-initialized.sh
cd upf-plugin && $(MAKE) version
buildenv: vpp-base
VPP_IMAGE_BASE=${BASE_REPO}:${BASE_TAG} BUILDENV_PRIVILEGED=1 BUILDENV_WORKDIR=/src/upf-plugin build/buildenv.sh
ifeq ($(SKIP_DEPS), 1)
BUILDENV_DEPS =
else
BUILDENV_DEPS = vpp-base
endif
test: $(BUILDENV_DEPS)
VPP_IMAGE_BASE=${BASE_REPO}:${BASE_TAG} BUILDENV_PRIVILEGED=1 build/buildenv.sh \
bash -c "cd upf-plugin && $(MAKE) test"
e2e: $(BUILDENV_DEPS)
VPP_IMAGE_BASE=${BASE_REPO}:${BASE_TAG} BUILDENV_PRIVILEGED=1 build/buildenv.sh \
bash -c "cd upf-plugin && $(MAKE) e2e"
generate-binapi: $(BUILDENV_DEPS)
VPP_IMAGE_BASE=${BASE_REPO}:${BASE_TAG} BUILDENV_PRIVILEGED=1 build/buildenv.sh \
bash -c "(cd upf-plugin && $(MAKE) genbinapi)"
debs: vpp-base
cd upf-plugin && BUILD_TYPE=${BUILD_TYPE} VPP_IMAGE_BASE=${BASE_REPO}:${BASE_TAG} $(MAKE) debs
# Open VSCode attached to buildenv container
code: vpp-base
VPP_IMAGE_BASE=${BASE_REPO}:${BASE_TAG} DEVENV_BG=1 BUILDENV_PRIVILEGED=1 build/buildenv.sh
ENCNAME=`printf {\"containerName\":\"/vpp-build-$(BUILD_TYPE)-bg\"} | od -A n -t x1 | tr -d '[\n\t ]'`; \
code --folder-uri "vscode-remote://attached-container+$${ENCNAME}/src"
# VPP include files differ from vpp-base source file, extract them to use language servers (like clangd)
.PHONY: extract-vpp-include
extract-vpp-include:
@rm -rf .vpp-include.new
mkdir .vpp-include.new
BUILDENV_EXTRA_ARGS="--user $(shell id -u):$(shell id -g)" \
VPP_IMAGE_BASE=${BASE_REPO}:${BASE_TAG} \
build/buildenv.sh bash -c '\
for pkg in libvppinfra-dev vpp-dev libnl-3-dev; do \
dpkg -L $$pkg | grep "^/usr/include/" | xargs -I {} cp --parents {} /src/.vpp-include.new/ 2>/dev/null || true; \
done'
@rm -rf .vpp-include
mv .vpp-include.new .vpp-include
.clangd: hack/clangd.template extract-vpp-include
sed -e 's|{{PROJECT_ROOT}}|$(CURDIR)|g' \
hack/clangd.template > .clangd
.PHONY: help
help:
@echo "Usage: make [target] [BUILD_TYPE=debug|release]"
@echo ""
@echo "Main Targets:"
@echo " vpp-base VPP with patches"
@echo " image VPP with UPF plugin"
@echo ""
@echo "Testing:"
@echo " test Run UPF plugin unit tests"
@echo " e2e Run UPF plugin E2E tests"
@echo ""
@echo "Development:"
@echo " initialize Pull upstream VPP and apply patches"
@echo " buildenv Start build environment container"
@echo " code Open VSCode in build environment"
@echo " .clangd Generate configuration for clangd LSP server"
@echo " generate-binapi Generate govpp binapi wrappers"
@echo ""
@echo "Charts:"
@echo " charts-test Test Helm charts"
@echo ""
@echo "Other:"
@echo " debs "
@echo ""
@echo "Environment Variables:"
@echo " BUILD_TYPE Build type: debug (default) or release"