1
0

Makefile 3.1 KB

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