-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
37 lines (28 loc) · 851 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
34
35
36
37
NAME := k8sec
VERSION := v0.6.0
COMMIT := $(shell git rev-parse HEAD)
DATE := $(shell date "+%Y-%m-%dT%H:%M:%S%z")
SRCS := $(shell find . -type f -name '*.go')
LDFLAGS := -ldflags="-s -w -X \"github.com/dtan4/k8sec/version.version=$(VERSION)\" -X \"github.com/dtan4/k8sec/version.commit=$(COMMIT)\" -X \"github.com/dtan4/k8sec/version.date=$(DATE)\" -extldflags -static"
NOVENDOR := $(shell go list ./... | grep -v vendor)
export GO111MODULE=on
.DEFAULT_GOAL := bin/$(NAME)
bin/$(NAME): $(SRCS)
go build $(LDFLAGS) -o bin/$(NAME)
.PHONY: ci-test
ci-test:
go test -coverpkg=./... -coverprofile=coverage.txt -v ./...
.PHONY: clean
clean:
rm -rf bin/*
rm -rf dist/*
rm -rf vendor/*
.PHONY: fast
fast:
go build $(LDFLAGS) -o bin/$(NAME)
.PHONY: install
install:
go install $(LDFLAGS)
.PHONY: test
test:
go test -cover -v $(NOVENDOR)