forked from openstandia/aws-cli-oidc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (46 loc) · 1.33 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
NAME := aws-cli-oidc
VERSION := v0.6.0
REVISION := $(shell git rev-parse --short HEAD)
SRCS := $(shell find . -type f -name '*.go')
LDFLAGS := -ldflags="-s -w -X \"github.com/openstandia/aws-cli-oidc/version.Version=$(VERSION)\" -X \"github.com/openstandia/aws-cli-oidc/version.Revision=$(REVISION)\" -extldflags -static"
DIST_DIRS := find * -type d -exec
.DEFAULT_GOAL := bin/$(NAME)
bin/$(NAME): $(SRCS)
go build $(LDFLAGS) -o bin/$(NAME) cmd/aws-cli-oidc/*.go
.PHONY: clean
clean:
rm -rf bin/*
rm -rf dist/*
rm -rf vendor/*
.PHONY: cross-build
cross-build:
for os in darwin linux windows; do \
[ $$os = "windows" ] && EXT=".exe"; \
for arch in amd64; do \
GOOS=$$os GOARCH=$$arch CGO_ENABLED=0 go build -a -tags netgo -installsuffix netgo $(LDFLAGS) -o dist/$$os-$$arch/$(NAME)$$EXT cmd/aws-cli-oidc/*.go; \
done; \
done
.PHONY: deps
deps:
GO111MODULE=on go mod vendor
.PHONY: dist
dist:
cd dist && \
$(DIST_DIRS) cp ../LICENSE {} \; && \
$(DIST_DIRS) cp ../README.md {} \; && \
$(DIST_DIRS) tar -zcf $(NAME)-$(VERSION)-{}.tar.gz {} \; && \
$(DIST_DIRS) zip -r $(NAME)-$(VERSION)-{}.zip {} \; && \
cd ..
.PHONY: fast
fast:
go build $(LDFLAGS) -o bin/$(NAME)
.PHONY: install
install:
go install $(LDFLAGS)
.PHONY: release
release:
git tag $(VERSION)
git push origin $(VERSION)
.PHONY: test
test:
go test -cover -v