-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (23 loc) · 884 Bytes
/
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
NAME ?= kubectl-nodepool
VERSION ?= $(shell git describe --tags || echo "unknown")
GO_LDFLAGS='-w -s'
GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags $(GO_LDFLAGS)
PLATFORM_LIST = \
darwin-amd64 \
darwin-arm64 \
linux-amd64 \
linux-arm64
all: linux-amd64 linux-arm64 darwin-amd64 darwin-arm64
darwin-%:
GOARCH=$* GOOS=darwin $(GOBUILD) -o $(NAME)-$(VERSION)-$@/$(NAME)
linux-%:
GOARCH=$* GOOS=linux $(GOBUILD) -o $(NAME)-$(VERSION)-$@/$(NAME)
gz_releases=$(addsuffix .tar.gz, $(PLATFORM_LIST))
$(gz_releases): %.tar.gz : %
tar czf $(NAME)-$(VERSION)-$@ -C $(NAME)-$(VERSION)-$</ ../LICENSE $(NAME)
sha256_releases=$(addsuffix .tar.gz.sha256, $(PLATFORM_LIST))
$(sha256_releases): %.sha256 : %
shasum -a 256 $(NAME)-$(VERSION)-$< > $(NAME)-$(VERSION)-$@
releases: $(gz_releases) $(sha256_releases)
install:
CGO_ENABLED=0 go install -trimpath -ldflags $(GO_LDFLAGS)