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 cashierd gatewayd
  8. # Dependencies which should force the binaries to be rebuilt
  9. BINDEPS = \
  10. Cargo.toml \
  11. $(shell find src -type f) \
  12. $(shell find token -type f) \
  13. $(shell find sql -type f)
  14. #all: $(BINS)
  15. all:
  16. cargo build --release --all-features --lib
  17. $(BINS): $(BINDEPS)
  18. $(CARGO) build --release --all-features --bin $@
  19. cp target/release/$@ $@
  20. test:
  21. $(CARGO) test --release --all-features --lib
  22. fix:
  23. $(CARGO) fix --release --all-features --allow-dirty
  24. clippy:
  25. $(CARGO) clippy --release --all-features --lib
  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