forked from bandprotocol/bandchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (84 loc) · 3.69 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
PACKAGES=$(shell go list ./... | grep -v '/simulation')
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
LEDGER_ENABLED ?= true
BINDIR ?= $(GOPATH)/bin
ifeq ($(LEDGER_ENABLED),true)
build_tags += ledger
endif
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=bandchain \
-X github.com/cosmos/cosmos-sdk/version.ServerName=bandd \
-X github.com/cosmos/cosmos-sdk/version.ClientName=bandcli \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags)"
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
all: install
install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/bandd
go install -mod=readonly $(BUILD_FLAGS) ./cmd/bandcli
go install -mod=readonly $(BUILD_FLAGS) ./cmd/yoda
faucet: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/faucet
release: go.sum
env GOOS=linux GOARCH=amd64 \
go build -mod=readonly -o ./build/bandd_linux_amd64 $(BUILD_FLAGS) ./cmd/bandd
env GOOS=darwin GOARCH=amd64 \
go build -mod=readonly -o ./build/bandd_darwin_amd64 $(BUILD_FLAGS) ./cmd/bandd
env GOOS=windows GOARCH=amd64 \
go build -mod=readonly -o ./build/bandd_windows_amd64 $(BUILD_FLAGS) ./cmd/bandd
env GOOS=linux GOARCH=amd64 \
go build -mod=readonly -o ./build/bandcli_linux_amd64 $(BUILD_FLAGS) ./cmd/bandcli
env GOOS=darwin GOARCH=amd64 \
go build -mod=readonly -o ./build/bandcli_darwin_amd64 $(BUILD_FLAGS) ./cmd/bandcli
env GOOS=windows GOARCH=amd64 \
go build -mod=readonly -o ./build/bandcli_windows_amd64 $(BUILD_FLAGS) ./cmd/bandcli
env GOOS=linux GOARCH=amd64 \
go build -mod=readonly -o ./build/yoda_linux_amd64 $(BUILD_FLAGS) ./cmd/yoda
env GOOS=darwin GOARCH=amd64 \
go build -mod=readonly -o ./build/yoda_darwin_amd64 $(BUILD_FLAGS) ./cmd/yoda
env GOOS=windows GOARCH=amd64 \
go build -mod=readonly -o ./build/yoda_windows_amd64 $(BUILD_FLAGS) ./cmd/yoda
go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
GO111MODULE=on go mod verify
touch go.sum
test:
@go test -mod=readonly $(PACKAGES)
###############################################################################
### Protobuf ###
###############################################################################
PREFIX ?= /usr/local
PROTOC_VERSION ?= 3.11.2
PROTOC_ZIP ?= protoc-3.11.2-linux-x86_64.zip
# ifeq ($(UNAME_S),Linux)
# PROTOC_ZIP ?= protoc-3.11.2-linux-x86_64.zip
# endif
# ifeq ($(UNAME_S),Darwin)
# PROTOC_ZIP ?= protoc-3.11.2-osx-x86_64.zip
# endif
proto-all: proto-gen
proto-gen:
@./scripts/protocgen.sh
proto-tools-stamp:
@echo "Installing protoc compiler..."
@echo "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}"
@(cd /tmp; \
curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}"; \
unzip -o ${PROTOC_ZIP} -d $(PREFIX) bin/protoc; \
unzip -o ${PROTOC_ZIP} -d $(PREFIX) 'include/*'; \
rm -f ${PROTOC_ZIP})
@echo "Installing protoc-gen-buf-check-breaking..."
@curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/protoc-gen-buf-check-breaking-${UNAME_S}-${UNAME_M}" \
-o "${BIN}/protoc-gen-buf-check-breaking" && \
chmod +x "${BIN}/protoc-gen-buf-check-breaking"
@echo "Installing buf..."
@curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-${UNAME_S}-${UNAME_M}" \
-o "${BIN}/buf" && \
chmod +x "${BIN}/buf"
touch $@
protoc-gen-gocosmos:
@echo "Installing protoc-gen-gocosmos..."
@go install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos