49 lines
1.5 KiB
Makefile
49 lines
1.5 KiB
Makefile
_default:
|
|
@just --list
|
|
|
|
# Install dependencies (Go modules)
|
|
install:
|
|
go mod download
|
|
|
|
# Run from source (development)
|
|
run:
|
|
go run ./cmd/goget
|
|
|
|
# Build the binary
|
|
build:
|
|
# Keep the embedded manpage in sync with man/goget.1. //go:embed
|
|
# cannot reference files outside the embedding package, so we copy
|
|
# the source-of-truth manpage into the package tree before compiling.
|
|
cp man/goget.1 cmd/goget/man-page-data/goget.1
|
|
go vet ./...
|
|
gofmt -l $(find cmd internal pkg -name '*.go') | grep . && exit 1 || true
|
|
go build -ldflags "-s -w" -o bin/goget ./cmd/goget
|
|
|
|
# Run tests (race detector + fuzz seed corpus)
|
|
test:
|
|
cp man/goget.1 cmd/goget/man-page-data/goget.1
|
|
go test -race -count=1 ./...
|
|
|
|
# Remove build artifacts
|
|
uninstall:
|
|
rm -rf bin/ coverage.out
|
|
|
|
# Validate the manpage with groff (zero warnings on success). Requires
|
|
# `groff` to be installed — skipped silently otherwise.
|
|
man:
|
|
@command -v groff >/dev/null || { echo "groff not installed, skipping"; exit 0; }
|
|
groff -man -ww -Kutf-8 -z man/goget.1
|
|
|
|
# Install the manpage to ~/.local/share/man/man1/ (XDG rootless).
|
|
# After install, `man goget` resolves it automatically. Re-run safely to
|
|
# pick up edits.
|
|
install-man: man
|
|
@mkdir -p "$HOME/.local/share/man/man1"
|
|
gzip -c -f man/goget.1 > "$HOME/.local/share/man/man1/goget.1.gz"
|
|
@echo "Installed: $HOME/.local/share/man/man1/goget.1.gz"
|
|
|
|
# Remove the manpage installed by `just install-man`.
|
|
uninstall-man:
|
|
rm -f "$HOME/.local/share/man/man1/goget.1.gz"
|
|
@echo "Removed: $HOME/.local/share/man/man1/goget.1.gz"
|