aboutsummaryrefslogtreecommitdiff
path: root/backends/epoc/build/updateMMPs.pl
diff options
context:
space:
mode:
authorLars Persson2005-06-21 20:19:39 +0000
committerLars Persson2005-06-21 20:19:39 +0000
commit7bded41f194331f309388afa5a30035927655f5d (patch)
tree394c4111912f6bb328ef0c0669aa4f7e9335fe11 /backends/epoc/build/updateMMPs.pl
parentfd8c94a2f372e64593657b1d02776d208af62bd0 (diff)
downloadscummvm-rg350-7bded41f194331f309388afa5a30035927655f5d.tar.gz
scummvm-rg350-7bded41f194331f309388afa5a30035927655f5d.tar.bz2
scummvm-rg350-7bded41f194331f309388afa5a30035927655f5d.zip
This is the submission of the Epoc/Symbian build files for
UIQ 2.1 UI Series 60 Series 80 Series 90/Nokia 7710 There is a dependency on ESdl for these devices. svn-id: r18427
Diffstat (limited to 'backends/epoc/build/updateMMPs.pl')
-rw-r--r--backends/epoc/build/updateMMPs.pl156
1 files changed, 156 insertions, 0 deletions
diff --git a/backends/epoc/build/updateMMPs.pl b/backends/epoc/build/updateMMPs.pl
new file mode 100644
index 0000000000..fc7108c3e6
--- /dev/null
+++ b/backends/epoc/build/updateMMPs.pl
@@ -0,0 +1,156 @@
+
+use Cwd;
+
+print "
+=======================================================================================
+Preparing to update all the Symbian MMP project files with objects from module.mk files
+=======================================================================================
+
+";
+
+$buildDir = getcwd();
+chdir("../../../");
+
+my @std = (""); # section standard, no #ifdef
+#my @sec = ("", "DISABLE_SCUMM_7_8", "DISABLE_HE"); # sections for scumm DISABLED_s
+my @exc = ("mt32","fluidsynth"); # exclusions for sound
+
+#arseModule(mmpStr, dirStr, ifdefArray, [exclusionsArray])
+#ParseModule("_base", "base", \@std); # now in EScummVM_TRG.mmp, these never change anyways...
+ParseModule("_base", "common", \@std);
+ParseModule("_base", "gui", \@std);
+ParseModule("_base", "graphics", \@std);
+ParseModule("_base", "sound", \@std, \@exc);
+
+ParseModule("_scumm", "scumm", \@std); #\@sec # no more: enabled all again
+ParseModule("_queen", "queen", \@std);
+ParseModule("_simon", "simon", \@std);
+ParseModule("_sky", "sky", \@std);
+ParseModule("_gob", "gob", \@std);
+
+print "
+=======================================================================================
+Done. Enjoy :P
+=======================================================================================
+";
+# parses multiple sections per mmp/module
+sub ParseModule
+{
+ my ($mmp,$module,$sections,$exclusions) = @_;
+ my @sections = @{$sections};
+ my @exclusions = @{$exclusions};
+
+ foreach $section (@sections)
+ {
+ CheckForModuleMK($module, $section, @exclusions);
+ UpdateProjectFile($mmp, $module, $section);
+ }
+}
+
+# parses all module.mk files in a dir and its subdirs
+sub CheckForModuleMK
+{
+ my ($item,$section,@exclusions) = @_;
+
+ if (-d $item)
+ {
+ #print "$item\n";
+
+ opendir DIR, $item;
+ #my @Files = readdir DIR;
+ my @Files = grep s/^([^\.].*)$/$1/, readdir DIR;
+ closedir DIR;
+
+ foreach $entry (@Files)
+ {
+ CheckForModuleMK("$item/$entry", $section, @exclusions);
+ }
+ }
+
+ if (-f $item and $item =~ /.*\/module.mk$/)
+ {
+ my $sec = "";
+ my $secnum = 0;
+
+ print "Parsing $item for section '$section' ... ";
+
+ open FILE, $item;
+ my @lines = <FILE>;
+ close FILE;
+
+ my $count = @lines;
+ print "$count lines";
+
+ A: foreach $line (@lines)
+ {
+ # found a section? reset
+ if ($line =~ /^ifndef (.*)/)
+ {
+ $sec = $1;
+ }
+
+ # found an object? Not uncommented!
+ if (!($line =~ /^#/) && $line =~ s/\.o/.cpp/)
+ {
+ # handle this section?
+ if ($sec eq $section)
+ {
+ $line =~ s/^\s*//g; # remove possible leading whitespace
+ $line =~ s/ \\//; # remove possible trailing ' \'
+ $line =~ s/\//\\/g; # replace / with \
+ chop($line); # remove \n
+
+ # do we need to skip this file?
+ foreach $exclusion (@exclusions)
+ {
+ if ($line =~ /$exclusion/)
+ {
+ #print "\n !$line (excluded)";
+ next A;
+ }
+ }
+
+ $secnum++;
+ #print "\n $line";
+ $output .= "SOURCE $line\n";
+ }
+ }
+ }
+ print " -- $secnum objects selected\n";
+ }
+}
+
+# update an MMP project file with the new objects
+sub UpdateProjectFile
+{
+ my ($mmp,$module,$section) = @_;
+ my $n = "AUTO_OBJECTS_".uc($module)."_$section";
+ my $a = "\/\/START_$n\/\/";
+ my $b = "\/\/STOP_$n\/\/";
+ my $name = "scummvm$mmp.mmp";
+ my $file = "$buildDir/$name";
+ my $updated = " Updated @ ".localtime();
+
+ print " ===>Updating backends/epoc/build/$name @ $n ... ";
+
+ open FILE, "$file";
+ my @lines = <FILE>;
+ close FILE;
+
+# open FILE, ">$file~";
+# print FILE @lines;
+# close FILE;
+
+ my $onestr = join("",@lines);
+ $onestr =~ s/$a.*$b/$a$updated\n$output$b/s;
+
+ open FILE, ">$file";
+ print FILE $onestr;
+ close FILE;
+
+ print "done.\n";
+
+ $output = "";
+}
+
+ \ No newline at end of file