Makefile 2.4 KB

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