Add completion for 'make'.
--- a/.bashrc Wed Oct 26 02:59:36 2011 +0300
+++ b/.bashrc Wed Oct 26 11:50:18 2011 +0300
@@ -236,6 +236,27 @@
}
complete -F _man man
+_make() {
+ local mk
+ local cur=${COMP_WORDS[COMP_CWORD]}
+ [[ $COMP_CWORD > 0 ]] && prev=${COMP_WORDS[COMP_CWORD-1]}
+ if [[ $prev = -f ]]; then
+ COMPREPLY=( $(compgen -f -- "$cur") )
+ return 0
+ fi
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
+ if [[ ${COMP_WORDS[i]} == -f ]]; then
+ mk=${COMP_WORDS[i+1]}
+ break
+ fi
+ done
+ [[ ! -f $mk ]] && mk=$(eval echo [Mm]akefile)
+ [[ -f $mk ]] || return 0
+ COMPREPLY=( $(compgen -W "$(sed -n -e '/^[[:alnum:]_-]*:/{s=^\([^:]*\):.*=\1=;p;}' $mk)" -- $cur) )
+ return 0
+}
+complete -F _make make gmake pmake
+
# Use bash-completion, if available.
if [ -f /etc/bash_completion ]; then
# Under Cygwin bash completition start a long time.