zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Hahler <genml+zsh-workers@thequod.de>
To: zsh-workers@zsh.org
Subject: [PATCH] _make-parseMakefile: skip non-targets
Date: Thu, 22 Aug 2019 08:59:29 +0200	[thread overview]
Message-ID: <20190822065929.16277-1-genml+zsh-workers@thequod.de> (raw)

From: Daniel Hahler <git@thequod.de>

These look like this, and might come from pattern rules ("%.res" in this
case):

    # Not a target:
    test_autocmd.res:
    #  Implicit rule search has not been done.
    #  Modification time never checked.
    #  File has not been updated.
---
 Completion/Unix/Command/_make | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index 38d0b0e76..695fc9907 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -69,7 +69,7 @@ _make-expandVars() {
 }
 
 _make-parseMakefile () {
-  local input var val target dep TAB=$'\t' tmp IFS=
+  local input var val target dep TAB=$'\t' tmp IFS= not_a_target=0
 
   while read input
   do
@@ -92,11 +92,20 @@ _make-parseMakefile () {
       VARIABLES[$var]=$val
       ;;
 
+      # Skip following TARGET: after "Not a target:" comment.
+      '# Not a target: ')
+      not_a_target=1
+      ;;
+
       # TARGET: dependencies
       # TARGET1 TARGET2 TARGET3: dependencies
       ([[*?[:alnum:]$][^$TAB:=%]#:[^=]*)
-      target=$(_make-expandVars ${input%%:*})
-      TARGETS+=( ${(z)target} )
+      if (( not_a_target )); then
+        not_a_target=0
+      else
+        target=$(_make-expandVars ${input%%:*})
+        TARGETS+=( ${(z)target} )
+      fi
       ;;
 
       # Include another makefile
-- 
2.23.0


                 reply	other threads:[~2019-08-22  7:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190822065929.16277-1-genml+zsh-workers@thequod.de \
    --to=genml+zsh-workers@thequod.de \
    --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).