1 |
commit: ce8ecda4ece83c04d481acacbed97a61e989cb64 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Aug 31 20:30:03 2014 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Aug 31 21:18:58 2014 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/gentoo-bashcomp.git;a=commit;h=ce8ecda4 |
7 |
|
8 |
Makefile: introduce a new 'install' rule. |
9 |
|
10 |
That handles proper install paths and substitutions. |
11 |
|
12 |
--- |
13 |
Makefile | 31 +++++++++++++++++++++++++++++++ |
14 |
1 file changed, 31 insertions(+) |
15 |
|
16 |
diff --git a/Makefile b/Makefile |
17 |
index da4702b..f167c7b 100644 |
18 |
--- a/Makefile |
19 |
+++ b/Makefile |
20 |
@@ -5,9 +5,40 @@ distapp = gentoo-bashcomp |
21 |
distver := $(shell date -u +%Y%m%d) |
22 |
distpkg := $(distapp)-$(distver) |
23 |
|
24 |
+DESTDIR = |
25 |
+EPREFIX = |
26 |
+ |
27 |
+# prefer paths from pkg-config, fallback to sane defaults |
28 |
+completionsdir ?= $(or \ |
29 |
+ $(shell pkg-config --variable=completionsdir bash-completion 2>/dev/null), \ |
30 |
+ ${EPREFIX}/usr/share/bash-completion/completions) |
31 |
+helpersdir ?= $(or \ |
32 |
+ $(shell pkg-config --variable=helpersdir bash-completion 2>/dev/null), \ |
33 |
+ ${EPREFIX}/usr/share/bash-completion/helpers) |
34 |
+compatdir ?= $(or \ |
35 |
+ $(shell pkg-config --variable=compatdir bash-completion 2>/dev/null), \ |
36 |
+ ${EPREFIX}/etc/bash_completion.d) |
37 |
+ |
38 |
+completions := $(wildcard completions/*) |
39 |
+helpers := $(wildcard helpers/*) |
40 |
+compats := $(wildcard compat/*) |
41 |
+ |
42 |
+POSTINST_SED = sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" -e "s|@helpersdir@|$(helpersdir)|" |
43 |
+ |
44 |
all: |
45 |
@echo Nothing to compile. |
46 |
|
47 |
+install: |
48 |
+ install -d "$(DESTDIR)$(completionsdir)" |
49 |
+ install -m0644 $(completions) "$(DESTDIR)$(completionsdir)" |
50 |
+ $(POSTINST_SED) $(addprefix "$(DESTDIR)$(completionsdir)"/,$(notdir $(completions))) |
51 |
+ install -d "$(DESTDIR)$(helpersdir)" |
52 |
+ install -m0644 $(helpers) "$(DESTDIR)$(helpersdir)" |
53 |
+ $(POSTINST_SED) $(addprefix "$(DESTDIR)$(helpersdir)"/,$(notdir $(helpers))) |
54 |
+ install -d "$(DESTDIR)$(compatdir)" |
55 |
+ install -m0644 $(compats) "$(DESTDIR)$(compatdir)" |
56 |
+ $(POSTINST_SED) $(addprefix "$(DESTDIR)$(compatdir)"/,$(notdir $(compats))) |
57 |
+ |
58 |
tag: |
59 |
git pull |
60 |
git tag -a $(distpkg) -m "tag $(distpkg)" |