sbsv1_os/e32toolp/platform/cl_win.pm
changeset 0 83f4b4db085c
child 10 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_win;
       
    18 
       
    19 # declare variables global for module
       
    20 my @Win32LibList=();
       
    21 my $Win32StdHeaders;
       
    22 my $BaseAddressFlag;
       
    23 my $Win32Resrc;
       
    24 
       
    25 
       
    26 require Exporter;
       
    27 @ISA=qw(Exporter);
       
    28 @EXPORT=qw(
       
    29 	PMHelp_Mmp
       
    30 
       
    31 	PMCheckPlatformL
       
    32 
       
    33 	PMPlatProcessMmp
       
    34 	
       
    35 	PMStartBldList
       
    36 		PMBld
       
    37 	PMStartSrcList
       
    38 		PMBitMapBld
       
    39 		PMResrcBld
       
    40 		PMAifBld
       
    41 		PMStartSrc
       
    42 		PMSrcDepend
       
    43 			PMSrcBldDepend
       
    44 			PMEndSrcBld
       
    45 		PMEndSrc
       
    46 	PMEndSrcList
       
    47 );
       
    48 
       
    49 use strict;
       
    50 use Winutl;
       
    51 use cl_generic;
       
    52 use Pathutl;
       
    53 
       
    54 sub PMHelp_Mmp {
       
    55 	&Winutl_Help_Mmp;
       
    56 }
       
    57 
       
    58 sub SysTrg () {
       
    59 	return 1 if &main::SystemTrg;
       
    60 	my $ExportLibrary=&main::ExportLibrary;
       
    61 	return 1 if ($ExportLibrary =~ /EKERN/i);
       
    62 	my $Trg=&main::Trg;
       
    63 	return 1 if ($Trg =~ /KSRT/i);
       
    64 	return 0;
       
    65 }
       
    66 
       
    67 sub PMCheckPlatformL {
       
    68 	if ((&main::Plat eq 'TOOLS') and (&main::BasicTrgType ne 'EXE') and (&main::BasicTrgType ne 'LIB')) {
       
    69 		die "Can't specify anything but EXE or LIB targettypes for this platform\n";
       
    70 	}
       
    71 }
       
    72 
       
    73 sub PMPlatProcessMmp (@) {
       
    74 	&Winutl_DoMmp(\@_, $ENV{INCLUDE});
       
    75 	$BaseAddressFlag=&Winutl_BaseAddress;
       
    76 	$BaseAddressFlag=~s/^(.+$)$/ \/base:\"$1\"/o;
       
    77 	@Win32LibList=&Winutl_Win32LibList;
       
    78 	my $MSVCVer = &Winutl_MSVCVer;
       
    79 	push @Win32LibList, "kernel32.lib";
       
    80 	$Win32Resrc=&Winutl_Win32Resrc;
       
    81 	$Win32StdHeaders=&Winutl_Win32StdHeaders;
       
    82 }
       
    83 
       
    84 sub PMStartBldList($) {
       
    85 	my ($makecmd) = @_;
       
    86 	die "Cannot generate $makecmd makefiles\n" if ($makecmd ne "nmake");
       
    87 	my $AifStructRef=&main::AifStructRef;
       
    88 	my $BaseTrg=&main::BaseTrg;
       
    89 	my $BitMapStructRef=&main::BitMapStructRef;
       
    90 	my @BldList=&main::BldList;
       
    91 	my @ChopSysIncPaths=&main::Path_Chop(&main::SysIncPaths);
       
    92 	my @ChopUserIncPaths=&main::Path_Chop(&main::UserIncPaths);
       
    93 	my $ExportLibrary=&main::ExportLibrary;
       
    94 	my $NoExportLibrary=&main::NoExportLibrary;
       
    95 	my $DefFile=&main::DefFile;
       
    96 	my $BasicTrgType=&main::BasicTrgType;
       
    97 	my $LibPath=&main::LibPath;
       
    98 
       
    99 	my $MSVCVer = &Winutl_MSVCVer;
       
   100 
       
   101 	my @MacroList=&main::MacroList();
       
   102 	push @MacroList, "__SUPPORT_CPP_EXCEPTIONS__";
       
   103 
       
   104 	my $VariantFile=&main::VariantFile();
       
   105 	my $Plat=&main::Plat;
       
   106 	my $ResourceStructRef=&main::ResourceStructRef;
       
   107 	my $Trg=&main::Trg;
       
   108 	my $TrgType=&main::TrgType;
       
   109 	my $defaultWarningLevel="/W4";
       
   110 	my $CompilerOption=&main::CompilerOption("MSVC");
       
   111 	my $LinkAs=&main::LinkAs;
       
   112 
       
   113 	&Generic_Header(0,$makecmd);	# define standard things using absolute paths
       
   114 
       
   115 	my $TrgDir="";
       
   116 	if (&Generic_Definition("TRGDIR") ne "") {
       
   117 		$TrgDir="\$(TRGDIR)\\";
       
   118 	}
       
   119 	if (&main::Plat eq "WINC") {	# target path ignored under WINC
       
   120 		$TrgDir="";
       
   121 	}
       
   122 	&main::Output(
       
   123 		"INCDIR  ="
       
   124 	);
       
   125 	if($VariantFile){
       
   126         my $VariantFileFileName  = Path_Split('FILE',$VariantFile);
       
   127         &main::Output(
       
   128               " /FI \"$VariantFileFileName\"",
       
   129               );
       
   130 
       
   131 	}
       
   132 
       
   133 	foreach (@ChopUserIncPaths,@ChopSysIncPaths) {
       
   134 		&main::Output(
       
   135 			" /I \"$_\""
       
   136 		);
       
   137 	}
       
   138 	&main::Output(
       
   139 		"\n",
       
   140 		"\n"
       
   141 	);
       
   142 
       
   143 	my $MSVCVer = &Winutl_MSVCVer;
       
   144 
       
   145 	&main::Output(
       
   146 		"CLFLAGS =",
       
   147 			" /nologo",			# suppress "sign-on" banner message
       
   148 			" /Zp4",			# packs structures on 4 byte boundaries
       
   149 			" /GF"				# Pools strings and places them in read-only memory 
       
   150 		);	
       
   151 
       
   152 	if ($MSVCVer >= 7) {
       
   153 		&main::Output(
       
   154 			" /wd4996",			# C4996: 'xxxx' was declared deprecated
       
   155 			" /wd4571"			# C4571: catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions
       
   156 		);	
       
   157 
       
   158 		if (&main::Plat ne 'TOOLS') {
       
   159 			&main::Output(
       
   160 				" /EHsc",			# Exceptions on
       
   161 				" /GR"				# RTTI on
       
   162 			);
       
   163 			if ($MSVCVer >= 8) {
       
   164 				&main::Output(
       
   165 					" /GS-"			# Buffer checking off
       
   166 				);
       
   167 			}
       
   168 		} else {
       
   169 			&main::Output(
       
   170 				" /EHsc",			# Exceptions on
       
   171 				" /GR",				# RTTI on
       
   172 				" /GS"				# Buffer checking on
       
   173 			);
       
   174 		}
       
   175 	} else {
       
   176 		if (&main::Plat ne 'TOOLS') {
       
   177 			&main::Output(
       
   178 				" /GX",				# Exceptions on
       
   179 				" /GR"				# RTTI on
       
   180 			);
       
   181 		}
       
   182 	}
       
   183 
       
   184 	if ($MSVCVer >= 8) {
       
   185 		&main::Output(
       
   186 			" /Zc:wchar_t-"				# Don't make wchar_t a built-in; breaks mangled names
       
   187 		);		
       
   188 	}
       
   189 
       
   190 	if (&main::Plat ne 'TOOLS') {
       
   191 		unless ($Win32StdHeaders) {
       
   192 			&main::Output(
       
   193 				" /X"			# ignore standard include directories
       
   194 			);
       
   195 		}
       
   196 	}
       
   197 	if ($CompilerOption !~ /\/W\d/) {
       
   198 		# Supply default warning level unless /Wn already specified via OPTION MSVC
       
   199 		&main::Output(
       
   200 			" $defaultWarningLevel"
       
   201 		);
       
   202 	}
       
   203 	&main::Output(
       
   204 		" $CompilerOption",		# user-supplied compiler options
       
   205 		"\n",
       
   206 		"\n"
       
   207 	);
       
   208 
       
   209 	&main::Output(
       
   210 		"CLDEFS  ="
       
   211 	);
       
   212 	foreach(@MacroList) {
       
   213 		&main::Output(
       
   214 			" /D \"$_\""
       
   215 		);
       
   216 	}
       
   217 	if (($BasicTrgType=~/^LIB$/o) and (&main::Plat eq 'TOOLS')) {
       
   218 		&main::Output(
       
   219 			" /D _MT"
       
   220 		); 
       
   221 	}
       
   222 	&main::Output(
       
   223 		" \$(USERDEFS)\n",
       
   224 		"\n"
       
   225 	);
       
   226 
       
   227 	foreach (@BldList) {
       
   228 		&main::Output(
       
   229 			"CL$_ = cl.exe"
       
   230 		);
       
   231 		if ($BasicTrgType=~/^EXE$/o) {
       
   232 			&main::Output(
       
   233 				' /MT'			# Creates a multi-threaded executable file, using libcmt.lib
       
   234 			);
       
   235 			if (/DEB$/o) {
       
   236 				&main::Output(
       
   237 					'd'				# i.e. /MTd or /MLd, debug executable using debug version of LIB
       
   238 				);
       
   239 			}
       
   240 		}
       
   241 		elsif (($BasicTrgType=~/^(DLL|LIB)$/o) and (&main::Plat ne 'TOOLS')){
       
   242 			&main::Output(
       
   243 				' /MD'			# Creates a multithreaded DLL, using MSVCRT.LIB
       
   244 			);
       
   245 			if (/DEB$/o) {
       
   246 				&main::Output(
       
   247 					'd'				# i.e. /MDd, debug executable using debug version of LIB
       
   248 				);
       
   249 			}
       
   250 		}
       
   251 		if (/DEB$/o) {
       
   252 			&main::Output(
       
   253 				' /Zi',			# Generates complete debugging information
       
   254 				' /Od'			# Disables optimization
       
   255 			);
       
   256 #			euser change to apply inlining on the _NAKED functions
       
   257 			if ($BaseTrg=~/^EUSER$/oi) {
       
   258 				&main::Output(
       
   259 					' /Ob1'		# Specific control of expension of inline functions
       
   260 				);
       
   261 			}
       
   262 		}
       
   263 		elsif (/REL$/o) {
       
   264 			&main::Output(
       
   265 				' /O1'				# Creates small code
       
   266 			);
       
   267 			if ($MSVCVer >= 8) {
       
   268 				&main::Output(
       
   269 					' /fp:strict'		# Improves floating-point consistency
       
   270 				);
       
   271 			} else {
       
   272 				&main::Output(
       
   273 					' /Op'				# Improves floating-point consistency
       
   274 				);
       
   275 			}
       
   276 		}
       
   277 		&main::Output(
       
   278 			' $(CLFLAGS)'
       
   279 		);
       
   280 		if (/DEB$/o) {
       
   281 			&main::Output(
       
   282 				" /Fd\"\$(EPOCTRG$_)\\$TrgDir$BaseTrg.pdb\""
       
   283 			);
       
   284 		}
       
   285 		foreach (&main::MacroList($_)) {
       
   286 			&main::Output(
       
   287 				" /D $_"
       
   288 			);
       
   289 		}
       
   290 		&main::Output(
       
   291 			" \$(CLDEFS) \$(INCDIR)\n"
       
   292 		);
       
   293 	}
       
   294 	&main::Output(
       
   295 		"\n",
       
   296 		"\n"
       
   297 	);
       
   298 	
       
   299 	foreach (@BldList) {
       
   300 		&main::Output(
       
   301 			"$_ :"
       
   302 		);
       
   303 		if ($BasicTrgType !~ /^IMPLIB$/io) {
       
   304 			&main::Output (
       
   305 				" \\\n",
       
   306 				"\t\"\$(EPOCTRG$_)\\$TrgDir$Trg\""
       
   307 			);
       
   308 			unless (/REL$/o) {
       
   309 				&main::Output(
       
   310 					" \\\n",
       
   311 					"\t\"\$(EPOCTRG$_)\\$BaseTrg.bsc\""
       
   312 				);
       
   313 			}
       
   314 			if (&Winutl_CopyForStaticLinkage) {
       
   315 				&main::Output(
       
   316 					" \\\n",
       
   317 					"\t\"\$(EPOCTRG$_)\\$Trg\""
       
   318 				);
       
   319 			}
       
   320 		}
       
   321 
       
   322 #		lib has to come after the main target so that a .DEF file will be generated if the project is not frozen
       
   323 		if ($DefFile and not &main::ExportUnfrozen) {
       
   324 			&main::Output(
       
   325 				" \\\n",
       
   326 				"\tLIBRARY\n"
       
   327 			);
       
   328 		}
       
   329 		&main::Output(
       
   330 			"\n",
       
   331 			"\n"
       
   332 		);
       
   333 	}
       
   334 
       
   335 
       
   336 	foreach (@BldList) {
       
   337 		my $makework="MAKEWORK$_";
       
   338 		&main::Output(
       
   339 			"\n",
       
   340 			"RESOURCE$_ : $makework"
       
   341 		);
       
   342 
       
   343 		my $BitMapRef;
       
   344 		foreach $BitMapRef (@$BitMapStructRef) {
       
   345 			my $file="\$(EPOCTRG$_)\\$$BitMapRef{TrgPath}$$BitMapRef{Trg}";
       
   346 			&Generic_MakeWorkFile($makework,$file);
       
   347 			&main::Output(
       
   348 				" \\\n",
       
   349 				"\t\"$file\""
       
   350 			);
       
   351 		}
       
   352 		undef $BitMapRef;
       
   353 
       
   354 		my $ResourceRef;
       
   355 		foreach $ResourceRef (@$ResourceStructRef) {
       
   356 			my $file="\$(EPOCTRG$_)\\$$ResourceRef{Trg}";
       
   357 			&Generic_MakeWorkFile($makework,$file);
       
   358 			&main::Output(	# must come before main target because source for target will depend on the
       
   359 			" \\\n",		# *.rsg file in $EPOCIncPath
       
   360 			"\t", &Generic_Quote("$file")
       
   361 			);
       
   362 		}
       
   363 		undef $ResourceRef;
       
   364 
       
   365 		my $AifRef;
       
   366 		foreach $AifRef (@$AifStructRef) {
       
   367 			my $file="\$(EPOCTRG$_)\\$TrgDir$$AifRef{Trg}";
       
   368 			&Generic_MakeWorkFile($makework,$file);
       
   369 			&main::Output(
       
   370 				" \\\n",
       
   371 				"\t\"$file\""
       
   372 			);
       
   373 		}
       
   374 		undef $AifRef;
       
   375 
       
   376 		&main::Output(
       
   377 			"\n"
       
   378 		);
       
   379 	}
       
   380 	&main::Output(
       
   381 		"\n",
       
   382 		"\n",
       
   383 	);
       
   384 
       
   385 	&main::Output(
       
   386 		"LIBRARY : MAKEWORKLIBRARY"
       
   387 	);
       
   388 	if ($BasicTrgType=~/^LIB$/o) {
       
   389 #		code to ensure that the static libraries for all builds are built at the library stage
       
   390 		foreach (@BldList) {
       
   391 			&main::Output(
       
   392 				" $_"
       
   393 			);
       
   394 		}
       
   395 	}
       
   396 	elsif ($DefFile and !$NoExportLibrary) {
       
   397 		unless (&main::ExportUnfrozen) {
       
   398 			if (-e $DefFile) { # effectively "if project frozen ..."
       
   399 				&main::Output(
       
   400 					" \"\$(EPOCLIB)\\UDEB\\$ExportLibrary.lib\"\n"
       
   401 				);
       
   402 			} else {
       
   403 				&main::Output(
       
   404 					"\n",
       
   405 					"\t\@echo WARNING: Not attempting to create \"\$(EPOCLIB)\\UDEB\\$ExportLibrary.lib\".\n",
       
   406 					"\t\@echo When exports are frozen in \"$DefFile\", regenerate Makefile.\n"
       
   407 				);
       
   408 			}
       
   409 		} else {
       
   410 			&main::Output(
       
   411 				"\n",
       
   412 				"\t\@echo Not attempting to create \"\$(EPOCLIB)\\UDEB\\$ExportLibrary.lib\"\n",
       
   413 				"\t\@echo from frozen .DEF file, since EXPORTUNFROZEN specified.\n"
       
   414 			);
       
   415 		}
       
   416 		my $LibLinkAs = ($BasicTrgType=~/^IMPLIB$/io) ? $LinkAs : $Trg;
       
   417 		&main::Output(
       
   418 			"\n",
       
   419 			"\n",
       
   420 			"# REAL TARGET - LIBRARY\n",
       
   421 			"\n",
       
   422 			"\"\$(EPOCLIB)\\UDEB\\$ExportLibrary.lib\" : \"$DefFile\"\n",
       
   423 			"\tperl -w -S prepdef.pl \"$DefFile\" \"\$(EPOCBLD)\\$ExportLibrary.prep.def\"\n",
       
   424 			"\tlib.exe /nologo /machine:i386 /nodefaultlib /name:\"$LibLinkAs\"    /def:\"\$(EPOCBLD)\\$ExportLibrary.prep.def\" /out:\"\$(EPOCLIB)\\UDEB\\$ExportLibrary.lib\"\n",
       
   425 			"\tdel \"\$(EPOCLIB)\\UDEB\\$ExportLibrary.exp\"\n"
       
   426 		);
       
   427 	}
       
   428 	&main::Output(
       
   429 		"\n",
       
   430 		"\n",
       
   431 		"FREEZE :\n"
       
   432 	);
       
   433 	if ($DefFile and $BasicTrgType !~ /^IMPLIB$/io) {
       
   434 		&main::Output(
       
   435 #			call perl on the script here so nmake will die if there are errors - this doesn't happen if calling perl in a batch file
       
   436 			"\tperl -w -S efreeze.pl \$(EFREEZE_ALLOW_REMOVE) \"$DefFile\" \"\$(EPOCBLD)\\$ExportLibrary.def\" \n"
       
   437 		);
       
   438 	}
       
   439 	&main::Output(
       
   440 		"\n",
       
   441 		"CLEANLIBRARY :\n"
       
   442 	);
       
   443 	if ($DefFile and !$NoExportLibrary) {
       
   444 		&main::Output(
       
   445 			"\t-\$(ERASE) \"\$(EPOCLIB)\\UDEB\\$ExportLibrary.lib\"\n"
       
   446 		);
       
   447 	}
       
   448 	&Generic_MakeWorkDir('MAKEWORKLIBRARY',"${LibPath}UDEB");
       
   449 
       
   450 	&Generic_Releaseables;
       
   451 }
       
   452 
       
   453 sub PMBld {
       
   454 
       
   455 	my $AifStructRef=&main::AifStructRef;
       
   456 	my @SrcList=&main::SrcList;
       
   457 	my $BaseTrg=&main::BaseTrg;
       
   458 	my $BitMapStructRef=&main::BitMapStructRef;
       
   459 	my $Bld=&main::Bld;
       
   460 	my $ExportLibrary=&main::ExportLibrary;
       
   461 	my $NoExportLibrary=&main::NoExportLibrary;
       
   462 	my $DefFile=&main::DefFile;
       
   463 	my $EPOCIncPath=&main::EPOCIncPath;
       
   464 	my $FirstLib=&main::FirstLib;
       
   465 	my $BasicTrgType=&main::BasicTrgType;
       
   466 	my @LibList;
       
   467 	my $RelPath=&main::RelPath;
       
   468 	my $ResourceStructRef=&main::ResourceStructRef;
       
   469 	my @StatLibList=&main::StatLibList;
       
   470 	my $Trg=&main::Trg;
       
   471 	my $TrgPath=&main::TrgPath;
       
   472 	my $TrgType=&main::TrgType;
       
   473 	my $MSVCVer = &Winutl_MSVCVer;
       
   474 	my $newlib = main::NewLib(); # Check if newlib has been set in the MMP file.
       
   475 
       
   476 
       
   477     my $NewLib = 'scppnwdl.lib'; # This is where operator new and operator delete
       
   478                                  # are defined for user side targets.
       
   479 
       
   480     my $NewKernLib = 'scppnwdl_kern.lib'; # This is where operator new and operator delete
       
   481                                  	  # are defined for kernel side targets.
       
   482 
       
   483 
       
   484 
       
   485 	my $WarningLevel='/WARN:3';
       
   486 	if (&main::Plat() eq 'TOOLS') {
       
   487 		$WarningLevel='/WARN:1';    # avoid LNK4005 warnings about unused libraries
       
   488 	}
       
   489 
       
   490 	if ($Bld =~ /DEB/) {
       
   491 		@LibList=&main::DebugLibList;
       
   492 	} else {
       
   493 		@LibList=&main::LibList;
       
   494 	}
       
   495 
       
   496 	my $BLDTRGPATH = "\$(EPOCTRG$Bld)\\";
       
   497 	my $BLDDATAPATH = "\$(EPOCTRG$Bld)\\";
       
   498 	if (&main::Plat ne "WINC") {	# target paths ignored under WINC
       
   499 		if (&Generic_Definition("TRGDIR") ne "") {
       
   500 			$BLDTRGPATH .= "\$(TRGDIR)\\";	    # handles TARGETPATH
       
   501 		}
       
   502 		$BLDDATAPATH .= "\$(DATADIR)\\";
       
   503 	}
       
   504 
       
   505 	my $Entry="";
       
   506 	my $EntrySymbol='';
       
   507 	my $Include="";
       
   508 	if ($BasicTrgType=~/^DLL$/o) {
       
   509 		$Entry="/noentry";
       
   510 		$Include="/include:\"__E32Dll\"";
       
   511 		$EntrySymbol='_E32Dll';
       
   512 	}
       
   513 	elsif ($TrgType=~/^EXEXP$/o) {
       
   514 		$Entry="/noentry";
       
   515 		$Include="/include:\"__E32Startup\"";
       
   516 		$EntrySymbol='_E32Startup';
       
   517 	}
       
   518 	elsif ($BasicTrgType=~/^EXE$/o) {
       
   519 		unless (&main::Plat eq 'TOOLS') {
       
   520 			$Entry="/entry:\"_E32Bootstrap\"";
       
   521 			$Include="/include:\"__E32Startup\"";
       
   522 		}
       
   523 	}
       
   524 	my $AbsentSubst = '';
       
   525 	if ($EntrySymbol) {
       
   526 		$AbsentSubst = " -absent $EntrySymbol";
       
   527 	}
       
   528 
       
   529 	# REAL TARGETS
       
   530 	#-------------
       
   531 	&main::Output(
       
   532 		"# REAL TARGET - BUILD VARIANT $Bld\n",
       
   533 		"\n"
       
   534 	);
       
   535 
       
   536 #	releasables
       
   537 	my @releaseables;
       
   538 
       
   539 	unless (&main::Plat() eq 'TOOLS') {
       
   540 		if ($BasicTrgType !~ /^IMPLIB$/io) {
       
   541 			push @releaseables, "$BLDTRGPATH$Trg";
       
   542 			if (&Winutl_CopyForStaticLinkage) {
       
   543 				push @releaseables, "\$(EPOCTRG$Bld)\\$Trg";
       
   544 			}
       
   545 			my $BitMapRef;
       
   546 			foreach $BitMapRef (@$BitMapStructRef) {
       
   547 				push @releaseables, "\$(EPOCTRG$Bld)\\$$BitMapRef{TrgPath}$$BitMapRef{Trg}";
       
   548 			}
       
   549 			my $ResourceRef;
       
   550 			foreach $ResourceRef (@$ResourceStructRef) {
       
   551 				push @releaseables, "\$(EPOCTRG$Bld)\\$$ResourceRef{Trg}";
       
   552 			}
       
   553 			my $AifRef;
       
   554 			foreach $AifRef (@$AifStructRef) {
       
   555 				push @releaseables, "$BLDTRGPATH$$AifRef{Trg}";
       
   556 			}
       
   557 			if ($Bld=~/DEB$/o) {
       
   558 				push @releaseables,"$BLDTRGPATH$BaseTrg.PDB";
       
   559 			}
       
   560 		}
       
   561 		if (-e $DefFile and !$NoExportLibrary) { # effectively "if project frozen ..."
       
   562 			push @releaseables, "\$(EPOCLIB$Bld)\\$ExportLibrary.lib";
       
   563 		}
       
   564 	}
       
   565 	else {
       
   566 		my $toolspath=&main::EPOCToolsPath();
       
   567 		push @releaseables, "$toolspath$Trg";
       
   568 	}
       
   569 
       
   570 	&main::Output(
       
   571 		"WHAT$Bld : WHATGENERIC\n",
       
   572 		"\n",
       
   573 		"CLEAN$Bld : CLEANBUILD$Bld CLEANRELEASE$Bld\n",
       
   574 		"\n",
       
   575 		"CLEANBUILD$Bld : CLEANILK$Bld\n",
       
   576 		"\t\@perl -w -S ermdir.pl \"\$(EPOCBLD$Bld)\"\n",
       
   577 		"\n",
       
   578 		"CLEANRELEASE$Bld : CLEANGENERIC CLEANILK$Bld\n",
       
   579 		"\n",
       
   580 		"CLEANILK$Bld :\n",
       
   581 		"\t-\$(ERASE) \"$BLDTRGPATH$BaseTrg.ILK\"\n",
       
   582 		"\n"
       
   583 	);
       
   584 	&Generic_WhatCleanTargets($Bld, "WHAT$Bld", "CLEANRELEASE$Bld", @releaseables);
       
   585 
       
   586 	&Generic_MakeWorkDir("MAKEWORK$Bld", &main::BldPath);
       
   587 	&Generic_MakeWorkDir("MAKEWORK$Bld", $BLDTRGPATH);
       
   588 
       
   589 	return if ($BasicTrgType =~ /^IMPLIB$/io);
       
   590 
       
   591 	&main::Output(
       
   592 		"LISTING$Bld : MAKEWORK$Bld"
       
   593 	);
       
   594 	foreach (@SrcList) {
       
   595 		my $BaseSrc = &main::Path_Split('Base', $_);
       
   596 		my $Ext = &main::Path_Split('Ext', $_);
       
   597 		$BaseSrc.='_' if (lc($Ext) eq '.cia');
       
   598    		&main::Output(
       
   599 			" \\\n\tLISTING$Bld$BaseSrc"
       
   600    		);
       
   601    	}
       
   602 	&main::Output(
       
   603 		"\n",
       
   604 		"\n"
       
   605 	);
       
   606 
       
   607 	if ($Bld=~/DEB$/o) {
       
   608 		&main::Output(
       
   609 			"BSC32_SBRS="
       
   610 		);
       
   611 		foreach (@SrcList) {
       
   612 			my $BaseSrc = &main::Path_Split('Base', $_);
       
   613 			my $Ext = &main::Path_Split('Ext', $_);
       
   614 			$BaseSrc.='_' if (lc($Ext) eq '.cia');
       
   615 			&main::Output(
       
   616 				" \\\n",
       
   617 				"\t\"\$(EPOCBLD$Bld)\\$BaseSrc.sbr\""
       
   618 			);
       
   619    		}
       
   620 		&main::Output(
       
   621 			"\n",
       
   622 			"\n",
       
   623 		"\"\$(EPOCTRG$Bld)\\$BaseTrg.bsc\" : \$(BSC32_SBRS)\n",
       
   624 		"\tbscmake.exe \@<<\n",
       
   625 		"\t/nologo /o\$\@ \$(BSC32_SBRS)\n",
       
   626 		"<<\n",
       
   627 		"\n",
       
   628 		"\n"
       
   629 		);
       
   630 	}
       
   631 
       
   632 	&main::Output(
       
   633 		"LIBS="
       
   634 	);
       
   635 	foreach (@StatLibList) {
       
   636 		&main::Output(
       
   637 			" \\\n\t\"\$(EPOCSTATLINK$Bld)\\$_\""
       
   638 		);
       
   639 	}
       
   640 	foreach (@LibList) {
       
   641 		&main::Output(
       
   642 			" \\\n\t\"\$(EPOCLINK$Bld)\\$_\""
       
   643 		);
       
   644 	}
       
   645 	&main::Output(
       
   646 		"\n",
       
   647 		"\n"
       
   648 	);
       
   649 
       
   650 	&main::Output(
       
   651 		"LINK_OBJS="
       
   652 	);
       
   653 	foreach (@SrcList) {
       
   654 		my $BaseSrc = &main::Path_Split('Base', $_);
       
   655 		my $Ext = &main::Path_Split('Ext', $_);
       
   656 		$BaseSrc.='_' if (lc($Ext) eq '.cia');
       
   657    		&main::Output(
       
   658 			" \\\n",
       
   659 			"\t\"\$(EPOCBLD$Bld)\\$BaseSrc.obj\""
       
   660    		);
       
   661    	}
       
   662 	if ($Win32Resrc) {
       
   663 		&main::Output(
       
   664 			" \\\n",
       
   665 			"\t\"\$(EPOCBLD$Bld)\\",&main::Path_Split('Base',$Win32Resrc),".res\""
       
   666 		);
       
   667 	}
       
   668 	&main::Output(
       
   669 		"\n",
       
   670 		"\n"
       
   671 	);
       
   672 
       
   673 	if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o) {
       
   674 		&main::OutFormat(
       
   675 			"STAGE1_LINK_FLAGS="
       
   676 		);
       
   677 		&main::OutFormat(
       
   678 			"\"\$(EPOCSTATLINK$Bld)\\$FirstLib\""
       
   679 		);
       
   680         
       
   681         if (main::StdCppSupport())
       
   682         {
       
   683             unless ($newlib) {
       
   684 		    	if ( main::SystemTrg() ) {
       
   685 		    		# System targets are PDD, LDD, VAR, KEXT and KDLL.
       
   686 		    		&main::OutFormat(
       
   687 		    			"\"\$(EPOCSTATLINK$Bld)\\$NewKernLib\""
       
   688 		    		);
       
   689 		    	}
       
   690 		    	else {
       
   691 		    		&main::OutFormat(
       
   692 		    			"\"\$(EPOCSTATLINK$Bld)\\$NewLib\""
       
   693 		    		);
       
   694 		    	}
       
   695 		    }
       
   696 	    	else {
       
   697 	    		&main::OutFormat(
       
   698 				    "\"\$(EPOCSTATLINK$Bld)\\$newlib\""
       
   699 			    );
       
   700 		    }    
       
   701         }
       
   702 		
       
   703 		foreach (@Win32LibList) {
       
   704 			&main::OutFormat(
       
   705 				' ',lc $_
       
   706 			);
       
   707 		}
       
   708 		&main::OutFormat(
       
   709 			" \$(LIBS) /nologo$BaseAddressFlag $Entry /subsystem:windows /dll"
       
   710 		);
       
   711 		if ($Bld=~/DEB$/o) {
       
   712 			&main::OutFormat(
       
   713 				' /debug'
       
   714 			);
       
   715 		}
       
   716 		&main::OutFormat(
       
   717 			" /incremental:no /machine:IX86"
       
   718 		);
       
   719 
       
   720 		if ($BasicTrgType=~/^EXE$/o) {
       
   721 			my $debug = '';
       
   722 			if ($Bld =~ /DEB$/o) {
       
   723 				$debug .= 'd';
       
   724 			}
       
   725 			&main::OutFormat(
       
   726 				" /nodefaultlib:libcmt$debug.lib"
       
   727 			);
       
   728 		}
       
   729 		&main::OutFormat(
       
   730 			" $Include /out:\"\$(EPOCBLD$Bld)\\$Trg\""
       
   731 		);
       
   732 
       
   733 		if ($MSVCVer < 7) {
       
   734 			&main::OutFormat(
       
   735 				" $WarningLevel"
       
   736 			);
       
   737 		}
       
   738 		&main::OutFormat(
       
   739 			" /implib:\"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"",
       
   740 			' /ignore:4089',		# LNK4089: all references to "dynamic-link library" discarded by /OPT:REF
       
   741 			' /ignore:4005'			# LNK4005: no objects used from XXX
       
   742 		);
       
   743 		if ($MSVCVer >= 7) {
       
   744 			&main::OutFormat(
       
   745 				' /ignore:4210'		# LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
       
   746 			);
       
   747 		}
       
   748 
       
   749 
       
   750 		&main::Output(
       
   751 			"\n",
       
   752 			"\n"
       
   753 		);
       
   754 	}
       
   755 
       
   756 	&main::OutFormat(
       
   757 		'LINK_FLAGS='
       
   758 	);
       
   759 	if ($BasicTrgType=~/^(EXE|DLL)$/o) {
       
   760 		unless (&main::Plat eq 'TOOLS') {
       
   761 			&main::OutFormat(
       
   762 				" \"\$(EPOCSTATLINK$Bld)\\$FirstLib\""
       
   763 			);
       
   764 
       
   765             if (main::StdCppSupport())
       
   766             {
       
   767                 unless ($newlib) {
       
   768 			    	if ( main::SystemTrg() ) {
       
   769 				    	# System targets are PDD, LDD, VAR, KEXT and KDLL.
       
   770 
       
   771 					    &main::OutFormat(
       
   772 						    "\"\$(EPOCSTATLINK$Bld)\\$NewKernLib\""
       
   773 					    );
       
   774 	    			}
       
   775 		    		else {
       
   776 			    		&main::OutFormat(
       
   777 				    		"\"\$(EPOCSTATLINK$Bld)\\$NewLib\""
       
   778 					    );
       
   779     				}
       
   780 	    		}
       
   781 		    	else {
       
   782 			    	&main::OutFormat(
       
   783 				    	"\"\$(EPOCSTATLINK$Bld)\\$newlib\""
       
   784     				);
       
   785 	    		}
       
   786             }
       
   787 		}
       
   788 	}
       
   789 	foreach (@Win32LibList) {
       
   790 		&main::OutFormat(
       
   791 			' ',lc $_
       
   792 		);
       
   793 	}
       
   794 	&main::OutFormat(
       
   795 		' $(LIBS) /nologo'
       
   796 	);
       
   797 	if ($BasicTrgType=~/^(EXE|DLL)$/o) {
       
   798 		unless (&main::Plat eq 'TOOLS') {
       
   799 			&main::OutFormat(
       
   800 				" /fixed:no $BaseAddressFlag"
       
   801 			);
       
   802 		}
       
   803 	}
       
   804 	&main::OutFormat(
       
   805 		" $Entry"
       
   806 	);
       
   807 	if (&main::Plat=~/^(WINC|TOOLS)$/o && $BasicTrgType=~/^EXE$/o) {
       
   808 		&main::OutFormat(
       
   809 			' /subsystem:console'
       
   810 		);
       
   811 	}
       
   812 	else {
       
   813 		&main::OutFormat(
       
   814 			' /subsystem:windows'
       
   815 		);
       
   816 	}
       
   817 	if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o) {
       
   818 		&main::OutFormat(
       
   819 			" /dll \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\""
       
   820 		);
       
   821 	}
       
   822 	if (&main::HeapSize) {
       
   823 		my %HeapSize=&main::HeapSize;
       
   824 		&main::OutFormat(
       
   825 			' /heap:',$HeapSize{Max},',',$HeapSize{Min}
       
   826 		);
       
   827 	}
       
   828 	if ($BasicTrgType=~/^(DLL|EXE)$/o) {
       
   829 		if ($Bld=~/DEB$/o) {
       
   830 			&main::OutFormat(
       
   831 				' /debug'
       
   832 			);
       
   833 		}
       
   834 		elsif ($Bld=~/REL$/o) {
       
   835 			&main::OutFormat(
       
   836 				' /incremental:no'
       
   837 			);
       
   838 		}
       
   839 	}
       
   840 	&main::OutFormat(
       
   841 		' /machine:IX86',
       
   842 		' /ignore:4089',	# LNK4089: all references to "dynamic-link library" discarded by /OPT:REF
       
   843 		' /ignore:4005'		# LNK4005: no objects used from XXX
       
   844 	);
       
   845 	if ($MSVCVer >= 7) {
       
   846 		&main::OutFormat(
       
   847 			' /ignore:4210'		# LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
       
   848 		);
       
   849 	}
       
   850 	if (&main::Plat eq 'TOOLS') {
       
   851 	    if (length(&main::LinkerOption("MSVC")) > 0)
       
   852 	    {
       
   853 		&main::OutFormat( " " . &main::LinkerOption("MSVC"));
       
   854 	    } else {
       
   855 		&main::OutFormat(
       
   856 			' /ignore:4098'	# LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
       
   857 		);
       
   858 	    }
       
   859 	}
       
   860 	else
       
   861 	{
       
   862 		if ($BasicTrgType=~/^EXE$/o) {
       
   863 			my $debug = '';
       
   864 			if ($Bld =~ /DEB$/o) {
       
   865 				$debug .= 'd';
       
   866 			}
       
   867 			&main::OutFormat(
       
   868 				" /nodefaultlib:libcmt$debug.lib"
       
   869 			);
       
   870 		}
       
   871 		&main::OutFormat(
       
   872 			" $Include"
       
   873 		);
       
   874 	} 
       
   875 	&main::OutFormat(
       
   876 		" /out:\"$BLDTRGPATH$Trg\""
       
   877 	);
       
   878 	if ($BasicTrgType=~/^(DLL)$/o) {
       
   879 		if ($MSVCVer < 7) {
       
   880 			&main::OutFormat(
       
   881 				" $WarningLevel"
       
   882 			);
       
   883 		}
       
   884 		&main::OutFormat(
       
   885 			" /implib:\"$BLDTRGPATH$ExportLibrary.lib\""
       
   886 		);
       
   887 	} elsif ($BasicTrgType=~/^(EXE)$/o) {
       
   888 		if ($MSVCVer < 7) {
       
   889 			&main::OutFormat(
       
   890 				" $WarningLevel"
       
   891 			);
       
   892 		}
       
   893 		&main::OutFormat(
       
   894 			" /implib:\"$BLDTRGPATH$ExportLibrary.exe.lib\""
       
   895 		);
       
   896 	}
       
   897 	&main::Output(
       
   898 		"\n",
       
   899 		"\n"
       
   900 	);
       
   901 
       
   902 	&main::Output(
       
   903 		"\"$BLDTRGPATH$Trg\" : \$(LINK_OBJS)"
       
   904 	);
       
   905 	if (-e $DefFile) { # effectively "if project frozen ..."
       
   906 		&main::Output(
       
   907 			" \"$DefFile\""
       
   908 		);
       
   909 	}
       
   910 	if ($BasicTrgType=~/^(DLL|EXE)$/o) {
       
   911 		unless (&main::Plat eq 'TOOLS') {
       
   912 			&main::Output(
       
   913 				" \"\$(EPOCSTATLINK$Bld)\\$FirstLib\""
       
   914 			);
       
   915 			
       
   916 			if (main::StdCppSupport())
       
   917 			{
       
   918 			    unless ($newlib) {
       
   919     				if ( main::SystemTrg() ) {
       
   920 	    				# System targets are PDD, LDD, VAR, KEXT and KDLL.
       
   921     
       
   922 	    				&main::Output(
       
   923 		    				"\"\$(EPOCSTATLINK$Bld)\\$NewKernLib\""
       
   924 			    		);
       
   925 				    }
       
   926     				else {
       
   927 	    				&main::Output(
       
   928 		    				"\"\$(EPOCSTATLINK$Bld)\\$NewLib\""
       
   929 			    		);
       
   930 				    }
       
   931     			}
       
   932 	    		else {
       
   933 		    		&main::Output(
       
   934 			    		"\"\$(EPOCSTATLINK$Bld)\\$newlib\""
       
   935 				    );
       
   936     			}		    
       
   937 			}
       
   938 		}
       
   939 	}
       
   940 	&main::Output(
       
   941 		" \$(LIBS)\n"
       
   942 	);
       
   943 
       
   944 
       
   945 #	Link by name first time round for dlls
       
   946 	if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o) {
       
   947 		&main::Output(
       
   948 			"\tlink.exe \@<<\n",
       
   949 			"\t\t\$(STAGE1_LINK_FLAGS) \$(LINK_OBJS)\n",
       
   950 			"<<\n",
       
   951 			"\tdel \"\$(EPOCBLD$Bld)\\$Trg\"\n",
       
   952 			"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\"\n"
       
   953 		);
       
   954 
       
   955 #		Generate an export info file
       
   956 		&main::Output(
       
   957 			"\tdumpbin /exports /out:\"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\" \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n",
       
   958 			"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n"
       
   959 		);
       
   960 
       
   961 #		call makedef to reorder the export information
       
   962 		&main::Output(
       
   963 #			call perl on the script here so nmake will die if there are errors - this doesn't happen if calling perl in a batch file
       
   964 			"\tperl -w -S makedef.pl $AbsentSubst -Inffile \"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\""
       
   965 		);
       
   966 		if (SysTrg()) {
       
   967     			&main::Output( "\t\t-SystemTargetType \\\n" );
       
   968     		}
       
   969 		if (-e $DefFile) { # effectively "if project frozen ..."
       
   970 			&main::Output(
       
   971 				" -Frzfile \"$DefFile\""
       
   972 			);
       
   973 		}
       
   974 		# freeze ordinals, a maximum of 2, for polymorphic dlls
       
   975 		my $Ordinal;
       
   976 		my $Num=1;
       
   977 		foreach $Ordinal (&main::Exports) {
       
   978 #			replace "$" with "$$" so that NMAKE doesn't think there's a macro in the function name
       
   979 			$Ordinal=~s-\$-\$\$-go;
       
   980 			&main::Output(
       
   981 				" -$Num $Ordinal"
       
   982 			);
       
   983 			$Num++;
       
   984 		}
       
   985 		&main::Output(
       
   986 			" \"\$(EPOCBLD)\\$ExportLibrary.def\" \n",
       
   987 			"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\"\n"
       
   988 		);
       
   989 
       
   990 		# create the export object from the .DEF file
       
   991 		&main::Output(
       
   992 			"\tlib.exe  /nologo /machine:i386 /nodefaultlib /name:\"$Trg\" /def:\"\$(EPOCBLD)\\$ExportLibrary.def\" /out:\"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n"
       
   993 		);
       
   994 		if (&main::ExportUnfrozen) {
       
   995 			&main::Output(
       
   996 			"\tcopy \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\" \"\$(EPOCLIB)\\UDEB\\$ExportLibrary.lib\"\n"
       
   997 			);
       
   998 		}
       
   999 		&main::Output(
       
  1000 			"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n"
       
  1001 		);
       
  1002 	}
       
  1003 
       
  1004 	if ($BasicTrgType=~/^(DLL|EXE)$/o) {
       
  1005 		&main::Output(
       
  1006 			"\tlink.exe \@<<\n"
       
  1007 		);
       
  1008 	}
       
  1009 	elsif ($BasicTrgType=~/^LIB$/o) {
       
  1010 		&main::Output(
       
  1011 			"\tlib.exe \@<<\n"
       
  1012 		);
       
  1013 	}
       
  1014 	&main::Output(
       
  1015 		"\t\t\$(LINK_FLAGS) \$(LINK_OBJS)\n",
       
  1016 		"<<\n"
       
  1017 	);
       
  1018 
       
  1019 	if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o) {
       
  1020 		&main::Output(
       
  1021 			"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\"\n"
       
  1022 		);
       
  1023 	}
       
  1024 
       
  1025 	if (&main::Plat eq 'TOOLS') {
       
  1026 		&main::Output(
       
  1027 			"\tcopy \"$BLDTRGPATH$Trg\" \"",&main::EPOCToolsPath,"$Trg\"\n"
       
  1028 		);
       
  1029 	}
       
  1030 	if (&Winutl_CopyForStaticLinkage) {
       
  1031 		&Generic_MakeWorkDir("MAKEWORK$Bld", "\$(EPOCTRG$Bld)");
       
  1032 		&main::Output(
       
  1033 			"\n",
       
  1034 			"\"\$(EPOCTRG$Bld)\\$Trg\" : \"$BLDTRGPATH$Trg\"\n",
       
  1035 			"\tcopy \$\? \$\@\n"
       
  1036 		);
       
  1037 	}
       
  1038 
       
  1039 	&main::Output(
       
  1040 		"\n",
       
  1041 		"\n"
       
  1042 	);
       
  1043 }
       
  1044 
       
  1045 sub PMStartSrcList {
       
  1046 
       
  1047 	&main::Output(
       
  1048 		"# SOURCES\n",
       
  1049 		"\n"
       
  1050 	);
       
  1051 }
       
  1052 
       
  1053 sub PMBitMapBld {
       
  1054 
       
  1055 	&Generic_BitMapBld;
       
  1056 
       
  1057 	# Need to copy generic resource into emulated Z drive
       
  1058 
       
  1059 	my $BitMapRef=&main::BitMapRef;
       
  1060 
       
  1061 	my $ChopTrgPath="";
       
  1062 	if ($$BitMapRef{TrgPath}) {
       
  1063 		$ChopTrgPath.="\\$$BitMapRef{TrgPath}";
       
  1064 		chop $ChopTrgPath;
       
  1065 	}
       
  1066 
       
  1067 	my @BldList=&main::BldList;
       
  1068 	my $Bld;
       
  1069 	foreach $Bld (@BldList) {
       
  1070 		my $path="\$(EPOCTRG$Bld)$ChopTrgPath";
       
  1071 		&main::Output(
       
  1072 			&Generic_Quote("$path\\$$BitMapRef{Trg}"), " : ", 
       
  1073 			&Generic_Quote("$$BitMapRef{GenericTrg}"), "\n",
       
  1074 			"\t", &Generic_CopyAction(),
       
  1075 			"\n"
       
  1076 		);
       
  1077 	}
       
  1078 }
       
  1079 
       
  1080 
       
  1081 sub PMResrcBld {
       
  1082 
       
  1083 	&Generic_ResrcBld;
       
  1084 
       
  1085 	# Need to copy generic resource into emulated Z drive
       
  1086 
       
  1087 	my $ResourceRef=&main::ResourceRef;
       
  1088 	my @BldList=&main::BldList;
       
  1089 
       
  1090 	foreach my $Bld (@BldList) {
       
  1091 		&main::Output(
       
  1092 			&Generic_Quote("\$(EPOCTRG$Bld)\\$$ResourceRef{Trg}"), " : ", 
       
  1093 			&Generic_Quote("$$ResourceRef{GenericTrg}"), "\n",
       
  1094 			"\t", &Generic_CopyAction(),
       
  1095 			"\n"
       
  1096 		);
       
  1097 	}
       
  1098 }
       
  1099 
       
  1100 sub PMAifBld {
       
  1101 
       
  1102 	&Generic_AifBld;
       
  1103 
       
  1104 	# Need to copy generic resource into emulated Z drive
       
  1105 
       
  1106 	my $AifRef=&main::AifRef;
       
  1107 	my $TrgDir="";
       
  1108 	if (&Generic_Definition("TRGDIR") ne "") {
       
  1109 		$TrgDir="\\\$(TRGDIR)";
       
  1110 	}
       
  1111 	if (&main::Plat eq "WINC") {	# target path ignored under WINC
       
  1112 		$TrgDir="";
       
  1113 	}
       
  1114 
       
  1115 	my @BldList=&main::BldList;
       
  1116 	my $Bld;
       
  1117 	foreach $Bld (@BldList) {
       
  1118 		my $file="\$(EPOCTRG$Bld)$TrgDir\\$$AifRef{Trg}";
       
  1119 		&main::Output(
       
  1120 			"\"$file\" : \"$$AifRef{GenericTrg}\"\n",
       
  1121 			"\tperl -w -S ecopyfile.pl \$? \$\@\n",
       
  1122 			"\n"
       
  1123 		);
       
  1124 	}
       
  1125 }
       
  1126 
       
  1127 sub PMStartSrc {
       
  1128 	my $Src=&main::Src;
       
  1129 
       
  1130 	&main::Output(
       
  1131 		"# Source $Src\n",
       
  1132 		"\n"
       
  1133 	);
       
  1134 }
       
  1135 
       
  1136 sub PMSrcDepend {
       
  1137 	my @BldList=&main::BldList;	
       
  1138 	my @DepList=&main::DepList;
       
  1139 
       
  1140 	&main::Output(
       
  1141 		"DEPEND="
       
  1142 	);
       
  1143 	foreach (@DepList) {
       
  1144 		&main::Output(
       
  1145 		" \\\n\t\"$_\""
       
  1146 		);
       
  1147 	}
       
  1148 	&main::Output(
       
  1149 		"\n",
       
  1150 		"\n"
       
  1151 	);
       
  1152 	foreach (@BldList) {
       
  1153 		&main::Output(
       
  1154 			"DEPEND$_=\$(DEPEND)\n",
       
  1155 			"\n"
       
  1156 		);
       
  1157 	}
       
  1158 	&main::Output(
       
  1159 		"\n"
       
  1160 	);
       
  1161 }
       
  1162 
       
  1163 sub PMSrcBldDepend {
       
  1164 	my $Bld=&main::Bld;
       
  1165 	my @DepList=&main::DepList;
       
  1166 
       
  1167 	&main::Output(
       
  1168 		"DEPEND$Bld="
       
  1169 	);
       
  1170 	foreach (@DepList) {
       
  1171 		&main::Output(
       
  1172 			" \\\n\t\"$_\""
       
  1173 		);
       
  1174 	}
       
  1175 	&main::Output(
       
  1176 		"\n",
       
  1177 		"\n"
       
  1178 	);
       
  1179 }
       
  1180 
       
  1181 sub PMEndSrcBld {
       
  1182 	my $BaseSrc=&main::BaseSrc;
       
  1183 	my $Bld=&main::Bld;
       
  1184 	my $Plat=&main::Plat;
       
  1185 	my $Src=ucfirst lc &main::Src;
       
  1186 	my $SrcPath=&main::SrcPath;
       
  1187 	my $Ext=&main::ExtSrc;
       
  1188 	my $Cia = (lc($Ext) eq '.cia') ? 1 : 0;
       
  1189 
       
  1190 	if ($Cia) {
       
  1191 		&main::Output(
       
  1192 			"\"\$(EPOCBLD$Bld)\\$BaseSrc\_.obj\" \"\$(EPOCBLD$Bld)\\$BaseSrc\_.sbr\" : \"$SrcPath$Src\" \$(DEPEND$Bld)\n",
       
  1193 			"\t\$(CL$Bld) /TP /Fo\"\$(EPOCBLD$Bld)\\$BaseSrc\_.obj\" /FR\"\$(EPOCBLD$Bld)\\$BaseSrc\_.sbr\" /c \"$SrcPath$Src\"\n",
       
  1194 			"\n",
       
  1195 #		assembler listing target 
       
  1196 			"LISTING$Bld$BaseSrc\_ : \"\$(EPOCBLD$Bld)\\$BaseSrc\_.lis\"\n",
       
  1197 			"\tcopy \$? \"$SrcPath$BaseSrc\_.$Plat.lst\"\n",
       
  1198 			"\n",
       
  1199 			"\"\$(EPOCBLD$Bld)\\$BaseSrc\_.lis\": \"$SrcPath$Src\" \$(DEPEND$Bld)\n",
       
  1200 			"\t\$(CL$Bld) /TP /Fa\"\$\@\" /Fo\"\$(EPOCBLD$Bld)\\$BaseSrc\_.obj\" /FR\"\$(EPOCBLD$Bld)\\$BaseSrc\_.sbr\" /c \"$SrcPath$Src\"\n",
       
  1201 			"\n"
       
  1202 		);
       
  1203 	} else {
       
  1204 		&main::Output(
       
  1205 			"\"\$(EPOCBLD$Bld)\\$BaseSrc.obj\" \"\$(EPOCBLD$Bld)\\$BaseSrc.sbr\" : \"$SrcPath$Src\" \$(DEPEND$Bld)\n",
       
  1206 			"\t\$(CL$Bld) /Fo\"\$(EPOCBLD$Bld)/\" /FR\"\$(EPOCBLD$Bld)\\$BaseSrc.sbr\" /c \"$SrcPath$Src\"\n",
       
  1207 			"\n",
       
  1208 #		assembler listing target 
       
  1209 			"LISTING$Bld$BaseSrc : \"\$(EPOCBLD$Bld)\\$BaseSrc.lis\"\n",
       
  1210 			"\tcopy \$? \"$SrcPath$BaseSrc.$Plat.lst\"\n",
       
  1211 			"\n",
       
  1212 			"\"\$(EPOCBLD$Bld)\\$BaseSrc.lis\": \"$SrcPath$Src\" \$(DEPEND$Bld)\n",
       
  1213 			"\t\$(CL$Bld) /Fa\"\$\@\" /Fo\"\$(EPOCBLD$Bld)/\" /FR\"\$(EPOCBLD$Bld)\\$BaseSrc\_.sbr\" /c \"$SrcPath$Src\"\n",
       
  1214 			"\n"
       
  1215 		);
       
  1216 	}
       
  1217 }
       
  1218 
       
  1219 sub PMEndSrc {
       
  1220 
       
  1221 	&main::Output(
       
  1222 		"\n",
       
  1223 		"\n"
       
  1224 	);
       
  1225 }
       
  1226 
       
  1227 sub PMEndSrcList {
       
  1228 	if ($Win32Resrc) {
       
  1229 		my @BldList=&main::BldList;
       
  1230 		my @DepList=&main::Deps_GenDependsL($Win32Resrc);
       
  1231 
       
  1232 		&main::Output(
       
  1233 			"# Win32 Resource $Win32Resrc\n",
       
  1234 			"\n",
       
  1235 			"DEPEND="
       
  1236 		);
       
  1237 		foreach (@DepList) {
       
  1238 			&main::Output(
       
  1239 				" \\\n\t\"$_\""
       
  1240 			);
       
  1241 		}
       
  1242 		&main::Output(
       
  1243 			"\n",
       
  1244 			"\n"
       
  1245 		);
       
  1246 	
       
  1247 		my $Bld;
       
  1248 		foreach $Bld (@BldList) {
       
  1249 			&main::Output(
       
  1250 				"\"\$(EPOCBLD$Bld)\\",&main::Path_Split('Base',$Win32Resrc),".res\" : \"$Win32Resrc\" \$(DEPEND)\n",
       
  1251 				"\trc /l 0x809 /fo\$\@ /i \"",&main::Path_Chop(&main::Path_Split('Path',$Win32Resrc)),"\" \"$Win32Resrc\"\n",
       
  1252 				"\n"
       
  1253 			);
       
  1254 		}
       
  1255 		&main::Output(
       
  1256 			"\n",
       
  1257 			"\n"
       
  1258 		);
       
  1259 	}
       
  1260 
       
  1261 	# Deal with accumulated MAKEDIRS etc.
       
  1262 
       
  1263 	&Generic_End;
       
  1264 }
       
  1265 
       
  1266 1;