-
Notifications
You must be signed in to change notification settings - Fork 38
/
Makefile
172 lines (142 loc) · 5.56 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
PKG = github.com/loomnetwork/go-loom
PROTOC = protoc --plugin=./protoc-gen-gogo -I$(GOPATH)/src -I/usr/local/include
GOGO_PROTOBUF_DIR = $(GOPATH)/src/github.com/gogo/protobuf
HASHICORP_DIR = $(GOPATH)/src/github.com/hashicorp/go-plugin
GETH_DIR = $(GOPATH)/src/github.com/ethereum/go-ethereum
SSHA3_DIR = $(GOPATH)/src/github.com/miguelmota/go-solidity-sha3
BTCD_DIR = $(GOPATH)/src/github.com/btcsuite/btcd
YUBIHSM_DIR = $(GOPATH)/src/github.com/certusone/yubihsm-go
# This commit sha should match the one in loomchain repo
GETH_GIT_REV = cce1b3f69354033160583e5576169f9b309ee62e
BTCD_GIT_REV = 7d2daa5bfef28c5e282571bc06416516936115ee
YUBIHSM_REV = 892fb9b370f3cbb486fc1f53d4a1d89e9f552af0
.PHONY: all evm examples get_lint update_lint example-cli evmexample-cli example-plugins example-plugins-external plugins proto test lint deps clean test-evm deps-evm deps-all lint
all: examples
evm: all example-evm-plugins evmexample-cli
examples: example-plugins example-plugins-external example-cli
example-cli: proto
go build -o $@ $(PKG)/examples/cli
evmexample-cli: proto
go build -tags "evm" -o $@ $(PKG)/examples/plugins/evmexample/cli
example-plugins: contracts/helloworld.so.1.0.0 contracts/lottery.so.1.0.0
example-plugins-external: contracts/helloworld.1.0.0
example-evm-plugins: contracts/evmexample.1.0.0 contracts/evmproxy.1.0.0
contracts/helloworld.1.0.0: proto
go build -o $@ $(PKG)/examples/plugins/helloworld
contracts/helloworld.so.1.0.0: proto
go build -buildmode=plugin -o $@ $(PKG)/examples/plugins/helloworld
contracts/lottery.so.1.0.0: examples/plugins/lottery/lottery.pb.go
go build -o $@ $(PKG)/examples/plugins/lottery
contracts/evmexample.1.0.0: proto
go build -tags "evm" -o $@ $(PKG)/examples/plugins/evmexample/contract
contracts/evmproxy.1.0.0: proto
go build -tags "evm" -o $@ $(PKG)/examples/plugins/evmproxy/contract
get_lint:
@echo "--> Installing lint"
chmod +x get_lint.sh
./get_lint.sh
update_lint:
@echo "--> Updating lint"
./get_lint.sh
lint:
cd $(GOPATH)/bin && chmod +x golangci-lint
cd $(GOPATH)/src/github.com/loomnetwork/go-loom
@golangci-lint run | tee goloomreport
linterrors:
chmod +x parselintreport.sh
./parselintreport.sh
protoc-gen-gogo:
go build github.com/gogo/protobuf/protoc-gen-gogo
%.pb.go: %.proto protoc-gen-gogo
$(PROTOC) --gogo_out=plugins=grpc:$(GOPATH)/src $(PKG)/$<
proto: \
types/types.pb.go \
auth/auth.pb.go \
vm/vm.pb.go \
plugin/types/types.pb.go \
builtin/types/address_mapper/address_mapper.pb.go \
builtin/types/coin/coin.pb.go \
builtin/types/ethcoin/ethcoin.pb.go \
builtin/types/dpos/dpos.pb.go \
builtin/types/dposv2/dposv2.pb.go \
builtin/types/dposv3/dposv3.pb.go \
builtin/types/plasma_cash/plasma_cash.pb.go \
builtin/types/karma/karma.pb.go \
builtin/types/chainconfig/chainconfig.pb.go \
builtin/types/deployer_whitelist/deployer_whitelist.pb.go \
builtin/types/transfer_gateway/transfer_gateway.pb.go \
builtin/types/transfer_gateway/v1/transfer_gateway.pb.go \
builtin/types/user_deployer_whitelist/user_deployer_whitelist.pb.go \
builtin/types/sample_go_contract/sample_go_contract.pb.go \
testdata/test.pb.go \
examples/types/types.pb.go \
examples/plugins/lottery/lottery.pb.go \
examples/plugins/evmexample/types/types.pb.go \
examples/plugins/evmproxy/types/types.pb.go
test: proto
go test -v $(PKG)/...
test-evm: proto
go test -tags "evm" -v $(PKG)/...
$(SSHA3_DIR):
git clone -q https://github.com/loomnetwork/go-solidity-sha3.git $@
$(GETH_DIR):
git clone -q https://github.com/loomnetwork/go-ethereum.git $@
deps-all: deps deps-evm
deps:
go get \
golang.org/x/crypto/ripemd160 \
golang.org/x/crypto/sha3 \
github.com/gogo/protobuf/jsonpb \
github.com/gogo/protobuf/proto \
github.com/gorilla/websocket \
github.com/phonkee/go-pubsub \
google.golang.org/grpc \
github.com/spf13/cobra \
github.com/hashicorp/go-plugin \
github.com/stretchr/testify/assert \
github.com/go-kit/kit/log \
github.com/pkg/errors \
github.com/certusone/yubihsm-go \
github.com/btcsuite/btcd
dep ensure -vendor-only
git clone -q [email protected]:gogo/protobuf.git $(GOGO_PROTOBUF_DIR) || true
cd $(GOGO_PROTOBUF_DIR) && git checkout v1.1.1
git clone [email protected]:hashicorp/go-plugin.git $(HASHICORP_DIR) || true
cd $(HASHICORP_DIR) && git checkout f4c3476bd38585f9ec669d10ed1686abd52b9961
git clone [email protected]:btcsuite/btcd.git $(BTCD_DIR) || true
cd $(BTCD_DIR) && git checkout $(BTCD_GIT_REV)
git clone [email protected]:certusone/yubihsm-go.git $(YUBIHSM_DIR) || true
cd $(YUBIHSM_DIR) && git checkout master && git pull && git checkout $(YUBIHSM_REV)
deps-evm: $(SSHA3_DIR) $(GETH_DIR)
cd $(GETH_DIR) && git checkout master && git pull && git checkout $(GETH_GIT_REV)
go get \
github.com/certusone/yubihsm-go \
gopkg.in/check.v1
clean:
go clean
rm -f \
protoc-gen-gogo \
types/types.pb.go \
auth/auth.pb.go \
vm/vm.pb.go \
builtin/types/coin/coin.pb.go \
builtin/types/ethcoin/ethcoin.pb.go \
builtin/types/plasma_cash/plasma_cash.pb.go \
builtin/types/karma/karma.pb.go \
builtin/types/chainconfig/chainconfig.pb.go \
builtin/types/deployer_whitelist/deployer_whitelist.pb.go \
builtin/types/user_deployer_whitelist/user_deployer_whitelist.pb.go \
builtin/types/sample_go_contract/sample_go_contract.pb.go \
testdata/test.pb.go \
examples/types/types.pb.go \
examples/plugins/evmexample/types/types.pb.go \
example-cli \
evmexample-cli \
builtin/plugins/lottery/lottery.pb.go \
contracts/helloworld.1.0.0 \
contracts/helloworld.so.1.0.0 \
out/cmds/cli \
contracts/evmexample.1.0.0 \
contracts/lottery.so.1.0.0 \
contracts/evmproxy.so.1.0.0 \
out/cmds/cli