[Bash-completion-commits] [bash-completion] 01/01: make: Add __BASH_MAKE_COMPLETION__ variable
Ville Skyttä
scop-guest at moszumanska.debian.org
Sun Apr 19 13:03:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
scop-guest pushed a commit to branch master
in repository bash-completion.
commit f9115ce0bb215e9089266d6f1ec20c3375aa970a
Author: Tristan Wibberley <tristan.wibberley at gmail.com>
Date: Sun Apr 5 04:44:06 2015 +0100
make: Add __BASH_MAKE_COMPLETION__ variable
This variable is there so that makefiles can avoid adding targets that shouldn't be offered.
A typical example would be targets added to dependency files by the -MP option to gcc.
---
completions/make | 3 ++-
test/fixtures/make/Makefile | 5 +++++
test/fixtures/make/sample.c | 1 +
test/fixtures/make/sample.d | 3 +++
test/fixtures/make/sample.h | 0
5 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/completions/make b/completions/make
index f8f7193..53f362e 100644
--- a/completions/make
+++ b/completions/make
@@ -144,7 +144,8 @@ _make()
local reset=$( set +o | command grep -F posix ); set +o posix # <(...)
COMPREPLY=( $( LC_ALL=C \
- make -npq "${makef[@]}" "${makef_dir[@]}" .DEFAULT 2>/dev/null | \
+ make -npq __BASH_MAKE_COMPLETION__=1 \
+ "${makef[@]}" "${makef_dir[@]}" .DEFAULT 2>/dev/null | \
sed -nf <(_make_target_extract_script $mode "$cur") ) )
$reset
diff --git a/test/fixtures/make/Makefile b/test/fixtures/make/Makefile
index cb99b25..d5a0012 100644
--- a/test/fixtures/make/Makefile
+++ b/test/fixtures/make/Makefile
@@ -1,5 +1,6 @@
$(info confuse: make)
+CFLAGS=-MMD -MP
NAME := sample
.PHONY: all
@@ -16,3 +17,7 @@ install: all
.PHONY: clean
clean:
-rm -f $(NAME)
+
+ifndef __BASH_MAKE_COMPLETION__
+-include sample.d
+endif
diff --git a/test/fixtures/make/sample.c b/test/fixtures/make/sample.c
index 2be4600..4212596 100644
--- a/test/fixtures/make/sample.c
+++ b/test/fixtures/make/sample.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include "sample.h"
int main(void)
{
diff --git a/test/fixtures/make/sample.d b/test/fixtures/make/sample.d
new file mode 100644
index 0000000..27979ff
--- /dev/null
+++ b/test/fixtures/make/sample.d
@@ -0,0 +1,3 @@
+sample.o: sample.c sample.h
+
+sample.h:
diff --git a/test/fixtures/make/sample.h b/test/fixtures/make/sample.h
new file mode 100644
index 0000000..e69de29
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git
More information about the Bash-completion-commits
mailing list