-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
61 lines (58 loc) · 2.7 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
DEFAULT:compile
IPLD_SCHEMA_PATH := ledger.ipldsch
LD_FLAGS := "-X main.GitCommit=`git rev-parse HEAD` -X main.GitTag=`git symbolic-ref -q --short HEAD || git describe --tags --exact-match || git rev-parse HEAD`"
compile:
@echo "\nCompiling faithful-cli binary for current platform ..."
go build -ldflags=$(LD_FLAGS) -o ./bin/faithful-cli .
compile-all: compile-linux compile-mac compile-windows
compile-linux:
@echo "\nCompiling faithful-cli binary for linux amd64 ..."
GOOS=linux GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o ./bin/linux/amd64/faithful-cli_linux_amd64 .
compile-mac:
@echo "\nCompiling faithful-cli binary for mac amd64 ..."
GOOS=darwin GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o ./bin/darwin/amd64/faithful-cli_darwin_amd64 .
@echo "\nCompiling faithful-cli binary for mac arm64 ..."
GOOS=darwin GOARCH=arm64 go build -ldflags=$(LD_FLAGS) -o ./bin/darwin/arm64/faithful-cli_darwin_arm64 .
compile-windows:
@echo "\nCompiling faithful-cli binary for windows amd64 ..."
GOOS=windows GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o ./bin/windows/amd64/faithful-cli_windows_amd64.exe .
test:
go test -v ./...
bindcode: install-deps
ipld schema codegen \
--generator=go-bindnode \
--package=ipldbindcode \
--output=./ipld/ipldbindcode \
$(IPLD_SCHEMA_PATH)
gengo: install-deps
ipld schema codegen \
--generator=go-gengo \
--package=ipldsch \
--output=./ipld/ipldsch \
$(IPLD_SCHEMA_PATH)
install-deps:
go install github.com/ipld/go-ipldtool/cmd/ipld@latest
install-protoc:
@echo "Installing protoc..."
@mkdir -p $$(pwd)/third_party/protoc
@echo "Getting the latest release of protoc from github.com/protocolbuffers/protobuf..."
@cd $$(pwd)/third_party/protoc && \
wget https://github.com/protocolbuffers/protobuf/releases/download/v23.1/protoc-23.1-linux-x86_64.zip
@echo "Unzipping protoc..."
@cd $$(pwd)/third_party/protoc && \
unzip protoc-23.1-linux-x86_64.zip
@echo "Installing protoc-gen-go..."
@go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
gen-proto: install-protoc
@echo "Generating proto files..."
$$(pwd)/third_party/protoc/bin/protoc \
--experimental_allow_proto3_optional \
--go_out=paths=source_relative:$$(pwd)/third_party/solana_proto/confirmed_block \
-I=$$(pwd)/third_party/solana_proto/confirmed_block/ \
$$(pwd)/third_party/solana_proto/confirmed_block/confirmed_block.proto
$$(pwd)/third_party/protoc/bin/protoc \
--experimental_allow_proto3_optional \
--go_out=paths=source_relative:$$(pwd)/third_party/solana_proto/transaction_by_addr \
-I=$$(pwd)/third_party/solana_proto/transaction_by_addr/ \
$$(pwd)/third_party/solana_proto/transaction_by_addr/transaction_by_addr.proto