* Merge from Gentoo:

- use make -qp to parse the Makefile for us, so we get proper completion
    on things like pattern rules. Patch by Mike Kelly <pioto@exherbo.org>.
This commit is contained in:
David Paleino 2008-12-11 20:13:16 +01:00
parent e4f86dc5a6
commit 1ca84fa680
2 changed files with 10 additions and 23 deletions

View File

@ -2851,17 +2851,6 @@ _make()
fi
done
# make reads `GNUmakefile', then `makefile', then `Makefile'
if [ -f ${makef_dir}/GNUmakefile ]; then
makef=${makef_dir}/GNUmakefile
elif [ -f ${makef_dir}/makefile ]; then
makef=${makef_dir}/makefile
elif [ -f ${makef_dir}/Makefile ]; then
makef=${makef_dir}/Makefile
else
makef=${makef_dir}/*.mk # local convention
fi
# before we scan for targets, see if a Makefile name was
# specified with -f
for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
@ -2872,18 +2861,14 @@ _make()
fi
done
[ ! -f $makef ] && return 0
[ -n "$makef" ] && makef="-f ${makef}"
[ -n "$makef_dir" ] && makef_dir="-C ${makef_dir}"
COMPREPLY=( $( make -qp $makef $makef_dir 2>/dev/null | \
awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
{split($1,A,/ /);for(i in A)print A[i]}' | \
command grep "^$cur" ))
# deal with included Makefiles
makef_inc=$( grep -E '^-?include' $makef | sed -e "s,^.* ,"$makef_dir"/," )
for file in $makef_inc; do
[ -f $file ] && makef="$makef $file"
done
COMPREPLY=( $( awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
{split($1,A,/ /);for(i in A)print A[i]}' \
$makef 2>/dev/null | command grep "^$cur" ))
fi
} &&
complete -f -F _make $filenames make gmake gnumake pmake

4
debian/changelog vendored
View File

@ -49,13 +49,15 @@ bash-completion (200811xx) UNRELEASED; urgency=low
* Merge from Gentoo:
- fix 'find' completion so that it properly completes on -?(i)whilename.
Patch by Ciaran McCreesh.
- use make -qp to parse the Makefile for us, so we get proper completion
on things like pattern rules. Patch by Mike Kelly <pioto@exherbo.org>.
* debian/links fixed (Closes: #494292)
* debian/control:
- fixed typo in the long description
* debian/install:
- correctly install contrib/* under /etc/bash_completion.d/
-- David Paleino <d.paleino@gmail.com> Tue, 25 Nov 2008 13:40:03 +0100
-- David Paleino <d.paleino@gmail.com> Thu, 11 Dec 2008 20:12:21 +0100
bash-completion (20080705) unstable; urgency=low