From 9a283ff7532ae434b9b06f5d3804fb6ac2afa56c Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sun, 10 Nov 2024 23:52:52 +0700 Subject: Makefile: use the pkg-config to derive bash completion install directory This is based on the bash-completion FAQ https://github.com/scop/bash-completion/blob/main/README.md#faq --- Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0577255..53fd97a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ ## SPDX-FileCopyrightText: 2022 M. Shulhan ## SPDX-License-Identifier: GPL-3.0-or-later +BASH_COMP_DIR=$(shell pkg-config --variable=completionsdir bash-completion) + .PHONY: install uninstall install: @@ -11,13 +13,15 @@ install: install bin/tmux-session.sh $(DESTDIR)/usr/bin/ install bin/wg-activate.sh $(DESTDIR)/usr/bin/ - install -d $(DESTDIR)/etc/bash_completion.d - install --mode=0644 etc/bash_completion.d/tmux-session $(DESTDIR)/etc/bash_completion.d/ - install --mode=0644 etc/bash_completion.d/wg-activate $(DESTDIR)/etc/bash_completion.d/ + install -d $(DESTDIR)$(BASH_COMP_DIR) + install --mode=0644 etc/bash_completion.d/tmux-session \ + $(DESTDIR)$(BASH_COMP_DIR) + install --mode=0644 etc/bash_completion.d/wg-activate \ + $(DESTDIR)$(BASH_COMP_DIR) uninstall: - rm -f $(DESTDIR)/etc/bash_completion.d/wg-activate - rm -f $(DESTDIR)/etc/bash_completion.d/tmux-session + rm -f $(DESTDIR)$(BASH_COMP_DIR)/wg-activate + rm -f $(DESTDIR)$(BASH_COMP_DIR)/tmux-session rm -f $(DESTDIR)/usr/bin/wg-activate.sh rm -f $(DESTDIR)/usr/bin/tmux-session.sh rm -f $(DESTDIR)/usr/bin/jwt-decode.sh -- cgit v1.3