zsh-users
 help / color / mirror / code / Atom feed
* compctl for Makefile targets?
@ 1997-06-13 15:01 Hank Hughes
  1997-06-13 15:30 ` Peter Stephenson
  1997-06-13 15:36 ` Vincent Lefevre
  0 siblings, 2 replies; 3+ messages in thread
From: Hank Hughes @ 1997-06-13 15:01 UTC (permalink / raw)
  To: zsh-users



	I noticed an example in with some documentation somewhere
	but it seemed incomplete so.... has anyone made a compctl
	for Makefile targets. I'm staring at a lot of software 
	installs, and rather than rewrite the wheel, I was wondering
	if "anyone out there" had one.


	Much appreciated,
	-Hank




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: compctl for Makefile targets?
  1997-06-13 15:01 compctl for Makefile targets? Hank Hughes
@ 1997-06-13 15:30 ` Peter Stephenson
  1997-06-13 15:36 ` Vincent Lefevre
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 1997-06-13 15:30 UTC (permalink / raw)
  To: Zsh users list, Hank Hughes

Hank Hughes wrote:
> 	I noticed an example in with some documentation somewhere
> 	but it seemed incomplete so.... has anyone made a compctl
> 	for Makefile targets.

I've been using a perl script to do this.  It mostly does the
business.


compctl -s '$(targets)' -x 'n[1,=]' -f -c -- + make


#!/usr/local/bin/perl -- -*-perl-*-

if ($ARGV[0] =~ /^-f(.*)$/) {
    shift;
    $mfile = $1 || shift;
}
((-f "Makefile")  &&  ($mfile = 'Makefile'))
    || ((-f 'makefile') && ($mfile = 'makefile'));

(-f $mfile) || exit(1);

open(STDIN, $mfile) || exit(1);

while(<STDIN>) {
    if (/:/) {
	s/\#.*$//;		# remove quotes
	next unless /:/;
	$_ = $`;
	next if /^\s*\./;	# .SUFFIXES, .c.o, etc.
	next if /\$/;		# $(OBJS): etc.

	foreach $word (split) {
	    $word{$word} = 1;
	}
    }
}

$, = "\n";
print keys(%word);

__END__

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: compctl for Makefile targets?
  1997-06-13 15:01 compctl for Makefile targets? Hank Hughes
  1997-06-13 15:30 ` Peter Stephenson
@ 1997-06-13 15:36 ` Vincent Lefevre
  1 sibling, 0 replies; 3+ messages in thread
From: Vincent Lefevre @ 1997-06-13 15:36 UTC (permalink / raw)
  To: zsh-users

On Fri, Jun 13, 1997 at 11:01:36AM -0400, Hank Hughes wrote:
> 	I noticed an example in with some documentation somewhere
> 	but it seemed incomplete so.... has anyone made a compctl
> 	for Makefile targets. I'm staring at a lot of software 
> 	installs, and rather than rewrite the wheel, I was wondering
> 	if "anyone out there" had one.

Here's mine:

replymake()
{
  if [[ -r Makefile ]] then
    reply=(`sed -n "s/^\([0-9A-Za-z_/.-]*\):.*/\1/p" Makefile`)
  else
    reply=()
  fi
}

compctl -K replymake -g '*.c(:r)' -x 'c[-1,-f][-1,-o][-1,-W]' -f - 'c[-1,-I][-1,-C],s[-I]' -g '*(/)' -- make

Of course, it can still be improved...

You can find other compctl in:
  http://www.ens-lyon.fr/~vlefevre/acorn/riscbsd/etc.zshrc

Comments are welcome...

-- 
Vincent Lefevre, vlefevre@ens-lyon.fr | Acorn Risc PC, StrongARM @ 202MHz
http://www.ens-lyon.fr/~vlefevre      | 20+1MB RAM, Eagle M2, TV + Teletext
PhD in Computer Science, 1st year     | Apple CD-300, SyQuest 270MB (SCSI)
-----------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-06-13 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-13 15:01 compctl for Makefile targets? Hank Hughes
1997-06-13 15:30 ` Peter Stephenson
1997-06-13 15:36 ` Vincent Lefevre

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