zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _make-parseMakefile: skip non-targets
@ 2019-08-22  6:59 Daniel Hahler
  0 siblings, 0 replies; only message in thread
From: Daniel Hahler @ 2019-08-22  6:59 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-22  7:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22  6:59 [PATCH] _make-parseMakefile: skip non-targets Daniel Hahler

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).