2021-10-07 14:27:21 -04:00
|
|
|
.POSIX:
|
|
|
|
.SUFFIXES:
|
|
|
|
.SUFFIXES: .1 .5 .1.scd .5.scd
|
|
|
|
|
2021-09-06 21:38:37 -04:00
|
|
|
PREFIX?=/usr/local
|
|
|
|
BINDIR?=$(PREFIX)/bin
|
2021-10-07 14:27:21 -04:00
|
|
|
MANDIR?=$(PREFIX)/share/man
|
2021-09-06 21:38:37 -04:00
|
|
|
|
|
|
|
# Exists in GNUMake but not in NetBSD make and others.
|
|
|
|
RM?=rm -f
|
|
|
|
|
2021-10-07 14:27:21 -04:00
|
|
|
RMDIR_IF_EMPTY:=sh -c '\
|
|
|
|
if test -d $$0 && ! ls -1qA $$0 | grep -q . ; then \
|
|
|
|
rmdir $$0; \
|
|
|
|
fi'
|
|
|
|
|
|
|
|
all: docs ## Build and generate files
|
|
|
|
|
|
|
|
docs: docs/aptpkg.1 docs/aptpkg.5 ## Generate docs
|
|
|
|
|
|
|
|
.1.scd.1:
|
|
|
|
scdoc < $< > $@
|
|
|
|
|
|
|
|
.5.scd.5:
|
|
|
|
scdoc < $< > $@
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean: ## Remove generated files
|
|
|
|
$(RM) docs/aptpkg.1 docs/aptpkg.5
|
|
|
|
|
2021-09-06 21:38:37 -04:00
|
|
|
.PHONY: help
|
|
|
|
help: ## Show this help
|
|
|
|
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install: ## Install aptpkg
|
2021-10-07 14:27:21 -04:00
|
|
|
mkdir -m755 -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 $(DESTDIR)$(MANDIR)/man5
|
2021-09-06 21:38:37 -04:00
|
|
|
install -m755 aptpkg $(DESTDIR)$(BINDIR)/aptpkg
|
2021-10-07 14:27:21 -04:00
|
|
|
install -m644 docs/aptpkg.1 $(DESTDIR)$(MANDIR)/man1/aptpkg.1
|
2021-10-07 22:05:34 -04:00
|
|
|
install -m644 docs/aptpkg.5 $(DESTDIR)$(MANDIR)/man5/aptpkg.5
|
2021-09-06 21:38:37 -04:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test: ## Run shellcheck tests
|
|
|
|
shellcheck aptpkg
|
|
|
|
|
|
|
|
.PHONY: uninstall
|
|
|
|
uninstall: ## Uninstall aptpkg
|
|
|
|
$(RM) $(DESTDIR)$(BINDIR)/aptpkg
|
2021-10-07 14:27:21 -04:00
|
|
|
$(RM) $(DESTDIR)$(MANDIR)/man1/aptpkg.1
|
|
|
|
$(RM) $(DESTDIR)$(MANDIR)/man5/aptpkg.5
|
2021-09-06 21:38:37 -04:00
|
|
|
${RMDIR_IF_EMPTY} $(DESTDIR)$(BINDIR)
|
2021-10-07 14:27:21 -04:00
|
|
|
${RMDIR_IF_EMPTY} $(DESTDIR)$(MANDIR)
|