-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
115 lines (97 loc) · 3.3 KB
/
Makefile
File metadata and controls
115 lines (97 loc) · 3.3 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
.PHONY: wasm wasm-amaci wasm-maci wasm-registry wasm-api-saas wasm-test
.PHONY: schema schema-amaci schema-maci schema-registry schema-api-saas
.PHONY: test unit-test clean optimize help
# Compile all contracts to wasm
wasm:
@echo "Building all contracts..."
@cd contracts/amaci && cargo wasm
@cd contracts/maci && cargo wasm
@cd contracts/registry && cargo wasm
@cd contracts/api-saas && cargo wasm
@cd contracts/test && cargo wasm
@echo "✅ All contracts built successfully"
# Compile individual contracts
wasm-amaci:
@cd contracts/amaci && cargo wasm
wasm-maci:
@cd contracts/maci && cargo wasm
wasm-registry:
@cd contracts/registry && cargo wasm
wasm-api-saas:
@cd contracts/api-saas && cargo wasm
wasm-test:
@cd contracts/test && cargo wasm
# Generate schemas for all contracts
schema:
@echo "Generating schemas..."
@cd contracts/amaci && cargo schema
@cd contracts/maci && cargo schema
@cd contracts/registry && cargo schema
@cd contracts/api-saas && cargo schema
@echo "✅ All schemas generated"
# Generate schema for individual contracts
schema-amaci:
@cd contracts/amaci && cargo schema
schema-maci:
@cd contracts/maci && cargo schema
schema-registry:
@cd contracts/registry && cargo schema
schema-api-saas:
@cd contracts/api-saas && cargo schema
# Run all tests (contracts + crates)
test:
@cargo test
# Run unit tests for all contracts
unit-test:
@echo "Running contract unit tests..."
@cd contracts/amaci && cargo unit-test
@cd contracts/maci && cargo unit-test
@cd contracts/registry && cargo unit-test
@cd contracts/api-saas && cargo unit-test
@cd contracts/test && cargo unit-test
@echo "✅ All contract tests passed"
# Run tests for crates only
test-crates:
@echo "Running crates tests..."
@cd crates/baby-jubjub && cargo test
@cd crates/maci-utils && cargo test
@cd crates/maci-crypto && cargo test
@cd crates/eddsa-poseidon && cargo test
@cd crates/crypto-test-gen && cargo test
@echo "✅ All crate tests passed"
# Optimize wasm files (requires wasm-opt)
optimize:
@echo "Optimizing wasm files..."
@for file in target/wasm32-unknown-unknown/release/*.wasm; do \
if [ -f "$$file" ]; then \
echo "Optimizing $$file..."; \
wasm-opt -Os "$$file" -o "$${file%.wasm}_optimized.wasm"; \
fi \
done
@echo "✅ Optimization complete"
# Clean build artifacts
clean:
@cargo clean
@echo "✅ Clean complete"
# Show help
help:
@echo "MACI Workspace Commands:"
@echo ""
@echo " make wasm - Build all contracts to wasm"
@echo " make wasm-amaci - Build amaci contract"
@echo " make wasm-maci - Build maci contract"
@echo " make wasm-registry - Build registry contract"
@echo " make wasm-api-saas - Build api-saas contract"
@echo " make wasm-test - Build test contract"
@echo ""
@echo " make schema - Generate schemas for all contracts"
@echo " make schema-amaci - Generate schema for amaci"
@echo " make schema-maci - Generate schema for maci"
@echo ""
@echo " make test - Run all tests (contracts + crates)"
@echo " make unit-test - Run unit tests for all contracts"
@echo " make test-crates - Run tests for all crates"
@echo ""
@echo " make optimize - Optimize wasm files (requires wasm-opt)"
@echo " make clean - Clean build artifacts"
@echo " make help - Show this help message"