summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2000-04-10 23:40:43 +0000
committerBart Schaefer <barts@users.sourceforge.net>2000-04-10 23:40:43 +0000
commit37012f06a7e5e8a64614dbf9032c77cff1bcfcfb (patch)
tree1f02eb83e5e9835997a9f4d6d2d801c970557a9d
parent3153dbb321717deb374fcf3cb86098b5b1ca3654 (diff)
downloadzsh-37012f06a7e5e8a64614dbf9032c77cff1bcfcfb.tar.gz
zsh-37012f06a7e5e8a64614dbf9032c77cff1bcfcfb.tar.xz
zsh-37012f06a7e5e8a64614dbf9032c77cff1bcfcfb.zip
10628: Check for GNU make using "_call version ..." as was done for GNU diff.
-rw-r--r--ChangeLog5
-rw-r--r--Completion/User/_make25
-rw-r--r--Doc/Zsh/compsys.yo5
3 files changed, 31 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ceadc4c9b..c130ef4f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-04-10  Bart Schaefer  <schaefer@brasslantern.com>
+
+	* 10628: Doc/Zsh/compsys.yo, Completion/User/_make: Check for
+	GNU make using "_call version ..." as was done for GNU diff.
+
 2000-04-10  Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
 
 	* 10625: Src/parse.c, Src/signals.c: detect ignored signals
diff --git a/Completion/User/_make b/Completion/User/_make
index 9a8a7ac44..5161e6689 100644
--- a/Completion/User/_make
+++ b/Completion/User/_make
@@ -1,7 +1,18 @@
-#compdef make gmake pmake
+#compdef make gmake pmake dmake
 
 local prev="$words[CURRENT-1]" file expl tmp
 
+(( $+_is_gnu )) || typeset -gA _is_gnu
+
+if (( ! $+_is_gnu[$1] )); then
+  if [[ $(_call version $1 -v -f /dev/null </dev/null 2>/dev/null) = *GNU* ]]
+  then
+    _is_gnu[$1]=yes
+  else
+    _is_gnu[$1]=
+  fi
+fi
+
 if [[ "$prev" = -[CI] ]]; then
   _files -/
 elif [[ "$prev" = -[foW] ]]; then
@@ -14,17 +25,23 @@ else
     file=Makefile
   elif [[ -e makefile ]]; then
     file=makefile
+  elif [[ -e GNUmakefile ]]; then
+    file=GNUmakefile
   else
     file=''
   fi
 
   if [[ -n "$file" ]] && _wanted targets; then
-    tmp=(
-          $(awk '/^[a-zA-Z0-9][^\/\t]+:/ {print $1}
+    if [[ -n "$_is_gnu[$1]" ]]; then
+      tmp=( $(make -nsp --no-print-directory -f "$file" .PHONY | awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}' FS=:) )
+    else
+      tmp=(
+            $(awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}
  	      /^\.include  *<bsd\.port\.(subdir\.|pre\.)?mk>/ || /^\.include  *".*mk\/bsd\.pkg\.(subdir\.)?mk"/ {
  	        print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum" }' \
  	     FS=: $file)
-         )
+           )
+    fi
     _all_labels targets expl 'make target' compadd "$tmp[@]" && return 0
   fi
   compset -P 1 '*='
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 8f89c105b..29a259f34 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -715,6 +715,11 @@ item(tt(values))(
 when completing a value out of a set of values (or a list of such
 values)
 )
+kindex(version, completion tag)
+item(tt(version))(
+used by tt(_call) to look up the command to run to determine the installed
+version of various other commands (currently tt(diff) and tt(make)).
+)
 kindex(warnings, completion tag)
 item(tt(warnings))(
 used to look up the tt(format) style for warnings