2000-04-11 01:40:43 +02:00
|
|
|
#compdef make gmake pmake dmake
|
1999-04-15 20:05:38 +02:00
|
|
|
|
2000-04-01 22:43:43 +02:00
|
|
|
local prev="$words[CURRENT-1]" file expl tmp
|
|
|
|
|
2000-04-11 01:40:43 +02:00
|
|
|
(( $+_is_gnu )) || typeset -gA _is_gnu
|
|
|
|
|
2000-04-11 10:22:57 +02:00
|
|
|
if (( ! $+_is_gnu[$words[1]] )); then
|
|
|
|
if [[ $(_call version $words[1] -v -f /dev/null </dev/null 2>/dev/null) = *GNU* ]]
|
2000-04-11 01:40:43 +02:00
|
|
|
then
|
2000-04-11 10:22:57 +02:00
|
|
|
_is_gnu[$words[1]]=yes
|
2000-04-11 01:40:43 +02:00
|
|
|
else
|
2000-04-11 10:22:57 +02:00
|
|
|
_is_gnu[$words[1]]=
|
2000-04-11 01:40:43 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2000-04-01 22:43:43 +02:00
|
|
|
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
|
2000-04-11 01:40:43 +02:00
|
|
|
elif [[ -e GNUmakefile ]]; then
|
|
|
|
file=GNUmakefile
|
2000-04-01 22:43:43 +02:00
|
|
|
else
|
|
|
|
file=''
|
|
|
|
fi
|
|
|
|
|
2000-04-11 10:22:57 +02:00
|
|
|
if [[ -n "$file" ]] && _tags targets; then
|
2000-04-25 06:50:52 +02:00
|
|
|
if [[ -n "$_is_gnu[$words[1]]" ]]; then
|
2000-04-27 14:44:21 +02:00
|
|
|
tmp=( $(_call targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null | awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}' FS=:) )
|
2000-04-11 01:40:43 +02:00
|
|
|
else
|
|
|
|
tmp=(
|
|
|
|
$(awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}
|
2000-04-01 22:43:43 +02:00
|
|
|
/^\.include *<bsd\.port\.(subdir\.|pre\.)?mk>/ || /^\.include *".*mk\/bsd\.pkg\.(subdir\.)?mk"/ {
|
|
|
|
print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum" }' \
|
2000-05-10 09:15:33 +02:00
|
|
|
FS=: $file)
|
2000-04-11 01:40:43 +02:00
|
|
|
)
|
|
|
|
fi
|
2000-04-11 10:22:57 +02:00
|
|
|
_wanted targets expl 'make target' compadd "$tmp[@]" && return 0
|
2000-04-01 22:43:43 +02:00
|
|
|
fi
|
|
|
|
compset -P 1 '*='
|
|
|
|
_files
|
|
|
|
fi
|