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