forked from comdex-official/comdex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (61 loc) · 2.21 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
PACKAGES := $(shell go list ./...)
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
TENDERMINT_VERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::')
BUILD_TAGS := $(strip netgo,ledger)
LD_FLAGS := -s -w \
-X github.com/cosmos/cosmos-sdk/version.Name=comdex \
-X github.com/cosmos/cosmos-sdk/version.AppName=comdex \
-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION} \
-X github.com/cosmos/cosmos-sdk/version.Commit=${COMMIT} \
-X github.com/cosmos/cosmos-sdk/version.BuildTags=${BUILD_TAGS} \
-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TENDERMINT_VERSION)
BUILD_FLAGS += -ldflags "${ldflags}"
GOBIN = $(shell go env GOPATH)/bin
.PHONY: benchmark
benchmark:
@go test -mod=readonly -v -bench ${PACKAGES}
.PHONY: all install build verify
.PHONY: clean
clean:
rm -rf ./bin ./vendor
all: verify build
install:
ifeq (${OS},Windows_NT)
go build -mod=readonly ${BUILD_FLAGS} -o ${GOBIN}/comdex.exe ./node
else
go build -mod=readonly ${BUILD_FLAGS} -o ${GOBIN}/comdex ./node
endif
build:
ifeq (${OS},Windows_NT)
go build ${BUILD_FLAGS} -o ${GOBIN}/comdex.exe ./node
else
go build ${BUILD_FLAGS} -o ${GOBIN}/comdex ./node
endif
install: mod-vendor
go install -mod=readonly -tags="${BUILD_TAGS}" -ldflags="${LD_FLAGS}" ./node
.PHONY: go-lint
go-lint:
@golangci-lint run --fix
.PHONY: mod-vendor
mod-vendor: tools
@go mod vendor
@modvendor -copy="**/*.proto" -include=github.com/cosmos/cosmos-sdk/proto,github.com/cosmos/cosmos-sdk/third_party/proto,github.com/cosmos/ibc-go/proto
.PHONY: proto-gen
proto-gen:
@.scripts/proto-gen.sh
.PHONY: proto-lint
proto-lint:
@find proto -name *.proto -exec clang-format-12 -i {} \;
.PHONY: test
test:
@go test -mod=readonly -timeout 15m -v ${PACKAGES}
.PHONT: test-coverage
test-coverage:
@go test -mod=readonly -timeout 15m -v -covermode=atomic -coverprofile=coverage.txt ${PACKAGES}
.PHONY: tools
tools:
@go install github.com/bufbuild/buf/cmd/[email protected]
@go install github.com/golangci/golangci-lint/cmd/[email protected]
@go install github.com/goware/[email protected]
@go install github.com/grpc-ecosystem/grpc-gateway/[email protected]