about summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2002-08-14 15:18:19 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2002-08-14 15:18:19 +0000
commit513088857a59c7704734bd7cc3d9a8bc7492e11b (patch)
tree18220546f856954642fcf4d7c7aeca2aa78e2e66 /Completion/Unix/Command
parentfc88981cf719f487cc0128dbcf275e3bbe16b1e9 (diff)
downloadzsh-513088857a59c7704734bd7cc3d9a8bc7492e11b.tar.gz
zsh-513088857a59c7704734bd7cc3d9a8bc7492e11b.tar.xz
zsh-513088857a59c7704734bd7cc3d9a8bc7492e11b.zip
17535: use-perl style for _make
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_make20
1 files changed, 18 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index 53958c0d0..07a80a96e 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -1,7 +1,8 @@
 #compdef make gmake pmake dmake
 
-local prev="$words[CURRENT-1]" file expl tmp is_gnu
+local prev="$words[CURRENT-1]" file expl tmp is_gnu cmdargs useperl
 
+zstyle -t ":completion:${curcontext}:" use-perl && useperl=1
 _pick_variant -r is_gnu gnu=GNU unix -v -f
 
 if [[ "$prev" = -[CI] ]]; then
@@ -25,7 +26,22 @@ else
   if [[ -n "$file" ]] && _tags targets; then
     if [[ $is_gnu = gnu ]] &&
        zstyle -t ":completion:${curcontext}:targets" call-command; then
-      tmp=( $(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null | awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}' FS=:) )
+       if [[ -n $useperl ]]; then
+        cmdargs=(perl -F: -ane '/^[a-zA-Z0-9][^\/\t=]+:/ && print "$F[0]\n"')
+       else
+        cmdargs=(awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}' FS=:)
+       fi
+       tmp=( $(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null | $cmdargs) )
+    elif [[ -n $useperl ]]; then
+      tmp=(
+      $(perl -ne '@matches = /^(?:([a-zA-Z0-9]+[^\/\t=\s]+)\s*)+:/  and
+	print join(" ", @matches);
+if (/^\.include\s+\<bsd\.port\.(subdir\.|pre\.)?mk>/ ||
+    /^\.include\s+\".*mk\/bsd\.pkg\.(subdir\.)?mk\"/) {
+    print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum\n";
+    }
+' $file)
+	)
     else
       tmp=(
             $(awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}