summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2010-03-21 14:35:03 +0000
committerJens Arnold <amiconn@rockbox.org>2010-03-21 14:35:03 +0000
commitbe384e845129b677e70d877fe914f2cab0900abf (patch)
tree3b65e97ed335eefe35c6c0d1233be34caac427d0 /tools
parent18e7c1f4af9593bfd8ce8bfcd4b594ed7211b6e9 (diff)
downloadrockbox-be384e845129b677e70d877fe914f2cab0900abf.tar.gz
rockbox-be384e845129b677e70d877fe914f2cab0900abf.tar.bz2
rockbox-be384e845129b677e70d877fe914f2cab0900abf.zip
Make multigcc.pl actually use more than one core on OS X and opensolaris.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25274 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/multigcc.pl24
1 files changed, 20 insertions, 4 deletions
diff --git a/tools/multigcc.pl b/tools/multigcc.pl
index fbe7c17aae..5222f61b49 100755
--- a/tools/multigcc.pl
+++ b/tools/multigcc.pl
@@ -1,4 +1,5 @@
#!/usr/bin/perl
+use Switch;
use List::Util 'shuffle'; # standard from Perl 5.8 and later
my $tempfile = "multigcc.out";
@@ -24,10 +25,25 @@ my $command = join " ", @params;
@files = shuffle(@files);
# count number of cores
-my $cores = 1;
-if (open CPUINFO, "</proc/cpuinfo") {
- $cores = scalar grep /^processor/i, <CPUINFO>;
- close CPUINFO;
+my $cores;
+switch($^O) {
+ case "darwin" {
+ chomp($cores = `sysctl -n hw.ncpu`);
+ $cores = 1 if ($?);
+ }
+ case "solaris" {
+ $cores = scalar grep /on-line/i, `psrinfo`;
+ $cores = 1 if ($?);
+ }
+ else {
+ if (open CPUINFO, "</proc/cpuinfo") {
+ $cores = scalar grep /^processor/i, <CPUINFO>;
+ close CPUINFO;
+ }
+ else {
+ $cores = 1;
+ }
+ }
}
# don't run empty children