Makefile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. .POSIX:
  2. # Install prefix
  3. PREFIX = /usr/local
  4. # Cargo binary
  5. CARGO = cargo
  6. # Flags passed to cargo/rustc
  7. #RUSTFLAGS = -C target-cpu=native
  8. # Binaries to be built
  9. BINS = zkas drk darkfid
  10. # Common dependencies which should force the binaries to be rebuilt
  11. BINDEPS = \
  12. Cargo.toml \
  13. $(shell find bin/*/src -type f) \
  14. $(shell find bin -type f -name '*.toml') \
  15. $(shell find src -type f) \
  16. $(shell find script/sql -type f) \
  17. $(shell find contrib/token -type f)
  18. all: $(BINS)
  19. token_lists:
  20. $(MAKE) -C contrib/token all
  21. $(BINS): token_lists $(BINDEPS)
  22. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --all-features --release --package $@
  23. cp -f target/release/$@ $@
  24. check: token_lists
  25. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) hack check --release --feature-powerset --all
  26. fix: token_lists
  27. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --release --all-features --fix --allow-dirty --all
  28. clippy: token_lists
  29. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --release --all-features --all
  30. rustdoc: token_lists
  31. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) doc --release --workspace --all-features \
  32. --no-deps --document-private-items
  33. # zkas source files which we want to compile for tests
  34. VM_SRC = proof/arithmetic.zk proof/mint.zk proof/burn.zk example/simple.zk
  35. VM_BIN = $(VM_SRC:=.bin)
  36. $(VM_BIN): zkas $(VM_SRC)
  37. ./zkas $(basename $@) -o $@
  38. test: token_lists $(VM_BIN) test-tx
  39. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --release --all-features --all
  40. test-tx:
  41. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) run --release --features=node,zkas --example tx
  42. clean:
  43. rm -f $(BINS)
  44. install: all
  45. mkdir -p $(DESTDIR)$(PREFIX)/bin
  46. cp -f $(BINS) $(DESTDIR)$(PREFIX)/bin
  47. uninstall:
  48. for i in $(BINS); \
  49. do \
  50. rm -f $(DESTDIR)$(PREFIX)/bin/$$i; \
  51. done;
  52. .PHONY: all check fix clippy rustdoc test test-tx clean install uninstall