forked from intel/afxdp-plugins-for-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
153 lines (134 loc) · 3.64 KB
/
Makefile
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Copyright(c) 2022 Intel Corporation.
# 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.
excluded_from_utests = "/test/e2e|/test/fuzz|/cmd/cni|/internal/bpf|/internal/logformats|internal/host|/internal/networking"
.PHONY: all e2e
all: format build test static
format:
@echo "****** Go Format ******"
@echo
-go fmt github.com/intel/afxdp-plugins-for-kubernetes/...
@echo
@echo
@echo "****** Clang Format ******"
@echo
-clang-format -i -style=file internal/bpf/*.c internal/bpf/*.h
@echo
@echo
buildc:
@echo "****** Build BPF ******"
@echo
gcc ./internal/bpf/bpfWrapper.c -lbpf -c -o ./internal/bpf/bpfWrapper.o
ar rs ./internal/bpf/libwrapper.a ./internal/bpf/bpfWrapper.o &> /dev/null
@echo
@echo
builddp: buildc
@echo "****** Build DP ******"
@echo
go build -o ./bin/afxdp-dp ./cmd/deviceplugin
@echo
@echo
buildcni: buildc
@echo "****** Build CNI ******"
@echo
go build -o ./bin/afxdp ./cmd/cni
@echo
@echo
build: builddp buildcni
image: buildcni
@echo "****** Docker Image ******"
@echo
docker build -t afxdp-device-plugin -f images/amd64.dockerfile .
@echo
@echo
undeploy:
@echo "****** Stop Daemonset ******"
@echo
kubectl delete -f ./deployments/daemonset.yml --ignore-not-found=true
@echo
@echo
deploy: image undeploy
@echo "****** Deploy Daemonset ******"
@echo
kubectl create -f ./deployments/daemonset.yml
@echo
@echo
test: buildc
@echo "****** Unit Tests ******"
@echo
go test $(shell go list ./... | grep -vE $(excluded_from_utests) | grep -v "/internal/resourcesapi")
@echo
@echo
e2e: build
@echo "****** Basic E2E ******"
@echo
cd test/e2e/ && ./e2e-test.sh
@echo
@echo
e2efull: build
@echo "****** Full E2E ******"
@echo
cd test/e2e/ && ./e2e-test.sh --full
@echo
@echo
e2edaemon: image
@echo "****** E2E Daemonset ******"
@echo
cd test/e2e/ && ./e2e-test.sh --daemonset
@echo
@echo
e2efulldaemon: image
@echo "****** Full E2E DaemSet ******"
@echo
cd test/e2e/ && ./e2e-test.sh --full --daemonset
@echo
@echo
static:
@echo "****** Go Lint ******"
@echo
golint -set_exit_status ./...
@echo
@echo
@echo "****** GolangCI-Lint ******"
@echo
golangci-lint run
@echo
@echo
@echo "****** Go Vet ******"
@echo
for pkg in $$(go list github.com/intel/afxdp-plugins-for-kubernetes/...); do echo $$pkg && go vet $$pkg; done
@echo
@echo
@echo "****** Hadolint ******"
@echo
for file in $$(find . -type f -iname "*dockerfile*"); do echo $$file && docker run --rm -i hadolint/hadolint < $$file; done
@echo
@echo
@echo "****** Shellcheck ******"
@echo
for file in $$(find . -iname "*.sh"); do echo $$file && shellcheck $$file; done
cloc: format
@echo "****** Update CLOC ******"
@echo
@cloc $(shell git ls-files)
sed -i "/<\!---clocstart--->/,/<\!---clocend--->/c\<\!---clocstart--->\n\`\`\`\n$$(cloc $$(git ls-files) | sed -n '/-----/,$$p' | sed -z 's/\n/\\n/g')\n\`\`\`\n\<\!---clocend--->" README.md
@echo
@echo
clean:
@echo "****** Cleanup ******"
@echo
rm -f ./bin/afxdp
rm -f ./bin/afxdp-dp
rm -f ./internal/bpf/bpfWrapper.o
rm -f ./internal/bpf/libwrapper.a
@echo
@echo