mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-08 22:28:12 -05:00
Intended to address tau RefID "Gifn1u". There are still a few things that require nightly. - cargo +nightly fmt - fuzzing
94 lines
2.7 KiB
Makefile
94 lines
2.7 KiB
Makefile
.POSIX:
|
|
|
|
# Cargo binary
|
|
CARGO = cargo
|
|
|
|
# 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
|
|
|
|
# wasm build target
|
|
WASM_TARGET = wasm32-unknown-unknown
|
|
|
|
# Cargo package name
|
|
PKGNAME = $(shell grep '^name = ' Cargo.toml | cut -d' ' -f3 | tr -d '"')
|
|
# wasm contract binary
|
|
WASM_BIN = $(PKGNAME:=.wasm)
|
|
|
|
# zkas compiler binary
|
|
ZKAS = ../../../zkas
|
|
|
|
# zkas circuits
|
|
PROOFS_SRC = $(shell find proof -type f -name '*.zk')
|
|
PROOFS_BIN = $(PROOFS_SRC:=.bin)
|
|
|
|
# wasm source files
|
|
WASM_SRC = \
|
|
Cargo.toml \
|
|
../../../Cargo.toml \
|
|
../../../src/sdk/Cargo.toml \
|
|
../../../src/serial/Cargo.toml \
|
|
$(shell find src -type f -name '*.rs') \
|
|
$(shell find ../../sdk -type f -name '*.rs') \
|
|
$(shell find ../../serial -type f -name '*.rs')
|
|
|
|
all: $(WASM_BIN)
|
|
|
|
$(PROOFS_BIN): $(ZKAS) $(PROOFS_SRC)
|
|
$(ZKAS) $(basename $@) -o $@
|
|
|
|
$(WASM_BIN): $(WASM_SRC) $(PROOFS_BIN)
|
|
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(WASM_TARGET) \
|
|
--release --package $(PKGNAME)
|
|
cp -f ../../../target/$(WASM_TARGET)/release/$@ $@
|
|
wasm-strip $@
|
|
|
|
test-integration: all
|
|
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \
|
|
--release --package $(PKGNAME) \
|
|
--features=no-entrypoint,client \
|
|
--test integration
|
|
|
|
test-mint-pay-swap: all
|
|
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \
|
|
--release --package $(PKGNAME) \
|
|
--features=no-entrypoint,client \
|
|
--test mint_pay_swap
|
|
|
|
test-genesis-mint: all
|
|
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \
|
|
--release --package $(PKGNAME) \
|
|
--features=no-entrypoint,client \
|
|
--test genesis_mint
|
|
|
|
test-token-mint: all
|
|
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \
|
|
--release --package $(PKGNAME) \
|
|
--features=no-entrypoint,client \
|
|
--test token_mint
|
|
|
|
test-delayed-tx: all
|
|
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \
|
|
--release --package $(PKGNAME) \
|
|
--features=no-entrypoint,client \
|
|
--test delayed_tx
|
|
|
|
test: test-integration test-mint-pay-swap test-genesis-mint test-token-mint test-delayed-tx
|
|
|
|
clippy: all
|
|
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --target=$(WASM_TARGET) \
|
|
--release --package $(PKGNAME)
|
|
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --target=$(RUST_TARGET) \
|
|
--release --package $(PKGNAME) \
|
|
--features=no-entrypoint,client --tests
|
|
|
|
clean:
|
|
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(WASM_TARGET) \
|
|
--release --package $(PKGNAME)
|
|
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) \
|
|
--release --package $(PKGNAME)
|
|
rm -f $(PROOFS_BIN) $(WASM_BIN)
|
|
|
|
.PHONY: all test-integration test-mint-pay-swap test-genesis-mint test-delayed-tx test clippy clean
|