-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (46 loc) · 1.31 KB
/
Makefile
File metadata and controls
56 lines (46 loc) · 1.31 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
45
46
47
48
49
50
51
52
53
54
55
56
BIN := awsmfa
BUILD_LDFLAGS := "-s -w"
GOBIN ?= $(shell go env GOPATH)/bin
GODOWNLOADER_VERSION := 0.1.0
export GO111MODULE=on
repo_name := future-architect/awsmfa
current_dir := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
.PHONY: all
all: clean build
.PHONY: deps
deps:
go mod tidy
.PHONY: devel-deps
devel-deps: deps
sh -c '\
tmpdir=$$(mktemp -d); \
cd $$tmpdir; \
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.36.0; \
rm -rf $$tmpdir'
.PHONY: build
build:
go build -ldflags=$(BUILD_LDFLAGS) -o $(BIN) -trimpath ./cmd/awsmfa
.PHONY: test
test: deps
go test -v ./...
.PHONY: test-cover
test-cover: deps
go test -v ./... -cover -coverprofile=c.out
go tool cover -html=c.out -o coverage.html
.PHONY: lint
lint: devel-deps
go vet ./...
golangci-lint run --config .golangci.yml ./...
.PHONY: clean
clean:
rm -rf $(BIN)
go clean
.PHONY: installer
installer:
sh -c '\
tmpdir=$$(mktemp -d); \
cd $$tmpdir; \
# Build from source, because "go get github.com/goreleaser/godownloader" will result in an error; \
git clone --quiet --depth 1 https://github.com/goreleaser/godownloader && cd godownloader; \
go run . -f -r ${repo_name} -o ${current_dir}/install.sh; \
rm -rf $$tmpdir'