zsh-workers
 help / color / mirror / 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
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

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ http://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git