2001-04-02 13:56:47 +02:00
|
|
|
#compdef make gmake pmake dmake
|
|
|
|
|
2002-03-15 17:26:08 +01:00
|
|
|
local prev="$words[CURRENT-1]" file expl tmp is_gnu
|
2001-04-02 13:56:47 +02:00
|
|
|
|
2002-03-15 17:26:08 +01:00
|
|
|
_pick_variant -r is_gnu gnu=GNU unix -v -f
|
2001-04-02 13:56:47 +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
|
2002-03-15 17:26:08 +01:00
|
|
|
elif [[ $is_gnu = gnu && -e GNUmakefile ]]; then
|
2001-04-02 13:56:47 +02:00
|
|
|
file=GNUmakefile
|
|
|
|
else
|
|
|
|
file=''
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$file" ]] && _tags targets; then
|
2002-03-15 17:26:08 +01:00
|
|
|
if [[ $is_gnu = gnu ]] &&
|
2001-04-02 13:56:47 +02:00
|
|
|
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=:) )
|
|
|
|
else
|
|
|
|
tmp=(
|
|
|
|
$(awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}
|
|
|
|
/^\.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" }' \
|
|
|
|
FS=: $file)
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
_wanted targets expl 'make target' compadd -a tmp && return 0
|
|
|
|
fi
|
2002-03-13 10:28:04 +01:00
|
|
|
compstate[parameter]="${PREFIX%%\=*}"
|
2001-04-02 13:56:47 +02:00
|
|
|
compset -P 1 '*='
|
2002-03-13 10:28:04 +01:00
|
|
|
_value "$@"
|
2001-04-02 13:56:47 +02:00
|
|
|
fi
|