Makefile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. .POSIX:
  2. PREFIX = /usr/local
  3. CONFDIR = $(HOME)/.config/darkfi
  4. DLURL = http://185.165.171.77
  5. CARGO = cargo
  6. DLTOOL = wget -q -O-
  7. #DLTOOL = curl
  8. # Here it's possible to append "cashierd" and "gatewayd".
  9. BINS = \
  10. drk \
  11. darkfid
  12. all: $(BINS) uid confdir mint.params spend.params
  13. $(BINS):
  14. $(CARGO) build --release --all-features --bin $@
  15. cp target/release/$@ $@
  16. uid:
  17. id -u > $@
  18. confdir:
  19. @echo "$(CONFDIR)" > $@
  20. %.params:
  21. $(DLTOOL) $(DLURL)/$@ > $@
  22. test:
  23. $(CARGO) test --release --all-features
  24. fix:
  25. $(CARGO) fix --release --all-features --allow-dirty
  26. clippy:
  27. $(CARGO) clippy --release --all-features
  28. install:
  29. @if ! [ -f uid ]; then \
  30. echo "Please run 'make' as user first." ; \
  31. exit 1 ; \
  32. fi;
  33. mkdir -p $(DESTDIR)$(PREFIX)/bin
  34. cp -f $(BINS) $(DESTDIR)$(PREFIX)/bin
  35. mkdir -p "$(shell cat confdir)"
  36. for i in $(BINS); \
  37. do \
  38. cp example/config/$$i.toml "$(shell cat confdir)" ; \
  39. done;
  40. cp mint.params spend.params "$(shell cat confdir)"
  41. chown -R "$(shell cat uid):$(shell cat uid)" "$(shell cat confdir)"
  42. uninstall:
  43. for i in $(BINS); \
  44. do \
  45. rm -f $(DESTDIR)$(PREFIX)/bin/$$i; \
  46. done;
  47. clean:
  48. rm -f $(BINS) mint.params spend.params uid confdir
  49. distclean: clean
  50. rm -rf target
  51. .PHONY: all test fix clippy install uninstall clean distclean