[Bash-completion-commits] ./current r1214: * Merge from Gentoo:

David Paleino d.paleino at gmail.com
Thu Dec 11 19:13:16 UTC 2008


------------------------------------------------------------
revno: 1214
committer: David Paleino <d.paleino at gmail.com>
branch nick: current
timestamp: Thu 2008-12-11 20:13:16 +0100
message:
  * 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 at exherbo.org>.
modified:
  bash_completion
  debian/changelog
-------------- next part --------------
=== modified file 'bash_completion'
--- a/bash_completion	2008-12-11 19:04:37 +0000
+++ b/bash_completion	2008-12-11 19:13:16 +0000
@@ -2851,17 +2851,6 @@
 			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 @@
 			fi
 		done
 
-		[ ! -f $makef ] && return 0
-
-		# 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" ))
+		[ -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" ))
+
 	fi
 } &&
 complete -f -F _make $filenames make gmake gnumake pmake

=== modified file 'debian/changelog'
--- a/debian/changelog	2008-12-11 19:04:37 +0000
+++ b/debian/changelog	2008-12-11 19:13:16 +0000
@@ -49,13 +49,15 @@
   * 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 at 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 at gmail.com>  Tue, 25 Nov 2008 13:40:03 +0100
+ -- David Paleino <d.paleino at gmail.com>  Thu, 11 Dec 2008 20:12:21 +0100
 
 bash-completion (20080705) unstable; urgency=low
 



More information about the Bash-completion-commits mailing list