#!/usr/bin/perl
use File::Basename;
my $srcdir = dirname $0;
require "$srcdir/builds.pm";
my $builddir = `pwd`;
@dirs = split(/\//, $builddir);
$test = pop(@dirs);
sub doconfigure {
my ($target, $type) = @_;
if (!exists($builds{$target})) {
for $key (keys(%builds)) {
if ($key =~ $target) {
$target = $key;
last;
}
}
}
$command = "${srcdir}/configure --type=${type} --target=${target}";
print "autoconf: \n\tTarget: $target \n\tType: $type \nCorrect? [Y/n] ";
chomp($response = <>);
if ($response eq "") {
$response = "y";
}
if ($response ne "y" && $response ne "Y") {
print "autoconf: Aborting\n";
exit(0);
}
system($command);
}
sub buildtype {
my ($text) = @_;
if ($text eq "sim") {
$build = "s";
} elsif ($text eq "boot") {
$build = "b";
} else {
$build = "n";
}
return $build;
}
if ($test =~ /(.*)-(.*)/)
{
$target = $1;
$build = buildtype($2);
doconfigure($target, $build);
}
elsif ($test =~ /(.*)/)
{
$target = $1;
$build = buildtype(pop(@dirs));
doconfigure($target, $build);
}