-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
42 lines (32 loc) · 1.38 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
#!/usr/bin/env make
NAME=cocaine-isolate-daemon
BUILDDT=$(shell date -u +%F@%H:%M:%S)
VERSION=$(shell git show-ref --head --hash head)
TAG=$(shell git describe --tags --always)
DEBVER=$(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
LDFLAGS=-ldflags "-X github.com/interiorem/stout/version.GitTag=${TAG} -X github.com/interiorem/stout/version.Version=${DEBVER} -X github.com/interiorem/stout/version.Build=${BUILDDT} -X github.com/interiorem/stout/version.GitHash=${VERSION}"
.DEFAULT: all
.PHONY: fmt vet test
PKGS := $(shell go list ./... | grep -v ^github.com/interiorem/stout/vendor/ | grep -v ^github.com/interiorem/stout/version)
all: fmt vet test
vet:
@echo "+ $@"
@go vet $(PKGS)
fmt:
@echo "+ $@"
@test -z "$$(gofmt -s -l . 2>&1 | grep -v ^vendor/ | tee /dev/stderr)" || \
(echo >&2 "+ please format Go code with 'gofmt -s'" && false)
test:
@echo "+ $@"
@echo "" > coverage.txt
@set -e; for pkg in $(PKGS); do go test -coverprofile=profile.out -covermode=atomic $$pkg; \
if [ -f profile.out ]; then \
cat profile.out >> coverage.txt; rm profile.out; \
fi done; \
build:
@echo "+ $@"
go build ${LDFLAGS} -o ${NAME} github.com/interiorem/stout/cmd/stout
build_travis_release:
@echo "+ $@"
env GOOS="linux" go build ${LDFLAGS} -o ${NAME} github.com/interiorem/stout/cmd/stout
env GOOS="darwin" go build ${LDFLAGS} -o ${NAME}_osx github.com/interiorem/stout/cmd/stout