-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
120 lines (101 loc) · 4.12 KB
/
Copy pathMakefile
File metadata and controls
120 lines (101 loc) · 4.12 KB
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
.PHONY: all clean build pack pack-fast package-build bin/l1 bin/fleet bin/oracle bin/bombard bin/VERSIONS
.DEFAULT_GOAL := all
export GOFLAGS := -trimpath
GO_TOOLCHAIN := go1.26.5
PACKAGE_GO_ENV := GOTOOLCHAIN=$(GO_TOOLCHAIN) \
GOPATH=/tmp/avalanche-benchmark-gopath \
GOMODCACHE=/tmp/avalanche-benchmark-gomodcache \
GOCACHE=/tmp/avalanche-benchmark-gocache
AVALANCHEGO_REPO := https://github.com/ava-labs/avalanchego.git
AVALANCHEGO_COMMIT := 80c123c996d7dbdab5f2800ed894348df7e11c21
AVALANCHEGO_BUILD_DIR := $(CURDIR)/.build/avalanchego-$(AVALANCHEGO_COMMIT)
SUBNET_EVM_ID := srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy
all: build
build: bin/l1 bin/fleet bin/oracle bin/bombard
bin/l1:
mkdir -p bin
$(PACKAGE_GO_ENV) go build -o bin/l1 ./cmd/l1
bin/fleet:
mkdir -p bin
$(PACKAGE_GO_ENV) go build -o bin/fleet ./cmd/fleet
bin/oracle:
mkdir -p bin
$(PACKAGE_GO_ENV) go build -o bin/oracle ./apps/settlement-feed/cmd/oracle
bin/bombard:
mkdir -p bin
$(PACKAGE_GO_ENV) go build -o bin/bombard ./cmd/bombard
bin/avalanchego:
rm -rf $(AVALANCHEGO_BUILD_DIR)
mkdir -p $(AVALANCHEGO_BUILD_DIR)
git -C $(AVALANCHEGO_BUILD_DIR) init
git -C $(AVALANCHEGO_BUILD_DIR) remote add origin $(AVALANCHEGO_REPO)
git -C $(AVALANCHEGO_BUILD_DIR) fetch --depth=1 origin $(AVALANCHEGO_COMMIT)
git -C $(AVALANCHEGO_BUILD_DIR) checkout --detach FETCH_HEAD
test "$$(git -C $(AVALANCHEGO_BUILD_DIR) rev-parse HEAD)" = "$(AVALANCHEGO_COMMIT)"
cd $(AVALANCHEGO_BUILD_DIR) && $(PACKAGE_GO_ENV) ./scripts/build.sh
cd $(AVALANCHEGO_BUILD_DIR)/graft/subnet-evm && $(PACKAGE_GO_ENV) go build \
-ldflags "-X github.com/ava-labs/avalanchego/version.GitCommit=$(AVALANCHEGO_COMMIT)" \
-o $(AVALANCHEGO_BUILD_DIR)/build/subnet-evm plugin/*.go
mkdir -p bin
cp $(AVALANCHEGO_BUILD_DIR)/build/avalanchego bin/avalanchego
cp $(AVALANCHEGO_BUILD_DIR)/build/subnet-evm bin/$(SUBNET_EVM_ID)
bin/$(SUBNET_EVM_ID): bin/avalanchego
test -x bin/$(SUBNET_EVM_ID)
bin/VERSIONS: bin/avalanchego bin/$(SUBNET_EVM_ID) bin/l1 bin/fleet bin/oracle bin/bombard
bin/avalanchego --version > bin/VERSIONS
go version bin/avalanchego bin/$(SUBNET_EVM_ID) bin/l1 bin/fleet bin/oracle bin/bombard >> bin/VERSIONS
echo "avalanchego commit $(AVALANCHEGO_COMMIT)" >> bin/VERSIONS
echo "kit commit $$(git rev-parse HEAD)" >> bin/VERSIONS
cat bin/VERSIONS
package-build: bin/avalanchego bin/$(SUBNET_EVM_ID) bin/l1 bin/fleet bin/oracle bin/bombard bin/VERSIONS
PACK_FILES := \
bin/ \
README.md \
.env.example \
examples/ \
chains/ \
docs/ \
playbooks/ \
monitoring/prometheus.yml \
monitoring/alerts.yml \
monitoring/docker-compose.yml \
monitoring/grafana-datasources.yml \
monitoring/grafana-dashboards.yml \
monitoring/fleet-weight-exporter.py \
monitoring/dashboards/ \
apps/settlement-feed/app.json \
apps/settlement-feed/README.md \
apps/settlement-feed/docs/ \
apps/settlement-feed/contracts/ \
apps/settlement-feed/dashboards/ \
apps/settlement-feed/alerts.yml \
tools/forkcheck.sh
# Forge build artifacts must never ride into the artifact from a working
# tree. The contracts ship as reference sources only.
PACK_EXCLUDES := \
--exclude apps/settlement-feed/contracts/lib \
--exclude apps/settlement-feed/contracts/cache \
--exclude apps/settlement-feed/contracts/out
pack:
rm -rf bin
$(MAKE) package-build
rm -f avalanche-benchmark.tar.gz
tar -czf avalanche-benchmark.tar.gz $(PACK_EXCLUDES) $(PACK_FILES)
tar -tzf avalanche-benchmark.tar.gz
# pack-fast keeps an already built avalanchego and plugin and rebuilds only the
# kit binaries. Use it while iterating; use pack for anything shipped.
pack-fast:
test -x bin/avalanchego && test -x bin/$(SUBNET_EVM_ID)
rm -f bin/l1 bin/fleet bin/oracle bin/bombard bin/VERSIONS
$(MAKE) package-build
rm -f avalanche-benchmark.tar.gz
tar -czf avalanche-benchmark.tar.gz $(PACK_EXCLUDES) $(PACK_FILES)
tar -tzf avalanche-benchmark.tar.gz
# Client handover: base + one app + this deployment's identities and frozen
# P-chain, secrets stripped, denylist enforced. Run from a deployment root.
APP ?= settlement-feed
BUNDLE ?= avalanche-l1-bundle.zip
bundle:
bash tools/bundle.sh $(APP) $(BUNDLE)
clean:
rm -rf bin .build avalanche-benchmark.tar.gz