--- _make 2004-08-18 10:10:24.000000000 -0400 +++ /usr/share/zsh/4.2.0/functions/Completion/Unix/_make 2004-08-18 11:03:52.000000000 -0400 @@ -1,5 +1,26 @@ #compdef make gmake pmake dmake +parseMakefile() { + local input + while read input; do + case $input in + [[:alnum:]]##:) + echo $input| cut -d: -f1 + ;; + include\ *) + local f + f=$(echo $input| cut -d\ -f2) + if [ $f != '/*' ]; then + f=$dir/$f + fi + if [ -r $f ]; then + parseMakefile < $f + fi + ;; + esac + done +} + local prev="$words[CURRENT-1]" file expl tmp is_gnu cmdargs useperl zstyle -t ":completion:${curcontext}:" use-perl && useperl=1 @@ -24,14 +45,10 @@ fi if [[ -n "$file" ]] && _tags targets; then - if [[ $is_gnu = gnu ]] && - zstyle -t ":completion:${curcontext}:targets" call-command; then - 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) ) + if [[ $is_gnu = gnu ]]; then + dir=$(dirname $file) + tmp=( $(parseMakefile < $file) ) + _wanted targets expl 'make target' compadd -a tmp && return 0 elif [[ -n $useperl ]]; then tmp=( $(perl -ne '@matches = /^(?:([a-zA-Z0-9]+[^\/\t=\s]+)\s*)+:/ and