From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26992 invoked by alias); 16 Oct 2016 16:36:18 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39654 Received: (qmail 1728 invoked from network); 16 Oct 2016 16:36:17 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.25):SA:0(0.0/5.0):. Processed in 0.463941 secs); 16 Oct 2016 16:36:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=/NHZAktMhR6KFeQkauQa4awMb7Q=; b=IWXw1F DVq90aGxnjz+1ZLyRqEvjJ2u83v+SedQ6Ju1VvkgEbBgE1O+k6kpXixQJ3lPff5W Fn8bkbV2DtQzlnylFkRITHpANvJKlak8CAe43zVkihAzbY74z3d9g4DY1vxK6ZF/ W6Q361aD35sJGGNc/k0/UcwqKJ2z7jIMDWSjw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=/NHZAktMhR6KFeQkauQa4awMb7Q=; b=n+4wP 7P8Ac2+9iRirVxH+IQpBcG7pKR+QX5HWNoQxEgvEnDeQEpP+YhTjA9nKJLflzJ+p ioN1xzVU/ZyQa/luXIl6Tp9V89MHn3D9IwN0Xj3zymKAlrq0D1CeU1RD7I9bJFdp N3HHznAMWMbvU2Dr6ACI2GriVxuSCOO/BTZ/yo= X-Sasl-enc: rSUSNYng+MzDCWU/iqSoB6ta5T6AKAbwBkgQzGLiO9RK 1476635772 Date: Sun, 16 Oct 2016 16:34:26 +0000 From: Daniel Shahaf To: Guilherme Salazar Cc: zsh-workers@zsh.org, Baptiste Daroussin Subject: Re: zsh make(1) completion on FreeBSD Message-ID: <20161016163426.GA14121@fujitsu.shahaf.local2> References: <20161011212150.GA24484@fujitsu.shahaf.local2> <20161012000249.GA32367@fujitsu.shahaf.local2> <20161012003606.GB32367@fujitsu.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) 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? >