From eb027788cf6a073f54d48f9dad92d66bf1dbf53c Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 28 May 2012 11:32:10 +0200 Subject: tools/autoconf.pl: 2 enhancements * -y param to not ask for confirmation * detect - as well Change-Id: Ie63f5882560cd7c7ee1c00f153e756b8695d567f --- tools/autoconf.pl | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/tools/autoconf.pl b/tools/autoconf.pl index 3dae96502f..24efc5aaf3 100755 --- a/tools/autoconf.pl +++ b/tools/autoconf.pl @@ -41,15 +41,17 @@ sub doconfigure { } $command = "${srcdir}/configure --type=${type} --target=${target}"; %typenames = ("n" => "Normal", "s" => "Simulator", "b" => "Bootloader" ); - print "Rockbox autoconf: \n\tTarget: $target \n\tType: $typenames{$type} \nCorrect? [Y/n] "; - chomp($response = <>); - if ($response eq "") { - $response = "y"; - } - if ($response ne "y" && $response ne "Y") { - print "autoconf: Aborting\n"; - exit(0); - } + unless (@ARGV[0] eq "-y") { + print "Rockbox autoconf: \n\tTarget: $target \n\tType: $typenames{$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); } @@ -59,18 +61,22 @@ sub buildtype { $build = "s"; } elsif ($text eq "boot") { $build = "b"; - } else { + } elsif ($text eq "build") { $build = "n"; - } + } else { + $build = ""; + } return $build; } if ($test =~ /(.*)-(.*)/) { - $target = $1; - $build = buildtype($2); - doconfigure($target, $build); -} + if (buildtype($2)) { + doconfigure($1, buildtype($2)); + } elsif (buildtype($1)) { + doconfigure($2, buildtype($1)); + } +} elsif ($test =~ /(.*)/) { $target = $1; -- cgit v1.2.3