summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-09-28 13:44:56 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-09-28 13:44:56 +0000
commit4c385e6cb343f820f6b084bf6a8e43b63a41e179 (patch)
treec2776c605c47504eca2075aea0a1ed6ec1ff332c /tools
parent7b52f979124f81aa685135e24be2e11ebcac833b (diff)
downloadrockbox-4c385e6cb343f820f6b084bf6a8e43b63a41e179.tar.gz
rockbox-4c385e6cb343f820f6b084bf6a8e43b63a41e179.tar.bz2
rockbox-4c385e6cb343f820f6b084bf6a8e43b63a41e179.zip
Add a simple script to try to run configure with the correct target name/type based on the build directory name.
~/rockbox/.../e200 -> e200, normal ~/rockbox/.../e200-sim -> e200, sim build ~/rockbox/.../sim/e200 -> e200, sim build replace sim with "boot" for bootloader, falls back on normal if neither is given. Run this from inside the build dir just like you would tools/configure using the full shortname guarentees the correct match, as above e200 will work for sansae200.... asks for confirmation before doing anything. Add your folder structure if this doesnt work for your way of doing things git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28180 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/autoconf.pl79
1 files changed, 79 insertions, 0 deletions
diff --git a/tools/autoconf.pl b/tools/autoconf.pl
new file mode 100755
index 0000000000..3dae96502f
--- /dev/null
+++ b/tools/autoconf.pl
@@ -0,0 +1,79 @@
+#!/usr/bin/perl
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id$
+#
+
+# This program attempts to run configure with the correct build target
+# and type based on the pwd.
+# example: ~/rockbox/sansae200 is the build dir, it would run configure
+# for the sansae200 normal build target.
+# ~/rockbox/sansae200-sim for the e200 sim build (-boot for bootloader)
+# ~/rockbox/sim/sansae200 for e200 sim build. (replace sim with boot is also possible)
+# The full shortname is not required, each target name is checked and the first
+# possible match is used.
+
+# This script must be placed in the same directory as configure and builds.pm
+#
+
+use File::Basename;
+my $srcdir = dirname $0;
+require "$srcdir/builds.pm";
+
+my $builddir = `pwd`;
+my @dirs = split(/\//, $builddir);
+
+my $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}";
+ %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);
+ }
+ 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);
+}