Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: compctl for Makefile targets?
- X-seq: zsh-users 898
- From: Peter Stephenson <pws@xxxxxx>
- To: zsh-users@xxxxxxxxxxxxxxx (Zsh users list), Hank Hughes <thigpen@xxxxxxxxxxx>
- Subject: Re: compctl for Makefile targets?
- Date: Fri, 13 Jun 1997 17:30:54 +0200
- In-reply-to: "Hank Hughes"'s message of "Fri, 13 Jun 1997 11:01:36 MET." <199706131501.LAA04129@xxxxxxxxxxxxxxxxxx>
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@xxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author