Makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. # Dependencies which should force the binaries to be rebuilt
  11. BINDEPS = \
  12. $(shell find src -type f) \
  13. $(shell find token -type f) \
  14. $(shell find sql -type f)
  15. all: $(BINS) uid confdir mint.params spend.params
  16. $(BINS): $(BINDEPS)
  17. $(CARGO) build --release --all-features --bin $@
  18. cp target/release/$@ $@
  19. uid:
  20. id -u > $@
  21. confdir:
  22. @echo "$(CONFDIR)" > $@
  23. %.params:
  24. $(DLTOOL) $(DLURL)/$@ > $@
  25. test:
  26. $(CARGO) test --release --all-features
  27. fix:
  28. $(CARGO) fix --release --all-features --allow-dirty
  29. clippy:
  30. $(CARGO) clippy --release --all-features
  31. install:
  32. @if ! [ -f uid ]; then \
  33. echo "Please run 'make' as user first." ; \
  34. exit 1 ; \
  35. fi;
  36. mkdir -p $(DESTDIR)$(PREFIX)/bin
  37. cp -f $(BINS) $(DESTDIR)$(PREFIX)/bin
  38. mkdir -p "$(shell cat confdir)"
  39. for i in $(BINS); \
  40. do \
  41. cp example/config/$$i.toml "$(shell cat confdir)" ; \
  42. done;
  43. cp mint.params spend.params "$(shell cat confdir)"
  44. chown -R "$(shell cat uid):$(shell cat uid)" "$(shell cat confdir)"
  45. uninstall:
  46. for i in $(BINS); \
  47. do \
  48. rm -f $(DESTDIR)$(PREFIX)/bin/$$i; \
  49. done;
  50. clean:
  51. rm -f $(BINS) mint.params spend.params uid confdir
  52. distclean: clean
  53. rm -rf target
  54. .PHONY: all test fix clippy install uninstall clean distclean