Makefile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. .POSIX:
  2. # Cargo binary
  3. CARGO = cargo +nightly
  4. # zkas compiler binary
  5. ZKAS = ../../../zkas
  6. # zkas circuits
  7. PROOFS_SRC = $(shell find proof -type f -name '*.zk')
  8. PROOFS_BIN = $(PROOFS_SRC:=.bin)
  9. # wasm source files
  10. WASM_SRC = \
  11. $(shell find src -type f) \
  12. $(shell find ../../sdk -type f -name '*.rs') \
  13. $(shell find ../../serial -type f -name '*.rs')
  14. # wasm contract binary
  15. WASM_BIN = consensus_contract.wasm
  16. # Just compile the tests
  17. NO_RUN = "--no-run"
  18. all: $(WASM_BIN)
  19. $(WASM_BIN): $(WASM_SRC) $(PROOFS_BIN)
  20. $(CARGO) build --release --package darkfi-consensus-contract --target wasm32-unknown-unknown
  21. cp -f ../../../target/wasm32-unknown-unknown/release/darkfi_consensus_contract.wasm $@
  22. $(PROOFS_BIN): $(ZKAS) $(PROOFS_SRC)
  23. $(ZKAS) $(basename $@) -o $@
  24. test-stake-unstake: all
  25. $(CARGO) test --release --features=no-entrypoint,client \
  26. --package darkfi-consensus-contract \
  27. --test stake_unstake $(ARGS)
  28. test-genesis-stake-unstake: all
  29. $(CARGO) test --release --features=no-entrypoint,client \
  30. --package darkfi-consensus-contract \
  31. --test genesis_stake_unstake $(ARGS)
  32. test: test-genesis-stake-unstake test-stake-unstake
  33. test-no-run:
  34. $(MAKE) test-genesis-stake-unstake ARGS=$(NO_RUN)
  35. $(MAKE) test-stake-unstake ARGS=$(NO_RUN)
  36. clean:
  37. rm -f $(PROOFS_BIN) $(WASM_BIN)
  38. .PHONY: all test-genesis-stake-unstake test-stake-unstake test clean