mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
feat: use make
This commit is contained in:
parent
fe955f626f
commit
fd1e75f9bb
105
Makefile
Normal file
105
Makefile
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
|
||||||
|
VERSION := 0.34.7
|
||||||
|
COMMIT := $(shell git log -1 --format='%H')
|
||||||
|
LEDGER_ENABLED ?= true
|
||||||
|
SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
|
||||||
|
|
||||||
|
export GO111MODULE = on
|
||||||
|
|
||||||
|
# process build tags
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
ifeq ($(WITH_CLEVELDB),yes)
|
||||||
|
build_tags += gcc
|
||||||
|
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=kava \
|
||||||
|
-X github.com/cosmos/cosmos-sdk/version.ServerName=kvd \
|
||||||
|
-X github.com/cosmos/cosmos-sdk/version.ClientName=kvcli \
|
||||||
|
-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_comma_sep)"
|
||||||
|
|
||||||
|
ifeq ($(WITH_CLEVELDB),yes)
|
||||||
|
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
|
||||||
|
endif
|
||||||
|
ldflags += $(LDFLAGS)
|
||||||
|
ldflags := $(strip $(ldflags))
|
||||||
|
|
||||||
|
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
|
||||||
|
|
||||||
|
|
||||||
|
all: install lint check
|
||||||
|
|
||||||
|
build: go.sum
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
go build -mod=readonly $(BUILD_FLAGS) -o build/kvd.exe ./cmd/kvd
|
||||||
|
go build -mod=readonly $(BUILD_FLAGS) -o build/kvcli.exe ./cmd/kvcli
|
||||||
|
else
|
||||||
|
go build -mod=readonly $(BUILD_FLAGS) -o build/kvd ./cmd/kvd
|
||||||
|
go build -mod=readonly $(BUILD_FLAGS) -o build/kvcli ./cmd/kvcli
|
||||||
|
endif
|
||||||
|
|
||||||
|
build-linux: go.sum
|
||||||
|
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build
|
||||||
|
|
||||||
|
install: go.sum check-ledger
|
||||||
|
go install -mod=readonly $(BUILD_FLAGS) ./cmd/kvd
|
||||||
|
go install -mod=readonly $(BUILD_FLAGS) ./cmd/kvcli
|
||||||
|
|
||||||
|
########################################
|
||||||
|
### Tools & dependencies
|
||||||
|
|
||||||
|
go-mod-cache: go.sum
|
||||||
|
@echo "--> Download go modules to local cache"
|
||||||
|
@go mod download
|
||||||
|
|
||||||
|
go.sum: go.mod
|
||||||
|
@echo "--> Ensure dependencies have not been modified"
|
||||||
|
@go mod verify
|
||||||
|
|
||||||
|
draw-deps:
|
||||||
|
@# requires brew install graphviz or apt-get install graphviz
|
||||||
|
go get github.com/RobotsAndPencils/goviz
|
||||||
|
@goviz -i ./cmd/gaiad -d 2 | dot -Tpng -o dependency-graph.png
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build/
|
||||||
|
|
||||||
|
.PHONY: all build-linux install \
|
||||||
|
go-mod-cache draw-deps clean build \
|
||||||
|
check-ledger
|
@ -32,7 +32,7 @@ git clone https://github.com/Kava-Labs/kava.git
|
|||||||
cd kava
|
cd kava
|
||||||
# Ensure GO Modules are enabled
|
# Ensure GO Modules are enabled
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
go install -tags "ledger" ./cmd/kvd ./cmd/kvcli
|
make install
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Create a Wallet
|
#### Create a Wallet
|
||||||
|
3
go.sum
3
go.sum
@ -41,7 +41,9 @@ github.com/cosmos/cosmos-sdk v0.35.0 h1:EPeie1aKHwnXtTzKggvabG7aAPN+DDmju2xquvjF
|
|||||||
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 h1:Iwin12wRQtyZhH6FV3ykFcdGNlYEzoeR0jN8Vn+JWsI=
|
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 h1:Iwin12wRQtyZhH6FV3ykFcdGNlYEzoeR0jN8Vn+JWsI=
|
||||||
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
|
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
|
||||||
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
|
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
|
||||||
|
github.com/cosmos/ledger-cosmos-go v0.10.3 h1:Qhi5yTR5Pg1CaTpd00pxlGwNl4sFRdtK1J96OTjeFFc=
|
||||||
github.com/cosmos/ledger-cosmos-go v0.10.3/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY=
|
github.com/cosmos/ledger-cosmos-go v0.10.3/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY=
|
||||||
|
github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI=
|
||||||
github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI=
|
github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI=
|
||||||
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
||||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@ -211,6 +213,7 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr
|
|||||||
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||||
|
github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8=
|
||||||
github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
|
github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
|
||||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||||
|
Loading…
Reference in New Issue
Block a user