summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-11-10 23:52:52 +0700
committerShulhan <ms@kilabit.info>2024-11-10 23:55:38 +0700
commit9a283ff7532ae434b9b06f5d3804fb6ac2afa56c (patch)
treea1c41d2457dc40ee073c41c72988c7cfce7d3acf
parent8511447a1a628772e46a3ddb787386a03302a417 (diff)
downloadbin.sh-9a283ff7532ae434b9b06f5d3804fb6ac2afa56c.tar.xz
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
-rw-r--r--Makefile14
1 files 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 <ms@kilabit.info>
## 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