sbsv1/abld/group/setupprj.bat
changeset 607 378360dbbdba
parent 599 fa7a3cc6effd
equal deleted inserted replaced
591:22486c9c7b15 607:378360dbbdba
       
     1 @REM Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 @REM All rights reserved.
       
     3 @REM This component and the accompanying materials are made available
       
     4 @REM under the terms of "Eclipse Public License v1.0"
       
     5 @REM which accompanies this distribution, and is available
       
     6 @REM at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 @REM
       
     8 @REM Initial Contributors:
       
     9 @REM Nokia Corporation - initial contribution.
       
    10 @REM 
       
    11 @REM Contributors:
       
    12 @REM
       
    13 @REM Description:
       
    14 @REM builds bld.bat files for subprojects within this component
       
    15 
       
    16 @if exist %0.bat perl -w -x %0.bat %1 %2 %3 %4 %5
       
    17 @if exist %0 perl -w -x %0 %1 %2 %3 %4 %5
       
    18 @GOTO End
       
    19 
       
    20 #!perl
       
    21 
       
    22 use strict;
       
    23 use Cwd;
       
    24 
       
    25 my $EPOCRoot;
       
    26 
       
    27 BEGIN {
       
    28 	$EPOCRoot = $ENV{EPOCROOT};
       
    29 	$EPOCRoot .= "\\" unless($EPOCRoot =~ /\\$/);
       
    30 	die "ERROR: Must set the EPOCROOT environment variable\n" if (!defined($EPOCRoot));
       
    31 	$EPOCRoot =~ s-/-\\-go;	# for those working with UNIX shells
       
    32 	die "ERROR: EPOCROOT must not be a UNC path\n" if ($EPOCRoot =~ /^\\\\/);
       
    33 	die "ERROR: EPOCROOT must end with a backslash\n" if ($EPOCRoot !~ /\\$/);
       
    34 	die "ERROR: EPOCROOT must specify an existing directory\n" if (!-d $EPOCRoot);
       
    35 }
       
    36 
       
    37 
       
    38 my $EPOCToolsPath="${EPOCRoot}epoc32\\tools";
       
    39 
       
    40 my $EPOCToolsConfigFilePath="${EPOCRoot}epoc32\\tools\\compilation_config";
       
    41 
       
    42 my $DocsPath="${EPOCRoot}epoc32\\EngDoc\\E32toolp";
       
    43 
       
    44 my $TemplateFilePath="${EPOCRoot}epoc32\\tools\\makefile_templates";
       
    45 
       
    46 my $ShellFilePath="${EPOCRoot}epoc32\\tools\\shell";
       
    47 
       
    48 my $BinFilePath="${EPOCRoot}epoc32\\tools";
       
    49 
       
    50 if (scalar @ARGV > 1) {
       
    51 	die "Too many arguments for setupprj.bat\n";
       
    52 }
       
    53 
       
    54 # only the secure platform is now supported, but keep the argument
       
    55 # checking as insurance against future developments.
       
    56 #
       
    57 my $secure = 1;
       
    58 if (scalar @ARGV == 1) {
       
    59 	my $option = $ARGV[0];
       
    60 	if ($option !~ /^secure$/i) {
       
    61 		die "Unknown option $ARGV[0] - did you mean \"secure\"?\n";
       
    62 	}
       
    63 }
       
    64 
       
    65 my $GroupDir=$0;  # $0 is this script
       
    66 $GroupDir=~s-^\w:(.*)$-$1-o;  # remove drive letter
       
    67 $GroupDir=~s-\/-\\-go;
       
    68 unless ($GroupDir=~m-^\\-o)
       
    69 	{
       
    70 	# $GroupDir is relative
       
    71 	my $Cwd=cwd();
       
    72 	$Cwd=~s-^\w:(.*)$-$1-o;  # remove drive letter
       
    73 	$Cwd=~s-\/-\\-go;
       
    74 	$Cwd=~s-^\\$--o;  # make sure we don't end in a backslash
       
    75 	$GroupDir="$Cwd\\$GroupDir";  # append relative group dir to absolute Cwd
       
    76 	}
       
    77 $GroupDir=~s-^(.*\\)[^\\]+$-$1-o; # remove filename, leaving just path
       
    78 # strip the resulting path of excess occurrences of . and ..
       
    79 while ($GroupDir=~s-\\\.\\-\\-go) { }
       
    80 while ($GroupDir=~s-\\(?!\.{2}\\)[^\\]*\\\.{2}(?=\\)--go) { }
       
    81 
       
    82 $GroupDir=~s-\\$--o;	# remove trailing backslash
       
    83 chdir "$GroupDir" or die "Can't cd to $GroupDir: $!\n";
       
    84 
       
    85 my %Files=();
       
    86 
       
    87 # read the component
       
    88 opendir E32TOOLP, ".." or die "ERROR: Can't open dir ..\n";
       
    89 my $SubDir;
       
    90 foreach $SubDir (grep /^[^\.]/o, map lc $_, readdir E32TOOLP) {
       
    91 	if ($SubDir!~/^(group|doc|test|binutils|maksym)$/o) {
       
    92 		opendir SUBDIR, "..\\$SubDir" or die "ERROR: Can't open dir \"..\\$SubDir\"\n";
       
    93 		my @FileList = map lc $_, readdir SUBDIR;
       
    94 		foreach my $file (grep /^[^_\.].+\.(pm|pl|bat|cmd|config|bsf|xml|cwlink|txt)$/o, @FileList) {
       
    95 			$Files{$file} = "$SubDir\\$file";
       
    96 		}
       
    97 		if ($secure) {
       
    98 			# Look for additional files whose names start with _secure_
       
    99 			my @securefiles = grep /^_secure_.+\.(pm|pl|bat|cmd|config|bsf|xml|cwlink|txt)$/o, @FileList;
       
   100 			foreach my $file (@securefiles) {
       
   101 				my $dstfile = $file;
       
   102 				$dstfile =~ s/^_secure_//;
       
   103 				if (defined($Files{$dstfile})) {
       
   104 					print "$dstfile: $SubDir\\$file overrides $Files{$dstfile}\n";
       
   105 				}
       
   106 				$Files{$dstfile} = "$SubDir\\$file";
       
   107 			}
       
   108 		}
       
   109 	}
       
   110 }
       
   111 
       
   112 # read the compiler configuration files
       
   113 my @ConfigFiles;
       
   114 
       
   115 opendir CONFIGDIR, "..\\platform" or die "ERROR: Can't open dir \"..\\platform\"\n";
       
   116 @ConfigFiles = grep /\.(mk|make)/i, readdir CONFIGDIR;
       
   117 
       
   118 closedir CONFIGDIR;
       
   119 
       
   120 opendir SUBDIR, "..\\doc" or die "ERROR: Can't open dir \"..\\doc\"\n";
       
   121 my @Docs = map lc $_, readdir SUBDIR;
       
   122 @Docs = grep /^[^\.].+\.(rtf|doc|changes|txt|html|htm)$/o, @Docs;
       
   123 	
       
   124 closedir SUBDIR;	
       
   125 
       
   126 open TEMPLATEFILESUBDIR, "\"dir \/s \/b \/a-d ..\\..\\buildsystem\\extension\" |";
       
   127 my @TemplateFiles=();
       
   128 my %TemplateDirs;
       
   129 while (<TEMPLATEFILESUBDIR>)
       
   130 	{
       
   131 	next if ($_ !~ /\.(mk|meta)$/i);	
       
   132 	$_ =~ s/^.*\\buildsystem\\extension\\//i;
       
   133 	chomp $_;
       
   134 	push @TemplateFiles, $_;
       
   135 	$_ =~ /^(.*\\)/o;
       
   136 	my $path = $1;
       
   137 	$path =~ s/\\$//;
       
   138 	$TemplateDirs{$path}=1;	
       
   139 	}
       
   140 close TEMPLATEFILESUBDIR;
       
   141 
       
   142 opendir SHELLFILESUBDIR, "..\\..\\buildsystem\\shell" or die "ERROR: Can't open dir \"..\\..\\buildsystem\\shell\"\n";
       
   143 my @ShellFiles = map lc $_, readdir SHELLFILESUBDIR;
       
   144 @ShellFiles = grep /^[^\.].+\.(mk)$/o, @ShellFiles;
       
   145 closedir SHELLFILESUBDIR;
       
   146 
       
   147 open BINFILESUBDIR, "\"dir \/s \/b \/a-d ..\\..\\buildsystem\\bin\" |";
       
   148 my @BinFiles=();
       
   149 my %BinDirs;
       
   150 while (<BINFILESUBDIR>)
       
   151     	{
       
   152     	next if ($_ !~ /\.(exe|jar)$/i);	
       
   153     	$_ =~ s/^.*\\buildsystem\\bin\\//i;
       
   154     	chomp $_;
       
   155     	push @BinFiles, $_;
       
   156     	$_ =~ /^(.*\\)/o;
       
   157     	my $path = $1;
       
   158     	$path =~ s/\\$//;
       
   159     	$BinDirs{$path}=1;	
       
   160     	}
       
   161 close BINFILESUBDIR;
       
   162 
       
   163 my $PrintGroupDir=$GroupDir;
       
   164 $PrintGroupDir=~s-\\-\\\\-go;
       
   165 
       
   166 # Create BLD.BAT
       
   167 my $OutTxt='';
       
   168 &Output(
       
   169 	"\@echo off\n",
       
   170 	"\@goto invoke\n",
       
   171 	"\n",
       
   172 	"#!perl\n",
       
   173 	"unless (\@ARGV==1 && \$ARGV[0]=~/^(deb|rel|clean|releasables)\$/io) {\n",
       
   174 	"	die\n",
       
   175 	"		\"E32TOOLP's bld.bat - usage\\n\",\n",
       
   176 	"		\"BLD [param]\\n\",\n",
       
   177 	"		\"where\\n\",\n",
       
   178 	"		\"param = DEB or REL or CLEAN\\n\"\n",
       
   179 	"	;\n",
       
   180 	"}\n",
       
   181 	"my \$Param=lc \$ARGV[0];\n",
       
   182 	"chdir \"$PrintGroupDir\";\n",
       
   183 	"if (\$Param =~ /releasables/i)\n",
       
   184 	"{\n",
       
   185 	"open PIPE, \"..\\\\..\\\\make-abld\\\\make -s -f e32toolp.make \$Param |\" or die \"Can't invoke make: \$!\\n\";\n",
       
   186 	"while (<PIPE>) { print \$_; }\n",
       
   187 	"close PIPE;\n",
       
   188 	"\n",
       
   189 	"exit;\n",
       
   190 	"}\n",
       
   191 	"print \"..\\\\..\\\\make-abld\\\\make -s -f e32toolp.make \$Param\\n\";\n",
       
   192 	"open PIPE, \"..\\\\..\\\\make-abld\\\\make -s -f e32toolp.make \$Param |\" or die \"Can't invoke make: \$!\\n\";\n",
       
   193 	"while (<PIPE>) { }\n",
       
   194 	"close PIPE;\n",
       
   195 	"\n",
       
   196 	"__END__\n",
       
   197 	"\n",
       
   198 	":invoke\n",
       
   199 	"perl -x $GroupDir\\bld.bat %1 %2\n"
       
   200 );
       
   201 	
       
   202 my $BLDFILE='bld.bat';
       
   203 print "Creating File \"$BLDFILE\"\n";
       
   204 open BLDFILE,">$BLDFILE" or die "\nERROR: Can't open or create Batch file \"$BLDFILE\"\n";
       
   205 print BLDFILE "$OutTxt" or die "\nERROR: Can't write output to Batch file \"$BLDFILE\"\n";
       
   206 close BLDFILE or die "\nERROR: Can't close Batch file \"$BLDFILE\"\n";
       
   207 
       
   208 
       
   209 # Create the make file
       
   210 $OutTxt='';
       
   211 &Output(
       
   212 	"\n",
       
   213 	"ifeq (\$(OS),Windows_NT)\n",
       
   214 	"ERASE = \@erase 2>>nul\n",
       
   215 	"else\n",
       
   216 	"ERASE = \@erase\n",
       
   217 	"endif\n",
       
   218 	"\n",
       
   219 	"\n",
       
   220 	"$EPOCToolsPath :\n",
       
   221 	"\t\@perl -w ..\\genutil\\emkdir.pl $EPOCToolsPath\n", 
       
   222 	"\n",
       
   223 	"$TemplateFilePath :\n",
       
   224 	"\t\@perl -w ..\\genutil\\emkdir.pl $TemplateFilePath\n", 
       
   225 	"\n"
       
   226 );
       
   227 
       
   228 foreach (sort keys %TemplateDirs) {
       
   229 	&Output(
       
   230 	"$TemplateFilePath\\$_ :\n",
       
   231 	"\t\@perl -w ..\\genutil\\emkdir.pl $TemplateFilePath\\$_\n", 
       
   232 	"\n"
       
   233 	);
       
   234 }
       
   235 
       
   236 foreach (sort keys %BinDirs) {
       
   237  	&Output(
       
   238  	"$BinFilePath\\$_ :\n",
       
   239  	"\t\@perl -w ..\\genutil\\emkdir.pl $BinFilePath\\$_\n", 
       
   240  	"\n"
       
   241  	);
       
   242 }
       
   243 
       
   244 &Output(
       
   245 	"$ShellFilePath :\n",
       
   246 	"\t\@perl -w ..\\genutil\\emkdir.pl $ShellFilePath\n", 
       
   247 	"\n",
       
   248 	"$EPOCToolsConfigFilePath :\n",
       
   249 	"\t\@perl -w ..\\genutil\\emkdir.pl $EPOCToolsConfigFilePath\n", 
       
   250 	"\n",
       
   251 	"$DocsPath :\n",
       
   252 	"\t\@perl -w ..\\genutil\\emkdir.pl $DocsPath\n", 
       
   253 	"\n",
       
   254 	"\n",
       
   255 	"deb : $EPOCToolsPath $EPOCToolsConfigFilePath $DocsPath $TemplateFilePath $ShellFilePath "
       
   256 );
       
   257 
       
   258 foreach (sort keys %TemplateDirs) {
       
   259 	&Output(
       
   260 	"$TemplateFilePath\\$_ "
       
   261 	);
       
   262 }
       
   263 
       
   264 foreach (sort keys %BinDirs) {
       
   265  	&Output(
       
   266  	"$BinFilePath\\$_ "
       
   267  	);
       
   268 }
       
   269 
       
   270 &Output("\n");
       
   271 
       
   272 my $File;
       
   273 foreach $File (keys %Files) {
       
   274 	&Output(
       
   275 		"\tcopy \"..\\$Files{$File}\" \"$EPOCToolsPath\\$File\" >nul\n"
       
   276 	);
       
   277 }
       
   278 
       
   279 my $ConfigFile;
       
   280 foreach $ConfigFile (@ConfigFiles) {
       
   281 	&Output(
       
   282 		"\tcopy \"..\\platform\\$ConfigFile\" \"$EPOCToolsConfigFilePath\\$ConfigFile\" >nul\n"
       
   283 	);
       
   284 }
       
   285 
       
   286 foreach $File (@Docs) {
       
   287 	&Output(
       
   288 			"\tcopy \"..\\doc\\$File\" \"$DocsPath\\$File\" >nul\n"
       
   289 	);
       
   290 }
       
   291 
       
   292 my $tfile;
       
   293 foreach $tfile (@TemplateFiles) {
       
   294 	&Output(
       
   295 			"\tcopy \"..\\..\\buildsystem\\extension\\$tfile\" \"$TemplateFilePath\\$tfile\" >nul\n"
       
   296 	);
       
   297 }
       
   298 
       
   299 my $bfile;
       
   300 foreach $bfile (@BinFiles) {
       
   301  	&Output(
       
   302  			"\tcopy \"..\\..\\buildsystem\\bin\\$bfile\" \"$BinFilePath\\$bfile\" >nul\n"
       
   303  	);
       
   304 }
       
   305 
       
   306 my $sfile;
       
   307 foreach $sfile (@ShellFiles) {
       
   308 	&Output(
       
   309 			"\tcopy \"..\\..\\buildsystem\\shell\\$sfile\" \"$ShellFilePath\\$sfile\" >nul\n"
       
   310 	);
       
   311 }
       
   312 
       
   313 &Output(
       
   314 	"\n",
       
   315 	"\n",
       
   316 	"rel : $EPOCToolsPath $EPOCToolsConfigFilePath $DocsPath $TemplateFilePath $ShellFilePath "
       
   317 );
       
   318 
       
   319 foreach (sort keys %TemplateDirs) {
       
   320 	&Output(
       
   321 	"$TemplateFilePath\\$_ "
       
   322 	);
       
   323 }
       
   324 
       
   325 foreach (sort keys %BinDirs) {
       
   326  	&Output(
       
   327  	"$BinFilePath\\$_ "
       
   328  	);
       
   329 }
       
   330 
       
   331 &Output("\n");
       
   332 
       
   333 	
       
   334 foreach $File (keys %Files) {
       
   335 	&Output(
       
   336 		"\t.\\perlprep.bat \"..\\$Files{$File}\" \"$EPOCToolsPath\\$File\"\n"
       
   337 	);
       
   338 }
       
   339 
       
   340 foreach $ConfigFile (@ConfigFiles) {
       
   341 	&Output(
       
   342 		"\tcopy \"..\\platform\\$ConfigFile\" \"$EPOCToolsConfigFilePath\\$ConfigFile\" >nul\n"
       
   343 	);
       
   344 }
       
   345 
       
   346 foreach $File (@Docs) {
       
   347 	&Output(
       
   348 			"\tcopy \"..\\doc\\$File\" \"$DocsPath\\$File\" >nul\n"
       
   349 	);
       
   350 }
       
   351 
       
   352 foreach $tfile (@TemplateFiles) {
       
   353 	&Output(
       
   354 			"\tcopy \"..\\..\\buildsystem\\extension\\$tfile\" \"$TemplateFilePath\\$tfile\" >nul\n"
       
   355 	);
       
   356 }
       
   357 foreach $bfile (@BinFiles) {
       
   358  	&Output(
       
   359  			"\tcopy \"..\\..\\buildsystem\\bin\\$bfile\" \"$BinFilePath\\$bfile\" >nul\n"
       
   360  	);
       
   361 }
       
   362 foreach $sfile (@ShellFiles) {
       
   363 	&Output(
       
   364 			"\tcopy \"..\\..\\buildsystem\\shell\\$sfile\" \"$ShellFilePath\\$sfile\" >nul\n"
       
   365 	);
       
   366 }
       
   367 &Output(
       
   368 	"\n",
       
   369 	"rel deb : $EPOCToolsPath\\make.exe\n",
       
   370 	"$EPOCToolsPath\\make.exe: ..\\..\\make-abld\\make.exe\n",
       
   371 	"\tcopy \$\? \$\@\n"
       
   372 );
       
   373 
       
   374 &Output(
       
   375 	"\n",
       
   376 	"rel deb : $EPOCToolsPath\\scpp.exe\n",
       
   377 	"$EPOCToolsPath\\scpp.exe: ..\\..\\scpp-abld\\scpp.exe\n",
       
   378 	"\tcopy \$\? \$\@\n"
       
   379 );
       
   380 
       
   381 
       
   382 &Output(
       
   383 	"\n",
       
   384 	"clean :\n"
       
   385 );
       
   386 foreach $File (keys %Files) {
       
   387 	&Output(
       
   388 		"\t-\$(ERASE) \"$EPOCToolsPath\\$File\"\n"
       
   389 	);
       
   390 }
       
   391 foreach $ConfigFile (@ConfigFiles) {
       
   392 	&Output(
       
   393 		"\t-\$(ERASE) \"$EPOCToolsConfigFilePath\\$ConfigFile\"\n"
       
   394 	);
       
   395 }
       
   396 foreach $File (@Docs) {
       
   397 	&Output(
       
   398 			"\t-\$(ERASE) \"$DocsPath\\$File\"\n"
       
   399 	);
       
   400 }
       
   401 foreach $tfile (@TemplateFiles) {
       
   402 	&Output(
       
   403 			"\t-\$(ERASE) \"$TemplateFilePath\\$tfile\"\n"
       
   404 	);
       
   405 }
       
   406 foreach $bfile (@BinFiles) {
       
   407  	&Output(
       
   408  			"\t-\$(ERASE) \"$BinFilePath\\$bfile\"\n"
       
   409  	);
       
   410 }
       
   411 foreach $sfile (@ShellFiles) {
       
   412 	&Output(
       
   413 			"\t-\$(ERASE) \"$ShellFilePath\\$sfile\"\n"
       
   414 	);
       
   415 }
       
   416 
       
   417 &Output(
       
   418 	"\n",
       
   419 	"releasables :\n"
       
   420 );
       
   421 foreach $File (keys %Files) {
       
   422 	&Output(
       
   423 		"\t\@echo $EPOCToolsPath\\$File\n"
       
   424 	);
       
   425 }
       
   426 foreach $ConfigFile (@ConfigFiles) {
       
   427 	&Output(
       
   428 		"\t\@echo $EPOCToolsConfigFilePath\\$ConfigFile\n"
       
   429 	);
       
   430 }
       
   431 foreach $File (@Docs) {
       
   432 	&Output(
       
   433 			"\t\@echo $DocsPath\\$File\n"
       
   434 	);
       
   435 }
       
   436 foreach $tfile (@TemplateFiles) {
       
   437 	&Output(
       
   438 			"\t\@echo $TemplateFilePath\\$tfile\n"
       
   439 	);
       
   440 }
       
   441 foreach $bfile (@BinFiles) {
       
   442  	&Output(
       
   443  			"\t\@echo $BinFilePath\\$bfile\n"
       
   444  	);
       
   445 }
       
   446 foreach $sfile (@ShellFiles) {
       
   447 	&Output(
       
   448 			"\t\@echo $ShellFilePath\\$sfile\n"
       
   449 	);
       
   450 }
       
   451 
       
   452 my $MAKEFILE="e32toolp.make";
       
   453 print "Creating File \"$MAKEFILE\"\n";
       
   454 open MAKEFILE,">$MAKEFILE" or die "\nERROR: Can't open or create Batch file \"$MAKEFILE\"\n";
       
   455 print MAKEFILE "$OutTxt" or die "\nERROR: Can't write output to Batch file \"$MAKEFILE\"\n";
       
   456 close MAKEFILE or die "\nERROR: Can't close Batch file \"$MAKEFILE\"\n";
       
   457 
       
   458 
       
   459 
       
   460 # this code autocreates the .rel file
       
   461 
       
   462 my @ToolsDst = ("make.exe", "scpp.exe");
       
   463 my @DocsDst = @Docs;
       
   464 my @ConfigFilesDst = @ConfigFiles;
       
   465 my @TemplateFilesDst = @TemplateFiles;
       
   466 my @BinFilesDst = @BinFiles;
       
   467 my @ShellFilesDst = @ShellFiles;
       
   468 
       
   469 push @ToolsDst, keys %Files;
       
   470 
       
   471 # TOOLS.REL file 
       
   472 
       
   473 my $RELFILE="tools.rel";
       
   474 print "Creating File \"$RELFILE\"\n";
       
   475 open RELFILE,">$RELFILE" or die "\nERROR: Can't open or create Rel file \"$RELFILE\"\n";
       
   476 print RELFILE "${EPOCRoot}epoc32\\tools\\";
       
   477 print RELFILE join("\n${EPOCRoot}epoc32\\tools\\", sort @ToolsDst);
       
   478 print RELFILE join("\n${EPOCRoot}epoc32\\tools\\compilation_config\\","", sort @ConfigFilesDst);
       
   479 print RELFILE join("\n${EPOCRoot}epoc32\\EngDoc\\E32toolp\\","", sort @DocsDst);
       
   480 close RELFILE or die "\nERROR: Can't close Rel file \"$RELFILE\"\n";
       
   481 
       
   482 # Check MRP file - the modern equivalent of tools.rel
       
   483 
       
   484 my $NewMRPText = "component tools_e32toolp\n";
       
   485 $NewMRPText .= "# This file is generated by setupprj.bat\n\n";
       
   486 $NewMRPText .= "ipr T\n";
       
   487 $NewMRPText .= "ipr O  \\sf\\os\\buildtools\\sbsv1_os\\e32toolp\\binutils\n\n";
       
   488 $NewMRPText .= "source \\sf\\os\\buildtools\\sbsv1_os\\e32toolp\n";
       
   489 $NewMRPText .= "source \\sf\\os\\buildtools\\toolsandutils\\buildsystem\n";
       
   490 $NewMRPText .= join("\nbinary \\epoc32\\tools\\", "",sort @ToolsDst);
       
   491 # Don't include EngDoc files in the MRP file
       
   492 $NewMRPText .= join("\nbinary \\epoc32\\tools\\compilation_config\\","", sort @ConfigFilesDst);
       
   493 $NewMRPText .= join("\nbinary \\epoc32\\tools\\makefile_templates\\","", sort @TemplateFilesDst);
       
   494 $NewMRPText .= join("\nbinary \\epoc32\\tools\\","", sort @BinFilesDst);
       
   495 $NewMRPText .= join("\nbinary \\epoc32\\tools\\shell\\","", sort @ShellFilesDst);
       
   496 $NewMRPText .= "\n\n";
       
   497 $NewMRPText .= "notes_source \\component_defs\\release.src\n";
       
   498 
       
   499 my $MRPFILE="abld.mrp";
       
   500 open MRPFILE,"<$MRPFILE" or die "\nERROR: Can't read MRP file \"$MRPFILE\"\n";
       
   501 my $OldMRPText = "";
       
   502 sysread MRPFILE, $OldMRPText, 100000;	# assumes MRP file is less than 100,000 bytes
       
   503 close MRPFILE or die "\nERROR: Can't close MRP file \"$MRPFILE\"\n";
       
   504 
       
   505 if ($OldMRPText ne $NewMRPText) {
       
   506 	print "REMARK: MRP file \"$MRPFILE\" differs from setupprj.bat generated content\n";
       
   507 	print "Creating suggested new MRP file \"$MRPFILE.new\"\n";
       
   508 	open MRPFILE,">$MRPFILE.new" or die "\nERROR: Can't open or create MRP file \"$MRPFILE.new\"\n";
       
   509 	print MRPFILE $NewMRPText;
       
   510 	close MRPFILE or die "\nERROR: Can't close MRP file \"$MRPFILE.new\"\n";
       
   511 }
       
   512 
       
   513 
       
   514 # SUBROUTINE SECTION
       
   515 ####################
       
   516 sub Output (@) {
       
   517 	my $Txt;
       
   518 	foreach $Txt (@_) {
       
   519 		$OutTxt.=$Txt;
       
   520 	}
       
   521 }
       
   522 
       
   523 sub UpToRoot ($) {	#args: $_[0] Abs FilePath/Path
       
   524 # return the path that will lead from the directory the path passed into the function
       
   525 # specifies back up to the root directory
       
   526 	return undef unless $_[0]=~m-^\\-o;
       
   527 	my $Path=$_[0];
       
   528 	my $UpP;
       
   529 	while ($Path=~m-\\-go)
       
   530 		{
       
   531 		$UpP.="..\\";
       
   532 		}
       
   533 	undef $Path;
       
   534 	$UpP=~s-^(.*)\.\.\\-$1-o;
       
   535 	$UpP=".\\" unless $UpP;
       
   536 }
       
   537 
       
   538 
       
   539 
       
   540 __END__
       
   541 
       
   542 :End