summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_make
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2013-11-07 14:52:31 +0100
committerAxel Beckert <abe@deuxchevaux.org>2013-11-07 14:52:31 +0100
commitd799ac78a744a5359563af55b4dee9e91255a1dc (patch)
tree73475ed7089e6ee050085a96b88018994b43bdfc /Completion/Unix/Command/_make
parentabfb3b136a4ad5b2832fb7d920442a2bb28c0697 (diff)
parent375115c7dfd6dff576915d25fe2ecdd381dd9d81 (diff)
downloadzsh-d799ac78a744a5359563af55b4dee9e91255a1dc.tar.gz
zsh-d799ac78a744a5359563af55b4dee9e91255a1dc.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Completion/Unix/Command/_make')
-rw-r--r--Completion/Unix/Command/_make86
1 files changed, 72 insertions, 14 deletions
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index 53e2e1b3e..e5a513f64 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -1,4 +1,4 @@
-#compdef make gmake pmake dmake
+#compdef make gmake pmake dmake freebsd-make bmake
# TODO: Based on targets given on the command line, show only variables that
# are used in those targets and their dependencies.
@@ -59,7 +59,7 @@ _make-expandVars() {
}
_make-parseMakefile () {
- local input var val target dep TAB=$'\t' dir=$1 tmp
+ local input var val target dep TAB=$'\t' dir=$1 tmp IFS=
while read input
do
@@ -148,7 +148,9 @@ _make-findBasedir () {
_make() {
local prev="$words[CURRENT-1]" file expl tmp is_gnu dir incl match
- local -A TARGETS VARIABLES
+ local context state state_descr line
+ local -a option_specs
+ local -A TARGETS VARIABLES opt_args
local ret=1
_pick_variant -r is_gnu gnu=GNU unix -v -f
@@ -156,21 +158,77 @@ _make() {
if [[ $is_gnu == gnu ]]
then
incl="(-|)include"
+ option_specs=(
+ '(-B --always-make)'{-B,--always-make}'[unconditionally make all targets]'
+ '*'{-C,--directory=}'[change directory first]:change to directory:->dir'
+ '-d[print lots of debug information]'
+ '--debug=-[print various types of debug information]:debug options:->debug'
+ '(-e --environment-overrides)'{-e,--environment-overrides}'[environment variables override makefiles]'
+ '--eval=-[evaluate STRING as a makefile statement]:STRING'
+ '(-f --file --makefile)'{-f,--file=,--makefile=}'[read FILE as a makefile]:makefile:->file'
+ '(- *)'{-h,--help}'[print help message and exit]'
+ '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors from recipes]'
+ '*'{-I,--include-dir=}'[search DIRECTORY for included makefiles]:search path for included makefile:->dir'
+ '(-j --jobs)'{-j,--jobs=}'[allow N jobs at once; infinite jobs with no arg]:number of jobs'
+ '(-k --keep-going)'{-k,--keep-going}"[keep going when some targets can't be made]"
+ '(-l --load-average --max-load)'{-l,--load-average=,--max-load}"[don't start multiple jobs unless load is below N]:load"
+ '(-L --check-symlik-times)'{-L,--check-symlink-times}'[use the latest mtime between symlinks and target]'
+ '(-n --just-print --dry-run --recon)'{-n,--just-print,--dry-run,--recon}"[don't actually run any recipe; just print them]"
+ '*'{-o,--old-file=,--assume-old=}"[consider FILE to be very old and don't remake it]:file not to remake:->file"
+ '(-p --print-data-base)'{-p,--print-data-base}'[print makes internal database]'
+ '(-q --question)'{-q,--question}'[run no recipe; exit status says if up to date]'
+ '(-r --no-builtin-rules)'{-r,--no-builtin-rules}'[disable the built-in implicit rules]'
+ '(-R --no-builtin-variables)'{-R,--no-builtin-variables}'[disable the built-in variable settings]'
+ '(-s --silent --quiet)'{-s,--silent,--quiet}"[don't echo recipes]"
+ '(-S --no-keep-going --stop)'{-S,--no-keep-going,--stop}'[turns off -k]'
+ '(-t --touch)'{-t,--touch}'[touch targets instead of remaking them]'
+ '(- *)'{-v,--version}'[print the version number of make and exit]'
+ '(-w --print-directory)'{-w,--print-directory}'[print the current directory]'
+ '--no-print-directory[turn off -w, even if it was turned on implicitly]'
+ '*'{-W,--what-if=,--new-file=,--assume-new=}'[consider FILE to be infinitely new]:file to treat as modified:->file'
+ '--warn-undefined-variables[warn when an undefined variable is referenced]'
+ '--warn-undefined-functions[warn when an undefined user function is called]'
+ )
else
+ # Basic make options only.
incl=.include
+ option_specs=(
+ '-C[change directory first]:directory:->dir'
+ '-I[include directory for makefiles]:directory:->dir'
+ '-f[specify makefile]:makefile:->file'
+ '-o[specify file not to remake]:file not to remake:->file'
+ '-W[pretend file was modified]:file to treat as modified:->file'
+ )
fi
- if [[ "$prev" == -[CI] ]]
- then
- _files -W ${(q)$(_make-findBasedir ${words[1,CURRENT-1]})} -/ && ret=0
- elif [[ "$prev" == -[foW] ]]
- then
- _files -W ${(q)$(_make-findBasedir $words)} && ret=0
- else
- file="$words[(I)-f]"
- if (( file ))
+ _arguments -s $option_specs \
+ '*:make target:->target' && ret=0
+
+ case $state in
+ (dir)
+ _description directories expl "$state_descr"
+ _files "$expl[@]" -W ${(q)$(_make-findBasedir ${words[1,CURRENT-1]})} -/ && ret=0
+ ;;
+
+ (file)
+ _description files expl "$state_descr"
+ _files "$expl[@]" -W ${(q)$(_make-findBasedir $words)} && ret=0
+ ;;
+
+ (debug)
+ _values -s , 'debug options' \
+ '(b v i j m)a[all debugging output]' \
+ 'b[basic debugging output]' \
+ '(b)v[one level above basic]' \
+ '(b)i[describe implicit rule searches (implies b)]' \
+ 'j[show details on invocation of subcommands]' \
+ 'm[enable debugging while remaking makefiles]' && ret=0
+ ;;
+
+ (target)
+ file=${(v)opt_args[(I)(-f|--file|--makefile)]}
+ if [[ -n $file ]]
then
- file=${~words[file+1]}
[[ $file == [^/]* ]] && file=${(q)$(_make-findBasedir $words)}/$file
[[ -r $file ]] || file=
else
@@ -222,7 +280,7 @@ _make() {
compadd -S '=' -- ${(k)VARIABLES} && ret=0
done
fi
- fi
+ esac
return ret
}