zsh-workers
 help / color / mirror / code / Atom feed
From: Guilherme Salazar <gmesalazar@gmail.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: zsh-workers@zsh.org, Baptiste Daroussin <baptiste.daroussin@gmail.com>
Subject: Re: zsh make(1) completion on FreeBSD
Date: Tue, 11 Oct 2016 20:27:14 -0300	[thread overview]
Message-ID: <CA+Hmt2h+jOFVcg1q9ujfTN0no1WJD2VyvuneRfZ+JJ1SW89cHQ@mail.gmail.com> (raw)
In-Reply-To: <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


  reply	other threads:[~2016-10-12  4:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06  2:56 Guilherme Salazar
2016-10-11 21:21 ` Daniel Shahaf
2016-10-11 23:27   ` Guilherme Salazar [this message]
2016-10-12  0:02     ` Daniel Shahaf
2016-10-12  0:24       ` Guilherme Salazar
2016-10-12  0:36         ` Daniel Shahaf
2016-10-12  1:14           ` Guilherme Salazar
2016-10-12  3:27             ` Guilherme Salazar
2016-10-13 10:08               ` Oliver Kiddle
2016-10-14  6:10                 ` Daniel Shahaf
2016-10-16 16:34             ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+Hmt2h+jOFVcg1q9ujfTN0no1WJD2VyvuneRfZ+JJ1SW89cHQ@mail.gmail.com \
    --to=gmesalazar@gmail.com \
    --cc=baptiste.daroussin@gmail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).