Makefile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. # zkas source files which we want to compile for tests
  31. VM_SRC = proof/arithmetic.zk proof/mint.zk proof/burn.zk example/simple.zk
  32. VM_BIN = $(VM_SRC:=.bin)
  33. $(VM_BIN): zkas $(VM_SRC)
  34. ./zkas $(basename $@) -o $@
  35. test: token_lists $(VM_BIN) test-tx
  36. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --release --all-features --all
  37. test-tx:
  38. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) run --release --features=node,zkas --example tx
  39. clean:
  40. rm -f $(BINS)
  41. install: all
  42. mkdir -p $(DESTDIR)$(PREFIX)/bin
  43. cp -f $(BINS) $(DESTDIR)$(PREFIX)/bin
  44. uninstall:
  45. for i in $(BINS); \
  46. do \
  47. rm -f $(DESTDIR)$(PREFIX)/bin/$$i; \
  48. done;
  49. .PHONY: all check fix clippy test test-tx clean install uninstall