/ Makefile
Makefile
1 .POSIX: 2 3 # Install prefix 4 PREFIX = $(HOME)/.cargo 5 6 # Cargo binary 7 CARGO = cargo 8 9 # Compile target for system binaries 10 RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2) 11 # Uncomment when doing musl static builds 12 #RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes 13 14 # List of zkas circuits to compile, used for tests 15 PROOFS_SRC = \ 16 $(shell find proof -type f -name '*.zk') \ 17 $(shell find bin/darkirc/proof -type f -name '*.zk') 18 19 PROOFS_BIN = $(PROOFS_SRC:=.bin) 20 21 # List of all binaries built 22 BINS = \ 23 zkas \ 24 darkfid \ 25 minerd \ 26 drk \ 27 darkirc \ 28 genev \ 29 genevd \ 30 lilith \ 31 taud \ 32 vanityaddr \ 33 explorerd \ 34 fud \ 35 fu 36 37 all: $(BINS) 38 39 zkas: 40 $(MAKE) -C bin/$@ \ 41 PREFIX="$(PREFIX)" \ 42 CARGO="$(CARGO)" \ 43 RUST_TARGET="$(RUST_TARGET)" \ 44 RUSTFLAGS="$(RUSTFLAGS)" 45 46 $(PROOFS_BIN): zkas $(PROOFS_SRC) 47 ./zkas $(basename $@) -o $@ 48 49 contracts: zkas 50 $(MAKE) -C src/contract/money 51 $(MAKE) -C src/contract/dao 52 $(MAKE) -C src/contract/deployooor 53 54 darkfid: contracts 55 $(MAKE) -C bin/$@ \ 56 PREFIX="$(PREFIX)" \ 57 CARGO="$(CARGO)" \ 58 RUST_TARGET="$(RUST_TARGET)" \ 59 RUSTFLAGS="$(RUSTFLAGS)" 60 61 minerd: contracts 62 $(MAKE) -C bin/$@ \ 63 PREFIX="$(PREFIX)" \ 64 CARGO="$(CARGO)" \ 65 RUST_TARGET="$(RUST_TARGET)" \ 66 RUSTFLAGS="$(RUSTFLAGS)" 67 68 drk: contracts 69 $(MAKE) -C bin/$@ \ 70 PREFIX="$(PREFIX)" \ 71 CARGO="$(CARGO)" \ 72 RUST_TARGET="$(RUST_TARGET)" \ 73 RUSTFLAGS="$(RUSTFLAGS)" 74 75 darkirc: zkas 76 $(MAKE) -C bin/$@ \ 77 PREFIX="$(PREFIX)" \ 78 CARGO="$(CARGO)" \ 79 RUST_TARGET="$(RUST_TARGET)" \ 80 RUSTFLAGS="$(RUSTFLAGS)" 81 82 genev: 83 $(MAKE) -C bin/genev/genev-cli \ 84 PREFIX="$(PREFIX)" \ 85 CARGO="$(CARGO)" \ 86 RUST_TARGET="$(RUST_TARGET)" \ 87 RUSTFLAGS="$(RUSTFLAGS)" 88 89 genevd: 90 $(MAKE) -C bin/genev/genevd \ 91 PREFIX="$(PREFIX)" \ 92 CARGO="$(CARGO)" \ 93 RUST_TARGET="$(RUST_TARGET)" \ 94 RUSTFLAGS="$(RUSTFLAGS)" 95 96 lilith: 97 $(MAKE) -C bin/$@ \ 98 PREFIX="$(PREFIX)" \ 99 CARGO="$(CARGO)" \ 100 RUST_TARGET="$(RUST_TARGET)" \ 101 RUSTFLAGS="$(RUSTFLAGS)" 102 103 taud: 104 $(MAKE) -C bin/tau/$@ \ 105 PREFIX="$(PREFIX)" \ 106 CARGO="$(CARGO)" \ 107 RUST_TARGET="$(RUST_TARGET)" \ 108 RUSTFLAGS="$(RUSTFLAGS)" 109 110 vanityaddr: 111 $(MAKE) -C bin/$@ \ 112 PREFIX="$(PREFIX)" \ 113 CARGO="$(CARGO)" \ 114 RUST_TARGET="$(RUST_TARGET)" \ 115 RUSTFLAGS="$(RUSTFLAGS)" 116 117 explorerd: 118 $(MAKE) -C bin/explorer/$@ \ 119 PREFIX="$(PREFIX)" \ 120 CARGO="$(CARGO)" \ 121 RUST_TARGET="$(RUST_TARGET)" \ 122 RUSTFLAGS="$(RUSTFLAGS)" 123 124 explorerd_bundle_contracts_src: contracts 125 $(MAKE) -C bin/explorer/explorerd bundle_contracts_src 126 127 fud: 128 $(MAKE) -C bin/fud/$@ \ 129 PREFIX="$(PREFIX)" \ 130 CARGO="$(CARGO)" \ 131 RUST_TARGET="$(RUST_TARGET)" \ 132 RUSTFLAGS="$(RUSTFLAGS)" 133 134 fu: 135 $(MAKE) -C bin/fud/$@ \ 136 PREFIX="$(PREFIX)" \ 137 CARGO="$(CARGO)" \ 138 RUST_TARGET="$(RUST_TARGET)" \ 139 RUSTFLAGS="$(RUSTFLAGS)" 140 141 # -- END OF BINS -- 142 143 fmt: 144 $(CARGO) +nightly fmt --all 145 146 # cargo install cargo-hack 147 check: explorerd_bundle_contracts_src $(PROOFS_BIN) 148 RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) hack check --target=$(RUST_TARGET) \ 149 --release --feature-powerset --workspace 150 151 clippy: explorerd_bundle_contracts_src $(PROOFS_BIN) 152 RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --target=$(RUST_TARGET) \ 153 --release --all-features --workspace --tests 154 155 fix: explorerd_bundle_contracts_src $(PROOFS_BIN) 156 RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --target=$(RUST_TARGET) \ 157 --release --all-features --workspace --tests --fix --allow-dirty 158 159 rustdoc: explorerd_bundle_contracts_src $(PROOFS_BIN) 160 RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) doc --target=$(RUST_TARGET) \ 161 --release --all-features --workspace --document-private-items --no-deps 162 163 test: explorerd_bundle_contracts_src $(PROOFS_BIN) 164 RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \ 165 --release --all-features --workspace 166 167 bench-zk-from-json: explorerd_bundle_contracts_src $(PROOFS_BIN) 168 rm -f src/contract/test-harness/*.bin 169 RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) bench --target=$(RUST_TARGET) \ 170 --bench zk_from_json --all-features --workspace \ 171 -- --save-baseline master 172 173 bench: explorerd_bundle_contracts_src $(PROOFS_BIN) 174 rm -f src/contract/test-harness/*.bin 175 RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) bench --target=$(RUST_TARGET) \ 176 --all-features --workspace \ 177 -- --save-baseline master 178 179 coverage: explorerd_bundle_contracts_src $(PROOFS_BIN) 180 RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) llvm-cov --target=$(RUST_TARGET) \ 181 --release --all-features --workspace --html 182 183 clean: 184 $(MAKE) -C src/contract/money clean 185 $(MAKE) -C src/contract/dao clean 186 $(MAKE) -C src/contract/deployooor clean 187 $(MAKE) -C bin/zkas clean 188 $(MAKE) -C bin/darkfid clean 189 $(MAKE) -C bin/minerd clean 190 $(MAKE) -C bin/drk clean 191 $(MAKE) -C bin/darkirc clean 192 $(MAKE) -C bin/genev/genev-cli clean 193 $(MAKE) -C bin/genev/genevd clean 194 $(MAKE) -C bin/lilith clean 195 $(MAKE) -C bin/tau/taud clean 196 $(MAKE) -C bin/vanityaddr clean 197 $(MAKE) -C bin/explorer/explorerd clean 198 RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release 199 rm -f $(PROOFS_BIN) 200 201 distclean: clean 202 rm -rf target 203 204 .PHONY: all $(BINS) explorerd_bundle_contracts_src fmt check clippy fix rustdoc \ 205 test bench-zk-from-json bench coverage clean distclean