-
Notifications
You must be signed in to change notification settings - Fork 44
/
Makefile
74 lines (58 loc) · 1.82 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
.PHONY: vendor build_linux build_windows build_all build_all_docker
.PHONY: clean vendor release
REGISTRY?=docker.io/flannel/flannel-cni-plugin
# Default tag and architecture. Can be overridden
TAG?=$(shell git describe --tags --dirty --always)
ARCH?=amd64
SRC_DIR?=$(pwd)
GO?=$(go)
GOPATH?=$(go env GOPATH)
# this is the upstream CNI plugin version used for testing
TEST_TAG?=v1.6.0
# Only enable CGO (and build the UDP backend) on AMD64
ifeq ($(ARCH),amd64)
CGO_ENABLED=1
else
CGO_ENABLED=0
endif
# Go version to use for builds. Can be overridden
GOLANG_VERSION?=1.23.3
build_all: vendor build_all_linux build_windows
@echo "All arches should be built for $(TAG)"
build_all_linux: vendor
GOOS=linux GOARCH=amd64 scripts/build_flannel.sh
GOOS=linux GOARCH=386 scripts/build_flannel.sh
GOOS=linux GOARCH=arm scripts/build_flannel.sh
GOOS=linux GOARCH=arm64 scripts/build_flannel.sh
GOOS=linux GOARCH=s390x scripts/build_flannel.sh
GOOS=linux GOARCH=ppc64le scripts/build_flannel.sh
GOOS=linux GOARCH=riscv64 scripts/build_flannel.sh
vendor:
go mod tidy
go mod vendor
build_all_docker: vendor
docker build \
--no-cache \
--build-arg GOLANG_VERSION=$(GOLANG_VERSION) \
--build-arg TAG=$(TAG) \
--tag $(REGISTRY):$(TAG) \
--tag $(REGISTRY):$(TAG)-$(ARCH) \
-f Dockerfile \
.
build_linux: vendor
GOOS=linux GOARCH=$(ARCH) scripts/build_flannel.sh
build_windows: vendor
GOOS=windows GOARCH=$(ARCH) scripts/build_flannel.sh
test_linux: vendor build_linux
TAG=$(TEST_TAG) scripts/test_linux.sh
clean:
rm -f dist/flannel*
rm -f release/cni-plugin-flannel*
package: vendor
scripts/package.sh
release: build_all
scripts/package.sh
release_docker: clean vendor
scripts/release.sh
@echo "Everything should be built for $(TAG)"
@echo "Add all flannel-* and *.tar.gz files from dist/ and release/ to the Github release"