about summary refs log tree commit diff
path: root/Completion/User/_make
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-06-27 05:33:04 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-06-27 05:33:04 +0000
commit346825df86466cf151be61b9429ef2c1734e66ea (patch)
treebd3e1ccd947b47f974c62b4113c5276416de2c9f /Completion/User/_make
parenta2159285e80508bb682d90a71270fbddada8bd05 (diff)
downloadzsh-3.1.5-pws-24.tar.gz
zsh-3.1.5-pws-24.tar.xz
zsh-3.1.5-pws-24.zip
zsh-3.1.5-pws-24 zsh-3.1.5-pws-24
Diffstat (limited to 'Completion/User/_make')
-rw-r--r--Completion/User/_make24
1 files changed, 22 insertions, 2 deletions
diff --git a/Completion/User/_make b/Completion/User/_make
index 4770c0d7a..add58dbf0 100644
--- a/Completion/User/_make
+++ b/Completion/User/_make
@@ -1,4 +1,24 @@
 #compdef make gmake pmake
 
-compgen -s "\$(awk '/^[a-zA-Z0-9][^\/ 	]+:/ {print \$1}' FS=: [mM]akefile /dev/null)" ||
-_files
+local prev="$words[CURRENT-1]" file ret=1
+
+if [[ "$prev" = -[CI] ]]; then
+  _files -/
+elif [[ "$prev" = -[foW] ]]; then
+  _files
+else
+  file="$words[(I)-f]"
+  if (( file )); then
+    file="$words[file+1]"
+  elif [[ -e Makefile ]]; then
+    file=Makefile
+  elif [[ -e makefile ]]; then
+    file=makefile
+  else
+    file=''
+  fi
+
+  [[ -n "$file" ]] &&
+    compadd - $(awk '/^[a-zA-Z0-9][^/ 	]+:/ {print $1}' FS=: $file) && ret=0
+  (( ret )) && _files
+fi