Fixing Makefile so:

* it does not fail on manpage install (folder was not found)
* CPLDIR is always defined as per 3rd condition, even if all fails
* moved from mkdir + cp + chmod to mkdir + install
This commit is contained in:
Paco Esteban 2018-10-28 17:52:59 +01:00
parent 29253bc254
commit d890a6ef53
1 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,6 @@
PREFIX ?= /usr/local PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man MANDIR ?= $(PREFIX)/share/man/man1
# Attempt to find bash completion dir in order of preference # Attempt to find bash completion dir in order of preference
ifneq ($(wildcard /etc/bash_completion.d/.),) ifneq ($(wildcard /etc/bash_completion.d/.),)
@ -14,23 +14,22 @@ endif
HAS_PKGCONFIG := $(shell command -v pkg-config 2> /dev/null) HAS_PKGCONFIG := $(shell command -v pkg-config 2> /dev/null)
ifdef HAS_PKGCONFIG ifdef HAS_PKGCONFIG
CPLDIR ?= $$(pkg-config --variable=completionsdir bash-completion 2> /dev/null) CPLDIR ?= $(shell pkg-config --variable=completionsdir bash-completion 2> /dev/null)
endif endif
install: install:
@echo Installing the executable to $(BINDIR) @echo Installing the executable to $(BINDIR)
@mkdir -p $(BINDIR) @mkdir -p $(BINDIR)
@cp -f burrow $(BINDIR)/burrow @install -m 755 burrow $(BINDIR)
@chmod 755 $(BINDIR)/burrow
@echo Installing the manual page to $(MANDIR)/man1 @echo Installing the manual page to $(MANDIR)/man1
@mkdir -p $(MANDIR) @mkdir -p $(MANDIR)
@cp -f burrow.1 $(MANDIR)/man1/burrow.1 @install -m 644 burrow.1 $(MANDIR)
@chmod 644 $(MANDIR)/man1/burrow.1
ifdef CPLDIR ifdef CPLDIR
ifneq ($(CPLDIR),)
@echo Installing the command completion to $(CPLDIR) @echo Installing the command completion to $(CPLDIR)
@mkdir -p $(CPLDIR) @mkdir -p $(CPLDIR)
@cp -f burrow.d $(CPLDIR)/burrow @install -m 644 burrow.d $(CPLDIR)/burrow
@chmod 644 $(CPLDIR)/burrow endif
endif endif
uninstall: uninstall:
@ -39,8 +38,10 @@ uninstall:
@echo Removing the manual page from $(MANDIR)/man1 @echo Removing the manual page from $(MANDIR)/man1
@rm -f $(BINDIR)/man1/burrow.1 @rm -f $(BINDIR)/man1/burrow.1
ifdef CPLDIR ifdef CPLDIR
ifneq ($(CPLDIR),)
@echo Removing the command completion from $(CPLDIR) @echo Removing the command completion from $(CPLDIR)
@rm -f $(CPLDIR)/burrow @rm -f $(CPLDIR)/burrow
endif endif
endif
.PHONY: install uninstall .PHONY: install uninstall