2020-07-05 11:25:52 +00:00
|
|
|
# Install to /usr/local unless otherwise specified, such as `make PREFIX=/app`
|
|
|
|
PREFIX?=/usr/local
|
|
|
|
|
|
|
|
# What to run to install various files
|
|
|
|
INSTALL?=install
|
|
|
|
# Run to install the actual binary
|
|
|
|
INSTALL_PROGRAM=$(INSTALL) -Dm 755
|
|
|
|
# Run to install application data, with differing permissions
|
|
|
|
INSTALL_DATA=$(INSTALL) -Dm 644
|
|
|
|
|
|
|
|
# Directories into which to install the various files
|
|
|
|
bindir=$(DESTDIR)$(PREFIX)/bin
|
|
|
|
sharedir=$(DESTDIR)$(PREFIX)/share
|
2018-08-14 23:42:09 -04:00
|
|
|
|
|
|
|
# Attempt to find bash completion dir in order of preference
|
|
|
|
ifneq ($(wildcard /etc/bash_completion.d/.),)
|
2020-07-05 11:25:52 +00:00
|
|
|
cpldir ?= /etc/bash_completion.d
|
2018-08-14 23:42:09 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
HAS_BREW := $(shell command -v brew 2> /dev/null)
|
|
|
|
ifdef HAS_BREW
|
2020-07-05 11:25:52 +00:00
|
|
|
cpldir ?= $$(brew --prefix)/etc/bash_completion.d
|
2018-08-14 23:42:09 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
HAS_PKGCONFIG := $(shell command -v pkg-config 2> /dev/null)
|
|
|
|
ifdef HAS_PKGCONFIG
|
2020-07-05 11:25:52 +00:00
|
|
|
cpldir ?= $$(pkg-config --variable=completionsdir bash-completion 2> /dev/null)
|
2018-08-14 23:42:09 -04:00
|
|
|
endif
|
|
|
|
|
2020-07-05 11:25:52 +00:00
|
|
|
help:
|
|
|
|
@echo "targets:"
|
|
|
|
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
|
|
|
| sed -n 's/^\(.*\): \(.*\)##\(.*\)/ \1|\3/p' \
|
|
|
|
| column -t -s '|'
|
|
|
|
|
|
|
|
install: pb pb.1 ## system install
|
|
|
|
$(INSTALL_PROGRAM) pb $(bindir)/pb
|
|
|
|
$(INSTALL_DATA) pb.1 $(sharedir)/man/man1/pb.1
|
|
|
|
ifdef cpldir
|
|
|
|
$(INSTALL_DATA) pb.d $(cpldir)/pb
|
2018-08-14 23:42:09 -04:00
|
|
|
endif
|
|
|
|
|
2020-07-05 11:25:52 +00:00
|
|
|
uninstall: ## system uninstall
|
|
|
|
rm -f $(bindir)/pb
|
|
|
|
rm -f $(sharedir)/man/man1/pb.1
|
|
|
|
ifdef cpldir
|
|
|
|
rm -f $(cpldir)/pb
|
2018-08-14 23:42:09 -04:00
|
|
|
endif
|
|
|
|
|
2020-07-05 11:25:52 +00:00
|
|
|
.PHONY: install uninstall help
|