Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: RPM completion in dev19 and a suggested change to make completion



On Apr 7,  1:19pm, Francis GALIEGUE wrote:
} Subject: RPM completion in dev19 and a suggested change to make completion
}
} The other suggestion I have is to allow make completion to take GNU
} make in acknowledgement:
[...]
} With this, for example, make <TAB> in the kernel sources "sees" target
} bzImage while it doesn't see it in the original version. Comments?

Random pot-shot:  I think if the linux kernel build process is going to
rely on GNU make features, the Makefile ought to be named GNUmakefile
so that (a) other makes won't try to read it and (b) we could tell from
the file name whether to attempt "make -p" or the like.

However, given how unlikely it is that this will happen any time soon,
how about the following (not committed to SourceForge due to controversy).
Even if we don't use the "make -nsp ..." part, we should add "=" to the
characters that aren't allowed to appear before the ":" -- I found it
was completing assignments of the form

	WWW_HOME = http

(because "WWW_HOME = http://blahblahblah"; matched the pattern).

Index: Completion/User/_make
===================================================================
@@ -14,17 +14,23 @@
     file=Makefile
   elif [[ -e makefile ]]; then
     file=makefile
+  elif [[ -e GNUmakefile ]]; then
+    file=GNUmakefile
   else
     file=''
   fi
 
   if [[ -n "$file" ]] && _wanted targets; then
-    tmp=(
-          $(awk '/^[a-zA-Z0-9][^\/\t]+:/ {print $1}
+    if [[ "$words[CURRENT]" = *gmake ]] || grep '^include ' "$file" >&/dev/null; then
+      tmp=( $(make -nsp --no-print-directory -f "$file" | awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}' FS=:) )
+    else
+      tmp=(
+            $(awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}
  	      /^\.include  *<bsd\.port\.(subdir\.|pre\.)?mk>/ || /^\.include  *".*mk\/bsd\.pkg\.(subdir\.)?mk"/ {
  	        print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum" }' \
  	     FS=: $file)
-         )
+           )
+    fi
     _all_labels targets expl 'make target' compadd "$tmp[@]" && return 0
   fi
   compset -P 1 '*='

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author