mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-14 23:46:10 +00:00
96bbf588b8
Submitted by: Yasuhiro Fukuma <yasuf@big.or.jp> in ports-jp ML #7987
48 lines
904 B
Plaintext
48 lines
904 B
Plaintext
exec /usr/bin/perl -Sx "$0" ${1+"$@"}
|
|
#! perl
|
|
|
|
$WRKSRC = $ENV{'WRKSRC'};
|
|
@MANSECS = split(/\s+/, $ENV{'MANSECS'});
|
|
|
|
for $sec (@MANSECS) {
|
|
print "===> Creating Makefile in man${sec}\n";
|
|
|
|
chdir "$WRKSRC/man$sec";
|
|
@manpages = ();
|
|
@mlinks = ();
|
|
|
|
for $manpage (<*.${sec}x>) {
|
|
open(F, $manpage) || die "cannot open $manpage: $!\n";
|
|
$_ = <F>;
|
|
chop;
|
|
close(F);
|
|
if (/^\.so /) {
|
|
($real = $') =~ s!^man./!!;
|
|
push(@mlinks, "$real\t$manpage");
|
|
}
|
|
else {
|
|
push(@manpages, $manpage);
|
|
}
|
|
}
|
|
|
|
open(MAKEFILE, '>Makefile');
|
|
|
|
if (@manpages) {
|
|
print MAKEFILE join("\t\\\n\t", "MAN${sec} =", sort @manpages);
|
|
print MAKEFILE "\n\n";
|
|
}
|
|
if (@mlinks) {
|
|
print MAKEFILE join("\t\\\n\t", "MLINKS =", sort @mlinks);
|
|
print MAKEFILE "\n\n";
|
|
}
|
|
|
|
print MAKEFILE <<EOF;
|
|
pages-list:
|
|
@\${ECHO} \${MAN${sec}} \${MLINKS}
|
|
|
|
.include <bsd.prog.mk>
|
|
EOF
|
|
|
|
close(MAKEFILE);
|
|
}
|