-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (34 loc) · 952 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
38
39
40
41
SHA := $(shell git rev-parse --short=8 HEAD)
GITVERSION := $(shell git describe --long --all)
BUILDDATE := $(shell date -Iseconds)
VERSION := $(or ${VERSION},devel)
DOCKER_TAG := $(or ${GIT_TAG_NAME}, latest)
export GO111MODULE := on
export CGO_ENABLED := 0
BINARY := metal-cloud-controller-manager
MAINMODULE := github.com/metal-stack/metal-ccm
.PHONY: build
build: test
go build \
-trimpath \
-tags netgo \
-ldflags \
"-X 'github.com/metal-stack/v.Version=$(VERSION)' \
-X 'github.com/metal-stack/v.Revision=$(GITVERSION)' \
-X 'github.com/metal-stack/v.GitSHA1=$(SHA)' \
-X 'github.com/metal-stack/v.BuildDate=$(BUILDDATE)'" \
-o bin/$(BINARY) \
$(MAINMODULE) \
&& strip bin/$(BINARY)
.PHONY: test
test:
go test -coverprofile cover.out -cover ./... && go tool cover -func cover.out
.PHONY: clean
clean:
rm -f bin/$(BINARY)
.PHONY: gofmt
gofmt:
GO111MODULE=off go fmt ./...
.PHONY: golint
golint:
golangci-lint run