-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (30 loc) · 1 KB
/
Makefile
File metadata and controls
44 lines (30 loc) · 1 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
NAME ?= kubectl-blame
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 # Most used
darwin-%:
GOARCH=$* GOOS=darwin $(GOBUILD) -o $(NAME)-$(VERSION)-$@/$(NAME)
linux-%:
GOARCH=$* GOOS=linux $(GOBUILD) -o $(NAME)-$(VERSION)-$@/$(NAME)
all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST)
install:
CGO_ENABLED=0 go install -trimpath -ldflags $(GO_LDFLAGS)
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)
clean:
rm -r $(NAME)-*
build-local:
$(GOBUILD)
test:
go test -race -v ./...