Each page covers synopsis, options, supported formats or extensions, safety and placement rules (x) or compression profiles and refusals (c), the progress display, exit statuses, environment and examples. c.1 renders its profile table with tbl. make install now installs them to $(PREFIX)/share/man/man1 (MANDIR is overridable), and make uninstall removes them.
41 lines
1022 B
Makefile
41 lines
1022 B
Makefile
PREFIX ?= $(HOME)/.local
|
|
BINDIR ?= $(PREFIX)/bin
|
|
MANDIR ?= $(PREFIX)/share/man
|
|
GO ?= go
|
|
|
|
# Static, reproducible binaries: no cgo, no local paths embedded.
|
|
BUILD = CGO_ENABLED=0 $(GO) build -trimpath
|
|
|
|
.PHONY: all build check test lint install uninstall clean
|
|
|
|
all: build
|
|
|
|
build:
|
|
$(BUILD) -o build/x ./cmd/x
|
|
$(BUILD) -o build/c ./cmd/c
|
|
|
|
check: lint test
|
|
|
|
test:
|
|
$(GO) test -count=1 ./...
|
|
|
|
lint:
|
|
@unformatted=$$(gofmt -l .); if [ -n "$$unformatted" ]; then \
|
|
echo "gofmt needed:"; echo "$$unformatted"; exit 1; fi
|
|
$(GO) vet ./...
|
|
@if command -v staticcheck >/dev/null 2>&1; then staticcheck ./...; \
|
|
else echo "staticcheck not installed; skipped"; fi
|
|
|
|
install: build
|
|
install -d '$(DESTDIR)$(BINDIR)'
|
|
install -m 755 build/x build/c '$(DESTDIR)$(BINDIR)/'
|
|
install -d '$(DESTDIR)$(MANDIR)/man1'
|
|
install -m 644 man/x.1 man/c.1 '$(DESTDIR)$(MANDIR)/man1/'
|
|
|
|
uninstall:
|
|
rm -f '$(DESTDIR)$(BINDIR)/x' '$(DESTDIR)$(BINDIR)/c'
|
|
rm -f '$(DESTDIR)$(MANDIR)/man1/x.1' '$(DESTDIR)$(MANDIR)/man1/c.1'
|
|
|
|
clean:
|
|
rm -rf build
|