From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Guilherme Salazar <gmesalazar@gmail.com>
Cc: zsh-workers@zsh.org, Baptiste Daroussin <baptiste.daroussin@gmail.com>
Subject: Re: zsh make(1) completion on FreeBSD
Date: Sun, 16 Oct 2016 16:34:26 +0000 [thread overview]
Message-ID: <20161016163426.GA14121@fujitsu.shahaf.local2> (raw)
In-Reply-To: <CA+Hmt2ixfYgbXduUgaqCQTFMWyT4BhCGp7A0XUwJJ++fJtxrkw@mail.gmail.com>
Guilherme Salazar wrote on Tue, Oct 11, 2016 at 22:14:04 -0300:
> > That's precisely what the _pick_variant call at the top of the function
> > does, so you can just test $is_gnu instead. Note that the enclosing if
> > already inspects that variable.
>
> $is_gnu will still give unix (on FreeBSD) in case `which make` is just
> a symlink to /usr/local/bin/gmake.
I went over this with Baptiste on IRC. _pick_variant behaves as
expected; however, the freebsd* case was taken for both bmake and gmake
on that OS (when call-command is unset, which is the default).
This patch refactors the code to avoid that, adds the TARGETS+= and
-nsdg1Fstdout magic from the original patch, and also adds dragonfly and
netbsd support at Baptiste's suggestion.
I left call-comand out of the non-GNU path since that's how it was
originally.
Thanks,
Daniel
[[[
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index d10c8ee..35a892c 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -263,17 +263,20 @@ _make() {
if [[ -n "$file" ]]
then
- if [[ $is_gnu == gnu ]] && zstyle -t ":completion:${curcontext}:targets" call-command
+ if [[ $is_gnu == gnu ]]
then
- _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
+ if zstyle -t ":completion:${curcontext}:targets" call-command; then
+ _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
+ else
+ _make-parseMakefile $PWD < $file
+ fi
else
- case "$OSTYPE" in
- freebsd*)
- _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsp -f "$file" .PHONY 2> /dev/null)
- ;;
- *)
+ if [[ $OSTYPE == (freebsd|dragonfly|netbsd)* || /$words[1] == */bmake* ]]; then
+ TARGETS+=(${=${(f)"$(_call_program targets "$words[1]" -s -f "$file" -V.ALLTARGETS 2> /dev/null)"}})
+ _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsdg1Fstdout -f "$file" .PHONY 2> /dev/null)
+ else
_make-parseMakefile $PWD < $file
- esac
+ fi
fi
fi
]]]
> > In current master (before your patch), the 'call-command' style is
> > consulted only for GNU make but not for FreeBSD. Do you know if that's
> > intentional, perhaps (going by the style's docs) because the GNU make
> > invocation has side-effects while the BSD make invocation has none?
>
> I'd expect the -n option to avoid side effects. Perhaps the reason is
> that the BSD make infrastructure is a lot different than GNU's and a
> single Makefile may not carry enough information by itself to generate
> good completion?
>
prev parent reply other threads:[~2016-10-16 16:36 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
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 [this message]
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=20161016163426.GA14121@fujitsu.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=baptiste.daroussin@gmail.com \
--cc=gmesalazar@gmail.com \
--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).