forked from elastic/eck-diagnostics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (30 loc) · 1.2 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
SHELL := /bin/bash
export VERSION ?= 1.1.0
export GOBIN = $(shell pwd)/bin
SNAPSHOT ?= true
TAG ?= $(shell git show --format='%h' HEAD --quiet)
LDFLAGS ?= -X github.com/elastic/eck-diagnostics/internal.buildVersion=$(VERSION) \
-X github.com/elastic/eck-diagnostics/internal.buildHash=$(TAG) \
-X github.com/elastic/eck-diagnostics/internal.buildDate=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')) \
-X github.com/elastic/eck-diagnostics/internal.snapshotBuild=$(SNAPSHOT)
all: $(GOBIN)/eck-diagnostics NOTICE.txt
# build
$(GOBIN)/eck-diagnostics: unit
@ GCO_ENABLED=0 go build -o $(GOBIN)/eck-diagnostics -ldflags="$(LDFLAGS)" github.com/elastic/eck-diagnostics/cmd
NOTICE.txt: $(GOBIN)/go-licence-detector
@ go list -m -json all | $(GOBIN)/go-licence-detector \
-noticeTemplate=build/notice/NOTICE.txt.tpl \
-noticeOut=NOTICE.txt \
-overrides=build/notice/overrides.json \
-includeIndirect
.PHONY: unit
unit: lint
@ go test -v ./...
.PHONY: lint
lint: $(GOBIN)/golangci-lint
@ $(GOBIN)/golangci-lint run
# tool dependencies
$(GOBIN)/go-licence-detector:
@ go install go.elastic.co/[email protected]
$(GOBIN)/golangci-lint:
@ go install github.com/golangci/golangci-lint/cmd/[email protected]