Makefile 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 = drk darkfid tau taud ircd dnetview darkotc
  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. # ZK proofs to compile with zkas
  19. PROOFS = \
  20. $(shell find bin/daod/proof -type f -name '*.zk') \
  21. $(shell find proof -type f -name '*.zk')
  22. PROOFS_BIN = $(PROOFS:=.bin)
  23. all: zkas $(PROOFS_BIN) $(BINS)
  24. zkas:
  25. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --all-features --release --package $@
  26. cp -f target/release/$@ $@
  27. $(PROOFS_BIN): $(PROOFS)
  28. ./zkas $(basename $@) -o $@
  29. token_lists:
  30. $(MAKE) -C contrib/token all
  31. $(BINS): token_lists $(BINDEPS)
  32. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --all-features --release --package $@
  33. cp -f target/release/$@ $@
  34. check: token_lists zkas $(PROOFS_BIN)
  35. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) hack check --release --feature-powerset --all
  36. fix: token_lists zkas $(PROOFS_BIN)
  37. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --release --all-features --fix --allow-dirty --all
  38. clippy: token_lists zkas $(PROOFS_BIN)
  39. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --release --all-features --all
  40. rustdoc: token_lists
  41. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) doc --release --workspace --all-features \
  42. --no-deps --document-private-items
  43. test: token_lists zkas $(PROOFS_BIN) test-tx
  44. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --release --all-features --all
  45. test-tx:
  46. RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) run --release --features=node,zkas --example tx
  47. clean:
  48. rm -f $(BINS)
  49. install:
  50. @for i in $(BINS); \
  51. do \
  52. if test ! -f $$i; \
  53. then \
  54. echo "The '$$i' binary was not built."; \
  55. echo "You should run 'make BINS=$$i' as a normal user before installing."; \
  56. exit 1; \
  57. fi; \
  58. done;
  59. mkdir -p $(DESTDIR)$(PREFIX)/bin
  60. cp -f $(BINS) $(DESTDIR)$(PREFIX)/bin
  61. uninstall:
  62. for i in $(BINS); \
  63. do \
  64. rm -f $(DESTDIR)$(PREFIX)/bin/$$i; \
  65. done;
  66. .PHONY: all check fix clippy rustdoc test test-tx clean install uninstall