-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
99 lines (77 loc) · 2.92 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
#!/usr/bin/make -f
CWD := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
# don't override user values
ifeq (,$(VERSION))
VERSION := $(shell git tag --sort=version:refname | tail -1)
# if VERSION is empty, then populate it with branch's name and raw commit hash
ifeq (,$(VERSION))
VERSION := $(BRANCH)-$(COMMIT)
endif
endif
DATE := $(shell date '+%Y-%m-%dT%H:%M:%S')
HEAD = $(shell git rev-parse HEAD)
# MacOS sequoia + XCode 16 causes the binary to instantly die
# Stripping the debug info with -s -w fixes this so the binary
# is properly signed
# ref: https://github.com/rollchains/spawn/issues/248
LD_FLAGS = -X main.SpawnVersion=$(VERSION) -s -w
BUILD_FLAGS = -mod=readonly -ldflags='$(LD_FLAGS)'
## mod-tidy: go mod tidy spawn, simapp, and interchaintest with proper go.mod suffixes
mod-tidy:
go mod tidy
mv simapp/interchaintest/go.mod_ simapp/interchaintest/go.mod
cd simapp && go mod tidy
cd simapp/interchaintest && go mod tidy
mv simapp/interchaintest/go.mod simapp/interchaintest/go.mod_
## install: Install the binary.
install:
@echo ⏳ Installing Spawn...
go install $(BUILD_FLAGS) ./cmd/spawn
@echo ✅ Spawn installed
## build: Build to ./bin/spawn.
build:
go build $(BUILD_FLAGS) -o ./bin/spawn ./cmd/spawn
## run: Run the raw source.
run:
go run ./cmd/spawn $(filter-out $@,$(MAKECMDGOALS))
.PHONY: install build run
# ---- Downloads ----
## get-heighliner: Install the cosmos docker utility.
get-heighliner:
@echo ⏳ Installing heighliner...
git clone --depth 1 https://github.com/strangelove-ventures/heighliner.git
cd heighliner && go install
@sleep 0.1
@echo ✅ heighliner installed to $(shell which heighliner)
get-localic:
@echo "Installing local-interchain"
git clone --depth 1 --branch v8.7.1 https://github.com/strangelove-ventures/interchaintest.git interchaintest-downloader
cd interchaintest-downloader/local-interchain && make install
@sleep 0.1
@echo ✅ local-interchain installed $(shell which local-ic)
.PHONY: get-heighliner
.PHONY: build-docs
## build-docs: Build the documentation.
build-docs:
@cd docs && npm ci && npm run build
## serve-docs: Run docs server
serve-docs:
@cd docs && npm run serve
## dev-docs: Run dev docs instance
dev-docs:
@cd docs && npm run dev
help: Makefile
@echo
@echo " Choose a command run in "spawn", or just run 'make' for install"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
.PHONY: help
# ---- Developer Templates ----
template-staking: install
spawn new myproject --consensus=proof-of-stake --debug --bech32=cosmos --bin=appd --bypass-prompt --log-level=debug --org=reece
template-poa: install
spawn new myproject --consensus=proof-of-authority --debug --no-git --bin=rolld --bech32=roll --denom=uroll --bypass-prompt --log-level=debug
template-ics: install
spawn new myproject --consensus=interchain-security --debug --no-git --bin=rolld --bech32=roll --denom=uroll --bypass-prompt --log-level=debug
.DEFAULT_GOAL := install