Add Makefile

main
earnest ma 2021-09-06 21:38:37 -04:00
parent ff3f139265
commit 1d8426c13d
Signed by: earnest ma
GPG Key ID: A343F43342EB6E2A
1 changed files with 28 additions and 0 deletions

28
Makefile Normal file
View File

@ -0,0 +1,28 @@
PREFIX?=/usr/local
BINDIR?=$(PREFIX)/bin
# Exists in GNUMake but not in NetBSD make and others.
RM?=rm -f
.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
mkdir -m755 -p $(DESTDIR)$(BINDIR)
install -m755 aptpkg $(DESTDIR)$(BINDIR)/aptpkg
.PHONY: test
test: ## Run shellcheck tests
shellcheck aptpkg
RMDIR_IF_EMPTY:=sh -c '\
if test -d $$0 && ! ls -1qA $$0 | grep -q . ; then \
rmdir $$0; \
fi'
.PHONY: uninstall
uninstall: ## Uninstall aptpkg
$(RM) $(DESTDIR)$(BINDIR)/aptpkg
${RMDIR_IF_EMPTY} $(DESTDIR)$(BINDIR)