Go-SDK & CLI tool to interact with the Woop Blockchain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
go-sdk/Makefile

71 lines
2.4 KiB

SHELL := /bin/bash
TOP:=$(realpath ..)
export LD_LIBRARY_PATH:=$(TOP)/bls/lib:$(TOP)/mcl/lib:/usr/local/opt/openssl/lib:/opt/homebrew/opt/gmp/lib/:/opt/homebrew/opt/openssl/lib
export LIBRARY_PATH:=$(LD_LIBRARY_PATH)
version := $(shell git rev-list --count HEAD)
commit := $(shell git describe --always --long --dirty)
built_at := $(shell date +%FT%T%z)
built_by := ${USER}@wikiwoop.com
flags := -gcflags="all=-N -l"
ldflags := -X main.version=v${version} -X main.commit=${commit}
ldflags += -X main.builtAt=${built_at} -X main.builtBy=${built_by}
cli := ./dist/wiki
upload-path-darwin := 's3://pub.wikiwoop.com/release/darwin-x86_64/mainnet/wiki'
upload-path-linux := 's3://pub.wikiwoop.com/release/linux-x86_64/mainnet/wiki'
upload-path-linux-version := 's3://pub.wikiwoop.com/release/linux-x86_64/mainnet/wiki_version'
uname := $(shell uname)
env := GO111MODULE=on
DIR := ${CURDIR}
export CGO_LDFLAGS=-L$(DIR)/dist/lib -Wl,-rpath -Wl,\$ORIGIN/lib
all:
source $(shell go env GOPATH)/src/github.com/woop-chain/woop/scripts/setup_bls_build_flags.sh && $(env) go build -o $(cli) -ldflags="$(ldflags)" cmd/main.go
cp $(cli) wiki
static:
make -C $(shell go env GOPATH)/src/github.com/woop-chain/mcl
make -C $(shell go env GOPATH)/src/github.com/woop-chain/bls minimised_static BLS_SWAP_G=1
source $(shell go env GOPATH)/src/github.com/woop-chain/woop/scripts/setup_bls_build_flags.sh && $(env) go build -o $(cli) -ldflags="$(ldflags) -w -extldflags \"-static\"" cmd/main.go
cp $(cli) wiki
debug:
source $(shell go env GOPATH)/src/github.com/woop-chain/woop/scripts/setup_bls_build_flags.sh && $(env) go build $(flags) -o $(cli) -ldflags="$(ldflags)" cmd/main.go
cp $(cli) wiki
install:all
cp $(cli) ~/.local/bin
run-tests: test-rpc test-key;
test-key:
go test ./pkg/keys -cover -v
test-rpc:
go test ./pkg/rpc -cover -v
# Notice assumes you have correct uploading credentials
upload-darwin:all
ifeq (${uname}, Darwin)
aws --profile upload s3 cp ./wiki ${upload-path-darwin}
else
@echo "Wrong operating system for target upload"
endif
# Only the linux build will upload the CLI version
upload-linux:static
ifeq (${uname}, Linux)
aws --profile upload s3 cp ./wiki ${upload-path-linux}
./wiki version &> ./wiki_version
aws --profile upload s3 cp ./wiki_version ${upload-path-linux-version}
else
@echo "Wrong operating system for target upload"
endif
.PHONY:clean run-tests upload-darwin upload-linux
clean:
@rm -f $(cli)
@rm -rf ./dist