mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-12-27 02:12:53 +00:00
Replace Makefile with a developmental Justfile
This commit deletes the Makefile, which contained targets to build exa and install it on the local machine, and replaces it with a Justfile, which only contains command to build and test exa. My reasoning for doing this is as follows: • exa is increasingly being installed through package managers, rather than built and tested locally, so users are avoiding using the Makefile at all. • It was a pain to keep up with the correct paths for installing the binary, man pages, and completions, which can vary between OSes. By removing them, the code in this repository need only concern itself with building exa and putting its files in the 'target' directory, simplifying things. • just is much simpler than make conceptually, which is why I prefer it. It just runs commands, rather than being a complete build system, which we already use Cargo for. • just has features built-in, such as listing tasks, that we've had to create make targets for. • exa only needed a Makefile at all because it pre-dates Cargo! • Other Rust projects seem to be getting along perfectly fine without one. If I've missed some important reason that makes it worth keeping the Makefile around then please let me know.
This commit is contained in:
parent
e95eb5e9fc
commit
0550faec05
@ -14,7 +14,7 @@ readme = "README.md"
|
||||
categories = ["command-line-utilities"]
|
||||
keywords = ["ls", "files", "command-line"]
|
||||
license = "MIT"
|
||||
exclude = ["/devtools/*", "/Makefile", "/Vagrantfile", "/screenshots.png"]
|
||||
exclude = ["/devtools/*", "/Justfile", "/Vagrantfile", "/screenshots.png"]
|
||||
|
||||
|
||||
[[bin]]
|
||||
|
26
Justfile
Normal file
26
Justfile
Normal file
@ -0,0 +1,26 @@
|
||||
all: build test
|
||||
all-release: build-release test-release
|
||||
|
||||
|
||||
# compiles the exa binary
|
||||
@build:
|
||||
cargo build
|
||||
|
||||
# compiles the exa binary (in release mode)
|
||||
@build-release:
|
||||
cargo build --release --verbose
|
||||
|
||||
|
||||
# runs unit tests
|
||||
@test:
|
||||
cargo test --all -- --quiet
|
||||
|
||||
# runs unit tests (in release mode)
|
||||
@test-release:
|
||||
cargo test --release --all --verbose
|
||||
|
||||
|
||||
# prints versions of the necessary build tools
|
||||
@versions:
|
||||
rustc --version
|
||||
cargo --version
|
86
Makefile
86
Makefile
@ -1,86 +0,0 @@
|
||||
DESTDIR =
|
||||
PREFIX = /usr/local
|
||||
|
||||
override define compdir
|
||||
ifndef $(1)
|
||||
$(1) := $$(or $$(shell pkg-config --variable=completionsdir $(2) 2>/dev/null),$(3))
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call compdir,BASHDIR,bash-completion,$(PREFIX)/etc/bash_completion.d))
|
||||
$(eval $(call compdir,ZSHDIR,zsh,/usr/share/zsh/vendor_completions.d))
|
||||
$(eval $(call compdir,FISHDIR,fish,$(PREFIX)/share/fish/vendor_completions.d))
|
||||
|
||||
FEATURES ?= default
|
||||
CARGO_OPTS := --no-default-features --features "$(FEATURES)"
|
||||
|
||||
all: target/release/exa
|
||||
build: target/release/exa
|
||||
|
||||
target/release/exa:
|
||||
cargo build --release $(CARGO_OPTS)
|
||||
|
||||
install: install-exa install-man
|
||||
|
||||
install-exa: target/release/exa
|
||||
install -m755 -- target/release/exa "$(DESTDIR)$(PREFIX)/bin/"
|
||||
|
||||
install-man:
|
||||
install -dm755 -- "$(DESTDIR)$(PREFIX)/bin/" "$(DESTDIR)$(PREFIX)/share/man/man1/"
|
||||
install -m644 -- contrib/man/exa.1 "$(DESTDIR)$(PREFIX)/share/man/man1/"
|
||||
|
||||
install-bash-completions:
|
||||
install -m644 -- contrib/completions.bash "$(DESTDIR)$(BASHDIR)/exa"
|
||||
|
||||
install-zsh-completions:
|
||||
install -m644 -- contrib/completions.zsh "$(DESTDIR)$(ZSHDIR)/_exa"
|
||||
|
||||
install-fish-completions:
|
||||
install -m644 -- contrib/completions.fish "$(DESTDIR)$(FISHDIR)/exa.fish"
|
||||
|
||||
test: target/release/exa
|
||||
cargo test --release $(CARGO_OPTS)
|
||||
|
||||
check: test
|
||||
|
||||
uninstall:
|
||||
-rm -f -- "$(DESTDIR)$(PREFIX)/share/man/man1/exa.1"
|
||||
-rm -f -- "$(DESTDIR)$(PREFIX)/bin/exa"
|
||||
-rm -f -- "$(DESTDIR)$(BASHDIR)/exa"
|
||||
-rm -f -- "$(DESTDIR)$(ZSHDIR)/_exa"
|
||||
-rm -f -- "$(DESTDIR)$(FISHDIR)/exa.fish"
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
|
||||
preview-man:
|
||||
man contrib/man/exa.1
|
||||
|
||||
help:
|
||||
@echo 'Available make targets:'
|
||||
@echo ' all - build exa (default)'
|
||||
@echo ' build - build exa'
|
||||
@echo ' clean - run `cargo clean`'
|
||||
@echo ' install - build and install exa and manpage'
|
||||
@echo ' install-exa - build and install exa'
|
||||
@echo ' install-man - install the manpage'
|
||||
@echo ' test - run `cargo test`'
|
||||
@echo ' uninstall - uninstall fish, manpage, and completions'
|
||||
@echo ' preview-man - preview the manpage without installing'
|
||||
@echo ' help - print this help'
|
||||
@echo
|
||||
@echo ' install-bash-completions - install bash completions into $$BASHDIR'
|
||||
@echo ' install-zsh-completions - install zsh completions into $$ZSHDIR'
|
||||
@echo ' install-fish-completions - install fish completions into $$FISHDIR'
|
||||
@echo
|
||||
@echo 'Variables:'
|
||||
@echo ' DESTDIR - A path that'\''s prepended to installation paths (default: "")'
|
||||
@echo ' PREFIX - The installation prefix for everything except zsh completions (default: /usr/local)'
|
||||
@echo ' BASHDIR - The directory to install bash completions in (default: $$PREFIX/etc/bash_completion.d)'
|
||||
@echo ' ZSHDIR - The directory to install zsh completions in (default: /usr/share/zsh/vendor-completions)'
|
||||
@echo ' FISHDIR - The directory to install fish completions in (default: $$PREFIX/share/fish/vendor_completions.d)'
|
||||
@echo ' FEATURES - The cargo feature flags to use. Set to an empty string to disable git support'
|
||||
|
||||
.PHONY: all build target/release/exa install-exa install-man preview-man \
|
||||
install-bash-completions install-zsh-completions install-fish-completions \
|
||||
clean uninstall help
|
12
Vagrantfile
vendored
12
Vagrantfile
vendored
@ -59,6 +59,18 @@ Vagrant.configure(2) do |config|
|
||||
EOF
|
||||
|
||||
|
||||
# Install Just, the command runner.
|
||||
config.vm.provision :shell, privileged: true, inline: <<-EOF
|
||||
if hash just &>/dev/null; then
|
||||
echo "just is already installed"
|
||||
else
|
||||
wget "https://github.com/casey/just/releases/download/v0.8.0/just-v0.8.0-x86_64-unknown-linux-musl.tar.gz"
|
||||
tar -xf "just-v0.8.0-x86_64-unknown-linux-musl.tar.gz"
|
||||
cp just /usr/local/bin
|
||||
fi
|
||||
EOF
|
||||
|
||||
|
||||
# Use a different ‘target’ directory on the VM than on the host.
|
||||
# By default it just uses the one in /vagrant/target, which can
|
||||
# cause problems if it has different permissions than the other
|
||||
|
Loading…
Reference in New Issue
Block a user