Makefile 1.3 KB

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