forked from aixeshunter/nfs_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (35 loc) · 962 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
42
43
44
45
GO ?= go
FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
PREFIX ?= _outputs
GODEP ?= $(GOPATH)/bin/dep
DOCKERFILE ?= Dockerfile
DOCKER_REPO ?= aixeshunter
DOCKER_IMAGE_NAME ?= nfs-exporter
DOCKER_IMAGE_TAG ?= v1.0
PROMU := $(FIRST_GOPATH)/bin/promu
.PHONY: promu
promu:
GOOS= GOARCH= $(GO) get -v -u github.com/prometheus/promu
.PHONY: build
build: promu
@echo ">> building binaries"
$(PROMU) build -v
.PHONY: docker
docker:
@echo ">> building docker image from $(DOCKERFILE)"
@docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
gotest: vet format
@echo ">> running tests"
@$(GO) test -short $(pkgs)
format:
@echo ">> formatting code"
@$(GO) fmt $(pkgs)
vet:
@echo ">> vetting code"
@$(GO) vet $(pkgs)
promu-build: vet format promu
$(PROMU) build
depcheck: $(GODEP)
@echo ">> ensure vendoring"
@$(GODEP) ensure