forked from tczekajlo/kube-consul-register
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (32 loc) · 1.05 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
46
47
48
SHELL := /bin/bash
PREFIX = kube-consul-register
PACKAGES = $(shell go list ./... | grep -v /vendor/)
TESTARGS ?= -race
CURRENTDIR = $(shell pwd)
SOURCEDIR = $(CURRENTDIR)
APP_SOURCES := $(shell find $(SOURCEDIR) -name '*.go' -not -path '$(SOURCEDIR)/vendor/*')
PATH := $(CURRENTDIR)/bin:$(PATH)
VERSION?=$(shell git describe --tags)
LD_FLAGS = -ldflags "-X main.VERSION=$(VERSION) -s -w"
all: build
.PHONY: clean build docker check
default: build
build: dist/kube-consul-controller
clean:
rm -rf dist vendor
dist/kube-consul-controller:
mkdir -p $(@D)
CGO_ENABLED=0 GOOS=linux go build $(LD_FLAGS) -v -o dist/kube-consul-register
docker:
docker build -t $(PREFIX):$(VERSION) .
$(PACKAGES): check-deps format
go test $(TESTARGS) $@
cd $(GOPATH)/src/$@; gometalinter --deadline 720s --vendor -D gotype -D dupl -D gocyclo -D gas -D errcheck
check-deps:
@which gometalinter > /dev/null || \
(go get github.com/alecthomas/gometalinter && gometalinter --install)
check: $(PACKAGES)
vendor:
glide install --strip-vendor
format:
goimports -w -l $(APP_SOURCES)