forked from IBM/newrelic-cli
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
41 lines (29 loc) · 1.17 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
VERSION := $(shell grep "version = " cmd/version.go | awk '{print $$4}' | sed 's/"//g')
PLATFORMS := linux/amd64 darwin/amd64 windows/amd64
temp = $(subst /, ,$@)
os = $(word 1, $(temp))
arch = $(word 2, $(temp))
COMMONENVVAR = GOOS=$(shell uname -s | tr A-Z a-z) GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m)))
BUILDENVVAR = CGO_ENABLED=0
all: build
deps:
git config --global url."[email protected]:".insteadOf "https://github.com/"
dep ensure
test:
$(COMMONENVVAR) $(BUILDENVVAR) go test ./... -v
build:
$(COMMONENVVAR) $(BUILDENVVAR) go vet ./...
$(COMMONENVVAR) $(BUILDENVVAR) go build -o nr *.go
tag: # used in client side to trigger a travis deployment job
ifndef VERSION
$(error VERSION is undefined - run using make tag VERSION=vX.Y.Z)
endif
git tag $(VERSION)
# Check to make sure the tag isn't "-dirty".
if git describe --tags --dirty | grep dirty; \
then echo current git working tree is "dirty". Make sure you do not have any uncommitted changes ;false; fi
git push --tags
$(PLATFORMS):
GOOS=$(os) GOARCH=$(arch) $(BUILDENVVAR) go build -o dist/nr-$(os)-$(arch) *.go
release: $(PLATFORMS)
.PHONY: all deps test build tag release $(PLATFORMS)