forked from yugabyte/yb-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
global.mk
58 lines (43 loc) · 1.39 KB
/
global.mk
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
TOP_BUILDDIR ?= .
DEFAULT_TARGET ?= all
GOBIN_DIR := ${TOP_BUILDDIR}/bin
OUT_DIR := ${TOP_BUILDDIR}/out
.PHONY: default_target
_default_target: ${OUT_DIR} ${GOBIN_DIR} tools ${DEFAULT_TARGET}
${OUT_DIR}:
@mkdir -p ${OUT_DIR}
${GOBIN_DIR}:
@mkdir -p ${GOBIN_DIR}
${OUT_DIR}/creds: ${OUT_DIR}
@mkdir -p ${OUT_DIR}/creds
# Run tests
test: fmt vet lint
go test ./... -coverprofile cover.out
lint: tools
golangci-lint run
# Run go fmt against code
fmt:
go fmt ./...
# Run go vet against code
vet:
go vet ./...
protoc-gen-ybrpc: ${GOBIN}/protoc-gen-ybrpc
${GOBIN}/protoc-gen-ybrpc:
${MAKE} -C ${TOP_BUILDDIR}/protoc-gen-ybrpc
####################################
# TOOLS
####################################
.PHONY: tools golangci-lint ginkgo cobra swagger protoc-gen-go
tools: golangci-lint ginkgo cobra swagger protoc-gen-go
golangci-lint: ${GOBIN_DIR}/golangci-lint
${GOBIN_DIR}/golangci-lint:
go install -modfile=${TOP_BUILDDIR}/go.mod github.com/golangci/golangci-lint/cmd/golangci-lint
ginkgo: ${GOBIN}/ginkgo
${GOBIN}/ginkgo:
go install -modfile=${TOP_BUILDDIR}/go.mod github.com/onsi/ginkgo/ginkgo
swagger: ${GOBIN}/swagger
${GOBIN}/swagger:
go install -modfile=${TOP_BUILDDIR}/go.mod github.com/go-swagger/go-swagger/cmd/swagger
protoc-gen-go: ${GOBIN}/protoc-gen-go
${GOBIN}/protoc-gen-go:
go install -modfile=${TOP_BUILDDIR}/go.mod google.golang.org/protobuf/cmd/protoc-gen-go