-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (41 loc) · 1.17 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
49
50
51
52
53
54
55
56
57
58
59
60
GO=go
MOCK=mockery
BINARY=govdev
MAIN=cmd/govdev/main.go
VERSION=`git describe --abbrev=0 --tags`
GIT_HASH=`git rev-parse HEAD`
BUILD_TIME=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'`
LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.GitHash=${GIT_HASH} -X main.BuildTime=${BUILD_TIME}"
.PHONY: clean test docs
default: install
build: test
$(GO) build $(LDFLAGS) -o $(BINARY) $(MAIN)
build-darwin-amd64: test
GOOS=darwin GOARCH=amd64 $(GO) build $(LDFLAGS) -o bin/$(BINARY)-darwin $(MAIN)
build-linux-amd64: test
GOOS=linux GOARCH=amd64 $(GO) build $(LDFLAGS) -o bin/$(BINARY)-linux $(MAIN)
build-windows-amd64: test
GOOS=windows GOARCH=amd64 $(GO) build $(LDFLAGS) -o bin/$(BINARY)-windows $(MAIN)
all: clean test build-darwin-amd64 build-linux-amd64 build-windows-amd64
test:
$(GO) test -v ./...
run: test
$(GO) run $(MAIN)
install: test
$(GO) install $(LDFLAGS) ./...
docker:
docker build -t $(BINARY):$(VERSION) .
docs:
godoc -http=:6061
fmt:
$(GO) fmt ./...
vet:
$(GO) vet -v ./...
coverage:
$(GO) test -cover -coverprofile=c.out ./...
$(GO) tool cover -html=c.out -o coverage.html
clean:
$(GO) clean
rm -rf bin/$(BINARY)*
rm -f $(BINARY)
# Project Specific