-
Notifications
You must be signed in to change notification settings - Fork 122
/
Makefile
182 lines (150 loc) · 4.35 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
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
.POSIX:
# Install prefix
PREFIX = $(HOME)/.cargo
# Cargo binary
CARGO = cargo +nightly
# Compile target for system binaries
RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
# Uncomment when doing musl static builds
#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
# List of zkas circuits to compile, used for tests
PROOFS_SRC = $(shell find proof -type f -name '*.zk')
PROOFS_BIN = $(PROOFS_SRC:=.bin)
# List of all binaries built
BINS = \
zkas \
darkfid \
darkfi-mmproxy \
minerd \
drk \
darkirc \
genev \
genevd \
lilith \
taud \
vanityaddr
all: $(BINS)
zkas:
$(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
$(PROOFS_BIN): zkas $(PROOFS_SRC)
./zkas $(basename $@) -o $@
contracts: zkas
$(MAKE) -C src/contract/money
$(MAKE) -C src/contract/dao
$(MAKE) -C src/contract/deployooor
darkfid: contracts
$(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
minerd: contracts
$(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
darkfi-mmproxy:
$(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
drk: contracts
$(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
darkirc: zkas
$(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
genev:
$(MAKE) -C bin/genev/genev-cli \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
genevd:
$(MAKE) -C bin/genev/genevd \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
lilith:
$(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
taud:
$(MAKE) -C bin/tau/$@ \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
vanityaddr:
$(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
# -- END OF BINS --
fmt:
$(CARGO) fmt --all
# cargo install cargo-hack
check: contracts $(PROOFS_BIN)
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) hack check --target=$(RUST_TARGET) \
--release --feature-powerset --workspace
clippy: contracts $(PROOFS_BIN)
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --target=$(RUST_TARGET) \
--release --all-features --workspace --tests
fix: contracts $(PROOFS_BIN)
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --target=$(RUST_TARGET) \
--release --all-features --workspace --tests --fix --allow-dirty
rustdoc: contracts $(PROOFS_BIN)
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) doc --target=$(RUST_TARGET) \
--release --all-features --workspace --document-private-items --no-deps
test: contracts $(PROOFS_BIN)
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \
--release --all-features --workspace
bench-zk-from-json: contracts $(PROOFS_BIN)
rm -f src/contract/test-harness/*.bin
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) bench --target=$(RUST_TARGET) \
--bench zk_from_json --all-features --workspace \
-- --save-baseline master
bench: contracts $(PROOFS_BIN)
rm -f src/contract/test-harness/*.bin
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) bench --target=$(RUST_TARGET) \
--all-features --workspace \
-- --save-baseline master
coverage: contracts $(PROOFS_BIN)
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) llvm-cov --target=$(RUST_TARGET) \
--release --all-features --workspace --html
clean:
$(MAKE) -C src/contract/money clean
$(MAKE) -C src/contract/dao clean
$(MAKE) -C src/contract/deployooor clean
$(MAKE) -C bin/zkas clean
$(MAKE) -C bin/darkfid clean
$(MAKE) -C bin/darkfi-mmproxy clean
$(MAKE) -C bin/minerd clean
$(MAKE) -C bin/drk clean
$(MAKE) -C bin/darkirc clean
$(MAKE) -C bin/genev/genev-cli clean
$(MAKE) -C bin/genev/genevd clean
$(MAKE) -C bin/lilith clean
$(MAKE) -C bin/tau/taud clean
$(MAKE) -C bin/vanityaddr clean
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release
rm -f $(PROOFS_BIN)
distclean: clean
rm -rf target
.PHONY: all $(BINS) fmt check clippy fix rustdoc test bench-zk-from-json bench coverage clean distclean