-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (46 loc) · 1.21 KB
/
Makefile
File metadata and controls
57 lines (46 loc) · 1.21 KB
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
49
50
51
52
53
54
55
56
57
SHELL := /bin/bash
REV_VAR := github.com/modcloth-labs/amqp-tee.RevString
VERSION_VAR := github.com/modcloth-labs/amqp-tee.VersionString
REPO_VERSION := $(shell git describe --always --dirty --tags)
REPO_REV := $(shell git rev-parse --sq HEAD)
GOBUILD_VERSION_ARGS := -ldflags "-X $(REV_VAR) $(REPO_REV) -X $(VERSION_VAR) $(REPO_VERSION)"
DOCKER ?= sudo docker
.PHONY: all
all: clean build test
.PHONY: clean
clean:
go clean -x ./...
.PHONY: build
build: deps
go install $(GOBUILD_VERSION_ARGS) -x ./...
.PHONY: savedeps
savedeps:
godep save -copy=false ./...
.PHONY: deps
deps:
godep restore
.PHONY: test
test: deps
go test ./...
.PHONY: fmtpolice
fmtpolice: fmt lint
.PHONY: fmt
fmt:
@set -e ; \
for f in $(shell git ls-files '*.go'); do \
gofmt $$f | diff -u $$f - ; \
done
.PHONY: lint
lint:
@for file in $(shell git ls-files '*.go') ; do \
if [[ ! "$$(golint $$file)" =~ ^[[:blank:]]*$$ ]] ; then \
$(MAKE) lintv && exit 1 ; fi \
done
.PHONY: lintv
lintv:
@for file in $(shell git ls-files '*.go') ; do $(GOPATH)/bin/golint $$file ; done
.PHONY: container
container: build
mkdir -p .build
cp $${GOPATH%%:*}/bin/amqp-tee .build
$(DOCKER) build -t quay.io/modcloth/amqp-tee:$(REPO_VERSION) .