sbsv1/abld/platform/cl_arm.pm
changeset 607 378360dbbdba
parent 599 fa7a3cc6effd
child 631 9435b9008a58
equal deleted inserted replaced
591:22486c9c7b15 607:378360dbbdba
       
     1 # Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 #
       
    15 
       
    16 
       
    17 package Cl_arm;
       
    18 
       
    19 my $ToolPrefix='';
       
    20 my %PlatOpt=(
       
    21 	'Dlltool'=>'',
       
    22 	'Entry'=>'-e',
       
    23 	'Ld'=>'',
       
    24 	'Elftran'=>'',
       
    25 );
       
    26 
       
    27 # takes an 'expression'  to evaluate with $_ bound to each of the 
       
    28 # remaining args
       
    29 sub PrintList
       
    30 {
       
    31     my $expr = shift @_;
       
    32     foreach (@_) {
       
    33 	my $str = eval($expr);
       
    34 	&main::Output($str);
       
    35     }
       
    36 }
       
    37 
       
    38 # specify floating point model here
       
    39 my $floatingpointmodel = "softvfp";
       
    40 
       
    41 if (&main::ARMFPU && (&main::ARMFPU =~ /^VFPV2$/i)) {
       
    42 	$floatingpointmodel = "vfpv2";
       
    43 }
       
    44 
       
    45 my $Archive;
       
    46 my $Link;
       
    47 my $Objcopy;
       
    48 
       
    49 require Exporter;
       
    50 @ISA=qw(Exporter);
       
    51 @EXPORT=qw(
       
    52 	PMHelp_Mmp
       
    53 
       
    54 	PMPlatProcessMmp
       
    55 	
       
    56 	PMStartBldList
       
    57 		PMBld
       
    58 	PMStartSrcList
       
    59 		PMBitMapBld
       
    60 		PMResrcBld
       
    61 		PMStartSrc
       
    62 		PMAifBld
       
    63 		PMSrcDepend
       
    64 			PMSrcBldDepend
       
    65 			PMEndSrcBld
       
    66 		PMEndSrc
       
    67 	PMEndSrcList
       
    68 	PMPrefixFile
       
    69 	PMSupportsFeatureVariants
       
    70 );
       
    71 
       
    72 use Cwd;
       
    73 use Armutl;
       
    74 use RVCT_plat2set;
       
    75 use cl_generic;
       
    76 use E32env;
       
    77 use Genutl;
       
    78 
       
    79 use constant NOCOMPRESSIONMETHOD => 0;
       
    80 use constant INFLATECOMPRESSIONMETHOD => 1;
       
    81 use constant BYTEPAIRCOMPRESSIONMETHOD => 2;
       
    82 
       
    83 use constant NON_DEBUGGABLE => 0;
       
    84 use constant DEBUGGABLE => 1;
       
    85 use constant DEBUGGABLE_UDEBONLY => 2;
       
    86 
       
    87 use constant NOTPAGED => 0;
       
    88 use constant UNPAGED => 1;
       
    89 use constant PAGED => 2;
       
    90 
       
    91 sub PMHelp_Mmp {
       
    92     &Armutl_Help_Mmp;
       
    93 }
       
    94 
       
    95 my $Plat=main::Plat();
       
    96 
       
    97 my ($RVCTMajorVersion, $RVCTMinorVersion, $RVCTBuildNumber) = RVCT_plat2set::get_version_list($Plat); 
       
    98 
       
    99 my $RVCTVersion = "${RVCTMajorVersion}_${RVCTMinorVersion}";
       
   100 
       
   101 my $ARMCCVersion = "${RVCTMajorVersion}${RVCTMinorVersion}0${RVCTBuildNumber}";
       
   102 
       
   103 my $oP = '--';
       
   104 $oP = '-' if ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2);
       
   105 
       
   106 #Check if Function call Logger is enabled
       
   107 my $Function_Call_Logger=&main::IsFunctionCallLogging();
       
   108 
       
   109 # Get the information regarding supporting Compiler Wrapper Option
       
   110 my $IsCompilerWrapperOption=&main::CompilerWrapperOption();
       
   111 
       
   112 #Check the existence of elf2e32.exe in the system path
       
   113 my $IsExistELF2E32EXE = 0;
       
   114     open ELF2E32PIPE, "elf2e32 2>&1 |";
       
   115     while (<ELF2E32PIPE>) {
       
   116 	if($_=~/^Symbian Post Linker\, Elf2E32/) {
       
   117 	    $IsExistELF2E32EXE = 1;
       
   118 	    last;
       
   119 	}
       
   120 	next;
       
   121     }
       
   122     close ELF2E32PIPE;
       
   123 
       
   124 my $ArmIncDir;
       
   125 my @ArmLibList;
       
   126 my $ArmRT = 0;
       
   127 my %AsmFiles = ();
       
   128 my %AsmDirs = ();
       
   129 my $oe_options = '';
       
   130 my $NamedSymLkup = 0;
       
   131 my $symNameLkupOpt = '';
       
   132 
       
   133 
       
   134 sub PMPlatProcessMmp (@) {
       
   135         &Armutl_DoMmp(@_);
       
   136 	$ArmIncDir = RVCT_plat2set::get_inc_path($Plat);
       
   137 	&main::SetStdIncPaths($ArmIncDir);
       
   138 	@ArmLibList = &Armutl_ArmLibList;
       
   139 	$ArmRT = &Armutl_ArmRT;
       
   140 	my @AsmFileList = &Armutl_AsmFileList;
       
   141 	foreach (@AsmFileList) { $AsmFiles{ucfirst lc $_} = 1; }
       
   142 }
       
   143 
       
   144 sub SysTrg () {
       
   145 	return 1 if &main::SystemTrg;
       
   146 	my $ExportLibrary=&main::ExportLibrary;
       
   147 	return 1 if ($ExportLibrary =~ /EKERN/i);
       
   148 	my $Trg=&main::Trg;
       
   149 	return 1 if ($Trg =~ /KSRT/i);
       
   150 	return 0;
       
   151 }
       
   152 
       
   153 my $RVCT20 = 0; 
       
   154 
       
   155 # suppress these warnings & errors
       
   156 #Warning: #66-D: enumeration value is out of "int" range 
       
   157 # "EUSER\CBASE\Ub_act.cpp", line 20: Warning:  #161-D: unrecognized #pragma
       
   158 # 611: overloaded virtual function "entity" is only partially overridden in <entitykind> "entity"
       
   159 # "EUSER\CBASE\Ub_act.cpp", line 256: Warning:  #654-D: declaration modifiers are incompatible with previous declaration
       
   160 # 997: <entity-kind> "entity" is hidden by "entity" -- virtual function override intended?
       
   161 # "EPOC32\include\s32stor.h", line 354: Error:  #1152-D: polymorphic base classes need to be exported as well
       
   162 # "INCLUDE\e32base.h", line 31: Warning:  #1300-D: ~CBufBase inherits implicit virtual
       
   163 #"COMPSUPP\\RVCT2_1\\Dfpaeabi.cpp", line 87: Warning: A1488W: PROC/FUNC at line 9 without matching ENDP/ENDFUNC
       
   164 #"COMPSUPP\\RVCT2_1\\Dfpaeabi.cpp", line 85: Warning: A1464W: ENDP/ENDFUNC without corresponding PROC/FUNC
       
   165 #Warning: L6318W: _integrator_cm1136_ekern.in(.text) contains branch to a non-code symbol FindMostSignificantOne(unsigned long).
       
   166 
       
   167 my $diag_suppressions = '--diag_suppress 66,161,611,654,997,1152,1300,1464,1488,6318,6331';
       
   168 
       
   169 # downgrade from errors to warnings
       
   170 my $diag_warnings = '';
       
   171 
       
   172 # upgrade from warnings to errors
       
   173 # Warning:  #1267-D: Implicit physical register R0 should be defined as a variable
       
   174 my $diag_errors = '--diag_error 1267';
       
   175   
       
   176 my $commonOptions = $RVCT20 ?
       
   177   "$diag_suppressions $diag_warnings $diag_errors" :
       
   178   "$diag_suppressions $diag_warnings $diag_errors";  
       
   179 
       
   180 my @mmpOption = &main::ReplaceOptions("ARMCC");
       
   181 my $CompilerOption = &main::CompilerOption("ARMCC");
       
   182 my $contingentOptions;
       
   183 my $thumbOptions = $RVCT20 ? '-thumb' : '--thumb ';
       
   184 my $armOptions = $RVCT20 ? '-arm' : '--arm ';
       
   185 my $kernelOptions = $RVCT20 ? '-arm' : '--arm --no_exceptions --no_exceptions_unwind';
       
   186 my $invariantOptions = $RVCT20 ? 
       
   187   '-cpu 5T --enum_is_int -Ono_known_library --export_vtbl -apcs /inter' :
       
   188   '--cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --export_all_vtbl --no_vfe --apcs /inter';
       
   189 $invariantOptions .= ' --dllimport_runtime' unless ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2);  
       
   190 my $exceptions = $RVCT20 ? '' : ' --exceptions --exceptions_unwind';
       
   191 my $floatingpoint = $RVCT20 ? '' : ' --fpu '.$floatingpointmodel.'';
       
   192 my @FCLogger_Macros; # Macros required to be passed to the FCLogger
       
   193 
       
   194 my $useLinkerFeedBack = 0;
       
   195 
       
   196 sub LinkerFeedBackFile() {
       
   197   return unless $useLinkerFeedBack;
       
   198   my $Trg = &main::Trg;
       
   199   return "$Trg.lfb";
       
   200 }
       
   201 
       
   202 sub LinkerFeedBackOption() {
       
   203   return "" unless $useLinkerFeedBack;
       
   204   my $BasicTrgType=&main::BasicTrgType;
       
   205   return "" unless ($BasicTrgType=~/^(DLL|EXE)/o);
       
   206   my $file = LinkerFeedBackFile();
       
   207   return "--feedback $file ";
       
   208 }
       
   209 
       
   210 my %BSF_keywords = (
       
   211 		    COMMON_OPTIONS => 1,
       
   212 		    THUMB_OPTIONS => 1,
       
   213 		    ARM_OPTIONS => 1,
       
   214 		    KERNEL_OPTIONS => 1,
       
   215 		    INVARIANT_OPTIONS => 1
       
   216 		   );
       
   217 
       
   218 sub Read_BSF_Options() {
       
   219         my %plat = (main::PlatRec());
       
   220 	my @Customization_Data = split(/\n/,$plat{'CUSTOMIZATION_DATA'});
       
   221 	foreach my $option (@Customization_Data) {
       
   222 			next if ($option =~ /^$/);
       
   223 	        warn "Unrecognized BSF syntax: $option.\n"
       
   224 		        unless ($option =~ /\s*(\S+)\s+(.+)$/);
       
   225 		my $key = uc $1;
       
   226 		my $val = $2;
       
   227 	        warn "Unrecognized BSF keyword: $key.\n"
       
   228 		        unless ($BSF_keywords{$key});
       
   229 		if ($key =~ /COMMON_OPTIONS/) {
       
   230 		        Set_BSF_Options(\$commonOptions,$val);
       
   231 			next;
       
   232 		}
       
   233 		if ($key =~ /THUMB_OPTIONS/) {
       
   234 		        Set_BSF_Options(\$thumbOptions,$val);
       
   235 			next;
       
   236 		}
       
   237 		if ($key =~ /ARM_OPTIONS/) {
       
   238 		        Set_BSF_Options(\$armOptions,$val);
       
   239 			next;
       
   240 		}
       
   241 		if ($key =~ /KERNEL_OPTIONS/) {
       
   242 		        Set_BSF_Options(\$kernelOptions,$val);
       
   243 			next;
       
   244 		}
       
   245 		if ($key =~ /INVARIANT_OPTIONS/) {
       
   246 		        Set_BSF_Options(\$invariantOptions,$val);
       
   247 			next;
       
   248 		}
       
   249 
       
   250 	}		
       
   251 }
       
   252 
       
   253 # Set the options passed from BSF file 
       
   254 # @param OptionName    - BSF Keyword using which the options would be overridden in the BSF file
       
   255 # @param Options       - List of options read from the BSF keyword
       
   256 sub Set_BSF_Options($$)
       
   257 {
       
   258 	my ($OptionName,$Options) = @_;
       
   259 	my @Fragments=();
       
   260 	
       
   261 	# Check if the value of BSF option is to be set or added/removed.
       
   262 	if($Options =~ /\+\[.*\]\+|\-\[.*\]\-/)
       
   263 	{
       
   264 		if (@Fragments = Split_BSF_Options($Options,'RemoveOptions'))
       
   265 		{
       
   266 			foreach my $Opt (@Fragments) 
       
   267 			{
       
   268 				# Remove trailing white spaces
       
   269 				$Opt =~ s/\s+$//;				
       
   270 				$$OptionName =~ s/$Opt//g;
       
   271 			}					
       
   272 			@Fragments=();
       
   273 		}
       
   274 		if (@Fragments = Split_BSF_Options($Options,'AddOptions')) 
       
   275 		{
       
   276 			$$OptionName .= " @Fragments";
       
   277 			@Fragments=();
       
   278 		}		
       
   279 		
       
   280 		# Warn if options are not present in the form '+[...]+' or '-[...]-'
       
   281 		$Options =~ s/\+\[.*?\]\+|\-\[.*?\]\-//g;
       
   282 		if($Options !~ /^\s*$/)
       
   283 		{
       
   284 			print "Warning: Ignoring option(s) \"$Options\" specified in BSF as option(s) should be in the form '+[...]+' or '-[...]-.\n";
       
   285 		}
       
   286 	}
       
   287 	else
       
   288 	{
       
   289 		$$OptionName = $Options;
       
   290 	}		
       
   291 	
       
   292 	&main::Output(					
       
   293 		"\n"
       
   294 	);
       
   295 }
       
   296 
       
   297 # Split BSF options to find options which are to be added/removed
       
   298 # @param String      - List of options present in form '+[...]+' or '-[....]-'
       
   299 # @param $Task       - Variable to decide whether to return options to be addded or options to be removed
       
   300 sub Split_BSF_Options($$)
       
   301 {
       
   302 	my ($String,$Task) = @_;
       
   303     my @Result = ();
       
   304 	my @Fragments = ();
       
   305 	my $Pattern = '';
       
   306 		
       
   307 	if ($Task eq 'AddOptions')
       
   308 	{
       
   309 		# Get the options which are to be added (present in the form '+[...]+')
       
   310 		@Fragments = $String =~ /\+\[(.*?)\]\+/g;	
       
   311 	}
       
   312 	elsif ($Task eq 'RemoveOptions') 
       
   313 	{
       
   314 		# Get the options which are to be removed (present in the form '-[...]-')
       
   315 		@Fragments = $String =~ /\-\[(.*?)\]\-/g;
       
   316 	}	
       
   317 
       
   318 	# Set the value of '$Pattern' which is required to segregate one option from another based on the option prefix.
       
   319 	# Option prefix for RVCT can be '-' or '--'.
       
   320 	$Pattern = '-{1,2}\S+\s*(?!-)\S*';	
       
   321 
       
   322 	foreach my $Val (@Fragments) 
       
   323 	{
       
   324 		my @Opt = $Val =~ /$Pattern/g;
       
   325 		push @Result,@Opt;		 		
       
   326 	}
       
   327 	return @Result;	
       
   328 }
       
   329 
       
   330 sub ComputeCompilerOpts() {
       
   331 	my %plat = &main::PlatRec();
       
   332 	Read_BSF_Options() if ($plat{'CUSTOMIZES'});
       
   333 	my $ABI=&main::ABI;
       
   334 	my $TrgType=&main::TrgType;
       
   335 	if (SysTrg()) {
       
   336 	        $contingentOptions = $kernelOptions.$floatingpoint;
       
   337         } elsif (main::BuildAsARM() or ($ABI eq 'ARMV4')) {
       
   338 	        $contingentOptions = $armOptions.$floatingpoint.$exceptions;
       
   339 	    } else {
       
   340 			$contingentOptions = $thumbOptions.$floatingpoint.$exceptions.' -D__MARM_THUMB__';	
       
   341 			push @FCLogger_Macros, '__MARM_THUMB__';
       
   342 	}
       
   343 	# support for ARMV4
       
   344 	my $invopts = "$invariantOptions";
       
   345 	if ($ABI eq 'ARMV4') {
       
   346 		$invopts =~ s/5T/4/;
       
   347 		$invopts =~ s/inter/nointer/;
       
   348 	} else {
       
   349 		$contingentOptions .= ' -D__MARM_INTERWORK__';
       
   350 		push @FCLogger_Macros, '__MARM_INTERWORK__';
       
   351 	}
       
   352 
       
   353 	#Options to export all the external symbols for OE DLL , OE Exe and OE Static Lib
       
   354 	if ($TrgType=~/^STDDLL$/o || $TrgType=~/^STDEXE$/o || $TrgType=~/^STDLIB$/o) {
       
   355 		$oe_options=' --no_hide_all';
       
   356 	}
       
   357 
       
   358 	return $commonOptions.' '.$contingentOptions.' '.$invopts.' '.$oe_options.' '.&main::CompilerOption("ARMCC");
       
   359 }
       
   360 
       
   361 my $Makecmd;
       
   362 
       
   363 sub PMStartBldList($) {
       
   364 	($Makecmd) = @_;
       
   365 	my $ABI=&main::ABI;
       
   366 	my $BaseTrg=&main::BaseTrg;
       
   367 	my $BasicTrgType=&main::BasicTrgType;
       
   368 	my @BldList=&main::BldList;
       
   369 	my @ChopSysIncPaths=&main::Path_Chop(&main::SysIncPaths);
       
   370 	my @ChopUserIncPaths=&main::Path_Chop(&main::UserIncPaths);
       
   371 	my $DefFile=&main::DefFile;
       
   372 	my $EPOCPath=&main::EPOCPath;
       
   373 	my $LinkAs=&main::LinkAs;
       
   374 	my $LibPath=&main::LibPath.'LIB\\';
       
   375 	my @MacroList=&main::MacroList();
       
   376 	push @MacroList, "__SUPPORT_CPP_EXCEPTIONS__";
       
   377 
       
   378 	my $VariantFile=&main::VariantFile();
       
   379 
       
   380 	my $Plat=&main::Plat;
       
   381 	my $Trg=&main::Trg;
       
   382 	if ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2) {
       
   383 		if ($BasicTrgType=~/^LIB$/o) {
       
   384 			# Temporary Workaround for RVCT2.1 static libs problem with RVCT2.2 builds
       
   385 			# Rename all the static libs produced with RVCT2.1 as {libname}2_1.lib
       
   386 		        if ($Trg=~/^\s*(\S+)(\.lib)$/io) {
       
   387 			        if ($1!~/$RVCTVersion/i) {
       
   388 				        $Trg=$1.$RVCTVersion.".lib";
       
   389 				}
       
   390 			}
       
   391 			if ($BaseTrg!~/$RVCTVersion/i) {
       
   392 			        $BaseTrg .= $RVCTVersion;
       
   393 			}
       
   394 		}
       
   395 	}
       
   396 
       
   397 	my $TrgType=&main::TrgType;
       
   398 	my @UidList=&main::UidList;	
       
   399     my $SystemTrg = &main::SystemTrg;
       
   400     my $ExportLibrary=&main::ExportLibrary;
       
   401     my $NoExportLibrary=&main::NoExportLibrary;
       
   402     # N.B. should get better way to detect kernel probably!!
       
   403     $SystemTrg = 1 if ($ExportLibrary =~ /EKERN/i);
       
   404 	
       
   405     # N.B. should get better way to detect this
       
   406     $SystemTrg = 1 if ($Trg =~ /KSRT/i);
       
   407 
       
   408 	my %Version = &main::Version();
       
   409 	my $ExtraExportLibrary;
       
   410 	my $PrimaryExportLibrary = $ExportLibrary;
       
   411 	unless ($Version{explicit}) {
       
   412 		$ExtraExportLibrary = $ExportLibrary;
       
   413 		$ExtraExportLibrary =~ s/\{(\d|a|b|c|d|e|f){8}\}//i;
       
   414 		$PrimaryExportLibrary = $ExtraExportLibrary;
       
   415 	}
       
   416 
       
   417 #	set up LinkAs
       
   418 	$UidList[2]=~/^0x(.*)$/o;
       
   419 	if ($1 ne '00000000') { # have to make sure than series of noughts in brackets doesn't appear in name for null uids
       
   420 		$LinkAs=join '', &main::Path_Split('Base',$LinkAs),"[$1]",&main::Path_Split('Ext',$LinkAs);
       
   421 	}
       
   422 
       
   423 #	work out the flags for various platforms
       
   424 	unless ($ABI eq 'ARMV5' or $ABI eq 'ARMV4') {
       
   425 		&main::FatalError("Platform module - ABI \"$ABI\" unrecognised");
       
   426 	}
       
   427 	my $ComputeCompilerOpts=ComputeCompilerOpts();
       
   428 	if (@mmpOption) 
       
   429 	{
       
   430 		my $pattern = '-{1,2}\S+\s*(?!-)\S*';	
       
   431 		foreach my $options (@mmpOption) 
       
   432 		{
       
   433 			my @opts = $options =~ /$pattern/g;
       
   434 			my $count = 0;
       
   435 			while ($count <= $#opts) 
       
   436 			{
       
   437 				my $opt;
       
   438 				my $rep;
       
   439 				if ($opts[$count] =~ /^(\S+)\s+(\S+)$/) 
       
   440 				{
       
   441 					$opt = $1;
       
   442 					$rep = $2;
       
   443 					$ComputeCompilerOpts =~ s/$opt\s+\S+\s+/ $opt $rep /g;
       
   444 					$count++;
       
   445 				}
       
   446 				else
       
   447 				{
       
   448 					$opt = $opts[$count];
       
   449 					$rep = $opts[$count+1];
       
   450 					$ComputeCompilerOpts =~ s/$opt/$rep/g;					
       
   451 					$count+=2;
       
   452 				}
       
   453 			}		
       
   454 		}
       
   455 	}
       
   456 
       
   457 	$PlatOpt{Arm} = $ComputeCompilerOpts;
       
   458 
       
   459 	my $InterWorking = ($ABI eq 'ARMV4') ? "" : "--inter";
       
   460 
       
   461 	$Archive=$ToolPrefix.'armar';
       
   462 	$Link=$ToolPrefix."armlink ${oP}diag_suppress 6331,6780 ";
       
   463 	$Objcopy=$ToolPrefix.'objcopy';
       
   464 
       
   465 	&Generic_Header(0,$Makecmd);	# define standard things using absolute paths
       
   466 		 
       
   467 	if ($Makecmd eq "nmake") {
       
   468 		&main::Output(
       
   469 			"\n",
       
   470   			"PATH=",&main::Path_Drive,$EPOCPath,"gcc\$(PBUILDPID)\\bin;\$(PATH)\n",
       
   471 			"\n"
       
   472 		);
       
   473 	}
       
   474 	else {
       
   475 		&main::Output(
       
   476 			"\n",
       
   477 			"# must set both PATH and Path to make it work correctly\n",
       
   478   			"Path:=",&main::Path_Drive,$EPOCPath,"gcc\$(PBUILDPID)\\bin;\$(Path)\n",
       
   479 			"PATH:=\$(Path)\n",
       
   480 			"\n"
       
   481 		);
       
   482 	}
       
   483 
       
   484 	&main::Output(
       
   485 		"INCDIR  ="
       
   486 	);
       
   487 	PrintList("\" -J \$_\"", @ChopUserIncPaths);
       
   488 	PrintList("\" -J \$_\"", @ChopSysIncPaths);
       
   489 	if ($ArmIncDir) {
       
   490 		&main::Output(
       
   491 		    " -J \"$ArmIncDir\" ",
       
   492 		);	
       
   493 	}
       
   494 	&main::Output(
       
   495 		"\n",
       
   496 		"\n"
       
   497 	);
       
   498 
       
   499 	#Function Call Logger
       
   500 	if ($Function_Call_Logger)	{
       
   501 		&main::Output(
       
   502 			"INCDIR_FCLOGGER  ="
       
   503 		);
       
   504 		PrintList("\" -I \$_\"", @ChopUserIncPaths);
       
   505 		PrintList("\" -I \$_\"", @ChopSysIncPaths);
       
   506 		if ($ArmIncDir) {
       
   507 			&main::Output(
       
   508 				" -I \"$ArmIncDir\" "
       
   509 			);	
       
   510 		}
       
   511 		&main::Output(
       
   512 			"\n",
       
   513 			"\n"
       
   514 		);
       
   515 	}
       
   516 	
       
   517 	&main::Output(
       
   518 		"ARMCCFLAGS=$PlatOpt{Arm} -c\\\n",
       
   519 		"\n"
       
   520 	);
       
   521 
       
   522 	&main::Output(
       
   523 		"ARMCCDEFS = "
       
   524 	);
       
   525 	PrintList("\" -D\$_\"", @MacroList);
       
   526 	
       
   527 	if($VariantFile) {
       
   528 		if ($Function_Call_Logger) {
       
   529 			#FC Logger accepts product include file without path
       
   530 			my $file=&main::Path_Split('File', ${VariantFile});
       
   531 			
       
   532 			&main::Output(
       
   533 				" -D\"__PRODUCT_INCLUDE__=\\\"${file}\\\"\""
       
   534 			);
       
   535 		}
       
   536 		else {
       
   537 			&main::Output(
       
   538 				" -D__PRODUCT_INCLUDE__=\\\"${VariantFile}\\\""
       
   539 			);
       
   540 		}
       
   541 	}
       
   542 
       
   543 	&main::Output(
       
   544 		" \$(USERDEFS)\n",
       
   545 		"\n"
       
   546 	);
       
   547 
       
   548 
       
   549 	if ($TrgType=~/^STDDLL$/o || $TrgType=~/^STDEXE$/o){
       
   550 #	For now, named symbol lookup is enabled only for the STD binaries. Later, it may be enabled based on an mmp 
       
   551 #	keyword.
       
   552 
       
   553 		$NamedSymLkup = 1;
       
   554 		$symNameLkupOpt = '--sym_name_lkup';
       
   555 	}
       
   556 
       
   557 
       
   558 
       
   559 	foreach (@BldList) {
       
   560 		&main::Output(
       
   561 			"ARMCC$_ = armcc"
       
   562 		);
       
   563 		if(&main::DebugSwitchUsed() ) {
       
   564 #			when the debug switch is specified and enabled, set the compiler's debug flag for both udeb or urel.
       
   565 #			when the debug switch is disabled, don't set the compiler's debug flag for either udeb or urel.
       
   566 #			The optimization option is set only based on the build i.e., Udeb or Urel and is independent of
       
   567 #			whether debug is enabled or not. This might give a poorer debug view for debug-enabled Urel build.
       
   568 			if(&main::SymbolicDebugEnabled() ) {
       
   569 				&main::Output(
       
   570 						  ' -g'
       
   571 				);
       
   572 			}
       
   573 		}
       
   574 		elsif (/DEB$/o) {
       
   575 			&main::Output(
       
   576 				      ' -g'
       
   577 			);
       
   578 		}
       
   579 
       
   580 		if (/DEB$/o) {
       
   581 			&main::Output(
       
   582 				      ' -O0'
       
   583 			);
       
   584 		}
       
   585 		else {
       
   586 			&main::Output(
       
   587 				      ' -O2'
       
   588 			);
       
   589 		}		
       
   590 		&main::Output(
       
   591 			' $(ARMCCFLAGS)'
       
   592 		);
       
   593 		my @ml = &main::MacroList($_);
       
   594 		PrintList("\" -D\$_\"", @ml);
       
   595 		&main::Output(
       
   596 			" \$(ARMCCDEFS)\n"
       
   597 		);
       
   598 	}
       
   599 	&main::Output(
       
   600 		"\n",
       
   601 		"\n"
       
   602 	);
       
   603 
       
   604 	#Function call logger
       
   605 	if ($Function_Call_Logger)	{
       
   606 		#Send all the debug macros to logger
       
   607 		foreach (@BldList) {
       
   608 			&main::Output (
       
   609 				"FCLOGGER$_ = ",
       
   610 				$EPOCPath, 
       
   611 				"tools\\fc_logger\\edgcpfe"
       
   612 			);
       
   613 
       
   614 			my @ml = &main::MacroList($_);
       
   615 			push @ml, "__ARMCC_VERSION=$ARMCCVersion";
       
   616 			PrintList("\" -D\$_\"", @ml);
       
   617 			&main::Output(
       
   618 				" \$(ARMCCDEFS)"
       
   619 			);
       
   620 			PrintList("\" -D\$_\"", @FCLogger_Macros);
       
   621 			&main::Output(
       
   622 				"\n",
       
   623 				"\n"
       
   624 			);
       
   625 		}
       
   626 	}
       
   627 	
       
   628 	foreach (@BldList) {
       
   629 		&main::Output(
       
   630 			"$_ :"
       
   631 		);
       
   632 
       
   633 		if ($BasicTrgType !~ /IMPLIB/io) {
       
   634 			&main::Output (
       
   635 				" \\\n\t",
       
   636 				&Generic_Quote("\$(EPOCTRG$_)\\".&main::Trg($_))
       
   637 			);
       
   638 		}
       
   639 
       
   640 #		lib has to come after the main target so that a .DEF file will be generated if the project is not frozen
       
   641 		if ($DefFile and not &main::ExportUnfrozen) {
       
   642 			&main::Output(
       
   643 				" \\\n",
       
   644 				"\tLIBRARY\n"
       
   645 			);
       
   646 		}
       
   647 		&main::Output(
       
   648 			"\n",
       
   649 			"\n"
       
   650 		);
       
   651 	}
       
   652 
       
   653 	# Resource building is done entirely via cl_generic.pm
       
   654 	PrintList("\"\nRESOURCE\$_ : MAKEWORK\$_\"", @BldList);
       
   655 	&main::Output(
       
   656 		"\n",
       
   657 		"\n",
       
   658 	);
       
   659 
       
   660 	&main::Output(
       
   661 		"LIBRARY : MAKEWORKLIBRARY"
       
   662 	);
       
   663 	if ($BasicTrgType=~/^LIB$/o) {
       
   664 #		code to ensure that the static libraries for all builds are built at the library stage
       
   665 	        PrintList("\" \$_\"", @BldList);
       
   666 	}
       
   667 	elsif ($DefFile and !$NoExportLibrary) {
       
   668 		unless (&main::ExportUnfrozen) {
       
   669 			if (-e $DefFile) { # effectively "if project frozen ..."
       
   670 				&main::Output(
       
   671 					" ", &Generic_Quote("\$(EPOCLIB)\\LIB\\$PrimaryExportLibrary.lib"),
       
   672 				);
       
   673 				# if elf2e32.exe(postlinker) exists, then generate .dso along with .lib
       
   674 				if ($IsExistELF2E32EXE) {
       
   675 					&main::Output(
       
   676 						" ", &Generic_Quote("\$(EPOCLIB)\\LIB\\$PrimaryExportLibrary.dso"), "\n"
       
   677 					);
       
   678 				}
       
   679 				else {
       
   680 					&main::Output("\n");
       
   681 				}
       
   682 			}
       
   683 			else {
       
   684 				&main::Output(
       
   685 					"\n",
       
   686 					"\t\@echo WARNING: Not attempting to create any import libraries.\n",
       
   687 					"\t\@echo When exports are frozen in \"$DefFile\", regenerate Makefile.\n"
       
   688 				);
       
   689 			}
       
   690 		} else {
       
   691 			&main::Output(
       
   692 				"\n",
       
   693 				"\t\@echo Not attempting to create \"\$(EPOCLIB)\\LIB\\$PrimaryExportLibrary.lib\"\n",
       
   694 				"\t\@echo from frozen .DEF file, since EXPORTUNFROZEN specified.\n"
       
   695 			);
       
   696 		}
       
   697 
       
   698 		my $theDefFile = $DefFile;
       
   699 		$theDefFile = "\$(EPOCBLD)\\$BaseTrg.def" unless (-e $DefFile);
       
   700 		&main::Output(
       
   701 			"\n",
       
   702 			"\n",
       
   703 			"# REAL TARGET - LIBRARY\n",
       
   704 			"\n",
       
   705 			&Generic_Quote("\$(EPOCLIB)\\LIB\\$ExportLibrary.lib"), " : ",
       
   706 			&Generic_Quote($DefFile), "\n",
       
   707 				"\tperl -S prepdef.pl ", &Generic_Quote($DefFile), " \"\$(EPOCBLD)\\$ExportLibrary.prep.def\"\n",
       
   708 				"\tdef2dll.bat --path=\$(EPOCLIB)\\LIB \\\n\t\t--bldpath=\$(EPOCBLD) \\\n\t\t--import=$ExportLibrary \\\n",
       
   709 			"\t\t--deffile=\"\$(EPOCBLD)\\$ExportLibrary.prep.def\" \\\n\t\t--linkAs=$LinkAs \\\n\t\t$InterWorking\n",
       
   710 			"\n",
       
   711 		 );
       
   712 		if ($ExtraExportLibrary) {
       
   713 			&main::Output(
       
   714 				"\n",
       
   715 				&Generic_Quote("\$(EPOCLIB)\\LIB\\$ExtraExportLibrary.lib"), " : ",
       
   716 				&Generic_Quote("\$(EPOCLIB)\\LIB\\$ExportLibrary.lib"), "\n",
       
   717 				"\tcopy \"\$<\" \"\$@\"\n"
       
   718 			);
       
   719 		}
       
   720 		#if elf2e32.exe(postlinker) exists, then generate .dso(which will be used by ABIV2 platforms)
       
   721 		if ($IsExistELF2E32EXE) {
       
   722 			&main::Output(
       
   723 				"\n",
       
   724 				&Generic_Quote("\$(EPOCLIB)\\LIB\\$ExportLibrary.dso"), " : ",
       
   725 				&Generic_Quote($DefFile), "\n",
       
   726 					"\telf2e32 --definput=\"\$(EPOCBLD)\\$ExportLibrary.prep.def\" --dso=",
       
   727 					&Generic_Quote("\$(EPOCLIB)\\LIB\\$ExportLibrary.dso"),
       
   728 					" --linkas=$LinkAs\n"
       
   729 			);
       
   730 			if ($ExtraExportLibrary) {
       
   731 				&main::Output(
       
   732 					"\n",
       
   733 					&Generic_Quote("\$(EPOCLIB)\\LIB\\$ExtraExportLibrary.dso"), " : ",
       
   734 					&Generic_Quote("\$(EPOCLIB)\\LIB\\$ExportLibrary.dso"), "\n",
       
   735 					"\tcopy \"\$<\" \"\$@\"\n"
       
   736 				);
       
   737 			}		
       
   738 		}		
       
   739 	}
       
   740 
       
   741 	my $freezeDir = &main::Path_Split('Path', $DefFile);
       
   742 	chop($freezeDir);
       
   743 
       
   744 	# dummy rule for def files to cope with filename case differences
       
   745 	unless (&main::ExportUnfrozen) {
       
   746 		if (-e $DefFile) { # effectively "if project frozen ..."
       
   747 			&main::Output(
       
   748 				"\n",
       
   749 				"\n",
       
   750 				&Generic_Quote($DefFile), " : ", "\n",
       
   751 				"\t\@rem Do nothing\n",
       
   752 			);
       
   753 		}
       
   754 	}
       
   755 
       
   756 	&main::Output(
       
   757 		"\n",
       
   758 		"\n",
       
   759 		&Generic_Quote($freezeDir), " : ", "\n",
       
   760 		"\tperl -S emkdir.pl \$\@\n",
       
   761 	);
       
   762 
       
   763 	&main::Output(
       
   764 		"\n",
       
   765 		"\n",
       
   766 		"FREEZE : ",
       
   767 		&Generic_Quote($freezeDir), "\n",
       
   768 	);
       
   769 	if ($DefFile and $BasicTrgType!~/^IMPLIB$/io) {
       
   770 # 	    call perl on the script here so make will die if there are errors 
       
   771 #           - this doesn't happen if calling perl in a batch file
       
   772 	    &main::Output( "\tperl -S efreeze.pl \$(EFREEZE_ALLOW_REMOVE) \"$DefFile\" \"\$(EPOCBLD)\\$ExportLibrary.def\" \n" );
       
   773 	}
       
   774 	&main::Output(
       
   775 		"\n",
       
   776 		"CLEANLIBRARY :\n"
       
   777 	);
       
   778 	if ($DefFile and !$NoExportLibrary) {
       
   779 		&main::Output(
       
   780 			"\t-\$(ERASE) \"\$(EPOCLIB)\\LIB\\$ExportLibrary.lib\"\n"
       
   781 		);
       
   782 		if ($ExtraExportLibrary) {
       
   783 			&main::Output(
       
   784 				"\t-\$(ERASE) \"\$(EPOCLIB)\\LIB\\$ExtraExportLibrary.lib\"\n"
       
   785 			);
       
   786 		}
       
   787 	}
       
   788 	&main::Output(
       
   789 		"\n",
       
   790 		"\n"
       
   791 	);
       
   792 	&Generic_MakeWorkDir('MAKEWORKLIBRARY',"${LibPath}");
       
   793 
       
   794 	&Generic_Releaseables;
       
   795 }
       
   796 
       
   797 
       
   798 sub PMBld {
       
   799 
       
   800 	my $ABI=&main::ABI;
       
   801     my @ASSPLibList=&main::ASSPLibList;
       
   802     my @SrcList=&main::SrcList;
       
   803     my @StringTables=&main::StringTables;
       
   804     my $BaseTrg=&main::BaseTrg;
       
   805 	my $FeatureVariantBaseTrg=&main::FeatureVariantBaseTrg;
       
   806     my $Bld=&main::Bld;
       
   807     my $ChopBldPath=&main::Path_Chop(&main::BldPath);
       
   808     my $DefFile=&main::DefFile;
       
   809     my $EPOCIncPath=&main::EPOCIncPath;
       
   810     my $FirstLib=&main::FirstLib;
       
   811     if ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2) {
       
   812 	    # Temporary Workaround for RVCT2.1 static libs problem with RVCT2.2 builds
       
   813 	    # Rename all the static libs used with RVCT2.1 as {libname}2_1.lib
       
   814 	    if ($FirstLib=~/^\s*(\S+)(\.lib)$/io) {
       
   815 		    if ($1!~/$RVCTVersion/i) {
       
   816 			    $FirstLib=$1."${RVCTVersion}.lib";
       
   817 		    }
       
   818 	    }
       
   819     }
       
   820     my $BasicTrgType=&main::BasicTrgType;
       
   821     my @LibList;
       
   822     my @RTLibList = $RVCT20 ?
       
   823       ('udfp.lib', 'udrt.lib', 'udrt.lib(VtblExports.o)'):
       
   824       ('dfpaeabi.lib', "dfprvct${RVCTVersion}.lib", 'drtaeabi.lib', 'drtaeabi.lib(VtblExports.o)');
       
   825     if ( $RVCTVersion lt "2_2" ) {
       
   826 		push @RTLibList, "dfprvct${RVCTVersion}-thunk.lib";
       
   827 		push @RTLibList, "drtrvct${RVCTVersion}.lib";
       
   828     }
       
   829     else {
       
   830 		# The scppnwdl.lib should come before drtrvct2_2.lib
       
   831 		push @RTLibList, "scppnwdl.lib";
       
   832 		push @RTLibList, "drtrvct${RVCTVersion}.lib";
       
   833     }
       
   834     my $SystemTrg = &main::SystemTrg;
       
   835     my $LibPath= &main::LibPath;
       
   836     my $LinkAs=&main::LinkAs;
       
   837     my $ExportLibrary=&main::ExportLibrary;
       
   838     my $NoExportLibrary=&main::NoExportLibrary;
       
   839     # N.B. should get better way to detect kernel probably!!
       
   840     $SystemTrg = 1 if ($ExportLibrary =~ /EKERN/i);
       
   841     my $ChopRelPath=&main::Path_Chop(&main::RelPath);
       
   842     my $RelPath=&main::RelPath;
       
   843     my @StatLibList=&main::StatLibList;
       
   844     if ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2) {
       
   845 	    # Temporary Workaround for RVCT2.1 static libs problem with RVCT2.2 builds
       
   846 	    # Rename all the static libs used with RVCT2.1 as {libname}2_1.lib
       
   847 	    for (my $i =0; $i < scalar(@StatLibList); $i++) {
       
   848 		    if ($StatLibList[$i]=~/^\s*(\S+)(\.lib)$/io) {
       
   849 			    if ($1!~/$RVCTVersion/i) {
       
   850 				    $StatLibList[$i]=$1."${RVCTVersion}.lib";
       
   851 			    }
       
   852 		    }
       
   853 	    }
       
   854     }	     
       
   855     my $StatLinkPath=&main::StatLinkPath;
       
   856     my $Trg=&main::Trg;
       
   857     if ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2) {
       
   858 	    if ($BasicTrgType=~/^LIB$/o) {
       
   859 		    # Temporary Workaround for RVCT2.1 static libs problem with RVCT2.2 builds
       
   860 		    # Rename all the static libs produced with RVCT2.1 as {libname}2_1.lib
       
   861 		    if ($Trg=~/^\s*(\S+)(\.lib)$/io) {
       
   862 			    if ($1!~/$RVCTVersion/i) {
       
   863 				    $Trg=$1.$RVCTVersion.".lib";
       
   864 			    }
       
   865 		    }
       
   866 		    if ($BaseTrg!~/$RVCTVersion/i) {
       
   867 			    $BaseTrg .= $RVCTVersion;
       
   868 		    }
       
   869 	    }
       
   870     }
       
   871 
       
   872 	#OE Glue Code
       
   873 	my @oe_exe_libs=("libcrt0.lib");
       
   874 	my @oe_exe_libs_wchar=("libwcrt0.lib");
       
   875 
       
   876 	#OE Import Library List
       
   877 	my @oe_import_library_list=();
       
   878 
       
   879     my $TrgType=&main::TrgType;
       
   880     my @UidList=&main::UidList;
       
   881 	my $InterWorking = ($ABI eq 'ARMV4') ? "" : "--inter";
       
   882 	my %Version = &main::Version();
       
   883 	my $ExtraExportLibrary;
       
   884 	unless ($Version{explicit}) {
       
   885 		$ExtraExportLibrary = $ExportLibrary;
       
   886 		$ExtraExportLibrary =~ s/\{(\d|a|b|c|d|e|f){8}\}//i;
       
   887 	}	
       
   888 
       
   889 
       
   890     my $linkerDebugOpt = "";
       
   891     if(&main::DebugSwitchUsed() ){
       
   892 		if(&main::SymbolicDebugEnabled ()){
       
   893 #		set the linker's debug flag if the debug switch is specified and enabled.
       
   894 		$linkerDebugOpt = "${oP}debug ";
       
   895 		}
       
   896 	}
       
   897 	elsif ($Bld =~ /DEB/) {
       
   898 	$linkerDebugOpt = "${oP}debug ";
       
   899 	}
       
   900     
       
   901 	if ($Bld =~ /DEB/) {
       
   902 	@LibList = &main::DebugLibList;
       
   903 	} else {
       
   904 	@LibList = &main::LibList;
       
   905     }
       
   906 
       
   907 	if(not(grep /^euser.lib$/, @LibList)){
       
   908 		push @oe_import_library_list, "euser.lib";
       
   909 	}
       
   910 	if(not (grep /^libc.lib$/i, @LibList)){
       
   911 		push @oe_import_library_list, "libc.lib";
       
   912 	}
       
   913 
       
   914 #	set up $LinkAs
       
   915     $UidList[2]=~/^0x(.*)$/o;
       
   916     if ($1 ne '00000000') {	# have to make sure than series of noughts in brackets doesn't appear in name for null uids
       
   917 	$LinkAs=join '', &main::Path_Split('Base',$LinkAs),"[$1]",&main::Path_Split('Ext',$LinkAs);
       
   918     }
       
   919 
       
   920 
       
   921     # REAL TARGETS
       
   922     #-------------
       
   923     &main::Output(
       
   924 		  "# REAL TARGET - BUILD VARIANT $Bld\n",
       
   925 		  "\n"
       
   926 		  );
       
   927 
       
   928 #	releasables
       
   929 	my @releaseables;
       
   930 	
       
   931 	push @releaseables, "$RelPath$Trg" if ($BasicTrgType!~/^IMPLIB$/io);
       
   932 	if ($BasicTrgType=~/^(DLL|EXE)$/o) {
       
   933 		push @releaseables, "$RelPath$Trg.map";
       
   934 	}
       
   935 	if (-e $DefFile and !$NoExportLibrary) { # effectively "if project frozen ..."
       
   936 		push @releaseables, "$LibPath$ExportLibrary.lib";
       
   937 		push @releaseables, "$LibPath$ExtraExportLibrary.lib" if ($ExtraExportLibrary);
       
   938 		#if elf2e32.exe(postlinker) exists in the $PATH, then include .dsos also into releasables list
       
   939 		if ($IsExistELF2E32EXE) {
       
   940 			push @releaseables, "$LibPath$ExportLibrary.dso";
       
   941 			push @releaseables, "$LibPath$ExtraExportLibrary.dso" if ($ExtraExportLibrary);
       
   942 		}		
       
   943 	}
       
   944 
       
   945 	push @releaseables, &main::FeatureVariantVMapFile() if &main::FeatureVariantVMapFile();
       
   946 	&main::Output(
       
   947 		"WHAT$Bld : WHATGENERIC\n",
       
   948 		"\n",
       
   949 		"CLEAN$Bld : CLEANBUILD$Bld CLEANRELEASE$Bld\n",
       
   950 		"\n",
       
   951 		"CLEANBUILD$Bld : \n",
       
   952 		"\t\@perl -S ermdir.pl \"\$(EPOCBLD$Bld)\"\n",
       
   953 		"\n",
       
   954 		"CLEANRELEASE$Bld : CLEANGENERIC\n",
       
   955 		"\n"
       
   956 	);
       
   957 	&Generic_WhatCleanTargets($Bld, "WHAT$Bld", "CLEANRELEASE$Bld", @releaseables);
       
   958 
       
   959 	&Generic_MakeWorkDir("MAKEWORK$Bld",$ChopBldPath);
       
   960 	&Generic_MakeWorkDir("MAKEWORK$Bld",$ChopRelPath);
       
   961 
       
   962 	return if ($BasicTrgType=~/^IMPLIB$/io);
       
   963 
       
   964 	&main::Output(
       
   965 		"LISTING$Bld : MAKEWORK$Bld"
       
   966 	);
       
   967 	foreach (@SrcList) {
       
   968 	    	my $BaseSrc = &main::Path_Split('Base', $_);
       
   969 	    	my $Ext = &main::Path_Split('Ext', $_);
       
   970 		if ($Ext =~ /cia/i) {
       
   971 		    $BaseSrc = "$BaseSrc\_";
       
   972 		}
       
   973 		&main::Output(
       
   974 			" \\\n\tLISTING$Bld$BaseSrc"
       
   975 		);
       
   976 	}
       
   977 	&main::Output(
       
   978 		"\n",
       
   979 		"\n"
       
   980 	);
       
   981 
       
   982 	# Compiler wrapper support starts
       
   983 	if($IsCompilerWrapperOption)
       
   984 	{
       
   985 	 	my $Platcmpwrap=&main::Plat;
       
   986 	 	
       
   987 		&main::Output(
       
   988 			"COMPWRAP$Bld : OUTPUT_NAME = ",
       
   989 			"$Platcmpwrap\_$Bld",
       
   990 			"\n"
       
   991 		);
       
   992 	 	
       
   993 		&main::Output(
       
   994 			"COMPWRAP$Bld : MAKEWORK$Bld"
       
   995 		);
       
   996 
       
   997 		foreach (@SrcList) {
       
   998 			my $BaseSrc = &main::Path_Split('Base', $_);
       
   999 			&main::Output(
       
  1000 				" \\\n\tCOMPWRAP$Bld$BaseSrc"
       
  1001 			);
       
  1002 		}
       
  1003 
       
  1004 		&main::Output(
       
  1005 			"\n",
       
  1006 			"\n"
       
  1007 		);
       
  1008 	}
       
  1009 	# Compiler wrapper support
       
  1010 
       
  1011 	&main::Output(
       
  1012 		"LIBS$Bld="
       
  1013 	);
       
  1014 	if ($BasicTrgType=~/^DLL$/o) { # Add the DLL stub library
       
  1015 		if ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2) {
       
  1016 			# Temporary Workaround for RVCT2.1 static libs problem with RVCT2.2 builds
       
  1017 			&main::Output(
       
  1018 				" \\\n\t",
       
  1019 				&Generic_Quote("\$(EPOCSTATLINK$Bld)\\EDLLSTUB$RVCTVersion.lib")
       
  1020 			);
       
  1021 		}
       
  1022 		else {
       
  1023 			&main::Output(
       
  1024 				" \\\n\t",
       
  1025 				&Generic_Quote("\$(EPOCSTATLINK$Bld)\\EDLLSTUB.lib")
       
  1026 			);
       
  1027 		}
       
  1028 	}
       
  1029 	    
       
  1030         PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\\\$\(EPOCSTATLINK$Bld\)\\\\\$_\"\)", @StatLibList);
       
  1031         PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\\\$\(EPOCLIB\)\\\\LIB\\\\\$_\"\)", @LibList);
       
  1032 
       
  1033 		#OE Import Libraries 
       
  1034 		if ( $TrgType=~/^STDEXE$/o || $TrgType=~/^STDDLL$/o ) 
       
  1035 		{
       
  1036 			PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\\\$\(EPOCLIB\)\\\\LIB\\\\\$_\"\)", @oe_import_library_list);
       
  1037 		}
       
  1038 
       
  1039 		#OE Glue Code
       
  1040 		if ($TrgType=~/^STDEXE$/o) {
       
  1041 			if (&main::IsWideCharMain()) {
       
  1042 				PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\\\$\(EPOCLIB\)\\\\$Bld\\\\\$_\"\)", @oe_exe_libs_wchar);
       
  1043 			}
       
  1044 			else {
       
  1045 				PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\\\$\(EPOCLIB\)\\\\$Bld\\\\\$_\"\)", @oe_exe_libs);
       
  1046 			}
       
  1047 		}
       
  1048 
       
  1049         my $StaticRTLib = $RVCT20 ? "usrt20" : "usrt${RVCTVersion}" ;
       
  1050         # use ksrt for system code and usrt for user ARM code
       
  1051         $StaticRTLib = "ksrt${RVCTVersion}" if ($SystemTrg);
       
  1052         &main::Output(
       
  1053 	        " \\\n\t",
       
  1054 		&Generic_Quote("\$(EPOCSTATLINK$Bld)\\$StaticRTLib\.lib")
       
  1055 		) unless ($Trg =~ /(U|K)SRT/i || ($BasicTrgType=~/^LIB$/o));
       
  1056 
       
  1057 	unless ($ArmRT || ($BasicTrgType=~/^LIB$/o)) {
       
  1058 	    my $TargLib = "$ExportLibrary.lib";
       
  1059 		$TargLib =~ s/\{(\d|a|b|c|d|e|f){8}\}//i;
       
  1060 	    unless ($SystemTrg) {
       
  1061 			foreach (@RTLibList) {
       
  1062 				&main::Output(
       
  1063 					" \\\n\t",
       
  1064 					&Generic_Quote("\$(EPOCLIB)\\LIB\\$_")
       
  1065 				) unless ($_ =~ /$TargLib/i);
       
  1066 			}
       
  1067 	    }
       
  1068 	}
       
  1069         PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\$_\"\)", @ArmLibList);
       
  1070 	&main::Output(
       
  1071 		"\n",
       
  1072 		"\n"
       
  1073 	);
       
  1074 
       
  1075    	&main::Output(
       
  1076  		"\n# ADDITIONAL LINKER OPTIONS",
       
  1077  		"\nUSERLDFLAGS = ",
       
  1078  		&main::LinkerOption("ARMCC"),
       
  1079   		"\n\n"
       
  1080   	);
       
  1081 	
       
  1082 	&main::Output(
       
  1083 		"VTBLEXPORTS$Bld="
       
  1084 	);
       
  1085         my $vtobj = quotemeta("(VtblExports.o)");
       
  1086         PrintList("\' \\\n\t\'\.\&Generic_Quote\(\"\\\$\(EPOCLIB\)\\\\LIB\\\\\$_$vtobj\"\)", @LibList);
       
  1087 	&main::Output(
       
  1088 		"\n",
       
  1089 		"\n"
       
  1090 	);
       
  1091 
       
  1092 	my $objectFiles = "";
       
  1093 
       
  1094 	my $bldPath =	&main::BldPath;
       
  1095 	my $replacement;
       
  1096 # If LOCAL_BUILD_PATH is set replace the \epoc32\build with local setting
       
  1097 	if ( defined( $ENV{LOCAL_BUILD_PATH} ) )  {
       
  1098 		$replacement = 	$ENV{"LOCAL_BUILD_PATH"};
       
  1099 		my $epocroot=$ENV{"EPOCROOT"};
       
  1100 		my $match = "\Q${epocroot}\EEPOC32\\\\BUILD";
       
  1101 		$bldPath =~ s/${match}/${replacement}/;
       
  1102 	}
       
  1103 #	Must add StringTable obj files first to preserve Evalid results consistency.
       
  1104 	foreach my $item (@StringTables) {
       
  1105 		$objectFiles .= $bldPath.$$item{BaseTrg}.".o\n" if !($$item{Hdronly});
       
  1106 	}
       
  1107 
       
  1108         &main::Output(
       
  1109 	        "OBJECTS$Bld="
       
  1110 	);
       
  1111         foreach (@SrcList) {
       
  1112 	    	my $BaseSrc = &main::Path_Split('Base', $_);
       
  1113 	    	my $Ext = &main::Path_Split('Ext', $_);
       
  1114 		if ($Ext =~ /cia/i) {
       
  1115 		    $BaseSrc = "$BaseSrc\_";
       
  1116 		}
       
  1117 
       
  1118 	        &main::Output(
       
  1119 		        " \\\n\t",
       
  1120 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.o")
       
  1121 		      );
       
  1122 
       
  1123 #	Only add if not already added from @StringTables
       
  1124 	my $objectFile = $bldPath.$BaseSrc.".o\n";
       
  1125 	$objectFile=~ s/\\/\\\\/g;    # escape the '\'
       
  1126 	if ($objectFiles !~ m/$objectFile/i){
       
  1127 		$objectFiles .= &main::BldPath.$BaseSrc.".o\n";
       
  1128 	}
       
  1129 
       
  1130 
       
  1131 	}
       
  1132         &main::Output(
       
  1133 	        "\n",
       
  1134 		"\n"
       
  1135 	);
       
  1136 
       
  1137 
       
  1138 	# Create "via" file containing all object files in order to reduce
       
  1139 	# command line lengths in pertinent calls
       
  1140 	my $objectsViaFile = &main::CommandFile();	
       
  1141 	&main::CreateExtraFile($objectsViaFile, $objectFiles);
       
  1142 	
       
  1143 
       
  1144         if ($BasicTrgType=~/^LIB$/o) {
       
  1145 	        &main::Output(
       
  1146 		      &Generic_Quote("\$(EPOCTRG$Bld)\\$Trg"),
       
  1147 		      " : \$(OBJECTS$Bld)"
       
  1148 		);
       
  1149         } else {
       
  1150 	        &main::Output(
       
  1151 		      &Generic_Quote("\$(EPOCTRG$Bld)\\$Trg"), " : ",
       
  1152 		      &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseTrg.in")
       
  1153 	        );
       
  1154         }
       
  1155 
       
  1156 	if (-e $DefFile) { # effectively "if project frozen ..."
       
  1157 		&main::Output(
       
  1158 			" ", &Generic_Quote($DefFile)
       
  1159 		);
       
  1160 	}
       
  1161 	if ($BasicTrgType=~/^(EXE|DLL)$/o) {
       
  1162 		&main::Output(
       
  1163 			" ", &Generic_Quote("\$(EPOCSTATLINK$Bld)\\$FirstLib")
       
  1164 		);
       
  1165 	}
       
  1166 	&main::Output(
       
  1167 		" \$(LIBS$Bld)"
       
  1168 	);
       
  1169 
       
  1170 #	generate an export object from the ordered .DEF file
       
  1171         if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
       
  1172 #       	make the .exp file a dependency for targets that have exports		
       
  1173 		&main::Output(" ", &Generic_Quote("\$(EPOCBLD$Bld)\\$ExportLibrary.exp"), "\n");
       
  1174 		if (&main::ExportUnfrozen) {
       
  1175 		    &main::Output(
       
  1176 			"\tdef2dll.bat --path=\$(EPOCBLD$Bld) \\\n\t\t--bldpath=\$(EPOCBLD$Bld) \\\n\t\t--export=$ExportLibrary \\\n\t\t--import=$ExportLibrary\\\n",
       
  1177 			"\t\t--deffile=\$(EPOCBLD$Bld)\\$ExportLibrary.def \\\n\t\t--linkAs=$LinkAs \\\n\t\t$InterWorking $symNameLkupOpt\n",
       
  1178 		    );
       
  1179 		    &main::Output(
       
  1180 		        "\n",
       
  1181 		        "\tcopy ", " \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\" ",
       
  1182 		        "\"\$(EPOCLIB)\\LIB\\$ExportLibrary.lib\"",
       
  1183 		        "\n"
       
  1184 		    );
       
  1185 		    if ($ExtraExportLibrary) {
       
  1186 			&main::Output(
       
  1187 			    "\n",
       
  1188 			    "\tcopy \"\$(EPOCLIB)\\LIB\\$ExportLibrary.lib\" ",
       
  1189 			    "\"\$(EPOCLIB)\\LIB\\$ExtraExportLibrary.lib\"",
       
  1190 			    "\n"
       
  1191 			);
       
  1192 		    }			    
       
  1193 		    #if elf2e32.exe(postlinker) exists, then generate .dso(which will be used by ABIV2 platforms)
       
  1194 		    if ($IsExistELF2E32EXE) {
       
  1195 			    &main::Output(
       
  1196 				    "\n",
       
  1197 				    "\telf2e32 --definput=\"\$(EPOCBLD$Bld)\\$ExportLibrary.def\" --dso=",
       
  1198 				    "\$(EPOCLIB)\\LIB\\$ExportLibrary.dso --linkas=$LinkAs\n"
       
  1199 			    );
       
  1200 			    if ($ExtraExportLibrary) {
       
  1201 				    &main::Output(
       
  1202 					    "\n",
       
  1203 					    "\tcopy \"\$(EPOCLIB)\\LIB\\$ExportLibrary.dso\" ",
       
  1204 					    "\"\$(EPOCLIB)\\LIB\\$ExtraExportLibrary.dso\"",
       
  1205 					    "\n"
       
  1206 				    );
       
  1207 			    }		
       
  1208 		    }		
       
  1209 	        }
       
  1210 	} elsif($NamedSymLkup){
       
  1211 #		For an EXE, generate the .exp to accomodate 0th ordinal
       
  1212 		&main::Output(" ", &Generic_Quote("\$(EPOCBLD$Bld)\\$ExportLibrary.exp"), "\n");
       
  1213 	}
       
  1214 	else {
       
  1215 	    &main::Output("\n");
       
  1216 	}
       
  1217 
       
  1218 #       get rid of any -symbols produced .map file
       
  1219         if ($BasicTrgType=~/^(DLL|EXE)/o) {
       
  1220 	        &main::Output(
       
  1221 			"\t-\$(ERASE) \"\$(EPOCTRG$Bld)\\$Trg.map\" \n"
       
  1222 		);	
       
  1223 	}
       
  1224 #		Generate the dependency info - This is required to put the libraries in the same order
       
  1225 #		as mentioned in mmp.
       
  1226 		if($NamedSymLkup) {
       
  1227 			&main::Output(
       
  1228 			"\tperl -S deputil.pl $InterWorking --path=\$(EPOCBLD$Bld) \\\n",
       
  1229 			 "\t\t--out=$ExportLibrary \\\n",
       
  1230 			 "\t\t--libpath=\$(EPOCLIB)\\LIB \\\n",
       
  1231 			 "\t\t\$(LIBS$Bld)\n",
       
  1232 			);
       
  1233 		}
       
  1234 		my $AbsentSubst = '';
       
  1235         if ($BasicTrgType=~/^(DLL|EXE)/o) {
       
  1236 	        my $datalinkbase = "0x400000";
       
  1237 	        $datalinkbase = &main::DataLinkAddress if (&main::DataLinkAddress);
       
  1238 
       
  1239 #               make sure the linker feedback file is writable if it exists.
       
  1240 		my $lfbfile = LinkerFeedBackFile();
       
  1241 		&main::Output(
       
  1242 			"\t\@if exist $lfbfile attrib -r $lfbfile\n"
       
  1243 			) if $useLinkerFeedBack;
       
  1244 
       
  1245 		my $lfboption = LinkerFeedBackOption();
       
  1246 
       
  1247 	        &main::Output(
       
  1248 		        "\t$Link $linkerDebugOpt ${oP}shl ${oP}reloc ${oP}split ${oP}rw-base $datalinkbase  \\\n\t\t$lfboption${oP}noscanlib $PlatOpt{Ld}\\\n"
       
  1249 			);
       
  1250 			my $EntrySymbol;
       
  1251 			if ($BasicTrgType=~/^DLL$/o) {
       
  1252 				$EntrySymbol = '_E32Dll';
       
  1253 			}
       
  1254 			elsif ($BasicTrgType=~/^EXE$/o) {
       
  1255 				$EntrySymbol = '_E32Startup';
       
  1256 			}
       
  1257 			if ($EntrySymbol) {
       
  1258 				$AbsentSubst = " -absent $EntrySymbol";
       
  1259 			}
       
  1260 	        if ($BasicTrgType=~/^DLL$/o) {
       
  1261 	            # get the right object file for the entry point
       
  1262 	            my $ObjFile = "UC_DLL_.o";
       
  1263 	            if ($FirstLib =~ /EDEV/i) {
       
  1264 		            $ObjFile = "D_ENTRY_.o";
       
  1265 	            }
       
  1266 	            if ($FirstLib =~ /EKLL/i) {
       
  1267 		            $ObjFile = "L_ENTRY_.o";
       
  1268 	            }
       
  1269 	            if ($FirstLib =~ /EEXT/i) {
       
  1270 		            $ObjFile = "X_ENTRY_.o";
       
  1271 	            }
       
  1272 	            if ($FirstLib =~ /EVAR/i) {
       
  1273 		            $ObjFile = "V_ENTRY_.o";
       
  1274 	            }
       
  1275 	            &main::Output(
       
  1276 				    "\t\t${oP}entry _E32Dll \$(EPOCSTATLINK$Bld)\\$FirstLib($ObjFile) \$(EPOCSTATLINK$Bld)\\$FirstLib \\\n",
       
  1277 				    "\t\t\$(EPOCBLD$Bld)\\$ExportLibrary.exp \\\n"
       
  1278 				);
       
  1279 	        } elsif ($BasicTrgType=~/^EXE$/o || $TrgType=~/^EXEXP$/o) {
       
  1280 			    # get the right object file for the entry point
       
  1281 			    my $ObjFile = "UC_EXE_.o" ;
       
  1282 			    if ($FirstLib =~ /KC_EXE/i) {
       
  1283 					$ObjFile = "K_ENTRY_.o";
       
  1284 			    }
       
  1285 				# If building user-side under RVCT2.0.x, use 2.0.1 static library	
       
  1286 				if ($RVCT20) { 
       
  1287 					if ($ObjFile =~/UC_EXE_.o/i) { 
       
  1288 						$FirstLib = "EEXE20.LIB"; 
       
  1289 					} 
       
  1290 				} 
       
  1291 			    
       
  1292 			    &main::Output( "\t\t${oP}entry _E32Startup \$(EPOCSTATLINK$Bld)\\$FirstLib($ObjFile) \$(EPOCSTATLINK$Bld)\\$FirstLib \\\n" );
       
  1293 			    if ($TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o || $NamedSymLkup) {
       
  1294 					&main::Output( "\t\t\$(EPOCBLD$Bld)\\$ExportLibrary.exp \\\n" );
       
  1295 			    }
       
  1296 			}
       
  1297 			if($NamedSymLkup) {
       
  1298 				&main::Output(
       
  1299 				"\t\t--edit \"\$(EPOCBLD$Bld)\\$ExportLibrary.dep\" \\\n"
       
  1300 				);
       
  1301 			}
       
  1302 	        &main::Output(
       
  1303 		        "\t\t-o \"\$(EPOCBLD$Bld)\\$Trg\" \\\n",
       
  1304 		        "\t\t${oP}symbols ${oP}list \"\$(EPOCTRG$Bld)\\$Trg.map\" \\\n",
       
  1305 				"\t\t\$(EPOCBLD$Bld)\\$BaseTrg.in \\\n"
       
  1306 			);
       
  1307 	        &main::Output(
       
  1308 		        "\t\t\$(LIBS$Bld) \\\n",
       
  1309 				"\t\t\$(VTBLEXPORTS$Bld) \$(USERLDFLAGS) \n"
       
  1310 			);
       
  1311 
       
  1312 	        if(&main::DebugSwitchUsed() ){
       
  1313 				if(&main::SymbolicDebugEnabled() ) {
       
  1314 				&main::Output(
       
  1315 					"\tcopy \"\$(EPOCBLD$Bld)\\$Trg\" \"\$(EPOCTRG$Bld)\\$FeatureVariantBaseTrg.sym\"\n"
       
  1316 					);
       
  1317 				}
       
  1318 			}
       
  1319 	        elsif ($Bld=~/^UDEB$/o) {
       
  1320 	               &main::Output(
       
  1321 			       "\tcopy \"\$(EPOCBLD$Bld)\\$Trg\" \"\$(EPOCTRG$Bld)\\$FeatureVariantBaseTrg.sym\"\n"
       
  1322 		       );
       
  1323 	        }
       
  1324 		
       
  1325 		if (&main::CompressTarget) {
       
  1326 		    &main::Output(
       
  1327 			    "\telftran $PlatOpt{Elftran} -version ", &Genutl_VersionToUserString(%Version), " -sid ", &main::SecureId(), " ", " -nocompress "
       
  1328 				 );
       
  1329 		    
       
  1330 		}
       
  1331 		else {
       
  1332 			if(&main::CompressTargetMode==NOCOMPRESSIONMETHOD){
       
  1333 				&main::Output(
       
  1334 					"\telftran $PlatOpt{Elftran} -version ", &Genutl_VersionToUserString(%Version), " -sid ", &main::SecureId(), " "
       
  1335 				);
       
  1336 			}
       
  1337 			elsif(&main::CompressTargetMode==INFLATECOMPRESSIONMETHOD){
       
  1338 				&main::Output(
       
  1339 				"\telftran $PlatOpt{Elftran} -version ", &Genutl_VersionToUserString(%Version), " -sid ", &main::SecureId(), " ", "  -compressionmethod deflate"
       
  1340 				);
       
  1341 			}
       
  1342 			elsif(&main::CompressTargetMode==BYTEPAIRCOMPRESSIONMETHOD){
       
  1343 				&main::Output(
       
  1344 					"\telftran $PlatOpt{Elftran} -version ", &Genutl_VersionToUserString(%Version), " -sid ", &main::SecureId(), " ", "  -compressionmethod bytepair"
       
  1345 				);
       
  1346 			}
       
  1347 		}
       
  1348 
       
  1349 		if (&main::IsDebuggable eq DEBUGGABLE) {
       
  1350  			&main::Output(
       
  1351  				' -debuggable '
       
  1352  			);
       
  1353  		}
       
  1354 
       
  1355 		if (&main::SmpSafe) {
       
  1356  			&main::Output(
       
  1357  				' -smpsafe'
       
  1358  			);
       
  1359  		}
       
  1360 
       
  1361 		if (&main::IsDebuggable eq DEBUGGABLE_UDEBONLY) {		
       
  1362 			if ($Bld=~/^UDEB$/o) {
       
  1363 				&main::Output(
       
  1364 				' -debuggable '
       
  1365 				);
       
  1366 			}
       
  1367 		}
       
  1368 		
       
  1369 		# change - exexps are allowed data, but they look like dlls to elftran....
       
  1370 		if (&main::AllowDllData || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
       
  1371 			&main::Output(
       
  1372 				' -allow'
       
  1373 			);
       
  1374 		}
       
  1375 		if (not &main::CallDllEntryPoints ) {
       
  1376 			&main::Output(
       
  1377 				' -nocall'
       
  1378 			);
       
  1379 		}
       
  1380 		if (&main::DataLinkAddress) {
       
  1381 			&main::Output(
       
  1382 				' -datalinkaddress ',&main::DataLinkAddress
       
  1383 			);
       
  1384 		}
       
  1385 		if (&main::FixedProcess) {
       
  1386 			&main::Output(
       
  1387 				' -fixed'
       
  1388 			);
       
  1389 		}
       
  1390 		if (&main::HeapSize) {
       
  1391 			my %HeapSize=&main::HeapSize;
       
  1392 			&main::Output(
       
  1393 				' -heap ',$HeapSize{Min},' ',$HeapSize{Max}
       
  1394 			);
       
  1395 		}
       
  1396 		if (&main::ProcessPriority) {
       
  1397 			&main::Output(
       
  1398 				' -priority ',&main::ProcessPriority
       
  1399 			);
       
  1400 		}
       
  1401 		if (&main::StackSize) {
       
  1402 			&main::Output(
       
  1403 				' -stack ',&main::StackSize
       
  1404 			);
       
  1405 		}
       
  1406 
       
  1407 		if (&main::CodePagingTargetMode == UNPAGED) {
       
  1408 			&main::Output(
       
  1409 				' -codepaging unpaged'
       
  1410 			);
       
  1411 		}
       
  1412 		elsif (&main::CodePagingTargetMode == PAGED) {
       
  1413 			&main::Output(
       
  1414 				' -codepaging paged'
       
  1415 			);
       
  1416 		}
       
  1417 
       
  1418 		if (&main::DataPagingTargetMode == UNPAGED) {
       
  1419 			&main::Output(
       
  1420 				' -datapaging unpaged'
       
  1421 			);
       
  1422 		}
       
  1423 		elsif (&main::DataPagingTargetMode == PAGED) {
       
  1424 			&main::Output(
       
  1425 				' -datapaging paged'
       
  1426 			);
       
  1427 		}
       
  1428 
       
  1429 		&main::Output(
       
  1430 			"\\\n\t\t"
       
  1431 		);
       
  1432 
       
  1433 		my $i=1;
       
  1434 		foreach (@UidList) {
       
  1435 			&main::Output(
       
  1436 				" -uid$i $_"
       
  1437 			);
       
  1438 			$i++;
       
  1439 		}
       
  1440 		if(&main::VendorId) {
       
  1441 			&main::Output(
       
  1442 				' -vid ',&main::VendorId
       
  1443 			);
       
  1444 		}
       
  1445 		&main::Output(
       
  1446 			"\\\n\t\t"
       
  1447 		);
       
  1448 		&main::Output(
       
  1449 			' -fpu ',$floatingpointmodel
       
  1450 		);
       
  1451 		&main::Output(
       
  1452 			' -capability ',&main::Capability
       
  1453 		);
       
  1454 		if($NamedSymLkup) {
       
  1455 			&main::Output(
       
  1456 				' -sym_name_lkup'
       
  1457 			);
       
  1458 		}
       
  1459 		&main::Output(
       
  1460 			"\\\n\t\t"
       
  1461 		);
       
  1462 		&main::Output(
       
  1463 			" \"\$(EPOCBLD$Bld)\\$Trg\""
       
  1464 		);
       
  1465 		&main::Output(
       
  1466 			"\\\n\t\t"
       
  1467 		);
       
  1468 		&main::Output(
       
  1469 			" \"\$\@\" \n"
       
  1470 		);
       
  1471 		&main::Output(
       
  1472 			"\n"
       
  1473 		);
       
  1474 
       
  1475          }
       
  1476          elsif ($BasicTrgType=~/^LIB$/o) {
       
  1477 	        &main::Output(
       
  1478 		        "\tarmar ${oP}create \$(EPOCSTATLINK$Bld)\\$Trg ${oP}via $objectsViaFile\n"
       
  1479 		);
       
  1480          }
       
  1481 
       
  1482          &main::Output(
       
  1483 		 "\n"
       
  1484 	 );
       
  1485 	 
       
  1486 #	add static lib into the object via file
       
  1487 	my $libViaFiles=$objectFiles;
       
  1488 	if (@StatLibList) {
       
  1489 		foreach (@StatLibList) {
       
  1490 			$libViaFiles.= &main::RelPath."$_ \n";
       
  1491 		}
       
  1492 		&main::CreateExtraFile($objectsViaFile, $libViaFiles);
       
  1493 	}
       
  1494 	
       
  1495     # TARGET *.IN
       
  1496     #------------
       
  1497 	 
       
  1498     &main::Output(
       
  1499 		&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseTrg.in"), ": \$(OBJECTS$Bld)\n",
       
  1500  	    "\t$Link $linkerDebugOpt ${oP}partial \\\n",
       
  1501 	    "\t\t-o \$\@ \\\n",
       
  1502 	    "\t\t${oP}via $objectsViaFile\n\n",
       
  1503     );
       
  1504     
       
  1505 
       
  1506 #   reorder the .DEF file taking frozen exports into account if there are any
       
  1507     if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o || $NamedSymLkup) {
       
  1508 
       
  1509 	    # TARGET *.EXP
       
  1510 	    #------------
       
  1511 	    &main::Output(
       
  1512 		    &Generic_Quote("\$(EPOCBLD$Bld)\\$ExportLibrary.exp"), ": \$(EPOCBLD$Bld)\\$BaseTrg.in"
       
  1513 	    );
       
  1514 
       
  1515 # if project is frozen, makedef (and hence the .exp file) are dependent upon it
       
  1516 		unless (&main::ExportUnfrozen) {
       
  1517 			if (-e $DefFile) { # effectively "if project frozen ..."
       
  1518 			    &main::Output(" $DefFile");
       
  1519 			}
       
  1520 		}
       
  1521 
       
  1522 	    &main::Output(
       
  1523 		"\n\tperl -S elf2inf.pl -o \$(EPOCBLD$Bld)\\$ExportLibrary.inf \\\n", 
       
  1524 		"\t\t\$\<",
       
  1525 		"\n\tperl -S makedef.pl $AbsentSubst -Inf \$(EPOCBLD$Bld)\\$ExportLibrary.inf \\\n"
       
  1526 	    );
       
  1527     	if (!$DefFile || $NoExportLibrary) {    			
       
  1528     		&main::Output( "\t\t-ignore_unfrozen_noncallable \\\n" );
       
  1529     	}
       
  1530 	if (SysTrg()) {
       
  1531     		&main::Output( "\t\t-SystemTargetType \\\n" );
       
  1532     	}
       
  1533     		
       
  1534 	    if (-e $DefFile) {	# effectively "if project frozen ..."
       
  1535 	            &main::Output(
       
  1536 			"\t\t-Frzfile \"$DefFile\" \\\n"
       
  1537 		    );
       
  1538 	    }
       
  1539 
       
  1540 		if($NamedSymLkup && !$DefFile){
       
  1541 #		For an EXE with named lookup, suppress the 'unfrozen exports' makedef warnings.
       
  1542 			&main::Output(
       
  1543 			"\t\t-ignore_unfrozen_exports \\\n",
       
  1544 			);
       
  1545 		}
       
  1546 
       
  1547 	    # freeze ordinals, a maximum of 2, for polymorphic dlls
       
  1548 	    my $Ordinal;
       
  1549 	    my $Num=1;
       
  1550 	    foreach $Ordinal (&main::Exports) {
       
  1551 	            &main::Output( "\t\t-$Num $Ordinal \\\n" );
       
  1552 		    $Num++;
       
  1553 	    }
       
  1554 	    
       
  1555 	    my $theDefFile = "\$(EPOCBLD$Bld)\\$ExportLibrary.def";
       
  1556 	    $theDefFile = $DefFile if (-e $DefFile && !&main::ExportUnfrozen);
       
  1557 	    &main::Output(
       
  1558 		"\t\t\"\$(EPOCBLD$Bld)\\$ExportLibrary.def\"\n",
       
  1559 		"\tcopy \"\$(EPOCBLD$Bld)\\$ExportLibrary.def\" \"\$(EPOCBLD)\\$ExportLibrary.def\"\n",
       
  1560 		"\tdef2dll.bat $AbsentSubst \\\n\t\t--path=\$(EPOCBLD$Bld) \\\n\t\t--bldpath=\$(EPOCBLD$Bld) \\\n\t\t--export=$ExportLibrary \\\n",
       
  1561 		"\t\t--deffile=$theDefFile \\\n\t\t--linkAs=$LinkAs \\\n\t\t$InterWorking $symNameLkupOpt\n"
       
  1562 	    );
       
  1563     }
       
  1564 
       
  1565     &main::Output( "\n" );
       
  1566 }
       
  1567 
       
  1568 # Set to 1 if multifile compilation wanted
       
  1569 my $domultifile = 0;
       
  1570 
       
  1571 sub DoMultiFile () {
       
  1572         return $ENV{RVCTMultiFile} if (defined $ENV{RVCTMultiFile});
       
  1573 	return $domultifile;
       
  1574 }
       
  1575 
       
  1576 my %CompilationGroups = ();
       
  1577 
       
  1578 sub InitMultiFileCompilation() {
       
  1579 #	Do preparatory work for multifile compilation
       
  1580 	my $SourceStructRef=&main::SourceStructRef;
       
  1581 
       
  1582 #	We sort the source files by path and extension. These form natural groups to compile together.
       
  1583 	my %PathToSourceMap = ();
       
  1584 	foreach my $SourceRef (@$SourceStructRef) {
       
  1585 		my $SrcFile = $$SourceRef{CurFile};
       
  1586 		my $Ext = &main::Path_Split('Ext', $SrcFile);
       
  1587 	        push @{$PathToSourceMap{$$SourceRef{SrcPath}}{$Ext}}, $SrcFile;
       
  1588 	}
       
  1589 
       
  1590 #	Now we split each group into sets of 10. 
       
  1591 	foreach my $SrcPath (keys %PathToSourceMap) {
       
  1592 		foreach my $Ext (keys %{$PathToSourceMap{$SrcPath}}) {
       
  1593 			my @FileList;
       
  1594 			my @ObjectList;
       
  1595 			my @SourceList;
       
  1596 			my $NumToGo = 10;
       
  1597 			foreach my $File (@{$PathToSourceMap{$SrcPath}{$Ext}}) {
       
  1598 				my $base = &main::Path_Split('Base', $File);
       
  1599 				my $cia = ($Ext =~ /cia/i);
       
  1600 				$base .= "_" if $cia;
       
  1601 				push @FileList, $File;
       
  1602 				push @ObjectList, "$base.o";
       
  1603 #				this gives us our source files xxx				
       
  1604 				push @SourceList, $cia ? "$base.cpp" : "$SrcPath$base$Ext";
       
  1605 				$NumToGo--;
       
  1606 				unless ($NumToGo) {
       
  1607 #				       Use the last file as the key. This means e.g that all the dependency
       
  1608 #				       info will have been generated for the earlier files in the list
       
  1609 				       push @{$CompilationGroups{$FileList[$#FileList]}{Sources}}, @SourceList;
       
  1610        				       push @{$CompilationGroups{$FileList[$#FileList]}{Objects}}, @ObjectList;
       
  1611 				       $NumToGo = 10;
       
  1612 				       undef @FileList;
       
  1613 				       undef @ObjectList;
       
  1614 				       undef @SourceList;
       
  1615 				}
       
  1616 			}
       
  1617 			push @{$CompilationGroups{$FileList[$#FileList]}{Sources}}, @SourceList;
       
  1618 			push @{$CompilationGroups{$FileList[$#FileList]}{Objects}}, @ObjectList;
       
  1619 		}
       
  1620 	}
       
  1621 
       
  1622 #	debug print out	
       
  1623 	if (0) {
       
  1624 	foreach my $keyfile (keys %CompilationGroups) {
       
  1625 		print "$keyfile :\n";
       
  1626 		foreach my $class (keys %{$CompilationGroups{$keyfile}}) {
       
  1627 			print "\t$class:\n\t\t";
       
  1628 			print join " ", @{$CompilationGroups{$keyfile}{$class}}, "\n";
       
  1629 		}
       
  1630 	}
       
  1631 	}
       
  1632 			
       
  1633 }
       
  1634 
       
  1635 sub PMStartSrcList {
       
  1636 
       
  1637 	&main::Output(
       
  1638 		"# SOURCES\n",
       
  1639 		"\n"
       
  1640 	);
       
  1641 
       
  1642 	InitMultiFileCompilation() if DoMultiFile();
       
  1643 
       
  1644 }
       
  1645 
       
  1646 sub PMBitMapBld {
       
  1647 
       
  1648 	&Generic_BitMapBld;
       
  1649 
       
  1650 }
       
  1651 
       
  1652 sub PMResrcBld {
       
  1653 
       
  1654 	&Generic_ResrcBld;
       
  1655 
       
  1656 }
       
  1657 
       
  1658 sub PMAifBld {
       
  1659 	&Generic_AifBld;
       
  1660 }
       
  1661 
       
  1662 
       
  1663 sub PMStartSrc {
       
  1664 	my $Src=&main::Src;
       
  1665 
       
  1666 	&main::Output(
       
  1667 		"# Source $Src\n",
       
  1668 		"\n"
       
  1669 	);
       
  1670 }
       
  1671 
       
  1672 sub PMSrcDepend {
       
  1673 	my @DepList=&main::DepList;
       
  1674 	return if (@DepList == 0);
       
  1675 
       
  1676 	my @BldList=&main::BldList;	
       
  1677 	my $BaseSrc=&main::BaseSrc;
       
  1678 	my $ExtSrc=&main::ExtSrc;
       
  1679 	
       
  1680 	my $BaseObj=$BaseSrc;
       
  1681 	my $cia = 0;
       
  1682 	if ($ExtSrc =~ /cia/i ) {
       
  1683 		$cia = 1;
       
  1684 		$BaseObj .= '_';
       
  1685 	}
       
  1686 
       
  1687 	foreach (@BldList) {
       
  1688 		&main::Output(
       
  1689 			&Generic_Quote("\$(EPOCBLD$_)\\$BaseSrc.pre"), " ",
       
  1690 			&Generic_Quote("\$(EPOCBLD$_)\\$BaseObj.cpp"), " ",
       
  1691 		) if $cia;
       
  1692 		&main::Output(
       
  1693 			&Generic_Quote("\$(EPOCBLD$_)\\$BaseSrc.lis"), " ",
       
  1694 			&Generic_Quote("\$(EPOCBLD$_)\\$BaseObj.o"), " \\\n",
       
  1695 		);
       
  1696 	}
       
  1697 	&main::Output(
       
  1698 		":"
       
  1699 	);
       
  1700         PrintList("\' \\\n\t\'\.\&Generic_Quote\(\$_\)", @DepList);
       
  1701 	&main::Output(
       
  1702 		"\n",
       
  1703 		"\n"
       
  1704 	);
       
  1705 }
       
  1706 
       
  1707 sub PMSrcBldDepend {
       
  1708 	my @DepList=&main::DepList;
       
  1709 	return if (@DepList == 0);
       
  1710 	
       
  1711 	my $Bld=&main::Bld;
       
  1712 	my $BaseSrc=&main::BaseSrc;
       
  1713 	my $ExtSrc=&main::ExtSrc;
       
  1714 	
       
  1715 	my $BaseObj=$BaseSrc;
       
  1716 	my $cia = 0;
       
  1717 	if ($ExtSrc =~ /cia/i ) {
       
  1718 		$cia = 1;
       
  1719 		$BaseObj .= '_';
       
  1720 	}
       
  1721 
       
  1722 	&main::Output(
       
  1723 		&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.pre"), " ",
       
  1724 		&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseObj.cpp"), " ",
       
  1725 	) if $cia;
       
  1726 	&main::Output(
       
  1727 		&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), " ",
       
  1728 		&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseObj.o"), " :",
       
  1729 	);
       
  1730         PrintList("\' \\\n\t\'\.\&Generic_Quote\(\$_\)", @DepList);
       
  1731 	&main::Output(
       
  1732 		"\n",
       
  1733 		"\n"
       
  1734 	);
       
  1735 }
       
  1736 
       
  1737 my $curdrive = "x";
       
  1738 
       
  1739 sub quoted_path
       
  1740     {
       
  1741     my ($arg) = @_;
       
  1742     return "\"$arg\"" if ($arg !~ /^\\[^\\]/);	# not an absolute path
       
  1743     if ($curdrive eq "x")
       
  1744 		{
       
  1745 		$curdrive="";
       
  1746 		$curdrive=$1 if (cwd =~ /^(.:)/);	
       
  1747 		}
       
  1748     return "\"$curdrive$arg\"";
       
  1749     }
       
  1750 
       
  1751 sub PMPrefixFile 
       
  1752 { 
       
  1753     my $IncPath = &main::EPOCIncPath;
       
  1754     
       
  1755     return quoted_path(&Generic_Quote("$IncPath"."rvct\\rvct.h"));
       
  1756 }
       
  1757 
       
  1758 
       
  1759 my $preinclude =   "--preinclude \$(EPOCINC)\\rvct\\rvct.h";
       
  1760 my $edg_preinclude = "-I \$(EPOCINC)\\RVCT${RVCTVersion} --preinclude edg_rvct${RVCTVersion}.h";
       
  1761 
       
  1762 sub SelectLangOptions {
       
  1763 	my ($Ext) = @_;
       
  1764 	if ($Ext=~/^.cpp$/) {
       
  1765 		# In case of function call logger, the preinclude file is passed to the function call logger
       
  1766 		# hence it is not required to pass the same file to the compiler.
       
  1767 		return "--cpp "	if ($Function_Call_Logger);
       
  1768 		return "--cpp $preinclude ";
       
  1769 	}
       
  1770 	if ($Ext=~/^.cia$/) {
       
  1771 		return "--cpp ";
       
  1772 	}
       
  1773 	if ($Ext=~/^.c$/) {
       
  1774 		if($CompilerOption =~/--cpp/) {
       
  1775 			#Function Call Logger
       
  1776 			return "--cpp " if ($Function_Call_Logger);
       
  1777 			return "--cpp $preinclude ";
       
  1778 		}
       
  1779 		else {
       
  1780 			#Function Call Logger
       
  1781 			return "--c90 " if ($Function_Call_Logger);
       
  1782 			return "--c90 $preinclude ";
       
  1783 		}
       
  1784 	}
       
  1785 	# To support .cc, .cxx, .c++ file extensions for Open Environment
       
  1786 	elsif ($Ext=~/^(.cc|.cxx|.c\+\+)$/) {
       
  1787 		#Function Call Logger
       
  1788 		return "--cpp " if ($Function_Call_Logger);
       
  1789 		return "--cpp $preinclude ";
       
  1790 	}
       
  1791 	return '';
       
  1792 }
       
  1793 
       
  1794 sub PMEndSrcBld {
       
  1795 #       Generate multifile compilation stuff if needed.
       
  1796         if (DoMultiFile()) {
       
  1797 	       MultiFileEndSrcBld();
       
  1798 	       return;
       
  1799 	}
       
  1800 
       
  1801 	my $ABI=&main::ABI;
       
  1802 	my $Plat=&main::Plat;
       
  1803 	my $BaseSrc=&main::BaseSrc;
       
  1804 	my $Bld=&main::Bld;
       
  1805 	my $Src=lc &main::Src;	
       
  1806 	my $SrcPath=&main::Path_Chop(&main::SrcPath);
       
  1807 	my $Ext = &main::Path_Split('Ext', $Src);	
       
  1808 	my $BaseTrg=&main::BaseTrg;
       
  1809 	my $BldPath = &main::BldPath;
       
  1810 	$Src = ucfirst $Src if ($Ext !~ /\.(cpp|c)$/);		
       
  1811 	my $LangOptions = &SelectLangOptions($Ext);
       
  1812 	# support for auto 'translated' ASM 
       
  1813 	my $AsmFilep = $AsmFiles{$Src};
       
  1814 
       
  1815 	# Logger Ouput filename 
       
  1816 	my $Logger_Output = lc ($BaseSrc) . ".int.cpp";
       
  1817 	my $LstExt ;
       
  1818 	if($Plat =~ /^(ARMV[6-9])/i){
       
  1819 		$LstExt = $1 ;	
       
  1820 	}
       
  1821 	else{
       
  1822 		$LstExt = $ABI;
       
  1823 	}
       
  1824 	
       
  1825 	my $lfboption = LinkerFeedBackOption();
       
  1826 
       
  1827 	#Function Call Logger
       
  1828 	my $FC_Logger_Option=" --wchar_t_keyword --microsoft_version=1300 --dictionary_file_name $BldPath$BaseTrg.txt --diag_suppress 66,161,611,654,815,830,997,1152,1300,1390";
       
  1829 
       
  1830 	if ($AsmFilep || $Ext =~ /cia/i) {
       
  1831 		&main::Output(
       
  1832 # compile the translated, preprocessed source
       
  1833 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.o"), " : ",
       
  1834 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.cpp"), "\n",
       
  1835 			"\t\@echo $Src\n",
       
  1836 			"\t\$(ARMCC$Bld) $lfboption$LangOptions -J $SrcPath \$(INCDIR) -o \$\@ \$(EPOCBLD$Bld)\\$BaseSrc\_.cpp\n",
       
  1837 			"\n",
       
  1838 # rule to translate the preprocessed source
       
  1839 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.cpp"), " : ",
       
  1840 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.pre"), "\n",
       
  1841 			"\ttranasm.bat -n -s -o=\$\@ \$(EPOCBLD$Bld)\\$BaseSrc.pre\n",
       
  1842 			"\n",
       
  1843 # rule to preprocess the source
       
  1844 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.pre"), " : ",
       
  1845 			&Generic_Quote("$SrcPath\\$Src"), "\n",
       
  1846   			"\t\$(ARMCC$Bld) -D__CIA__ -E $preinclude $LangOptions -J $SrcPath \$(INCDIR) $SrcPath\\$Src -o \$\@ \n",
       
  1847 # generate an assembly listing target too
       
  1848 			"LISTING$Bld$BaseSrc\_ : ", &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.lis"), "\n",
       
  1849 			"\t", &Generic_CopyAction("$SrcPath\\$BaseSrc\_.$LstExt.lst"),
       
  1850 			"\n",
       
  1851 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.lis"), " : ",
       
  1852 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.cpp"), "\n",
       
  1853 			"\t\$(ARMCC$Bld) $LangOptions -S -J $SrcPath \$(INCDIR) -o \$\@ \$(EPOCBLD$Bld)\\$BaseSrc\_.cpp\n",
       
  1854 			"\n"
       
  1855 			);
       
  1856 	} else {
       
  1857 		#If Function Call logging is enabled, add call to function call logger
       
  1858 		if ($Function_Call_Logger) {
       
  1859 			&main::Output(
       
  1860 				&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.o"),
       
  1861 				" : ",
       
  1862 				&Generic_Quote("\$(EPOCBLD$Bld)\\$Logger_Output"),
       
  1863 				"\n",
       
  1864 				"\t\@echo $Logger_Output\n",
       
  1865 				"\t\$(ARMCC$Bld) $lfboption$LangOptions -J $SrcPath \$(INCDIR) -o \$\@ \$(EPOCBLD$Bld)\\$Logger_Output\n",
       
  1866 				"\n",
       
  1867 # generate an assembly listing target too
       
  1868 				"LISTING$Bld$BaseSrc : ", &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), "\n",
       
  1869 				"\t", &Generic_CopyAction("$SrcPath\\$BaseSrc.$LstExt.lst"),
       
  1870 				"\n",
       
  1871 				&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), " : ",
       
  1872 				&Generic_Quote("$SrcPath\\$Logger_Output"), "\n",
       
  1873 				"\t\$(ARMCC$Bld) $LangOptions -S -J $SrcPath \$(INCDIR) -o \$\@ \$(EPOCBLD$Bld)\\$Logger_Output \n",
       
  1874 				"\n"
       
  1875 			);
       
  1876 
       
  1877 			#Call to Function Call Logger
       
  1878 			&main::Output(
       
  1879 				&Generic_Quote("\$(EPOCBLD$Bld)\\$Logger_Output"), " : ",
       
  1880 				&Generic_Quote("$SrcPath\\$Src"),
       
  1881 				"\n",
       
  1882 				"\t \@echo $Logger_Output\n",
       
  1883 				"\t \$(FCLOGGER$Bld) $lfboption$edg_preinclude \\\n",
       
  1884 			    "\t -I $SrcPath  \\\n",
       
  1885 				"\t \$(INCDIR_FCLOGGER) $FC_Logger_Option \\\n",
       
  1886 			    "\t --gen_c_file_name \$\@ $SrcPath\\$Src\n",
       
  1887 				"\n\n",
       
  1888 			);
       
  1889 		}
       
  1890 		else {			
       
  1891 			&main::Output(
       
  1892 				&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.o"), " : ",
       
  1893 				&Generic_Quote("$SrcPath\\$Src"), "\n",
       
  1894 				"\t\@echo $Src\n",
       
  1895 				"\t\$(ARMCC$Bld) $lfboption$LangOptions -J $SrcPath \$(INCDIR) -o \$\@ $SrcPath\\$Src\n",
       
  1896 				"\n",
       
  1897 # generate an assembly listing target too
       
  1898 			"LISTING$Bld$BaseSrc : ", &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), "\n",
       
  1899 			"\t", &Generic_CopyAction("$SrcPath\\$BaseSrc.$LstExt.lst"),
       
  1900 			"\n",
       
  1901 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), " : ",
       
  1902 			&Generic_Quote("$SrcPath\\$Src"), "\n",
       
  1903 			"\t\$(ARMCC$Bld) $LangOptions -S -J $SrcPath \$(INCDIR) -o \$\@ $SrcPath\\$Src \n",
       
  1904 			"\n"
       
  1905 			);
       
  1906 			#Compiler wrapper support starts
       
  1907 			if($IsCompilerWrapperOption)
       
  1908 			{
       
  1909 				my $Platcmpwrap=&main::Plat;
       
  1910 				&main::Output(
       
  1911 					"COMPWRAP$Bld$BaseSrc : ",
       
  1912 					&Generic_Quote("$SrcPath\\$Src"), "\n",
       
  1913 					"\t\@echo Analysing $Src\n",
       
  1914 					"\t\$(COMPWRAP) \$(ARMCC$Bld) $LangOptions -S -J $SrcPath \$(INCDIR) -o \$\@ $SrcPath\\$Src \n",
       
  1915 					"\n"
       
  1916 				);
       
  1917 			}
       
  1918 			#Compiler wrapper support ends
       
  1919 			
       
  1920 		}
       
  1921 	}
       
  1922 }
       
  1923 
       
  1924 my $MFVarN = 0;
       
  1925 sub MultiFileEndSrcBld {
       
  1926 	my $ABI=&main::ABI;
       
  1927 	my $BaseSrc=&main::BaseSrc;
       
  1928 	my $Bld=&main::Bld;
       
  1929         my $KeyFile = &main::Src;
       
  1930 	my $Src=ucfirst lc $KeyFile;
       
  1931 	my $SrcPath=&main::Path_Chop(&main::SrcPath);
       
  1932 	my $Ext = &main::Path_Split('Ext', $Src);
       
  1933 	my $LangOptions = &SelectLangOptions($Ext);
       
  1934 	# support for auto 'translated' ASM 
       
  1935 	my $AsmFilep = $AsmFiles{$Src};
       
  1936 
       
  1937 	my $lfboption = LinkerFeedBackOption();
       
  1938 
       
  1939 	if ($AsmFilep || $Ext =~ /cia/i) {
       
  1940 		if ($CompilationGroups{$KeyFile}) {
       
  1941 # compile the translated, preprocessed source
       
  1942 		       &main::Output( "OBJECTS$MFVarN = ");
       
  1943 		       foreach my $obj (@{$CompilationGroups{$KeyFile}{Objects}}) {
       
  1944 			       &main::Output( &Generic_Quote("\\\n\t\$(EPOCBLD$Bld)\\$obj"), " "); 
       
  1945 		       }
       
  1946        		       &main::Output( "\n\n");
       
  1947 		       &main::Output( "SOURCES$MFVarN = ");
       
  1948 		       foreach my $src (@{$CompilationGroups{$KeyFile}{Sources}}) {
       
  1949 			       &main::Output( &Generic_Quote("\\\n\t\$(EPOCBLD$Bld)\\$src", " "));
       
  1950 		       }
       
  1951        		       &main::Output( "\n\n");
       
  1952 		       &main::Output( "\$(OBJECTS$MFVarN) : \$(SOURCES$MFVarN) \n");
       
  1953 
       
  1954 		       &main::Output(
       
  1955 				     "\t\@echo Compiling \$(SOURCES$MFVarN)\n", 
       
  1956 				     "\t\$(ARMCC$Bld) -J $SrcPath \$(INCDIR) $lfboption\\\n",
       
  1957 				     "\t\t$LangOptions -o \$\@ --multifile \$(SOURCES$MFVarN)"
       
  1958 		      );
       
  1959        		       &main::Output( "\n\n");
       
  1960 		       $MFVarN++;
       
  1961 		}
       
  1962 		&main::Output(
       
  1963 # rule to translate the preprocessed source
       
  1964 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.cpp"), " : ",
       
  1965 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.pre"), "\n",
       
  1966 			"\ttranasm.bat -n -s -o=\$\@ \$(EPOCBLD$Bld)\\$BaseSrc.pre\n",
       
  1967 			"\n",
       
  1968 # rule to preprocess the source
       
  1969 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.pre"), " : ",
       
  1970 			&Generic_Quote("$SrcPath\\$Src"), "\n",
       
  1971   			"\t\$(ARMCC$Bld) -D__CIA__ -E $preinclude $LangOptions -J $SrcPath \$(INCDIR) $SrcPath\\$Src -o \$\@ \n",
       
  1972 # generate an assembly listing target too
       
  1973 			"LISTING$Bld$BaseSrc\_ : ", &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.lis"), "\n",
       
  1974 			"\t", &Generic_CopyAction("$SrcPath\\$BaseSrc\_.$LstExt.lst"),
       
  1975 			"\n",
       
  1976 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.lis"), " : ",
       
  1977 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc\_.cpp"), "\n",
       
  1978 			"\t\$(ARMCC$Bld) $LangOptions -S -J $SrcPath \$(INCDIR) -o \$\@ \$(EPOCBLD$Bld)\\$BaseSrc\_.cpp\n",
       
  1979 			"\n"
       
  1980 			);
       
  1981 	} else {
       
  1982 
       
  1983 		if ($CompilationGroups{$KeyFile}) {
       
  1984 #                      compile the source
       
  1985 		       &main::Output( "OBJECTS$MFVarN = ");
       
  1986 		       foreach my $obj (@{$CompilationGroups{$KeyFile}{Objects}}) {
       
  1987 			       &main::Output( &Generic_Quote("\\\n\t\$(EPOCBLD$Bld)\\$obj"), " "); 
       
  1988 		       }
       
  1989        		       &main::Output( "\n\n");
       
  1990 		       &main::Output( "SOURCES$MFVarN = ");
       
  1991 		       foreach my $src (@{$CompilationGroups{$KeyFile}{Sources}}) {
       
  1992 			       &main::Output( &Generic_Quote("\\\n\t$src"), " ");
       
  1993 		       }
       
  1994        		       &main::Output( "\n\n");
       
  1995 		       &main::Output( "\$(OBJECTS$MFVarN) : \$(SOURCES$MFVarN) \n");
       
  1996 
       
  1997 		       &main::Output(
       
  1998 				     "\t\@echo Compiling \$(SOURCES$MFVarN)\n", 
       
  1999 				     "\t\$(ARMCC$Bld) -J $SrcPath \$(INCDIR) $lfboption\\\n",
       
  2000 				     "\t\t$LangOptions -o \$\@ --multifile \$(SOURCES$MFVarN)"
       
  2001 		      );
       
  2002        		       &main::Output( "\n\n");
       
  2003 		       $MFVarN++;
       
  2004 		}
       
  2005 #		generate an assembly listing target too
       
  2006 		&main::Output(
       
  2007 			"LISTING$Bld$BaseSrc : ", &Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), "\n",
       
  2008 			"\t", &Generic_CopyAction("$SrcPath\\$BaseSrc.$LstExt.lst"),
       
  2009 			"\n",
       
  2010 			&Generic_Quote("\$(EPOCBLD$Bld)\\$BaseSrc.lis"), " : ",
       
  2011 			&Generic_Quote("$SrcPath\\$Src"), "\n",
       
  2012 			"\t\$(ARMCC$Bld) $LangOptions -S -J $SrcPath \$(INCDIR) -o \$\@ $SrcPath\\$Src \n",
       
  2013 			"\n"
       
  2014 			);
       
  2015 	}
       
  2016 }
       
  2017 
       
  2018 
       
  2019 sub PMEndSrc {
       
  2020 
       
  2021 	&main::Output(
       
  2022 		"\n",
       
  2023 		"\n"
       
  2024 	);
       
  2025 }
       
  2026 
       
  2027 sub PMEndSrcList {
       
  2028 
       
  2029 	# Deal with accumulated MAKEDIRS etc.
       
  2030 
       
  2031 	&Generic_End;
       
  2032 }
       
  2033 
       
  2034 sub PMSupportsFeatureVariants
       
  2035 	{
       
  2036 	return 1;
       
  2037 	}
       
  2038 
       
  2039 1;
       
  2040 
       
  2041 
       
  2042 
       
  2043 
       
  2044 
       
  2045 
       
  2046