-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
45 lines (37 loc) · 1.43 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
PACKAGES := $(shell go list ./...)
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
BUILD_TAGS := $(strip netgo,ledger)
LD_FLAGS := -s -w \
-X github.com/cosmos/cosmos-sdk/version.Name=sentinel \
-X github.com/cosmos/cosmos-sdk/version.AppName=sentinelcli \
-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}
.PHONY: benchmark
benchmark:
@go test -mod=readonly -v -bench= ${PACKAGES}
.PHONY: clean
clean:
rm -rf ./build
.PHONY: build
build:
GOOS=darwin GOARCH=amd64 go build -mod=readonly -tags="${BUILD_TAGS}" -ldflags="${LD_FLAGS}" \
-o ./build/sentinelcli-${VERSION}-darwin-amd64 main.go
GOOS=linux GOARCH=amd64 go build -mod=readonly -tags="${BUILD_TAGS}" -ldflags="${LD_FLAGS}" \
-o ./build/sentinelcli-${VERSION}-linux-amd64 main.go
GOOS=windows GOARCH=amd64 go build -mod=readonly -tags="${BUILD_TAGS}" -ldflags="${LD_FLAGS}" \
-o ./build/sentinelcli-${VERSION}-windows-amd64.exe main.go
.PHONY: install
install:
go build -mod=readonly -tags="${BUILD_TAGS}" -ldflags="${LD_FLAGS}" \
-o ${GOPATH}/bin/sentinelcli main.go
.PHONY: go-lint
go-lint:
@golangci-lint run --fix
.PHONY: test
test:
@go test -mod=readonly -v -cover ${PACKAGES}
.PHONY: tools
tools:
@go install github.com/golangci/golangci-lint/cmd/[email protected]