eval 'exec perl -S $0 ${1+"$@"}'
if 0;
$0 =~ s/^.*?(\w+)[\.\w+]*$/$1/;
my($SRCTOP,$thisdir,$srcdir,$BUILDTOP,$libgccpath,$STLIBOBJS) = @ARGV;
if (0) {
print STDERR "SRCTOP = $SRCTOP\n";
print STDERR "BUILDTOP = $BUILDTOP\n";
print STDERR "STLIBOBJS = $STLIBOBJS\n";
}
$libgccincdir = $libgccpath;
$libgccincdir =~ s,libgcc\.[^ ]*$,include,;
$libgccincdir = quotemeta($libgccincdir);
my(@ignoredirs) = ( $libgccincdir );
my($extrasuffixes) = ($STLIBOBJS ne "");
sub my_qm {
my($x) = @_;
$x = quotemeta($x);
$x =~ s,\\/,/,g;
return $x;
}
sub strrep {
my($old,$new,$s) = @_;
my($l) = "strrep('$old','$new','$s')";
my($out) = "";
while ($s ne "") {
my($i) = index($s, $old);
if ($i == -1) {
$out .= $s;
$s = "";
} else {
$out .= substr($s, 0, $i) . $new;
if (length($s) > $i + length($old)) {
$s = substr($s, $i + length($old));
} else {
$s = "";
}
}
}
return $out;
}
sub do_subs {
local($_) = @_;
s,\\$, \\,g; s, + \\$, \\,g;
s,//+,/,g; s, \./, ,g;
if ($extrasuffixes) {
s,^([a-zA-Z0-9_\-]*)\.o:,$1.so $1.po \$(OUTPRE)$1.\$(OBJEXT):,;
} else {
s,^([a-zA-Z0-9_\-]*)\.o:,\$(OUTPRE)$1.\$(OBJEXT):,;
}
my ($x);
foreach $x (@ignoredirs) {
s,$x/[^ ]* ,,g;
s,$x/[^ ]*$,,g;
}
my($srct) = $SRCTOP . "/";
$_ = strrep(" $srct", " \$(SRCTOP)/", $_);
while ($srct =~ m,/[a-z][a-zA-Z0-9_.\-]*/\.\./,) {
$srct =~ s,/[a-z][a-zA-Z0-9_.\-]*/\.\./,/,;
$_ = strrep(" $srct", " \$(SRCTOP)/", $_);
}
if ($thisdir eq ".") {
} else {
my($pat) = " \$(SRCTOP)/$thisdir/";
my($out) = " \$(srcdir)/";
$_ = strrep($pat, $out, $_);
while ($pat =~ m,/[a-z][a-zA-Z0-9_.\-]*/$,) {
$pat =~ s,/[a-z][a-zA-Z0-9_.\-]*/$,/,;
$out .= "../";
if ($pat ne " \$(SRCTOP)/") {
$_ = strrep($pat, $out, $_);
}
}
}
$_ = strrep(" $BUILDTOP/", " \$(BUILDTOP)/", $_);
return $_;
}
sub do_subs_2 {
local($_) = @_;
s/$/ /;
s/ */ /g;
s;/[^ ]*/tcl\.h ;;g;
s;/[^ ]*/tclDecls\.h ;;g;
s;/[^ ]*/tclPlatDecls\.h ;;g;
s;/os/usr/include/[^ ]* ;;g;
s;/usr/include/[^ ]* ;;g;
s;/usr/lib/[^ ]* ;;g;
while (m/\/[a-z][a-z0-9_.\-]*\/\.\.\//) {
s//\//g;
}
s;\$\(srcdir\)/([^ /]* );$1;g;
s;\$\(BUILDTOP\)/include/com_err.h ;\$(COM_ERR_DEPS) ;g;
s;\$\(BUILDTOP\)/include/ss/ss.h \$\(BUILDTOP\)/include/ss/ss_err.h ;\$(SS_DEPS) ;g;
s;\$\(BUILDTOP\)/include/db.h \$\(BUILDTOP\)/include/db-config.h ;\$(DB_DEPS) ;g;
$_ = &uniquify($_);
s;\$\(BUILDTOP\)/include/kerberosIV/krb_err.h ;\$(KRB_ERR_H_DEP) ;g;
s; *$;;g;
return $_;
}
sub uniquify {
local($_) = @_;
my(@sides) = split ": ", $_;
my($lhs) = "";
if ($ $lhs = $sides[0] . ": ";
$_ = $sides[1];
}
my(@words) = split " ", $_;
my($w);
my($result) = "";
my(%seen);
undef %seen;
foreach $w (sort { $a cmp $b; } @words) {
next if defined($seen{$w});
$seen{$w} = 1;
if ($result ne "") { $result .= " "; }
$result .= $w;
}
return $lhs . $result . " ";
}
sub split_lines {
local($_) = @_;
s/(.{50}[^ ]*) /$1 \\\n /g;
return $_ . "\n";
}
print <<EOH ;
EOH
my $buf = '';
while (<STDIN>) {
chop;
$_ = &do_subs($_);
if (m/\\$/) {
chop;
$buf .= $_;
} else {
$buf = &do_subs_2($buf . $_);
print &split_lines($buf);
$buf = '';
}
}
exit 0;