summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2014-08-31 22:30:03 +0200
committerMichał Górny <mgorny@gentoo.org>2014-08-31 23:18:58 +0200
commitce8ecda4ece83c04d481acacbed97a61e989cb64 (patch)
treeb65f100554ddd60d5baf0d86e330860c61cc662c
parentSplit completions by completed command. (diff)
downloadgentoo-bashcomp-ce8ecda4ece83c04d481acacbed97a61e989cb64.tar.gz
gentoo-bashcomp-ce8ecda4ece83c04d481acacbed97a61e989cb64.tar.bz2
gentoo-bashcomp-ce8ecda4ece83c04d481acacbed97a61e989cb64.zip
Makefile: introduce a new 'install' rule.gentoo-bashcomp-20140911
That handles proper install paths and substitutions.
-rw-r--r--Makefile31
1 files changed, 31 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index da4702b..f167c7b 100644
--- a/Makefile
+++ b/Makefile
@@ -5,9 +5,40 @@ distapp = gentoo-bashcomp
distver := $(shell date -u +%Y%m%d)
distpkg := $(distapp)-$(distver)
+DESTDIR =
+EPREFIX =
+
+# prefer paths from pkg-config, fallback to sane defaults
+completionsdir ?= $(or \
+ $(shell pkg-config --variable=completionsdir bash-completion 2>/dev/null), \
+ ${EPREFIX}/usr/share/bash-completion/completions)
+helpersdir ?= $(or \
+ $(shell pkg-config --variable=helpersdir bash-completion 2>/dev/null), \
+ ${EPREFIX}/usr/share/bash-completion/helpers)
+compatdir ?= $(or \
+ $(shell pkg-config --variable=compatdir bash-completion 2>/dev/null), \
+ ${EPREFIX}/etc/bash_completion.d)
+
+completions := $(wildcard completions/*)
+helpers := $(wildcard helpers/*)
+compats := $(wildcard compat/*)
+
+POSTINST_SED = sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" -e "s|@helpersdir@|$(helpersdir)|"
+
all:
@echo Nothing to compile.
+install:
+ install -d "$(DESTDIR)$(completionsdir)"
+ install -m0644 $(completions) "$(DESTDIR)$(completionsdir)"
+ $(POSTINST_SED) $(addprefix "$(DESTDIR)$(completionsdir)"/,$(notdir $(completions)))
+ install -d "$(DESTDIR)$(helpersdir)"
+ install -m0644 $(helpers) "$(DESTDIR)$(helpersdir)"
+ $(POSTINST_SED) $(addprefix "$(DESTDIR)$(helpersdir)"/,$(notdir $(helpers)))
+ install -d "$(DESTDIR)$(compatdir)"
+ install -m0644 $(compats) "$(DESTDIR)$(compatdir)"
+ $(POSTINST_SED) $(addprefix "$(DESTDIR)$(compatdir)"/,$(notdir $(compats)))
+
tag:
git pull
git tag -a $(distpkg) -m "tag $(distpkg)"