-
Notifications
You must be signed in to change notification settings - Fork 596
Expand file tree
/
Copy pathMakefile
More file actions
369 lines (269 loc) · 12.9 KB
/
Makefile
File metadata and controls
369 lines (269 loc) · 12.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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# 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 fast
# - 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.
# MAKEFILE_TARGET is exported so filter_test_cmds can inject it into the hash prefix for targeted rebuilds.
define test
$(call run_command,$(1),$(ROOT)/$(2),\
export MAKEFILE_TARGET=$(1) && ./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: noir barretenberg noir-projects l1-contracts release-image boxes playground docs aztec-up spartan
#==============================================================================
# BOOTSTRAP TARGETS
#==============================================================================
# Fast bootstrap.
fast: 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 spartan
# Full bootstrap.
full: fast bb-full-tests bb-cpp-full yarn-project-benches
# Release. Everything plus copy bb cross compiles to ts projects.
release: fast 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-arm64-linux:
$(call build,$@,avm-transpiler,build_cross arm64-linux)
avm-transpiler-cross-amd64-windows:
$(call build,$@,avm-transpiler,build_cross amd64-windows)
avm-transpiler-cross: avm-transpiler-cross-amd64-macos avm-transpiler-cross-arm64-macos avm-transpiler-cross-arm64-linux avm-transpiler-cross-amd64-windows
#==============================================================================
# Barretenberg
#==============================================================================
# Barretenberg - Aggregate target for all barretenberg sub-projects.
barretenberg: bb-cpp bb-ts bb-rs 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)
# Yarn install for nodejs_module (needed by presets that build nodejs_module)
bb-cpp-yarn:
$(call run_command,$@,$(ROOT)/barretenberg/cpp,$(ROOT)/ci3/denoise 'cd src/barretenberg/nodejs_module && yarn --immutable')
# Format check (skipped if cache hit)
bb-cpp-format-check:
$(call build,$@,barretenberg/cpp,build_format_check)
# 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: bb-cpp-yarn
$(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 bb-cpp-yarn bb-cpp-format-check
$(call build,$@,barretenberg/cpp,build_native)
# BB C++ WASM - Single-threaded WebAssembly build
bb-cpp-wasm:
$(call build,$@,barretenberg/cpp,build_preset wasm)
# BB C++ WASM Threads - Multi-threaded WebAssembly build
bb-cpp-wasm-threads:
$(call build,$@,barretenberg/cpp,build_preset wasm-threads)
# Cross-compile object phases (parallel with avm-transpiler cross-compile)
bb-cpp-cross-arm64-linux-objects: bb-cpp-yarn
$(call build,$@,barretenberg/cpp,build_cross_objects arm64-linux)
bb-cpp-cross-amd64-macos-objects: bb-cpp-yarn
$(call build,$@,barretenberg/cpp,build_cross_objects amd64-macos)
bb-cpp-cross-arm64-macos-objects: bb-cpp-yarn
$(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-cross-arm64-linux bb-cpp-yarn
$(call build,$@,barretenberg/cpp,build_preset 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 bb-cpp-yarn
$(call build,$@,barretenberg/cpp,build_preset 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 bb-cpp-yarn
$(call build,$@,barretenberg/cpp,build_preset arm64-macos)
# Cross-compile for AMD64 Windows (release only)
bb-cpp-cross-amd64-windows: avm-transpiler-cross-amd64-windows
$(call build,$@,barretenberg/cpp,build_preset amd64-windows)
# iOS SDK download (shared by all iOS cross-compile targets)
bb-cpp-ios-sdk:
$(call run_command,$@,$(ROOT)/barretenberg/cpp,bash scripts/download-ios-sdk.sh)
# Android sysroot download (shared by all Android cross-compile targets)
bb-cpp-android-sysroot:
$(call run_command,$@,$(ROOT)/barretenberg/cpp,bash scripts/download-android-sysroot.sh)
# Cross-compile for ARM64 iOS (release only, static lib only)
bb-cpp-cross-arm64-ios: bb-cpp-ios-sdk
$(call build,$@,barretenberg/cpp,build_preset arm64-ios)
# Cross-compile for ARM64 iOS Simulator (release only, static lib only)
bb-cpp-cross-arm64-ios-sim: bb-cpp-ios-sdk
$(call build,$@,barretenberg/cpp,build_preset arm64-ios-sim)
# Cross-compile for ARM64 Android (release only, static lib only)
bb-cpp-cross-arm64-android: bb-cpp-android-sysroot
$(call build,$@,barretenberg/cpp,build_preset arm64-android)
# Cross-compile for x86_64 Android (release only, static lib only)
bb-cpp-cross-x86_64-android: bb-cpp-android-sysroot
$(call build,$@,barretenberg/cpp,build_preset x86_64-android)
bb-cpp-cross: bb-cpp-cross-arm64-linux bb-cpp-cross-amd64-macos bb-cpp-cross-arm64-macos bb-cpp-cross-amd64-windows bb-cpp-cross-arm64-ios bb-cpp-cross-arm64-ios-sim bb-cpp-cross-arm64-android bb-cpp-cross-x86_64-android
# 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_preset 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 bb-cpp-gcc bb-cpp-fuzzing bb-cpp-asan bb-cpp-smt bb-cpp-cross-arm64-macos bb-cpp-cross-arm64-ios bb-cpp-cross-arm64-android
# 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 Rust - barretenberg-rs FFI crate
bb-rs: bb-ts bb-cpp-native
$(call build,$@,barretenberg/rust)
# 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 bb-crs
$(call build,$@,barretenberg/sol)
#==============================================================================
# Barretenberg Tests
#==============================================================================
bb-cpp-native-tests: bb-cpp-native
$(call test,$@,barretenberg/cpp,native)
bb-cpp-wasm-threads-tests: bb-cpp-wasm-threads
$(call test,$@,barretenberg/cpp,wasm_threads)
bb-cpp-asan-tests: bb-cpp-asan
$(call test,$@,barretenberg/cpp,asan)
bb-cpp-smt-tests: 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-rs-tests: bb-rs
$(call test,$@,barretenberg/rust)
bb-tests: bb-cpp-native-tests bb-acir-tests bb-ts-tests bb-sol-tests bb-bbup-tests bb-docs-tests bb-rs-tests
bb-full-tests: bb-cpp-wasm-threads-tests bb-cpp-asan-tests bb-cpp-smt-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)
spartan:
$(call build,$@,spartan)