2018-08-15 05:42:09 +02:00
|
|
|
PREFIX ?= /usr/local
|
|
|
|
BINDIR ?= $(PREFIX)/bin
|
|
|
|
MANDIR ?= $(PREFIX)/share/man
|
|
|
|
|
|
|
|
# Attempt to find bash completion dir in order of preference
|
|
|
|
ifneq ($(wildcard /etc/bash_completion.d/.),)
|
|
|
|
CPLDIR ?= /etc/bash_completion.d
|
|
|
|
endif
|
|
|
|
|
|
|
|
HAS_BREW := $(shell command -v brew 2> /dev/null)
|
|
|
|
ifdef HAS_BREW
|
|
|
|
CPLDIR ?= $$(brew --prefix)/etc/bash_completion.d
|
|
|
|
endif
|
|
|
|
|
|
|
|
HAS_PKGCONFIG := $(shell command -v pkg-config 2> /dev/null)
|
|
|
|
ifdef HAS_PKGCONFIG
|
|
|
|
CPLDIR ?= $$(pkg-config --variable=completionsdir bash-completion 2> /dev/null)
|
|
|
|
endif
|
|
|
|
|
|
|
|
install:
|
|
|
|
@echo Installing the executable to $(BINDIR)
|
|
|
|
@mkdir -p $(BINDIR)
|
|
|
|
@cp -f pb $(BINDIR)/pb
|
|
|
|
@chmod 755 $(BINDIR)/pb
|
|
|
|
@echo Installing the manual page to $(MANDIR)/man1
|
2018-08-15 14:18:57 +02:00
|
|
|
@mkdir -p $(MANDIR)/man1
|
2018-08-15 05:42:09 +02:00
|
|
|
@cp -f pb.1 $(MANDIR)/man1/pb.1
|
|
|
|
@chmod 644 $(MANDIR)/man1/pb.1
|
2020-02-04 18:30:00 +01:00
|
|
|
ifeq ($(CPLDIR),)
|
2018-08-15 05:42:09 +02:00
|
|
|
@echo Installing the command completion to $(CPLDIR)
|
|
|
|
@mkdir -p $(CPLDIR)
|
|
|
|
@cp -f pb.d $(CPLDIR)/pb
|
|
|
|
@chmod 644 $(CPLDIR)/pb
|
|
|
|
endif
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
@echo Removing the executable from $(BINDIR)
|
|
|
|
@rm -f $(BINDIR)/pb
|
|
|
|
@echo Removing the manual page from $(MANDIR)/man1
|
|
|
|
@rm -f $(BINDIR)/man1/pb.1
|
2020-02-04 18:30:00 +01:00
|
|
|
ifeq ($(CPLDIR),)
|
2018-08-15 05:42:09 +02:00
|
|
|
@echo Removing the command completion from $(CPLDIR)
|
|
|
|
@rm -f $(CPLDIR)/pb
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: install uninstall
|