forked from harmony-one/go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (38 loc) · 1.43 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
version := $(shell git rev-list --count HEAD)
commit := $(shell git describe --always --long --dirty)
built_at := $(shell date +%FT%T%z)
built_by := ${USER}@harmony.one
flags := -gcflags="all=-N -l -c 2"
ldflags := -X main.version=v${version} -X main.commit=${commit}
ldflags += -X main.builtAt=${built_at} -X main.builtBy=${built_by}
cli := ./dist/hmy
upload-path-darwin := 's3://pub.harmony.one/release/darwin-x86_64/mainnet/hmy'
upload-path-linux := 's3://pub.harmony.one/release/linux-x86_64/mainnet/hmy'
env := GO111MODULE=on
DIR := ${CURDIR}
export CGO_LDFLAGS=-L$(DIR)/dist/lib -Wl,-rpath -Wl,\$ORIGIN/lib
all:prepare-dirs
$(env) go build -o $(cli) -ldflags="$(ldflags)" cmd/main.go
cp $(cli) hmy
debug:prepare-dirs
$(env) go build $(flags) -o $(cli) -ldflags="$(ldflags)" cmd/main.go
cp $(cli) hmy
run-tests: test-rpc test-key;
test-key:
go test ./pkg/keys -cover -v
test-rpc:
go test ./pkg/rpc -cover -v
prepare-dirs:
mkdir -p dist
rsync -a $(shell go env GOPATH)/src/github.com/harmony-one/bls/lib/* ./dist/lib/
rsync -a $(shell go env GOPATH)/src/github.com/harmony-one/mcl/lib/* ./dist/lib/
rsync -a /usr/local/opt/openssl/lib/* ./dist/lib/
# Notice assumes you have correct uploading credentials
upload-darwin:all
aws --profile upload s3 cp ./hmy ${upload-path-darwin}
upload-linux:all
aws --profile upload s3 cp ./hmy ${upload-path-linux}
.PHONY:clean run-tests upload-darwin upload-linux
clean:
@rm -f $(cli)
@rm -rf ./dist