about summary refs log tree commit diff
path: root/Completion/Unix/Command/_make
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-11-10 09:59:26 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-11-10 09:59:26 +0000
commit254b3f1a6b85e6cfefe21fea3d81c3f97c003ec2 (patch)
tree08450909fc3a75be4a8faa6f3b848473fea5c979 /Completion/Unix/Command/_make
parent7929d97254f84932ab79baf613f3f300ca0a5f84 (diff)
downloadzsh-254b3f1a6b85e6cfefe21fea3d81c3f97c003ec2.tar.gz
zsh-254b3f1a6b85e6cfefe21fea3d81c3f97c003ec2.tar.xz
zsh-254b3f1a6b85e6cfefe21fea3d81c3f97c003ec2.zip
22992: make $? available in exit traps/hooks
22993: slightly more effective _make variable fix
Diffstat (limited to 'Completion/Unix/Command/_make')
-rw-r--r--Completion/Unix/Command/_make10
1 files changed, 8 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index 91c434559..93d4b52da 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -51,6 +51,12 @@ expandVars() {
     done
 }
 
+# parseMakefile only runs inside $(...), so it doesn't matter that
+# it pollutes the global namespace, setting zsh variables to
+# make variables.  The difficult case is where a make variable
+# is special in zsh; we use local -h to hide those.  This
+# isn't a complete solution since it means variables defined in
+# included Makefiles are undefined before returning to the parent.
 parseMakefile() {
     local input var val TAB=$'\t' dir=$1
 
@@ -60,7 +66,7 @@ parseMakefile() {
 	    var=${input%%[ $TAB]#=*}
 	    val=${input#*=}
 	    val=${val##[ $TAB]#}
-	    local -h $var
+	    [[ ${(tP)var} = *special ]] && local -h $var
 	    eval $var=\$val
 	    ;;
 	([[:alnum:]][[:alnum:]_]#[ $TAB]#:=*)
@@ -68,7 +74,7 @@ parseMakefile() {
 	    val=${input#*=}
 	    val=${val##[ $TAB]#}
 	    val=$(expandVars 10 $val)
-	    local -h $var
+	    [[ ${(tP)var} = *special ]] && local -h $var
 	    eval $var=\$val
 	    ;;
 	([[:alnum:]][^$TAB:=]#:[^=]*)