-
Notifications
You must be signed in to change notification settings - Fork 109
/
Makefile
45 lines (35 loc) · 1.31 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
42
43
44
45
GO ?= GO15VENDOREXPERIMENT=1 go
GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
PROMU ?= $(GOPATH)/bin/promu
GOLINTER ?= $(GOPATH)/bin/gometalinter
pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
TARGET ?= logstash_exporter
PREFIX ?= $(shell pwd)
BIN_DIR ?= $(shell pwd)
all: clean format vet gometalinter build test
test:
@echo ">> running tests"
@$(GO) test -short $(pkgs)
format:
@echo ">> formatting code"
@$(GO) fmt $(pkgs)
gometalinter: $(GOLINTER)
@echo ">> linting code"
@$(GOLINTER) --install --update > /dev/null
@$(GOLINTER) --config=./.gometalinter.json ./...
build: $(PROMU)
@echo ">> building binaries"
@$(PROMU) build --prefix $(PREFIX)
clean:
@echo ">> Cleaning up"
@find . -type f -name '*~' -exec rm -fv {} \;
@rm -fv $(TARGET)
$(GOPATH)/bin/promu promu:
@GOOS=$(shell uname -s | tr A-Z a-z) \
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
$(GO) get -u github.com/prometheus/promu
$(GOPATH)/bin/gometalinter lint:
@GOOS=$(shell uname -s | tr A-Z a-z) \
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
$(GO) get -u github.com/alecthomas/gometalinter
.PHONY: all format vet build test promu clean $(GOPATH)/bin/promu $(GOPATH)/bin/gometalinter lint