Makefile 2.5 KB

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