Makefile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. $(BINS): $(BINDEPS)
  16. $(CARGO) build --release --all-features --bin $@
  17. cp target/release/$@ $@
  18. test:
  19. $(CARGO) test --release --all-features
  20. fix:
  21. $(CARGO) fix --release --all-features --allow-dirty
  22. clippy:
  23. $(CARGO) clippy --release --all-features
  24. install: all
  25. mkdir -p $(DESTDIR)$(PREFIX)/bin
  26. mkdir -p $(DESTDIR)$(PREFIX)/share/darkfi
  27. mkdir -p $(DESTDIR)$(PREFIX)/share/doc/darkfi
  28. cp -f $(BINS) $(DESTDIR)$(PREFIX)/bin
  29. for i in $(BINS); \
  30. do \
  31. cp -f example/config/$$i.toml $(DESTDIR)$(PREFIX)/share/doc/darkfi; \
  32. done;
  33. uninstall:
  34. for i in $(BINS); \
  35. do \
  36. rm -f $(DESTDIR)$(PREFIX)/bin/$$i; \
  37. done;
  38. rm -rf $(DESTDIR)$(PREFIX)/share/doc/darkfi
  39. rm -rf $(DESTDIR)$(PREFIX)/share/darkfi
  40. clean:
  41. rm -f $(BINS)
  42. distclean: clean
  43. rm -rf target
  44. .PHONY: all test fix clippy install uninstall clean distclean