Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] _make: target: handle "make -C dir"



From: Daniel Hahler <git@xxxxxxxxxx>

_make-findBasedir handles any "-C" arguments to find the basedir, but
with `zstyle -t :completion::complete:make::targets call-command true`
it would then not use it.

This is necessary however to get the correct list of targets, which
might be generated based on files from there.

`$basedir` defaults to `$PWD`, so it is ok to pass it always (I assume).
---
 Completion/Unix/Command/_make | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index e23906373..38d0b0e76 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -236,13 +236,13 @@ _make() {
 
     (target)
     file=${(v)opt_args[(I)(-f|--file|--makefile)]}
+    local basedir
+    basedir=${$(_make-findBasedir $words)}
     if [[ -n $file ]]
     then
-      [[ $file == [^/]* ]] && file=${(q)$(_make-findBasedir $words)}/$file
+      [[ $file == [^/]* ]] && file=$basedir/$file
       [[ -r $file ]] || file=
     else
-      local basedir
-      basedir=${$(_make-findBasedir $words)}
       if [[ $is_gnu == gnu && -r $basedir/GNUmakefile ]]
       then
         file=$basedir/GNUmakefile
@@ -259,10 +259,10 @@ _make() {
 
     if [[ -n "$file" ]]
     then
-      if [[ $is_gnu == gnu ]] 
+      if [[ $is_gnu == gnu ]]
       then
         if zstyle -t ":completion:${curcontext}:targets" call-command; then
-          _make-parseMakefile < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
+          _make-parseMakefile < <(_call_program targets "$words[1]" -C $basedir -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
         else
           _make-parseMakefile < $file
         fi
-- 
2.23.0



Messages sorted by: Reverse Date, Date, Thread, Author