-
Notifications
You must be signed in to change notification settings - Fork 600
Expand file tree
/
Copy pathMakefile
More file actions
321 lines (234 loc) · 10.9 KB
/
Makefile
File metadata and controls
321 lines (234 loc) · 10.9 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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# Aztec Packages Build System
#
# This Makefile is called by the root bootstrap.sh build and build_and_test functions.
# It coordinates the build order and dependencies between projects.
# The actual build logic remains in each project's bootstrap.sh script.
#
# Note that "test" targets don't *run* tests, they just output test commands to /tmp/test_cmds.
#
# Expectation is to run with one of the following targets:
# - make [all]
# - make full
# - make release
# Shell to use for all commands
SHELL := /bin/bash
export DENOISE := 1
ROOT := $(shell git rev-parse --show-toplevel)
# Core helper to run a shell command with colored, prefixed output
# Usage: $(call run_command,label,directory,command)
# Color is automatically computed from label hash by color_prefix script
define run_command
@cd $(2) && $(ROOT)/ci3/color_prefix $(1) "$(3)"
endef
# Main build helper - calls bootstrap.sh with optional function argument
# Usage: $(call build,label,project-path[,function-name])
# label: Display name for colored output (usually the target name)
# project-path: Path to the project directory
# function-name: Optional bootstrap.sh command
define build
$(call run_command,$(1),$(ROOT)/$(2),$(ROOT)/ci3/denoise './bootstrap.sh $(3)')
endef
# Collects the test commands from the given project
# Writes the full output to /tmp/test_cmds atomically.
# The test engine is expected to be running and it will read commands from this file.
define test
$(call run_command,$(1),$(ROOT)/$(2),\
./bootstrap.sh test_cmds $(3) | $(ROOT)/ci3/filter_test_cmds | $(ROOT)/ci3/atomic_append /tmp/test_cmds)
endef
#==============================================================================
# PHONY TARGETS - List every target that has a file/dir of the same name.
#==============================================================================
.PHONY: all noir barretenberg noir-projects l1-contracts release-image boxes playground docs aztec-up
#==============================================================================
# BOOTSTRAP TARGETS
#==============================================================================
# Fast bootstrap
all: release-image barretenberg boxes playground docs aztec-up \
bb-tests l1-contracts-tests yarn-project-tests boxes-tests playground-tests aztec-up-tests docs-tests noir-protocol-circuits-tests release-image-tests
# Full bootstrap
full: release-image barretenberg boxes playground docs aztec-up \
bb-cpp-full yarn-project-benches \
bb-full-tests l1-contracts-tests yarn-project-tests boxes-tests playground-tests aztec-up-tests docs-tests noir-protocol-circuits-tests release-image-tests
# Release. Everything plus copy bb cross compiles to ts projects.
release: all bb-cpp-release-dir bb-ts-cross-copy
#==============================================================================
# Noir
#==============================================================================
noir:
$(call build,$@,noir)
#==============================================================================
# AVM Transpiler
#==============================================================================
avm-transpiler-native:
$(call build,$@,avm-transpiler,build_native)
avm-transpiler-cross-amd64-macos:
$(call build,$@,avm-transpiler,build_cross amd64-macos)
avm-transpiler-cross-arm64-macos:
$(call build,$@,avm-transpiler,build_cross arm64-macos)
avm-transpiler-cross: avm-transpiler-cross-amd64-macos avm-transpiler-cross-arm64-macos
#==============================================================================
# Barretenberg
#==============================================================================
# Barretenberg - Aggregate target for all barretenberg sub-projects.
barretenberg: bb-cpp bb-ts bb-acir bb-docs bb-sol bb-bbup bb-crs
# BB C++ - Main aggregate target.
bb-cpp: bb-cpp-native bb-cpp-wasm bb-cpp-wasm-threads
# BB CRS Download
bb-crs:
$(call build,$@,barretenberg/crs)
# BBup - BB updater tool
bb-bbup:
$(call build,$@,barretenberg/bbup)
# BB C++ Native - Split into compilation and linking phases
# Compilation phase: Build barretenberg + vm2_sim objects (can run in parallel with avm-transpiler)
bb-cpp-native-objects:
$(call build,$@,barretenberg/cpp,build_native_objects)
# Linking phase: Link all native binaries (needs avm-transpiler)
bb-cpp-native: bb-cpp-native-objects avm-transpiler-native
$(call build,$@,barretenberg/cpp,build_native)
# BB C++ WASM - Single-threaded WebAssembly build
bb-cpp-wasm:
$(call build,$@,barretenberg/cpp,build_wasm)
# BB C++ WASM Threads - Multi-threaded WebAssembly build
bb-cpp-wasm-threads:
$(call build,$@,barretenberg/cpp,build_wasm_threads)
bb-cpp-wasm-threads-benches: bb-cpp-wasm-threads
$(call build,$@,barretenberg/cpp,build_wasm_threads_benches)
# Cross-compile object phases (parallel with avm-transpiler cross-compile)
bb-cpp-cross-arm64-linux-objects:
$(call build,$@,barretenberg/cpp,build_cross_objects arm64-linux)
bb-cpp-cross-amd64-macos-objects:
$(call build,$@,barretenberg/cpp,build_cross_objects amd64-macos)
bb-cpp-cross-arm64-macos-objects:
$(call build,$@,barretenberg/cpp,build_cross_objects arm64-macos)
# Cross-compile for ARM64 Linux (release only)
bb-cpp-cross-arm64-linux: bb-cpp-cross-arm64-linux-objects avm-transpiler-native
$(call build,$@,barretenberg/cpp,build_cross arm64-linux)
# Cross-compile for AMD64 macOS (release only)
bb-cpp-cross-amd64-macos: bb-cpp-cross-amd64-macos-objects avm-transpiler-cross-amd64-macos
$(call build,$@,barretenberg/cpp,build_cross amd64-macos)
# Cross-compile for ARM64 macOS (release or CI_FULL)
bb-cpp-cross-arm64-macos: bb-cpp-cross-arm64-macos-objects avm-transpiler-cross-arm64-macos
$(call build,$@,barretenberg/cpp,build_cross arm64-macos)
bb-cpp-cross: bb-cpp-cross-arm64-linux bb-cpp-cross-amd64-macos bb-cpp-cross-arm64-macos
# GCC syntax check (CI only, non-release)
bb-cpp-gcc:
$(call build,$@,barretenberg/cpp,build_gcc_syntax_check_only)
# Fuzzing preset check (CI only, non-release)
bb-cpp-fuzzing:
$(call build,$@,barretenberg/cpp,build_fuzzing_syntax_check_only)
# Address sanitizer build (CI only, non-release)
bb-cpp-asan:
$(call build,$@,barretenberg/cpp,build_asan_fast)
# SMT verification (CI_FULL only)
bb-cpp-smt:
$(call build,$@,barretenberg/cpp,build_smt_verification)
bb-cpp-release-dir: bb-cpp-native bb-cpp-cross
$(call build,$@,barretenberg/cpp,build_release_dir)
bb-cpp-full: bb-cpp-gcc bb-cpp-fuzzing bb-cpp-asan bb-cpp-smt bb-cpp-cross-arm64-macos bb-cpp-wasm-threads-benches
# BB TypeScript - TypeScript bindings
bb-ts: bb-cpp-wasm bb-cpp-wasm-threads bb-cpp-native
$(call build,$@,barretenberg/ts)
# Copies the cross-compiles into bb.js.
bb-ts-cross-copy: bb-ts bb-cpp-cross
$(call build,$@,barretenberg/ts,cross_copy)
# BB ACIR Tests - ACIR compatibility tests
bb-acir: noir bb-cpp-native bb-ts
$(call build,$@,barretenberg/acir_tests)
# BB Documentation
bb-docs:
$(call build,$@,barretenberg/docs)
# BB Solidity - Solidity verifier contracts
bb-sol: bb-cpp-native
$(call build,$@,barretenberg/sol)
#==============================================================================
# Barretenberg Tests
#==============================================================================
bb-cpp-tests-native: bb-cpp-native
$(call test,$@,barretenberg/cpp,native)
bb-cpp-tests-wasm-threads: bb-cpp-wasm-threads
$(call test,$@,barretenberg/cpp,wasm_threads)
bb-cpp-tests-asan: bb-cpp-asan
$(call test,$@,barretenberg/cpp,asan)
bb-cpp-tests-smt: bb-cpp-smt
$(call test,$@,barretenberg/cpp,smt)
bb-acir-tests: bb-acir
$(call test,$@,barretenberg/acir_tests)
bb-ts-tests: bb-ts
$(call test,$@,barretenberg/ts)
bb-sol-tests: bb-sol
$(call test,$@,barretenberg/sol)
bb-docs-tests: bb-docs
$(call test,$@,barretenberg/docs)
bb-bbup-tests: bb-bbup
$(call test,$@,barretenberg/bbup)
bb-tests: bb-cpp-tests-native bb-acir-tests bb-ts-tests bb-sol-tests bb-bbup-tests bb-docs-tests
bb-full-tests: bb-cpp-tests-native bb-cpp-tests-wasm-threads bb-cpp-tests-asan bb-cpp-tests-smt bb-acir-tests bb-ts-tests bb-sol-tests bb-bbup-tests bb-docs-tests
#==============================================================================
# Noir Projects
#==============================================================================
noir-protocol-circuits: noir bb-cpp-native
$(call build,$@,noir-projects/noir-protocol-circuits)
noir-protocol-circuits-tests: noir noir-protocol-circuits
$(call test,$@,noir-projects/noir-protocol-circuits)
mock-protocol-circuits: noir bb-cpp-native
$(call build,$@,noir-projects/mock-protocol-circuits)
noir-contracts: noir bb-cpp-native
$(call build,$@,noir-projects/noir-contracts)
aztec-nr: noir bb-cpp-native
$(call build,$@,noir-projects/aztec-nr)
# These tests are not included in the dep tree.
# Rather this target must be explicitly called by bootstrap.sh after it's started the txe's.
noir-projects-txe-tests:
$(call test,$@,noir-projects/aztec-nr)
$(call test,$@,noir-projects/noir-contracts)
$(call test,$@,noir-projects/noir-contracts-comp-failures)
# Noir Projects - Aggregate target (builds all sub-projects)
noir-projects: noir-protocol-circuits mock-protocol-circuits noir-contracts aztec-nr
#==============================================================================
# L1 Contracts - Ethereum L1 smart contracts
#==============================================================================
# l1-contracts-src: Build all src/ contracts (fully independent!)
l1-contracts-src:
$(call build,$@,l1-contracts,build_src)
# l1-contracts-verifier: Build generated verifier and tests (depends on noir-protocol-circuits)
l1-contracts-verifier: noir-protocol-circuits l1-contracts-src
$(call build,$@,l1-contracts,build_verifier)
# l1-contracts: Complete build (aggregate target)
l1-contracts: l1-contracts-src l1-contracts-verifier
l1-contracts-tests: l1-contracts-verifier
$(call test,$@,l1-contracts)
#==============================================================================
# Yarn Project - TypeScript monorepo with all TS packages
#==============================================================================
yarn-project: bb-ts noir-projects l1-contracts
$(call build,$@,yarn-project)
yarn-project-tests: yarn-project
$(call test,$@,yarn-project/end-to-end)
$(call test,$@,yarn-project)
yarn-project-benches: yarn-project
$(call build,$@,yarn-project/end-to-end,build_bench)
#==============================================================================
# The Rest
#==============================================================================
# Release Image - Docker image for releases
release-image: yarn-project
$(call build,$@,release-image)
release-image-tests: release-image
$(call test,$@,release-image)
boxes: yarn-project
$(call build,$@,boxes)
boxes-tests: boxes
$(call test,$@,boxes)
playground: yarn-project
$(call build,$@,playground)
playground-tests: playground
$(call test,$@,playground)
docs: yarn-project
$(call build,$@,docs)
docs-tests: docs
$(call test,$@,docs)
aztec-up: yarn-project
$(call build,$@,aztec-up)
aztec-up-tests: aztec-up
$(call test,$@,aztec-up)