#compdef make gmake pmake local prev="$words[CURRENT-1]" file ret=1 expl 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" ]] && _wanted targets expl 'make target' && compadd "$expl[@]" - \ $(awk '/^[a-zA-Z0-9][^\/ \t]+:/ {print $1} /^\.include */ || /^\.include *".*mk\/bsd\.pkg\.(subdir\.)?mk"/ { print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum" }' \ FS=: $file) && ret=0 (( ret )) && { compset -P 1 '*\='; _files } fi