generated from dymensionxyz/rollapp
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile
175 lines (142 loc) · 5.02 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/usr/bin/make -f
PROJECT_NAME=rollappd
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H')
LEDGER_ENABLED ?= true
DRS_VERSION = 1
#ifndef $(CELESTIA_NETWORK)
# CELESTIA_NETWORK=mock
# export CELESTIA_NETWORK
#endif
ifndef BECH32_PREFIX
$(error BECH32_PREFIX is not set)
endif
# don't override user values
ifeq (,$(NAME))
NAME := $(shell git describe --tags)
# if VERSION is empty, then populate it with branch's name and raw commit hash
ifeq (,$(NAME))
NAME := $(BRANCH)-$(COMMIT)
endif
endif
ifndef $(GOPATH)
GOPATH=$(shell go env GOPATH)
export GOPATH
endif
TM_VERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::')
export GO111MODULE = on
build_tags = netgo
ifeq ($(LEDGER_ENABLED),true)
ifeq ($(OS),Windows_NT)
GCCEXE = $(shell where gcc.exe 2> NUL)
ifeq ($(GCCEXE),)
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),OpenBSD)
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
else
GCC = $(shell command -v gcc 2> /dev/null)
ifeq ($(GCC),)
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
endif
endif
endif
build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))
whitespace :=
whitespace += $(whitespace)
comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))
# process linker flags
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=$(NAME)\
-X github.com/cosmos/cosmos-sdk/version.AppName=rollapp-evm \
-X github.com/cosmos/cosmos-sdk/version.Version=DRS-$(DRS_VERSION) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TM_VERSION) \
-X github.com/dymensionxyz/rollapp-evm/app.AccountAddressPrefix=$(BECH32_PREFIX) \
-X github.com/dymensionxyz/dymint/version.DrsVersion=$(DRS_VERSION)
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
###########
# Install #
###########
all: install
.PHONY: install
install: build
@echo "--> installing rollapp-evm"
mv build/rollapp-evm $(GOPATH)/bin/rollapp-evm
.PHONY: build
build: go.sum ## Compiles the rollapd binary
@echo "--> Ensure dependencies have not been modified"
@go mod verify
@echo "--> building rollapp-evm"
@go build -o build/rollapp-evm $(BUILD_FLAGS) ./cmd/rollappd
.PHONY: clean
clean: ## Clean temporary files
go clean
clean-tmp: ## Clean temporary files
rm -rf \
tmp-swagger-gen/
###############################################################################
### Protobuf ###
###############################################################################
protoVer=v0.7
protoImageName=tendermintdev/sdk-proto-gen:$(protoVer)
containerProtoGen=$(PROJECT_NAME)-proto-gen-$(protoVer)
proto-gen:
@echo "Generating Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \
sh ./scripts/protogen.sh; fi
@go mod tidy
#? proto-swagger-gen: Generate Protobuf Swagger
proto-swagger-gen:
@echo "Generating Protobuf Swagger"
@$(protoImage) sh ./scripts/protoc-swagger-gen.sh
proto-clean:
@echo "Cleaning proto generating docker container"
@docker rm $(containerProtoGen) || true
.PHONY: proto-gen proto-swagger-gen proto-clean
###############################################################################
### Releasing ###
###############################################################################
PACKAGE_NAME:=github.com/dymensionxyz/rollapp-evm
GOLANG_CROSS_VERSION = v1.22
GOPATH ?= '$(HOME)/go'
release-dry-run:
docker run \
--rm \
--privileged \
-e CGO_ENABLED=1 \
-e TM_VERSION=$(TM_VERSION) \
-e BECH32_PREFIX=$(BECH32_PREFIX) \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-v ${GOPATH}/pkg:/go/pkg \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
--clean --skip=validate --skip=publish --snapshot
release:
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
docker run \
--rm \
--privileged \
-e CGO_ENABLED=1 \
-e TM_VERSION=$(TM_VERSION) \
-e BECH32_PREFIX=$(BECH32_PREFIX) \
--env-file .release-env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --clean --skip=validate
.PHONY: release-dry-run release