Makefile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. .POSIX:
  2. # Install prefix
  3. PREFIX = /usr/local
  4. # Cargo binary
  5. CARGO = cargo
  6. # Here it's possible to append "cashierd" and "gatewayd".
  7. BINS = drk darkfid
  8. # Dependencies which should force the binaries to be rebuilt
  9. BINDEPS = \
  10. Cargo.toml \
  11. $(shell find src -type f) \
  12. $(shell find sql -type f) \
  13. $(shell find contrib/token -type f) \
  14. all: $(BINS)
  15. $(BINS): $(BINDEPS)
  16. $(CARGO) build --release --all-features --bin $@
  17. cp -f target/release/$@ $@
  18. test:
  19. $(CARGO) test --release --all-features
  20. $(CARGO) build --release --all-features --bin tx
  21. ./target/release/tx
  22. fix:
  23. $(CARGO) clippy --release --all-features --fix --allow-dirty
  24. clippy:
  25. $(CARGO) clippy --release --all-features
  26. install: all
  27. mkdir -p $(DESTDIR)$(PREFIX)/bin
  28. mkdir -p $(DESTDIR)$(PREFIX)/share/darkfi
  29. mkdir -p $(DESTDIR)$(PREFIX)/share/doc/darkfi
  30. cp -f $(BINS) $(DESTDIR)$(PREFIX)/bin
  31. for i in $(BINS); \
  32. do \
  33. cp -f example/config/$$i.toml $(DESTDIR)$(PREFIX)/share/doc/darkfi; \
  34. done;
  35. uninstall:
  36. for i in $(BINS); \
  37. do \
  38. rm -f $(DESTDIR)$(PREFIX)/bin/$$i; \
  39. done;
  40. rm -rf $(DESTDIR)$(PREFIX)/share/doc/darkfi
  41. rm -rf $(DESTDIR)$(PREFIX)/share/darkfi
  42. clean:
  43. rm -f $(BINS)
  44. distclean: clean
  45. rm -rf target
  46. .PHONY: all test fix clippy install uninstall clean distclean