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