Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh make(1) completion on FreeBSD
- X-seq: zsh-workers 39618
- From: Guilherme Salazar <gmesalazar@xxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Subject: Re: zsh make(1) completion on FreeBSD
- Date: Tue, 11 Oct 2016 20:27:14 -0300
- Cc: zsh-workers@xxxxxxx, Baptiste Daroussin <baptiste.daroussin@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=gmail.com; s=20120113;        h=mime-version:in-reply-to:references:from:date:message-id:subject:to         :cc:content-transfer-encoding;        bh=LRBlS5UUxZymK4HbF0ZfA3bv7scOW0DUelXCacZDtI0=;        b=M7Hm9ByhSvbvCRHIkElJ0YJCXC8PjCq+SnNL1EiIfGWB5kBJG2LkbOgJxi4MiHKs9c         vxD/lHhT8PuxsB1CrrHwGOTpoouxVWr8PuaClVbqpuKseSQg+Ui1VwHXVJ3T89N5dVnC         tf8r/FwBTkdwu9aqXs5lsoe6bJmbOaTBvrGRsp3zduytvCkANJkigqBdDnbXPoZDdK4K         +SR4b/JWKurLiXE6sAp6s247Abxb7FLruu8G3W3YypMrqV4aCvbVf4xTTh1/5tM9em6B         e4xSqFjFEMV755DFon4B0VQrIDmj8HkB9GrSB34qMwB3Z06N2xbH+vtl1yjlUlAAoJeq         uowQ==
- In-reply-to: <20161011212150.GA24484@fujitsu.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CA+Hmt2iOypn5PDukmM3TH1=g-194QC_6FLVeaM-U0vFG1YbO7w@mail.gmail.com> <20161011212150.GA24484@fujitsu.shahaf.local2>
Hi Daniel,
> I'd like to see this fixed but I'm not on FreeBSD right now.  Any chance
> you could write a patch?  I think there are two approaches, either (a)
> figure out what incantation of BSD make is equivalent to «gmake -nspf
> $file», or (b) use the -d switch to ask make what are the targets,
> variables, and other things that _make-parseMakefile extracts.
Baptiste (cc'ed) kindly sent me a patch he uses to get targets
completion [1]. Using it and adding variable completion, I got to the
following:
````
--- /usr/ports/shells/zsh/work/zsh-5.2/Completion/Unix/Command/_make
 2015-08-08 14:51:33.000000000 -0300
+++ /usr/local/share/zsh/5.2/functions/Completion/Unix/_make
2016-10-11 20:14:43.403084000 -0300
@@ -268,7 +268,14 @@
       else
         case "$OSTYPE" in
           freebsd*)
-          _make-parseMakefile $PWD < <(_call_program targets
"$words[1]" -nsp -f "$file" .PHONY 2> /dev/null)
+          if [[ $words[1] == *'gmake'* ]]
+          then
+            args="-nsp"
+          else
+            args="-nsdg1Fstdout"
+            TARGETS+=(${=${(f)"$(_call_program targets \"$words[1]\"
-s -f "$file" -V.ALLTARGETS 2> /dev/null)"}})
+          fi
+          _make-parseMakefile $PWD < <(_call_program targets
"$words[1]" $args -f "$file" .PHONY 2> /dev/null)
     ;;
     *)
           _make-parseMakefile $PWD < $file
````
It works well for bmake without breaking gmake.
[1] https://people.freebsd.org/~bapt/_make.diff
Messages sorted by:
Reverse Date,
Date,
Thread,
Author