Add Makefile
Targets: build, install, uninstall, test, check, fmt Installs to ~/.local/bin by default
This commit is contained in:
parent
6f3cc0578d
commit
320fda7acc
|
|
@ -0,0 +1,58 @@
|
|||
.PHONY: all build release debug install uninstall clean test check help
|
||||
|
||||
PREFIX ?= $(HOME)/.local
|
||||
BINDIR ?= $(PREFIX)/bin
|
||||
|
||||
CARGO ?= cargo
|
||||
CARGO_FLAGS ?=
|
||||
|
||||
all: release
|
||||
|
||||
build: release
|
||||
|
||||
release:
|
||||
$(CARGO) build --release $(CARGO_FLAGS)
|
||||
|
||||
debug:
|
||||
$(CARGO) build $(CARGO_FLAGS)
|
||||
|
||||
install: release
|
||||
install -d $(BINDIR)
|
||||
install -m 755 target/release/ork $(BINDIR)/ork
|
||||
|
||||
uninstall:
|
||||
rm -f $(BINDIR)/ork
|
||||
|
||||
clean:
|
||||
$(CARGO) clean
|
||||
|
||||
test:
|
||||
$(CARGO) test $(CARGO_FLAGS)
|
||||
|
||||
check:
|
||||
$(CARGO) check $(CARGO_FLAGS)
|
||||
$(CARGO) clippy $(CARGO_FLAGS) -- -D warnings
|
||||
|
||||
fmt:
|
||||
$(CARGO) fmt
|
||||
|
||||
fmt-check:
|
||||
$(CARGO) fmt -- --check
|
||||
|
||||
help:
|
||||
@echo "orkmode - org-mode parser and CLI"
|
||||
@echo ""
|
||||
@echo "Targets:"
|
||||
@echo " all, build, release Build release binary"
|
||||
@echo " debug Build debug binary"
|
||||
@echo " install Install to $(BINDIR)"
|
||||
@echo " uninstall Remove from $(BINDIR)"
|
||||
@echo " clean Remove build artifacts"
|
||||
@echo " test Run tests"
|
||||
@echo " check Run cargo check and clippy"
|
||||
@echo " fmt Format code"
|
||||
@echo " fmt-check Check formatting"
|
||||
@echo ""
|
||||
@echo "Variables:"
|
||||
@echo " PREFIX Installation prefix (default: ~/.local)"
|
||||
@echo " CARGO Cargo command (default: cargo)"
|
||||
Loading…
Reference in New Issue