-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
40 lines (29 loc) · 999 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
export GO15VENDOREXPERIMENT = 1
VERSION := $(shell git describe --tags --always --dirty)
REVISION := $(shell git rev-parse --sq HEAD)
PACKAGES := $(shell go list ./... | grep -v '/vendor/')
.DEFAULT_GOAL := check
ifndef GOBIN
GOBIN := $(shell echo "$${GOPATH%%:*}/bin")
endif
LINT := $(GOBIN)/golint
GOX := $(GOBIN)/gox
$(LINT): ; @go get github.com/golang/lint/golint
$(GOX): ; @go get -v github.com/mitchellh/gox
.PHONY: build
build:
@go build -ldflags "-X main.VersionString=$(VERSION) -X main.RevisionString=$(REVISION)" $(PACKAGES)
.PHONY: dist
dist: $(GOX)
@$(GOX) -ldflags "-X main.VersionString=$(VERSION) -X main.RevisionString=$(REVISION)" -os 'linux darwin windows' -arch '386 amd64' -output 'dist/{{.OS}}_{{.Arch}}' $(PACKAGES)
.PHONY: vet
vet:
@go vet $(PACKAGES)
.PHONY: lint
lint: $(LINT)
@exit $$($(LINT) . | tee /dev/tty | wc -l)
.PHONY: test
test:
@go test $(PACKAGES) github.com/jszwedko/circleci-cli/vendor/encoding/json
.PHONY: check
check: vet lint test build