aboutsummaryrefslogtreecommitdiff
path: root/backends/epoc/build/updateMMPs.pl
diff options
context:
space:
mode:
Diffstat (limited to 'backends/epoc/build/updateMMPs.pl')
-rw-r--r--backends/epoc/build/updateMMPs.pl120
1 files changed, 110 insertions, 10 deletions
diff --git a/backends/epoc/build/updateMMPs.pl b/backends/epoc/build/updateMMPs.pl
index 648821889c..1b3ea77fb0 100644
--- a/backends/epoc/build/updateMMPs.pl
+++ b/backends/epoc/build/updateMMPs.pl
@@ -12,27 +12,44 @@ $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...
+#arseModule(mmpStr, dirStr, ifdefArray, [exclusionsArray])
+#ParseModule("_base", "base", \@std); # now in ./TRG/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("_scumm", "scumm", \@std);
ParseModule("_queen", "queen", \@std);
ParseModule("_simon", "simon", \@std);
ParseModule("_sky", "sky", \@std);
ParseModule("_gob", "gob", \@std);
-ParseModule("_saga", "saga", \@std);
+ParseModule("_saga", "saga", \@std);
+ParseModule("_kyra", "kyra", \@std);
+
+print "
+=======================================================================================
+Updating slave MACRO settings in MMP files from master 'scummvm_base.mmp'
+=======================================================================================
+
+";
+
+@mmp_files = ( "scummvm_scumm.mmp", "scummvm_queen.mmp", "scummvm_simon.mmp", "scummvm_sky.mmp", "scummvm_gob.mmp", "scummvm_saga.mmp", "scummvm_kyra.mmp",
+ "UIQ/EScummVM_UIQ.mmp", "S60/EScummVM_S60_EXE.mmp", "S80/EScummVM_S80.mmp", "S90/EScummVM_S90.mmp");
+
+UpdateSlaveMacros();
+
print "
=======================================================================================
Done. Enjoy :P
=======================================================================================
";
+
+##################################################################################################################
+##################################################################################################################
+
# parses multiple sections per mmp/module
sub ParseModule
{
@@ -47,6 +64,8 @@ sub ParseModule
}
}
+##################################################################################################################
+
# parses all module.mk files in a dir and its subdirs
sub CheckForModuleMK
{
@@ -120,6 +139,8 @@ sub CheckForModuleMK
}
}
+##################################################################################################################
+
# update an MMP project file with the new objects
sub UpdateProjectFile
{
@@ -137,10 +158,6 @@ sub UpdateProjectFile
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;
@@ -152,5 +169,88 @@ sub UpdateProjectFile
$output = "";
}
+
+##################################################################################################################
+
+sub UpdateSlaveMacros
+{
+ my $updated = " Updated @ ".localtime();
+
+ my $name = "scummvm_base.mmp";
+ my $file = "$buildDir/$name";
+ print "Reading master MACROS from backends/epoc/build/$name ... ";
+
+ open FILE, "$file";
+ my @lines = <FILE>;
+ close FILE;
+ my $onestr = join("",@lines);
+
+ my $n = "AUTO_MACROS_MASTER";
+ my $a = "\/\/START_$n\/\/";
+ my $b = "\/\/STOP_$n\/\/";
+ $onestr =~ /$a(.*)$b/s;
+ my $macros = $1;
- \ No newline at end of file
+ my $libs = "\n// automagically enabled static libs from macros above\n";
+ my $libZ = "STATICLIBRARY scummvm_base.lib // must be above USE_* .libs\n";
+ my $macro_counter = 0;
+ my $macros2 = "\n"; # output
+
+ foreach $line (split("\n", $macros))
+ {
+ # do we need to add a static .lib?
+ if ($line =~ /^.*MACRO\s*([A-Z_]*)\s*\/\/\s*LIB\:(.*)$/)
+ {
+ my $macro = $1; my $lib = $2;
+
+ # this macro enabled? then also add the .lib
+ if ($line =~ /^\s*MACRO\s*$macro/m)
+ {
+ $libZ .= "STATICLIBRARY $lib\n" if ($macro =~ /^USE_/);
+ }
+ else
+ {
+ $libs .= "STATICLIBRARY $lib\n" if ($macro =~ /^DISABLE_/);
+ }
+ $macro_counter++;
+ }
+ # no comment? add the macro
+ if ($line =~ /^\s*MACRO/)
+ {
+ $macros2 .= "$line\n";
+ }
+ }
+
+ print "$macro_counter macro lines.\n";
+
+ $n = "AUTO_MACROS_SLAVE";
+ $a = "\/\/START_$n\/\/";
+ $b = "\/\/STOP_$n\/\/";
+
+ foreach $name (@mmp_files)
+ {
+ $file = "$buildDir/$name";
+ print "Updating macros in backends/epoc/build/$name ... ";
+
+ open FILE, "$file";
+ @lines = <FILE>;
+ close FILE;
+
+ $onestr = join("",@lines);
+
+ # slash in name means it's a phone specific build file: add LIBs
+ my $libs2 = ""; # output
+ $libs2 .= "$libs$libZ" if ($name =~ /\//);
+
+ $onestr =~ s/$a.*$b/$a$updated$macros2$libs2$b/s;
+
+ open FILE, ">$file";
+ print FILE $onestr;
+ close FILE;
+
+ my $count = @lines;
+ print "wrote $count lines.\n";
+ }
+}
+
+##################################################################################################################