forked from spacemeshos/go-spacemesh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (35 loc) · 1.22 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
BINARY := go-spacemesh
VERSION := 0.0.1
COMMIT :=$(shell git rev-parse HEAD)
BRANCH :=$(shell git rev-parse --abbrev-ref HEAD)
BIN_DIR := $(shell pwd)/build
CURR_DIR :=$(shell pwd)
# Setup the -ldflags option to pass vars defined here to app vars
LDFLAGS = -ldflags "-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.branch=${BRANCH}"
PKGS := $(shell go list ./... | grep -v /vendor)
PLATFORMS := windows linux darwin
os = $(word 1, $@)
build:
go build ${LDFLAGS} -o $(CURR_DIR)/$(BINARY)
.PHONY: $(PLATFORMS)
$(PLATFORMS):
GOOS=$(os) GOARCH=amd64 go build ${LDFLAGS} -o $(BIN_DIR)/$(BINARY)-$(VERSION)-$(os)-amd64
test:
go test -p 1 ./...
.PHONY: build test devtools cover
lint:
./ci/validate-lint.sh
devtools:
# Install the build tools
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/golang/protobuf/protoc-gen-go
go get -u github.com/kardianos/govendor
# Get the dependencies
govendor sync
cover:
@echo "mode: count" > cover-all.out
@$(foreach pkg,$(PKGS),\
go test -coverprofile=cover.out -covermode=count $(pkg);\
tail -n +2 cover.out >> cover-all.out;)
go tool cover -html=cover-all.out