Makefile 2.3 KB

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