Makefile 1.2 KB

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