-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
121 lines (95 loc) · 2.55 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
export CGO_ENABLED = 0
export VERSION = ${shell git describe --tags 2>/dev/null}
export SOURCE_DATE_ISO = ${shell TZ=UTC git log ${VERSION} -1 --date=iso-local --pretty=%cd}
BIN = mullvad-upgrade-tunnel
GO_LDFLAGS = -buildid= -s -w -X main.VERSION=${VERSION}
.PHONY: all
all: ${BIN}
.PHONY: ${BIN}
${BIN}:
go build -a -trimpath -buildvcs=false -ldflags "${GO_LDFLAGS}" \
-o ${BIN} ./cmd/mullvad-upgrade-tunnel
.PHONY: install
install:
go install
.PHONY: grpc
grpc:
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative internal/grpc/ephemeralpeer.proto
.PHONY: upgrade
upgrade:
go get -u
go mod tidy
go mod vendor
.PHONY: clean
clean:
rm -f ${BIN}*
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: vet
vet:
golangci-lint run ./...
.PHONY: vuln
vuln:
govulncheck ./...
.PHONY: test
test:
go test -v ./...
.PHONY: ci
ci:
podman build --quiet --target test \
-t wgephemeralpeer-tester .
podman run --rm -v .:/build:Z -w /build \
-it wgephemeralpeer-tester make all vuln test vet
.PHONY: build-container
build-container:
podman build --target build -t wgephemeralpeer .
.PHONY: build
build: build-container
podman run --rm -v .:/build:Z -w /build \
-e GOOS=${GOOS} -e GOARCH=${GOARCH} -e GOARM=${GOARM} -e TZ=UTC \
wgephemeralpeer \
sh -c '\
ARMV=$${GOARM:+v$$GOARM};make BIN=${BIN}${EXT} && \
touch -d "${SOURCE_DATE_ISO}" ${BIN}${EXT} && \
zip -X ${BIN}_${VERSION}_${GOOS}_${GOARCH}$$ARMV.zip ${BIN}${EXT}'
.PHONY: release-darwin-amd64
release-darwin-amd64:
$(MAKE) GOOS=darwin GOARCH=amd64 build
.PHONY: release-darwin-arm64
release-darwin-arm64:
$(MAKE) GOOS=darwin GOARCH=arm64 build
.PHONY: release-linux-amd64
release-linux-amd64:
$(MAKE) GOOS=linux GOARCH=amd64 build
.PHONY: release-linux-arm64
release-linux-arm64:
$(MAKE) GOOS=linux GOARCH=arm64 build
.PHONY: release-linux-armv5
release-linux-armv5:
$(MAKE) GOOS=linux GOARCH=arm GOARM=5 build
.PHONY: release-linux-armv6
release-linux-armv6:
$(MAKE) GOOS=linux GOARCH=arm GOARM=6 build
.PHONY: release-linux-armv7
release-linux-armv7:
$(MAKE) GOOS=linux GOARCH=arm GOARM=7 build
.PHONY: release-windows-amd64
release-windows-amd64:
$(MAKE) GOOS=windows GOARCH=amd64 EXT=.exe build
.PHONY: release-windows-arm64
release-windows-arm64:
$(MAKE) GOOS=windows GOARCH=arm64 EXT=.exe build
.PHONY: release
release: \
clean \
release-darwin-amd64 \
release-darwin-arm64 \
release-linux-amd64 \
release-linux-arm64 \
release-linux-armv5 \
release-linux-armv6 \
release-linux-armv7 \
release-windows-amd64 \
release-windows-arm64