Makefile 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. DESTDIR =
  2. PREFIX = /usr/local
  3. override define compdir
  4. ifndef $(1)
  5. $(1) := $$(or $$(shell pkg-config --variable=completionsdir $(2) 2>/dev/null),$(3))
  6. endif
  7. endef
  8. $(eval $(call compdir,BASHDIR,bash-completion,$(PREFIX)/etc/bash_completion.d))
  9. ZSHDIR = /usr/share/zsh/vendor-completions
  10. $(eval $(call compdir,FISHDIR,fish,$(PREFIX)/share/fish/vendor_completions.d))
  11. FEATURES ?= default
  12. all: target/release/exa
  13. build: target/release/exa
  14. target/release/exa:
  15. cargo build --release --no-default-features --features "$(FEATURES)"
  16. install: install-exa install-man
  17. install-exa: target/release/exa
  18. install -m755 -- target/release/exa "$(DESTDIR)$(PREFIX)/bin/"
  19. install-man:
  20. install -dm755 -- "$(DESTDIR)$(PREFIX)/bin/" "$(DESTDIR)$(PREFIX)/share/man/man1/"
  21. install -m644 -- contrib/man/exa.1 "$(DESTDIR)$(PREFIX)/share/man/man1/"
  22. install-bash-completions:
  23. install -m644 -- contrib/completions.bash "$(DESTDIR)$(BASHDIR)/exa"
  24. install-zsh-completions:
  25. install -m644 -- contrib/completions.zsh "$(DESTDIR)$(ZSHDIR)/_exa"
  26. install-fish-completions:
  27. install -m644 -- contrib/completions.fish "$(DESTDIR)$(FISHDIR)/exa.fish"
  28. uninstall:
  29. -rm -f -- "$(DESTDIR)$(PREFIX)/share/man/man1/exa.1"
  30. -rm -f -- "$(DESTDIR)$(PREFIX)/bin/exa"
  31. -rm -f -- "$(DESTDIR)$(BASHDIR)/exa"
  32. -rm -f -- "$(DESTDIR)$(ZSHDIR)/_exa"
  33. -rm -f -- "$(DESTDIR)$(FISHDIR)/exa.fish"
  34. clean:
  35. cargo clean
  36. preview-man:
  37. man contrib/man/exa.1
  38. help:
  39. @echo 'Available make targets:'
  40. @echo ' all - build exa (default)'
  41. @echo ' build - build exa'
  42. @echo ' clean - run `cargo clean`'
  43. @echo ' install - build and install exa and manpage'
  44. @echo ' install-exa - build and install exa'
  45. @echo ' install-man - install the manpage'
  46. @echo ' uninstall - uninstall fish, manpage, and completions'
  47. @echo ' preview-man - preview the manpage without installing'
  48. @echo ' help - print this help'
  49. @echo
  50. @echo ' install-bash-completions - install bash completions into $$BASHDIR'
  51. @echo ' install-zsh-completions - install zsh completions into $$ZSHDIR'
  52. @echo ' install-fish-completions - install fish completions into $$FISHDIR'
  53. @echo
  54. @echo 'Variables:'
  55. @echo ' DESTDIR - A path that'\''s prepended to installation paths (default: "")'
  56. @echo ' PREFIX - The installation prefix for everything except zsh completions (default: /usr/local)'
  57. @echo ' BASHDIR - The directory to install bash completions in (default: $$PREFIX/etc/bash_completion.d)'
  58. @echo ' ZSHDIR - The directory to install zsh completions in (default: /usr/share/zsh/vendor-completions)'
  59. @echo ' FISHDIR - The directory to install fish completions in (default: $$PREFIX/share/fish/vendor_completions.d)'
  60. @echo ' FEATURES - The cargo feature flags to use. Set to an empty string to disable git support'
  61. .PHONY: all build target/release/exa install-exa install-man preview-man \
  62. install-bash-completions install-zsh-completions install-fish-completions \
  63. clean uninstall help