-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
108 lines (86 loc) · 3.46 KB
/
Makefile
File metadata and controls
108 lines (86 loc) · 3.46 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
.PHONY: all dataplane test test-tsan test-functional proto-lint cli cli-install fuzz clean $(foreach module,$(MODULES),cli/$(module) cli-install/$(module))
# Define the list of modules to avoid repetition
MODULES := decap dscp route forward nat64 pdump acl fwstate
# Default PREFIX for debian packaging
PREFIX ?= /usr
all: dataplane cli
proto-lint:
@find . -name '*.proto' -print0 | xargs -0 clang-format --dry-run --Werror
go test ./lint/protobuf/cmd/protolint/
go run ./lint/protobuf/cmd/protolint/ --exclude subprojects
go-cache-clean:
go clean -cache
setup:
meson setup build
setup-debug:
@if [ ! -d "build" ]; then \
meson setup -Dbuildtype=debug -Doptimization=0 build; \
else \
meson configure -Dbuildtype=debug -Doptimization=0 -Db_sanitize="" build; \
fi
setup-asan:
meson setup -Dbuildtype=debug -Doptimization=0 -Db_sanitize=address,undefined build
dataplane:
meson compile -C build
install1:
cp build/dataplane/yanet-dataplane /usr/bin
cp build/controlplane/yanet-controlplane /usr/bin
cd cli && make install
cli:
cargo build --release --workspace
cli-install: cli-core-install $(foreach module,$(MODULES),cli-install/$(module))
cli-core-install:
$(MAKE) -C cli install PREFIX=$(PREFIX)
cli-install/%:
$(MAKE) -C modules/$*/cli install PREFIX=$(PREFIX)
cli-clean/%:
$(MAKE) -C modules/$*/cli clean
test: go-cache-clean dataplane
go test -count=1 $$(go list ./... | grep -v 'tests/functional')
meson test -C build
test-asan: go-cache-clean
@if [ ! -d "build" ]; then \
$(MAKE) setup-asan; \
else \
meson configure -Dbuildtype=debug -Doptimization=0 -Dfuzzing=disabled -Db_sanitize=address,undefined build; \
fi
meson compile -C build
CGO_CFLAGS="-fsanitize=address,undefined" CGO_LDFLAGS="-fsanitize=address,undefined" go test -count=1 $$(go list ./... | grep -v 'tests/functional')
meson test -C build
test-tsan:
@if [ ! -d "build-tsan" ]; then \
meson setup build-tsan -Dbuildtype=debug -Doptimization=0 -Db_sanitize=thread; \
else \
meson configure -Dbuildtype=debug -Doptimization=0 -Db_sanitize=thread build-tsan; \
fi
meson test -C build-tsan --suite common --suit fwstate --no-suite large
test-functional:
@echo "Running functional tests..."
cd tests/functional && $(MAKE) test
fuzz:
@if [ -d build ] && ! meson introspect build --buildoptions | jq -er '.[] | select(.name=="fuzzing") | .value'|grep -q enabled; then \
echo "Wiping build for fuzzing..."; \
rm -rf build; \
fi
@if [ ! -d build ]; then \
env CC=clang CXX=clang++ meson setup -Dbuildtype=debug -Doptimization=0 -Dfuzzing=enabled build; \
fi
env CC=clang CXX=clang++ meson compile -C build
@echo "Ready to fuzz the following modules:"
@find build/tests/fuzzing/ -type f -executable -printf '%f\n'
@if [ -n "$(MODULE)" ]; then \
mkdir -p corpus; \
./build/tests/fuzzing/$(MODULE) corpus/; \
fi
install: dataplane cli-install
meson install -C build --skip-subprojects
install -d $(DESTDIR)/etc/yanet2
install -m 644 controlplane/etc/yanet/controlplane-director.yaml $(DESTDIR)/etc/yanet2/controlplane.yaml
install -m 644 dataplane.yaml $(DESTDIR)/etc/yanet2/dataplane.yaml
install -m 644 controlplane/etc/yanet/bird-adapter.yaml $(DESTDIR)/etc/yanet2/bird-adapter.yaml
install -m 644 agents/yanet-pipeline-operator/etc/yanet/yanet-pipeline-operator.yaml $(DESTDIR)/etc/yanet2/yanet-pipeline-operator.yaml
clean: go-cache-clean $(foreach module,$(MODULES),cli-clean/$(module))
@echo "Cleaning build directories..."
rm -rf build/
rm -rf buildfuzz/
$(MAKE) -C cli clean