[Bash-completion-devel] Improve make target completion

Tristan Wibberley tristan.wibberley at gmail.com
Sat Sep 1 08:14:41 UTC 2012


Hello bash completion team.

Forwarding my changes to the team now that I discovered there is a
mailling list for this.

Please consider applying the attached git commits for bash-completion for make.

attachments:
  commit-aef2ee - converts make completion to use more metadata for
better results
  commit-6d1b6d9 - simplifies regex, adds more exclusions
  commit-d05dbbc - scalability and speed + incremental completions.

The commits against
http://anonscm.debian.org/gitweb/?p=bash-completion/bash-completion.git
improve bash completion for make by replacing the processing command
for the output of make -np

This lists all explicit targets, no intermediates, and no source files.

For an automake project like gcc there is almost no difference in
output completions. For gcc's generated makefile a couple of
completions are not proposed in this version which are proposed by the
existing version and these are not buildable targets in that project's
make system.

Performance even for small makefiles like gcc's is improved.

For makefiles with .INTERMEDIATE targets properly marked up then
generated deps rules, targets of those deps and intermediate files do
not get listed thus the patch avoids suggesting most of the targets a
user doesn't want.

For the linux kernel makefiles, completion time is reduced to one
quarter of the time to process the makefiles, nearly halving the
latency while returning most useful targets (taking the list from 88
to four digits) and keeping the number of suggestions small (taking
the first round of suggestions up to the first slash from 88 to 100 or
so because it supports incremental completion where targets are in
subdirectories.).

For a makefile such as the example at
http://codeshot.blogspot.co.uk/2012/08/this-is-program-that-lists-targets-in.html
the improvement is dramatic. When I create 4 empty files named
test/a.cc test/b.cc test/c.cc test/d.cc in a subfolder "test" below
that Makefile this version of make target completion generates 14
useful user targets and no source files vs 2 useful targets and 5
source files for the existing bash completion awk expression.

--
Regards,
Tristan Wibberley
-------------- next part --------------
A non-text attachment was scrubbed...
Name: commit-d05dbbc
Type: application/octet-stream
Size: 6419 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20120901/838bd37a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: commit-aef2eee
Type: application/octet-stream
Size: 2460 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20120901/838bd37a/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: commit-6d1b6d9
Type: application/octet-stream
Size: 3645 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20120901/838bd37a/attachment-0002.obj>


More information about the Bash-completion-devel mailing list