summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2010-06-30 16:39:28 +0000
committerFrank Gevaerts <frank@gevaerts.be>2010-06-30 16:39:28 +0000
commit40f33f0e308278548534260e3adf932a418238fa (patch)
treec33159f1d516c3e5e373c1a13c1b8dbab661146c
parent94aa0d741e8aadff243b6b88092df7b30c1bc6e4 (diff)
downloadrockbox-40f33f0e308278548534260e3adf932a418238fa.tar.gz
rockbox-40f33f0e308278548534260e3adf932a418238fa.zip
Fix a problem where multigcc.pl sometimes produces lines like "sh-elf-gcc: no input files", especially on systems with many cores and for builds with (relatively) few files. This happened because the slice size was rounded up, which meant that in some cases there werere leftover slices.
Also remove the now unnecessary cores>files checking. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27196 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xtools/multigcc.pl16
1 files changed, 7 insertions, 9 deletions
diff --git a/tools/multigcc.pl b/tools/multigcc.pl
index 5222f61b49..9be9978bd4 100755
--- a/tools/multigcc.pl
+++ b/tools/multigcc.pl
@@ -46,27 +46,25 @@ switch($^O) {
}
}
-# don't run empty children
-if (scalar @files <= $cores)
-{
- $cores = 1;
-}
-
# fork children
my @pids;
my $slice = int((scalar @files + $cores) / $cores);
-for my $i (0 .. $cores-1)
+
+# reset $cores to 0 so we can count the number of actually used cores
+$cores=0;
+
+for (my $i=0;$i<scalar @files;$i += $slice)
{
my $pid = fork;
if ($pid)
{
# mother
- $pids[$i] = $pid;
+ $pids[$cores++] = $pid;
}
else
{
# get my slice of the files
- my @list = @files[$i * $slice .. $i * $slice + $slice - 1];
+ my @list = @files[$i .. $i + $slice - 1];
# run command
system("$command @list > $tempfile.$$");