tmux-party/Makefile
veg 6be0ac1877 Initial pre-release
tmux-party: share a tmux session with people on the same UNIX host.
Single-file POSIX shell (party) with a filesystem + tmux server-access
trust model. See README.md.
2026-06-01 15:31:54 +00:00

77 lines
3 KiB
Makefile

PREFIX =
DESTDIR =
BINDIR =
MANDIR =
INSTALL = install
# Default install prefix follows the host OS convention (override on the
# command line: `make PREFIX=...`):
# illumos, Solaris (uname -s = SunOS): /opt/party
# Linux, *BSD, macOS, everywhere else: /usr/local
# POSIX make has no ifeq or $(shell), so the OS dispatch lives in the
# install/uninstall recipes themselves. BINDIR and MANDIR remain
# independently overridable. Plain `=` rather than `?=` keeps illumos
# /usr/bin/make happy (it predates POSIX-2008's conditional assignment).
#
# Beyond copying files, `make install` also wires the install bindir into
# the system PATH so `party` and `man party` work from a fresh login shell
# without -M or rc-file edits. The wiring is done by tools/post-install.sh
# and is OS-aware: on illumos /opt/party is appended to /etc/default/login;
# on Linux/BSD/macOS at /usr/local nothing needs doing; for non-standard
# prefixes elsewhere the script prints the export lines to add manually.
# `make uninstall` reverses the wiring symmetrically. Both steps are
# skipped when DESTDIR is set (package staging context).
all:
@echo "party is a single shell script; nothing to build."
@echo "Run 'make install' (PREFIX auto-detects from uname -s)."
install:
@prefix='$(PREFIX)'; \
[ -n "$$prefix" ] || case `uname -s` in \
SunOS) prefix=/opt/party ;; \
*) prefix=/usr/local ;; \
esac; \
bindir='$(BINDIR)'; [ -n "$$bindir" ] || bindir="$$prefix/bin"; \
mandir='$(MANDIR)'; [ -n "$$mandir" ] || mandir="$$prefix/share/man/man1"; \
echo "Installing to $$prefix (bin=$$bindir, man=$$mandir)"; \
$(INSTALL) -d "$(DESTDIR)$$bindir" "$(DESTDIR)$$mandir" && \
$(INSTALL) -m 0755 party "$(DESTDIR)$$bindir/party" && \
$(INSTALL) -m 0644 party.1 "$(DESTDIR)$$mandir/party.1" && \
{ [ -n "$(DESTDIR)" ] || sh tools/post-install.sh install "$$prefix"; }
uninstall:
@prefix='$(PREFIX)'; \
[ -n "$$prefix" ] || case `uname -s` in \
SunOS) prefix=/opt/party ;; \
*) prefix=/usr/local ;; \
esac; \
bindir='$(BINDIR)'; [ -n "$$bindir" ] || bindir="$$prefix/bin"; \
mandir='$(MANDIR)'; [ -n "$$mandir" ] || mandir="$$prefix/share/man/man1"; \
rm -f "$(DESTDIR)$$bindir/party" "$(DESTDIR)$$mandir/party.1"; \
[ -n "$(DESTDIR)" ] || sh tools/post-install.sh uninstall "$$prefix"
check:
sh -n party
@if command -v bats >/dev/null 2>&1; then \
bats tests; \
else \
echo "bats not installed; skipping tests."; \
fi
# Static analysis. Deliberately a local-only target rather than a bats
# test: shellcheck reads bytes, not the OS, so running it across the
# remote test matrix would be redundant. SC3065/SC3067 flag `-k`, `-O`,
# and `-L` as non-strict-POSIX, but every /bin/sh in our matrix (dash,
# bash, mksh, ksh) honors them and rewriting through stat would be a
# portability step backward.
lint:
@if command -v shellcheck >/dev/null 2>&1; then \
shellcheck -s sh -e SC3065,SC3067 party; \
else \
echo "shellcheck not installed; install it locally to lint."; \
exit 1; \
fi
.PHONY: all install uninstall check lint