Makefile 2.5 KB

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