sbsv1_os/e32toolp/platform/ide_vc6.pm
changeset 0 83f4b4db085c
child 1 d4b442d23379
equal deleted inserted replaced
-1:000000000000 0:83f4b4db085c
       
     1 # Copyright (c) 1999-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 # Makmake-module for creating MAKMAKE MSVC6 IDE makefiles shared by windows platform modules
       
    15 # 
       
    16 #
       
    17 
       
    18 package Ide_vc6;
       
    19 
       
    20 # declare variables global for module
       
    21 my $BaseAddressFlag;
       
    22 my @CppCall;
       
    23 my %IdeBlds=();
       
    24 my %PrjHdrs=();
       
    25 my @Win32LibList=();
       
    26 my $Win32Resrc;
       
    27 my $Win32StdHeaders;
       
    28 my $MSVCVer;
       
    29 
       
    30 my $SupText='';
       
    31 
       
    32 
       
    33 require Exporter;
       
    34 @ISA=qw(Exporter);
       
    35 
       
    36 @EXPORT=qw(
       
    37 	PMHelp_Mmp
       
    38 
       
    39 	PMCheckPlatformL
       
    40 
       
    41 	PMPlatProcessMmp
       
    42 
       
    43 	PMStartBldList
       
    44 		PMBld
       
    45 	PMEndBldList
       
    46 	PMStartSrcList
       
    47 			PMResrcBld
       
    48 			PMDoc
       
    49 			PMStartSrc
       
    50 			PMSrcDepend
       
    51 	PMEndSrcList
       
    52 );
       
    53 
       
    54 use strict;
       
    55 use Winutl;
       
    56 use Pathutl;
       
    57 
       
    58 sub PMHelp_Mmp {
       
    59 # get the windows help from WINUTL
       
    60 	&Winutl_Help_Mmp;
       
    61 }
       
    62 
       
    63 sub PMCheckPlatformL {
       
    64 	if ((&main::Plat eq 'TOOLS') and (&main::BasicTrgType ne 'EXE') and (&main::BasicTrgType ne 'LIB')) {
       
    65 		die "Can't specify anything but EXE or LIB targettypes for this platform\n";
       
    66 	}
       
    67 }
       
    68 
       
    69 sub PMPlatProcessMmp (@) {
       
    70 
       
    71 	# get WINUTL to do the windows mmp file processing
       
    72 	&Winutl_DoMmp(\@_, $ENV{INCLUDE});
       
    73 	$BaseAddressFlag=&Winutl_BaseAddress;
       
    74 	$BaseAddressFlag=~s/^(.+$)$/ \/base:\"$1\"/o;
       
    75 	@Win32LibList=&Winutl_Win32LibList;
       
    76 	my $MSVCVer = &Winutl_MSVCVer;
       
    77 	push @Win32LibList, "kernel32.lib";
       
    78 	$Win32Resrc=&Winutl_Win32Resrc;
       
    79 	$Win32StdHeaders=&Winutl_Win32StdHeaders;
       
    80 }
       
    81 
       
    82 sub PMStartBldList($) {
       
    83 	my ($makecmd) = @_;
       
    84 	die "Cannot generate $makecmd makefiles\n" if ($makecmd ne "nmake");
       
    85 	my $BaseTrg=&main::BaseTrg;
       
    86 	my @BldList=&main::BldList;
       
    87 	my $BldPath=&main::BldPath;
       
    88 	my $ChopDataPath=&main::Path_Chop(&main::DataPath);
       
    89 	my $ChopTrgPath=&main::Path_Chop(&main::TrgPath);
       
    90 	my $DefFile=&main::DefFile;
       
    91 	my $BasicTrgType=&main::BasicTrgType;
       
    92 	my $ExportLibrary=&main::ExportLibrary;
       
    93 	my $LibPath=&main::LibPath;
       
    94 
       
    95 	my $MSVCVer = &Winutl_MSVCVer;
       
    96 
       
    97 	my $LinkPath=&main::LinkPath;
       
    98 	my $Plat=&main::Plat;
       
    99 	my $RelPath=&main::RelPath;
       
   100 	my $Trg=&main::Trg;
       
   101 	my $StatLinkPath=&main::StatLinkPath;
       
   102 	my $TrgType=&main::TrgType;
       
   103 
       
   104 
       
   105 	# set up global IDE builds variable
       
   106 	%IdeBlds= (
       
   107 		UREL=> "$BaseTrg - Win32 Uni Release",
       
   108 		UDEB=> "$BaseTrg - Win32 Uni Debug",
       
   109 	);
       
   110 	if (&main::Plat eq 'TOOLS') {
       
   111 		%IdeBlds= (
       
   112 			REL=> "$BaseTrg - Win32 Release",
       
   113 			DEB=> "$BaseTrg - Win32 Debug",
       
   114 		);
       
   115 	}
       
   116 	
       
   117 
       
   118 #	Start the supplementary makefile
       
   119 
       
   120 	$SupText.=join('',
       
   121 		"\n",
       
   122 #			need to set path here because MSDEV might be set up so that
       
   123 #			it does not take account of the PATH environment variable
       
   124 		"PATH=$ENV{PATH}\n",
       
   125 		"\n",
       
   126 		"# EPOC DEFINITIONS\n",
       
   127 		"\n",
       
   128 		"EPOCBLD = $BldPath #\n",
       
   129 		"EPOCTRG = $RelPath #\n",
       
   130 		"EPOCLIB = $LibPath #\n",
       
   131 		"EPOCLINK = $LinkPath #\n",
       
   132 		"EPOCSTATLINK = $StatLinkPath #\n",
       
   133 		"\n"
       
   134 	);
       
   135 			
       
   136 	if ($BasicTrgType eq 'DLL' || $TrgType eq 'EXEXP') {
       
   137 		foreach (@BldList) {
       
   138 			$SupText.=join('',
       
   139 				"EPOCBLD$_ = \$(EPOCBLD)$_\n",
       
   140 				"EPOCTRG$_ = \$(EPOCTRG)$_\n",
       
   141 				"EPOCLIB$_ = \$(EPOCLIB)UDEB\n",
       
   142 				"EPOCLINK$_ = \$(EPOCLINK)UDEB\n",
       
   143 				"EPOCSTATLINK$_ = \$(EPOCSTATLINK)$_\n",
       
   144 				"\n"
       
   145 			);
       
   146 		}
       
   147 		$SupText.="\nTRGDIR = ";
       
   148 		if ($Plat!~/^WINC$/o && $ChopTrgPath) {	# target path not allowed under WINC
       
   149 			$SupText.=$ChopTrgPath;
       
   150 		}
       
   151 		else {
       
   152 			$SupText.=".\\";
       
   153 		}
       
   154 		$SupText.="\n\nDATADIR = $ChopDataPath\n\n";
       
   155 
       
   156 
       
   157 #		commands for creating the import library
       
   158 		$SupText.="LIBRARY :";
       
   159 		if ($DefFile) {
       
   160 			unless (&main::ExportUnfrozen) {
       
   161 				if (-e $DefFile) { # effectively "if project frozen ..."
       
   162 					$SupText.=" \"\$(EPOCLIB)UDEB\\$ExportLibrary.lib\"\n";
       
   163 				}
       
   164 				else {
       
   165 					$SupText.=join('',
       
   166 						"\n",
       
   167 						"\t\@echo WARNING: Not attempting to create \"\$(EPOCLIB)UDEB\\$ExportLibrary.lib\".\n",
       
   168 						"\t\@echo When exports are frozen in \"$DefFile\", regenerate Makefile.\n"
       
   169 					);
       
   170 				}
       
   171 			}
       
   172 			else {
       
   173 				$SupText.=join('',
       
   174 					"\n",
       
   175 					"\t\@echo Not attempting to create \"\$(EPOCLIB)UDEB\\$ExportLibrary.lib\"\n",
       
   176 					"\t\@echo from frozen .DEF file, since EXPORTUNFROZEN specified.\n"
       
   177 				);
       
   178 			}
       
   179 			$SupText.=join('',
       
   180 				"\n",
       
   181 				"\n",
       
   182 				"# REAL TARGET - IMPORT LIBRARY\n",
       
   183 				"\n",
       
   184 				"\"\$(EPOCLIB)UDEB\\$ExportLibrary.lib\" : \"$DefFile\" MAKEWORKLIBRARY\n",
       
   185 				"\tperl -S prepdef.pl \"$DefFile\" \"\$(EPOCBLD)\\$ExportLibrary.prep.def\"\n",
       
   186 				"\tlib.exe /nologo /machine:i386 /nodefaultlib /name:\"$Trg\" /def:\"\$(EPOCBLD)\\$ExportLibrary.prep.def\" /out:\"\$(EPOCLIB)UDEB\\$ExportLibrary.lib\"\n",
       
   187 				"\tdel \"\$(EPOCLIB)UDEB\\$ExportLibrary.exp\"\n"
       
   188 			);
       
   189 		}
       
   190 		$SupText.=join('',
       
   191 			"\n",
       
   192 			"\n",
       
   193 			"MAKEWORKLIBRARY : \"${LibPath}UDEB\"\n",
       
   194 			"\n",
       
   195 			"\"${LibPath}UDEB\" :\n"
       
   196 		);
       
   197 		$SupText.="\t\@perl -w -S emkdir.pl \"${LibPath}UDEB\"\n\n\n";
       
   198 	}
       
   199 
       
   200 
       
   201 
       
   202 	&main::Output(
       
   203 		"# Microsoft Developer Studio Project File - Name=\"$BaseTrg\" - Package Owner=<4>\n",
       
   204 		"# Microsoft Developer Studio Generated Build File, Format Version 6.00\n",
       
   205 		"# ** DO NOT EDIT **\n",
       
   206 		"\n"
       
   207 	);
       
   208 
       
   209 	if ($BasicTrgType=~/^DLL$/o) {
       
   210 		&main::Output(
       
   211 			"# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102\n"
       
   212 		);
       
   213 	}
       
   214 	elsif ($BasicTrgType=~/^EXE$/o) {
       
   215 		if (not &main::Plat=~/^(WINC|TOOLS)$/o) {
       
   216 			&main::Output(
       
   217 				"# TARGTYPE \"Win32 (x86) Application\" 0x0101\n"
       
   218 			);
       
   219 		}
       
   220 		else {
       
   221 			&main::Output(
       
   222 				"# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\n"
       
   223 			);
       
   224 		}
       
   225 	}
       
   226 	elsif ($BasicTrgType=~/^(LIB)$/o) {
       
   227 		&main::Output(
       
   228 			"# TARGTYPE \"Win32 (x86) Static Library\" 0x0104\n"
       
   229 		);
       
   230 	}
       
   231 	
       
   232 	&main::Output(
       
   233 		"\n",
       
   234 		"CFG=",$IdeBlds{$BldList[0]},"\n",
       
   235 		"!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n",
       
   236 		"!MESSAGE use the Export Makefile command and run\n",
       
   237 		"!MESSAGE \n",
       
   238 		"!MESSAGE NMAKE /f \"",$BaseTrg,".mak\".\n",
       
   239 		"!MESSAGE \n",
       
   240 		"!MESSAGE You can specify a configuration when running NMAKE\n",
       
   241 		"!MESSAGE by defining the macro CFG on the command line. For example:\n",
       
   242 		"!MESSAGE \n",
       
   243 		"!MESSAGE NMAKE /f \"",$BaseTrg,".mak\" CFG=\"".$IdeBlds{$BldList[0]}."\"\n",
       
   244 		"!MESSAGE \n",
       
   245 		"!MESSAGE Possible choices for configuration are:\n",
       
   246 		"!MESSAGE \n"
       
   247 	);
       
   248 	&main::OutSetLength(79);
       
   249 	if ($BasicTrgType=~/^DLL$/o) {
       
   250 		foreach (reverse @BldList) { # reverse because VC6 takes last as the default
       
   251 			&main::OutFormat(
       
   252 				"!MESSAGE \"",$IdeBlds{$_},"\" (based on \"Win32 (x86) Dynamic-Link Library\")"
       
   253 			);
       
   254 			&main::Output();
       
   255 		}
       
   256 	}
       
   257 	elsif ($BasicTrgType=~/^EXE$/o) {
       
   258 		if (not &main::Plat=~/^(WINC|TOOLS)$/o) {
       
   259 			foreach (reverse @BldList) {
       
   260 				&main::OutFormat(
       
   261 					"!MESSAGE \"",$IdeBlds{$_},"\" (based on \"Win32 (x86) Application\")"
       
   262 				);
       
   263 				&main::Output();
       
   264 			}
       
   265 		}
       
   266 		else {
       
   267 			foreach (reverse @BldList) {
       
   268 				&main::OutFormat(
       
   269 					"!MESSAGE \"",$IdeBlds{$_},"\" (based on \"Win32 (x86) Console Application\")"
       
   270 				);
       
   271 				&main::Output();
       
   272 			}
       
   273 		}
       
   274 	}
       
   275 	elsif ($BasicTrgType=~/^(LIB)$/o) {
       
   276 		foreach (@BldList) {
       
   277 			&main::OutFormat(
       
   278 				"!MESSAGE \"",$IdeBlds{$_},"\" (based on \"Win32 (x86) Static Library\")"
       
   279 			);
       
   280 			&main::Output();
       
   281 		}
       
   282 	}
       
   283 	&main::OutSetLength();
       
   284 	&main::Output(
       
   285 		"!MESSAGE \n",
       
   286 		"\n"
       
   287 	);
       
   288 
       
   289 	# BEGIN THE PROJECT
       
   290 	#------------------
       
   291 	&main::Output(
       
   292 		"# Begin Project\n",
       
   293 		"# PROP Scc_ProjName \"\"\n",
       
   294 		"# PROP Scc_LocalPath \"\"\n",
       
   295 		"CPP=cl.exe\n",
       
   296 		"MTL=midl.exe\n",
       
   297 		"RSC=rc.exe\n",
       
   298 		"\n"
       
   299 	);
       
   300 }
       
   301 
       
   302 sub PMBld {
       
   303 
       
   304 	my @BaseSrcList=&main::BaseSrcList;
       
   305 	my $BaseTrg=&main::BaseTrg;
       
   306 	my $Bld=&main::Bld;
       
   307 	my @BldList=&main::BldList;
       
   308 	my $ChopBldPath=&main::Path_Chop(&main::BldPath);
       
   309 	my $ChopLinkPath=&main::Path_Chop(&main::LinkPath);
       
   310 	my $ChopRelPath=&main::Path_Chop(&main::RelPath);
       
   311 	my $ChopStatLinkPath=&main::Path_Chop(&main::StatLinkPath);
       
   312 	my @ChopSysIncPaths=&main::Path_Chop(&main::SysIncPaths);
       
   313 	my @ChopUserIncPaths=&main::Path_Chop(&main::UserIncPaths);
       
   314 	my $ExportLibrary=&main::ExportLibrary;
       
   315 	my $DefFile=&main::DefFile;
       
   316 	my $FirstLib=&main::FirstLib;
       
   317 	my $BasicTrgType=&main::BasicTrgType;
       
   318 	my @MacroList=&main::MacroList();
       
   319 	push @MacroList, "__SUPPORT_CPP_EXCEPTIONS__";
       
   320     my $VariantFile=&main::VariantFile();
       
   321 
       
   322 
       
   323 	my @LibList;
       
   324 	my $PathBaseDsp=&main::MakeFilePath.&main::BaseMak;
       
   325 	my @StatLibList=&main::StatLibList;
       
   326 	my $Trg=&main::Trg;
       
   327 	my $TrgPath=&main::TrgPath;
       
   328 	my $TrgType=&main::TrgType;
       
   329 	
       
   330 	my $newlib = main::NewLib(); # Check if newlib has been set in the MMP file.
       
   331 	my $NewLib = 'scppnwdl.lib'; # This is where operator new and operator delete
       
   332                                  # are defined for user side targets.
       
   333 	my $NewKernLib = 'scppnwdl_kern.lib'; # This is where operator new and operator delete
       
   334                                  	  # are defined for kernel side targets.
       
   335 
       
   336 
       
   337 	if ($Bld =~ /DEB/) {
       
   338 		@LibList=&main::DebugLibList;
       
   339 	} else {
       
   340 		@LibList=&main::LibList;
       
   341 	}
       
   342 
       
   343 	my $NotUseWin32LibsFlag="";
       
   344 	unless ($Win32StdHeaders or &main::Plat eq 'TOOLS') {
       
   345 		$NotUseWin32LibsFlag=" /X"; # this flag suppresses searching of the standard directories for header files
       
   346 	}
       
   347 
       
   348 
       
   349 	if ($Bld eq $BldList[0]) {
       
   350 		&main::Output(
       
   351 			"!IF  \"\$(CFG)\" == \"$IdeBlds{$Bld}\"\n",
       
   352 			"\n"
       
   353 		);
       
   354 	}
       
   355 	else {
       
   356 		&main::Output(
       
   357 			"!ELSEIF  \"\$(CFG)\" == \"$IdeBlds{$Bld}\"\n",
       
   358 			"\n"
       
   359 		);
       
   360 	}
       
   361 	&main::Output(
       
   362 		"# PROP BASE Use_MFC 0\n"
       
   363 	);
       
   364 	if ($Bld=~/REL$/o) {
       
   365 		&main::Output(
       
   366 			"# PROP BASE Use_Debug_Libraries 0\n",
       
   367 			"# PROP BASE Output_Dir \".\\Win32_Un\"\n",
       
   368 			"# PROP BASE Intermediate_Dir \".\\Win32_Un\"\n"
       
   369 		);
       
   370 	}
       
   371 	elsif ($Bld=~/DEB$/o) {
       
   372 		&main::Output(
       
   373 			"# PROP BASE Use_Debug_Libraries 1\n",
       
   374 			"# PROP BASE Output_Dir \".\\Win32_U0\"\n",
       
   375 			"# PROP BASE Intermediate_Dir \".\\Win32_U0\"\n"
       
   376 		);
       
   377 	}
       
   378 	&main::Output(
       
   379 			"# PROP Use_MFC 0\n"
       
   380 	);
       
   381 	if ($Bld=~/REL$/o) {
       
   382 		&main::Output(
       
   383 			"# PROP Use_Debug_Libraries 0\n"
       
   384 		);
       
   385 	}
       
   386 	elsif ($Bld=~/DEB$/o) {
       
   387 		&main::Output(
       
   388 			"# PROP Use_Debug_Libraries 1\n"
       
   389 		);
       
   390 	}
       
   391 	&main::Output(
       
   392 		"# PROP Output_Dir \"$ChopRelPath\"\n",
       
   393 		"# PROP Intermediate_Dir \"$ChopBldPath\"\n",
       
   394 	);
       
   395 
       
   396 	&main::Output(
       
   397 		"# ADD CPP",
       
   398 		" /nologo",		# suppress "sign-on" banner message
       
   399 		" /Zp4"	,		# packs structures on 4 byte boundaries
       
   400 		" /GF"			# Pools strings and places them in read-only memory 
       
   401 	);
       
   402 
       
   403 	$MSVCVer = &Winutl_MSVCVer;
       
   404 
       
   405 	if ($MSVCVer >= 7) {
       
   406 		&main::Output(
       
   407 			" /wd4996",			# C4996: 'xxxx' was declared deprecated
       
   408 			" /wd4571"			# C4571: catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions
       
   409 		);	
       
   410 
       
   411 		if (&main::Plat ne 'TOOLS') {
       
   412 			&main::Output(
       
   413 				" /EHsc",			# Exceptions on
       
   414 				" /GR"				# RTTI on
       
   415 			);
       
   416 			if ($MSVCVer >= 8) {
       
   417 				&main::Output(
       
   418 					" /GS-"			# Buffer checking off
       
   419 				);
       
   420 			}
       
   421 		} else {
       
   422 			&main::Output(
       
   423 				" /EHsc",			# Exceptions on
       
   424 				" /GR",				# RTTI on
       
   425 				" /GS"				# Buffer checking on
       
   426 			);
       
   427 		}
       
   428 	} else {
       
   429 		if (&main::Plat ne 'TOOLS') {
       
   430 			&main::Output(
       
   431 					" /GX",				# Exceptions on
       
   432 					" /GR"				# RTTI on
       
   433 			);
       
   434 		}
       
   435 	}
       
   436 
       
   437 	if ($BasicTrgType=~/^EXE$/o) {
       
   438 		&main::Output(
       
   439 			' /MT'			# Creates a multi-threaded executable file, using libcmt.lib
       
   440 		);
       
   441 		if ($Bld=~/DEB$/o) {
       
   442 			&main::Output(
       
   443 				"d"			# i.e. /MTd, debug executable using debug version of libcmt
       
   444 			);
       
   445 		}
       
   446 	}
       
   447 	elsif (($BasicTrgType=~/^(DLL|LIB)$/o) and (&main::Plat ne 'TOOLS')) {
       
   448 		&main::Output(
       
   449 			" /MD"			# Creates a multithreaded DLL, using MSVCRT.LIB
       
   450 		);
       
   451 		if ($Bld=~/DEB$/o) {
       
   452 			&main::Output(
       
   453 				"d"			# i.e. /MDd, debug executable using debug version of msvcrt
       
   454 			);
       
   455 		}
       
   456 	}
       
   457 
       
   458 	if ($MSVCVer >= 8) {
       
   459 		&main::Output(
       
   460 			" /Zc:wchar_t-"				# Don't make wchar_t a built-in; breaks mangled names
       
   461 		);		
       
   462 	}
       
   463 
       
   464 	if (($MSVCVer >= 7) || (&main::Plat ne 'TOOLS')) {
       
   465 		&main::Output(
       
   466 			" /W4"
       
   467 		);
       
   468 	}
       
   469 
       
   470 	if ($Bld=~/DEB$/o) {
       
   471 		&main::Output(
       
   472 			" /Zi",		# Generates complete debugging information
       
   473 			" /Od"		# Disables optimization
       
   474 		);
       
   475 #		euser change to apply inlining on the _NAKED functions
       
   476 		if ($BaseTrg=~/^EUSER$/oi) {
       
   477 			&main::Output(
       
   478 				' /Ob1'	# Specific control of expension of inline functions
       
   479 			);
       
   480 		}
       
   481 	}
       
   482 	elsif ($Bld=~/REL$/o) {
       
   483 		&main::Output(
       
   484 			' /O1'				# Creates small code
       
   485 		);
       
   486 		if ($MSVCVer >= 8) {
       
   487 			&main::Output(
       
   488 				' /fp:strict'		# Improves floating-point consistency
       
   489 			);
       
   490 		} else {
       
   491 			&main::Output(
       
   492 				' /Op'				# Improves floating-point consistency
       
   493 			);
       
   494 		}
       
   495 
       
   496 	}
       
   497 	&main::Output(
       
   498 		"$NotUseWin32LibsFlag"
       
   499 	);
       
   500 	my @incList=();
       
   501 	my $candidate;
       
   502 	INCLOOP: foreach $candidate (@ChopUserIncPaths,@ChopSysIncPaths) {
       
   503 		my $accepted;	# remove duplicates
       
   504 		foreach $accepted (@incList) {
       
   505 			if ($candidate eq $accepted) {
       
   506 				next INCLOOP;
       
   507 			}
       
   508 		}
       
   509 		push @incList, $candidate;
       
   510 		&main::Output(
       
   511 			" /I \"$candidate\""
       
   512 		);
       
   513 	}
       
   514 	foreach (@MacroList) {
       
   515 		&main::Output(
       
   516 			" /D \"$_\""
       
   517 		);
       
   518 	}
       
   519 
       
   520 
       
   521    if($VariantFile){
       
   522         my $VariantFileFileName  = Path_Split('FILE',$VariantFile);
       
   523         &main::Output(
       
   524               " /FI\"$VariantFileFileName\""
       
   525               );
       
   526 	}
       
   527 
       
   528 	if ($Bld=~/DEB$/o) {
       
   529 		&main::Output(
       
   530 			" /FR /Fd\"$ChopRelPath\\$TrgPath$BaseTrg.PDB\""
       
   531 		);
       
   532 	}
       
   533 	&main::Output(
       
   534 		" /c\n",
       
   535 	);
       
   536 
       
   537 	if ($BasicTrgType=~/^DLL$/o) {
       
   538 		&main::Output(
       
   539 			"# ADD MTL /nologo"
       
   540 		);
       
   541 		if ($Bld=~/REL$/o) {
       
   542 			&main::Output(
       
   543 				" /mktyplib203 /D"
       
   544 			);
       
   545 		}
       
   546 		elsif ($Bld=~/DEB$/o) {
       
   547 			&main::Output(
       
   548 				" /D \"_DEBUG\" /mktyplib203"
       
   549 			);
       
   550 		}
       
   551 		&main::Output(
       
   552 			" /win32\n"
       
   553 		);
       
   554 	}
       
   555 
       
   556 	&main::Output(
       
   557 		"# ADD BASE RSC /l 0x809\n",
       
   558 		"# ADD RSC /l 0x809 /d"
       
   559 	);
       
   560 	if ($Bld=~/REL$/o) {
       
   561 		&main::Output(
       
   562 			" \"NDEBUG\""
       
   563 		);
       
   564 	}
       
   565 	elsif ($Bld=~/DEB$/o) {
       
   566 		&main::Output(
       
   567 			" \"_DEBUG\""
       
   568 		);
       
   569 	}
       
   570 	&main::Output(
       
   571 		"\n"
       
   572 	);
       
   573 
       
   574 	&main::Output(
       
   575 		"BSC32=bscmake.exe\n",
       
   576 		"# ADD BSC32 /nologo\n",
       
   577 	);
       
   578 
       
   579 	if ($BasicTrgType=~/^(DLL|EXE)$/o) {
       
   580 		&main::Output(
       
   581 			"LINK32=link.exe\n",
       
   582 			"# ADD BASE LINK32 /machine:IX86\n",
       
   583 			"# ADD LINK32"
       
   584 		);
       
   585 		unless (&main::Plat eq 'TOOLS') {
       
   586 			&main::Output(
       
   587 				" \"$ChopStatLinkPath\\$FirstLib\""
       
   588 			);
       
   589 			
       
   590 			unless ($newlib) {
       
   591 				if ( main::SystemTrg() ) {
       
   592 					# System targets are PDD, LDD, VAR, KEXT and KDLL.
       
   593 
       
   594 					&main::Output(
       
   595 						" \"$ChopStatLinkPath\\$NewKernLib\""
       
   596 					);
       
   597 				}
       
   598 				else {
       
   599 					&main::Output(
       
   600 						" \"$ChopStatLinkPath\\$NewLib\""
       
   601 					);
       
   602 				}
       
   603 			}
       
   604 			else {
       
   605 				&main::Output(
       
   606 					" \"$ChopStatLinkPath\\$newlib\""
       
   607 				);
       
   608 			}
       
   609 		}
       
   610 	}
       
   611 	elsif ($BasicTrgType=~/^LIB$/o) {
       
   612 		&main::Output(
       
   613 			"LIB32=link.exe -lib\n",
       
   614 			"# ADD BASE LIB32 /machine:IX86\n",
       
   615 			"# ADD LIB32"
       
   616 		);
       
   617 	}
       
   618 	foreach (@Win32LibList) {
       
   619 		&main::Output(
       
   620 			" \"",lc $_,"\""
       
   621 		);
       
   622 	}
       
   623 	foreach (@StatLibList) {
       
   624 		&main::Output(
       
   625 			" \"$ChopStatLinkPath\\",lc $_,"\""
       
   626 		);
       
   627 	}
       
   628 	foreach (@LibList) {
       
   629 		&main::Output(
       
   630 			" \"$ChopLinkPath\\",lc $_,"\""
       
   631 		);
       
   632 	}
       
   633 	if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o) {
       
   634 		&main::Output(
       
   635 			" \"$ChopBldPath\\$ExportLibrary.exp\""
       
   636 		);
       
   637 	}
       
   638 	&main::Output(' /nologo');
       
   639 	if ($BasicTrgType=~/^(DLL|EXE)$/o) {
       
   640 		&main::Output(
       
   641 			" /fixed:no $BaseAddressFlag"
       
   642 		);
       
   643 	}
       
   644 	if (&main::HeapSize) {
       
   645 		my %HeapSize=&main::HeapSize;
       
   646 		&main::Output(
       
   647 			' /heap:',$HeapSize{Max},',',$HeapSize{Min}
       
   648 		);
       
   649 	}
       
   650 	if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o) {
       
   651 		&main::Output(
       
   652 			' /noentry /dll'
       
   653 		);
       
   654 	}
       
   655 	elsif ($BasicTrgType=~/^EXE$/o) {
       
   656 		unless (&main::Plat eq 'TOOLS') {
       
   657 			&main::Output(
       
   658 				' /entry:"?_E32Bootstrap@@YGXXZ"'
       
   659 			);
       
   660 		}
       
   661 	}
       
   662 	if (&main::Plat=~/^(WINC|TOOLS)$/o && $BasicTrgType=~/^EXE$/o) { # shouldn't really have WINC mentioned here
       
   663 		&main::Output(
       
   664 			' /subsystem:console'
       
   665 		);
       
   666 	}
       
   667 	else {
       
   668 		&main::Output(
       
   669 			' /subsystem:windows'
       
   670 		);
       
   671 	}
       
   672 	if ($BasicTrgType=~/^(DLL|EXE)$/o && $Bld=~/DEB$/o) {
       
   673 		&main::Output(
       
   674 #			pdb needs specifying here to be the same as the default applied in command-line builds
       
   675 			" /pdb:\"$ChopRelPath\\$TrgPath$BaseTrg.pdb\" /debug"
       
   676 		);
       
   677 	}
       
   678 	&main::Output(
       
   679 		' /machine:IX86',
       
   680 		' /ignore:4089',		# LNK4089: all references to "dynamic-link library" discarded by /OPT:REF
       
   681 		' /ignore:4005'			# LNK4005: no objects used from XXX
       
   682 	);
       
   683 
       
   684 	if ($MSVCVer >= 7) {
       
   685 		&main::Output(
       
   686 			' /ignore:4210'	# LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
       
   687 		);
       
   688 	}
       
   689 
       
   690 	my $EntrySymbol='';
       
   691 	unless (&main::Plat eq 'TOOLS') {
       
   692 		if ($BasicTrgType=~/^EXE$/o) {
       
   693 			my $debug = '';
       
   694 			if ($Bld =~ /DEB$/o) {
       
   695 				$debug .= 'd';
       
   696 			}
       
   697 			&main::Output(
       
   698 				" /nodefaultlib:libcmt$debug.lib"
       
   699 			);
       
   700 		}
       
   701 		if ($BasicTrgType=~/^DLL$/o) {
       
   702 			&main::Output(
       
   703 				" /include:\"__E32Dll\""
       
   704 			);
       
   705 			$EntrySymbol='_E32Dll';
       
   706 		}
       
   707 		elsif ($BasicTrgType=~/^EXE$/o) {
       
   708 			&main::Output(
       
   709 				" /include:\"__E32Startup\""
       
   710 			);
       
   711 			$EntrySymbol='_E32Startup';
       
   712 		}
       
   713 	} else {
       
   714 		&main::Output(
       
   715 			' /ignore:4098'	# LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
       
   716 		);
       
   717 	}
       
   718 	my $AbsentSubst = '';
       
   719 	if ($EntrySymbol) {
       
   720 		$AbsentSubst = " -absent $EntrySymbol";
       
   721 	}
       
   722 	&main::Output(
       
   723 		" /out:\"$ChopRelPath\\$TrgPath$Trg\""
       
   724 	);
       
   725 	if ($MSVCVer <= 7) {
       
   726 		if ($BasicTrgType=~/^(DLL|EXE)$/o) {
       
   727 			&main::Output(
       
   728 				' /WARN:3'
       
   729 			);
       
   730 		}
       
   731 	}
       
   732 	if ($BasicTrgType=~/^(DLL|EXE)$/o && $Bld=~/DEB$/o) {
       
   733 		&main::Output(
       
   734 			"\n",
       
   735 			"# SUBTRACT LINK32 /pdb:none"
       
   736 		);
       
   737 	}
       
   738 	&main::Output(
       
   739 		"\n"
       
   740 	);
       
   741 	if (&main::Plat eq 'TOOLS' and $BasicTrgType eq 'EXE') {
       
   742 		&main::Output(
       
   743 			"# Begin Special Build Tool\n",
       
   744 			"PostBuild_Cmds=copy \"$ChopRelPath\\$TrgPath$Trg\" \"",&main::EPOCToolsPath,"$Trg\" \n",
       
   745 			"# End Special Build Tool\n"
       
   746 		);
       
   747 	}
       
   748 	if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o) {
       
   749 		&main::Output(
       
   750 			"# Begin Special Build Tool\n",
       
   751 			"SOURCE=\$(InputPath)\n",
       
   752 			"PreLink_Cmds=echo Doing first-stage link by name\\\n"
       
   753 		);
       
   754 		&main::Output(
       
   755 			"\tnmake -nologo -f \"${PathBaseDsp}.SUP.MAKE\" PRELINK$Bld\\\n",
       
   756 			"\tif errorlevel 1 nmake -nologo -f \"${PathBaseDsp}.SUP.MAKE\" STOPLINK$Bld \n",
       
   757 			"PostBuild_Cmds=nmake -nologo -f \"${PathBaseDsp}.SUP.MAKE\" POSTBUILD$Bld\n",
       
   758 			"# End Special Build Tool\n"
       
   759 		);
       
   760 
       
   761 
       
   762 #		append to the supplementary makefile for each build
       
   763 		$SupText.=join('',
       
   764 			"# BUILD - $Bld\n",
       
   765 			"\n",
       
   766 			"LIBS="
       
   767 		);
       
   768 		foreach (@StatLibList) {
       
   769 			$SupText.=" \\\n\t\"\$(EPOCSTATLINK$Bld)\\$_\"";
       
   770 		}
       
   771 		foreach (@LibList) {
       
   772 			$SupText.=" \\\n\t\"\$(EPOCLINK$Bld)\\$_\"";
       
   773 		}
       
   774 		$SupText.="\n\nLINK_OBJS=";
       
   775 		foreach (@BaseSrcList) {
       
   776 			$SupText.=" \\\n\t\"\$(EPOCBLD$Bld)\\$_.obj\"";
       
   777 		}
       
   778 		if ($Win32Resrc) {
       
   779 			$SupText.=" \\\n\t\"\$(EPOCBLD$Bld)\\".&main::Path_Split('Base',$Win32Resrc).".res\"";
       
   780 		}
       
   781 		$SupText.="\n\nSTAGE1_LINK_FLAGS=\"\$(EPOCSTATLINK$Bld)\\$FirstLib\"";
       
   782 		
       
   783 		unless ($newlib) {
       
   784 			if ( main::SystemTrg() ) {
       
   785 				# System targets are PDD, LDD, VAR, KEXT and KDLL.
       
   786 
       
   787 				$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$NewKernLib\"";
       
   788 			}
       
   789 			else {
       
   790 				$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$NewLib\"";
       
   791 			}
       
   792 		}
       
   793 		else {
       
   794 			$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$newlib\"";
       
   795 		}
       
   796 		
       
   797 		foreach (@Win32LibList) {
       
   798 			$SupText.=' ';
       
   799 			$SupText.=lc $_;
       
   800 		}
       
   801 		$SupText.=" \\\n \$(LIBS) /nologo$BaseAddressFlag /noentry /dll /subsystem:windows";
       
   802 		if ($Bld=~/DEB$/o) {
       
   803 			$SupText.=' /debug';
       
   804 		}
       
   805 		$SupText.=" \\\n /incremental:no /machine:IX86 /ignore:4089";
       
   806 		if ($BasicTrgType=~/^EXE$/o) {
       
   807 			my $debug = '';
       
   808 			if ($Bld =~ /DEB$/o) {
       
   809 				$debug .= 'd';
       
   810 			}
       
   811 			$SupText .= " /nodefaultlib:libcmt$debug.lib";
       
   812 		}
       
   813 		if ($MSVCVer >= 7) {
       
   814 			$SupText .=  " /ignore:4210";
       
   815 		}
       
   816 		if ($BasicTrgType=~/^DLL$/o) {
       
   817 			$SupText.=" /include:\"__E32Dll\"";
       
   818 		}
       
   819 		else {
       
   820 			$SupText.=" /include:\"__E32Startup\"";
       
   821 		}
       
   822 		if ($BasicTrgType=~/^(DLL)$/o) {
       
   823 			$SupText.=" /implib:\"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"";
       
   824 		} elsif ($BasicTrgType=~/^(EXE)$/o) {
       
   825 			$SupText.=" /implib:\"\$(EPOCBLD$Bld)\\$ExportLibrary.exe.lib\"";
       
   826 		}
       
   827 		$SupText.=join('',
       
   828 			' /ignore:4089',		# LNK4089: all references to "dynamic-link library" discarded by /OPT:REF
       
   829 			' /ignore:4005'			# LNK4005: no objects used from XXX
       
   830 		);
       
   831 		if ($MSVCVer >= 7) {
       
   832 			$SupText.=" /ignore:4210";		# LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
       
   833 		}
       
   834 		$SupText.=" /out:\"\$(EPOCBLD$Bld)\\$Trg\"";
       
   835 		if ($MSVCVer < 7) {
       
   836 			$SupText .= " /WARN:3";
       
   837 		}
       
   838 		$SupText.="\n\n";
       
   839 		$SupText.="PRELINK$Bld : \$(LINK_OBJS)";
       
   840 		if (-e $DefFile) { # effectively "if project frozen ..."
       
   841 			$SupText.=" \"$DefFile\"";
       
   842 		}
       
   843 		unless (&main::Plat eq 'TOOLS') {
       
   844 			$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$FirstLib\"";
       
   845 			
       
   846 			unless ($newlib) {
       
   847 				if ( main::SystemTrg() ) {
       
   848 					# System targets are PDD, LDD, VAR, KEXT and KDLL.
       
   849 
       
   850 					$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$NewKernLib\"";
       
   851 				}
       
   852 				else {
       
   853 					$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$NewLib\"";
       
   854 				}
       
   855 			}
       
   856 			else {
       
   857 				$SupText.=" \"\$(EPOCSTATLINK$Bld)\\$newlib\"";
       
   858 			}
       
   859 		}
       
   860 		$SupText.=" \$(LIBS)\n";
       
   861 
       
   862 #		Link by name first time round for dlls
       
   863 		$SupText.=join('',
       
   864 			"\tlink.exe \@<<\n",
       
   865 			"\t\t\$(STAGE1_LINK_FLAGS) \$(LINK_OBJS)\n",
       
   866 			"<<\n",
       
   867 			"\tdel \"\$(EPOCBLD$Bld)\\$Trg\"\n"
       
   868 		);
       
   869 
       
   870 		if ($BasicTrgType=~/^(DLL)$/o) {
       
   871 			$SupText.="\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\"\n";
       
   872 		} elsif ($BasicTrgType=~/^(EXE)$/o) {
       
   873 			$SupText.="\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.exe.exp\"\n";
       
   874 		}
       
   875 
       
   876 #		Generate an export info file
       
   877 		if ($BasicTrgType=~/^(DLL)$/o) {
       
   878 			$SupText.=join('',
       
   879 				"\tdumpbin /exports /out:\"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\" \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n",
       
   880 				"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n"
       
   881 			);
       
   882 		} elsif ($BasicTrgType=~/^(EXE)$/o) {
       
   883 			$SupText.=join('',
       
   884 				"\tdumpbin /exports /out:\"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\" \"\$(EPOCBLD$Bld)\\$ExportLibrary.exe.lib\"\n",
       
   885 				"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.exe.lib\"\n"
       
   886 			);
       
   887 		}
       
   888 
       
   889 #		call makedef to reorder the export information
       
   890 #		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
       
   891 		$SupText.="\tperl -w -S makedef.pl $AbsentSubst -Inffile \"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\"";
       
   892 		if (-e $DefFile) { # effectively "if project frozen ..."
       
   893 			$SupText.=" -Frzfile \"$DefFile\"";
       
   894 		}
       
   895 		# freeze ordinals, a maximum of 2, for polymorphic dlls
       
   896 		my $Ordinal;
       
   897 		my $Num=1;
       
   898 		foreach $Ordinal (&main::Exports) {
       
   899 #			replace "$" with "$$" so that NMAKE doesn't think there's a macro in the function name
       
   900 			$Ordinal=~s-\$-\$\$-go;
       
   901 			$SupText.=" -$Num $Ordinal";
       
   902 			$Num++;
       
   903 		}
       
   904 		$SupText.=join('',
       
   905 			" \"\$(EPOCBLD)$ExportLibrary.def\" \n",
       
   906 			"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.inf\"\n"
       
   907 		);
       
   908 
       
   909 		# create the export object from the .DEF file
       
   910 		$SupText.="\tlib.exe  /nologo /machine:i386 /nodefaultlib /name:\"$Trg\" /def:\"\$(EPOCBLD)$ExportLibrary.def\" /out:\"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n";
       
   911 		if (&main::ExportUnfrozen) {
       
   912 			$SupText.="\tcopy \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\" \"\$(EPOCLIB)UDEB\\$ExportLibrary.lib\"\n";
       
   913 		}
       
   914 		$SupText.=join('',
       
   915 			"\tdel \"\$(EPOCBLD$Bld)\\$ExportLibrary.lib\"\n",
       
   916 			"\t\@echo First-stage link successful\n",
       
   917 			"\n",
       
   918 			"\n",
       
   919 			"STOPLINK$Bld : DELEXPOBJ$Bld\n",
       
   920 			"\t\@echo Stopped the build by removing the export object,\n",
       
   921 			"\t\@echo if present, because the pre-link stage failed\n",
       
   922 			"\n",
       
   923 			"\n",
       
   924 			"POSTBUILD$Bld : DELEXPOBJ$Bld"
       
   925 		);
       
   926 		if ($DefFile and not &main::ExportUnfrozen) {
       
   927 			$SupText.=" LIBRARY";
       
   928 		}
       
   929 		$SupText.=join('',
       
   930 			"\n",
       
   931 			"\n",
       
   932 			"\n",
       
   933 			"DELEXPOBJ$Bld :\n"
       
   934 		);
       
   935 
       
   936 		if ($BasicTrgType=~/^(DLL)$/o) {
       
   937 			$SupText.="\tif exist \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\" del \"\$(EPOCBLD$Bld)\\$ExportLibrary.exp\"\n";
       
   938 		} elsif ($BasicTrgType=~/^(EXE)$/o) {
       
   939 			$SupText.="\tif exist \"\$(EPOCBLD$Bld)\\$ExportLibrary.exe.exp\" del \"\$(EPOCBLD$Bld)\\$ExportLibrary.exe.exp\"\n";
       
   940 		}
       
   941 
       
   942 		$SupText.=join('',
       
   943 			"\n",
       
   944 			"\n",
       
   945 			"\n"
       
   946 		);
       
   947 	}
       
   948 
       
   949 	&main::Output(
       
   950 		"\n"
       
   951 	);
       
   952 }
       
   953 
       
   954 sub PMEndBldList {
       
   955 
       
   956 	# CLOSE THE !IF ... !ENDIF LOOP
       
   957 	#------------------------------
       
   958 	&main::Output(
       
   959 		"!ENDIF \n",
       
   960 		"\n"
       
   961 	);
       
   962 }
       
   963 
       
   964 sub PMStartSrcList {
       
   965 
       
   966 	my @BldList=&main::BldList;
       
   967 
       
   968 	&main::Output(
       
   969 		"# Begin Target\n",
       
   970 		"\n"
       
   971 	);
       
   972 	foreach (@BldList) {
       
   973 		&main::Output(
       
   974 			"# Name \"".$IdeBlds{$_}."\"\n"
       
   975 		);
       
   976 	}
       
   977 	&main::Output(
       
   978 		"# Begin Group \"Source Files\"\n",
       
   979 		"\n",
       
   980 		"# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90\"\n"
       
   981 	);
       
   982 }
       
   983 
       
   984 sub PMResrcBld {
       
   985 
       
   986 	my $ResourceRef=&main::ResourceRef;
       
   987 	my $Resrc=ucfirst lc &main::Path_Split('File', $$ResourceRef{Source});
       
   988 	my $BaseResrc=&main::Path_Split('Base', $$ResourceRef{Source});
       
   989 	my $SrcPath=&main::Path_Split('Path', $$ResourceRef{Source});
       
   990 	my $TrgPath=&main::Path_Split('Path', $$ResourceRef{Trg});
       
   991 	my @LangList=($$ResourceRef{Lang});
       
   992 	
       
   993 	my $inputpath="$SrcPath$Resrc";
       
   994 	
       
   995 	&main::Output(
       
   996 		"# Begin Source File\n",
       
   997 		"\n",
       
   998 		"SOURCE=$inputpath\n"
       
   999 	);
       
  1000 
       
  1001 	my @BldList=&main::BldList;
       
  1002 	my $ChopBldPath=&main::Path_Chop(&main::BldPath);
       
  1003 	my @ChopSysIncPaths=&main::Path_Chop(&main::SysIncPaths);
       
  1004 	my @ChopUserIncPaths=&main::Path_Chop(&main::UserIncPaths);
       
  1005 	my $DataPath=&main::DataPath;
       
  1006 	my @DepList=&main::DepList;
       
  1007 	my $PathBaseDsp=&main::MakeFilePath.&main::BaseMak;
       
  1008 	my $PerlLibPath=&main::PerlLibPath;
       
  1009 	my $RelPath=&main::RelPath;
       
  1010 	my $ChopSrcPath=&main::Path_Chop($SrcPath);
       
  1011 
       
  1012 	my $ResrcHdr=join '', &main::EPOCIncPath(), $BaseResrc, '.RSG';
       
  1013 
       
  1014 	&main::OutFormat(
       
  1015 		"USERDEP__$BaseResrc="
       
  1016 	);
       
  1017 	$SupText.="DEPEND=";
       
  1018 	my $Dep;
       
  1019 	foreach $Dep (@DepList) {
       
  1020 		&main::OutFormat(
       
  1021 			"\"$Dep\"\t"
       
  1022 		);
       
  1023 		$SupText.=" \\\n\t\"$Dep\"";
       
  1024 	}
       
  1025 	&main::Output(
       
  1026 		"\n"
       
  1027 	);
       
  1028 	$SupText.="\n\n";
       
  1029 
       
  1030 	my $Bld;
       
  1031 	foreach $Bld (@BldList) {
       
  1032 		my $ResrcTrgFullName="$RelPath$Bld\\$TrgPath$BaseResrc.r";
       
  1033 		if ($Bld eq $BldList[0]) {
       
  1034 			&main::Output(
       
  1035 				'!IF'
       
  1036 			);
       
  1037 		}
       
  1038 		else {
       
  1039 			&main::Output(
       
  1040 				'!ELSEIF'
       
  1041 			);
       
  1042 		}
       
  1043 		&main::Output(
       
  1044 			"  \"\$(CFG)\" == \"$IdeBlds{$Bld}\"\n",
       
  1045 			"\n"
       
  1046 		);
       
  1047 		&main::Output(
       
  1048 			"# PROP Intermediate_Dir \"$ChopBldPath\"\n",
       
  1049 			"# Begin Custom Build - Building resources from $Resrc\n",
       
  1050 			"InputPath=$inputpath\n",
       
  1051 			"\n",
       
  1052 			"BuildCmds= \\\n",
       
  1053 			"\tnmake -nologo -f \"${PathBaseDsp}.SUP.MAKE\"\\\n",
       
  1054 			"  \"$ResrcTrgFullName\"\n"
       
  1055 		);
       
  1056 		$SupText.="\"$ResrcTrgFullName\" :";
       
  1057 		my $Lang;
       
  1058 		foreach $Lang (@LangList) {
       
  1059 			if ($Lang eq 'SC') {
       
  1060 #				change to put dummy file in dependency list
       
  1061 				$SupText.=" \"$ResrcTrgFullName$Lang.dummy\"";
       
  1062 				next;
       
  1063 			}
       
  1064 			$SupText.=" \"$ResrcTrgFullName$Lang\"";
       
  1065 		}
       
  1066 		$SupText.="\n\n";
       
  1067 		foreach $Lang (@LangList) {
       
  1068 #			change to put dummy file in dependency list
       
  1069 			if ($Lang eq 'SC') {
       
  1070 				$SupText.="\"$ResrcTrgFullName$Lang.dummy\"";
       
  1071 			}
       
  1072 			else {
       
  1073 				$SupText.="\"$ResrcTrgFullName$Lang\"";
       
  1074 			}
       
  1075 			$SupText.=" : \"$SrcPath$Resrc\" \$(DEPEND)\n";
       
  1076 			$SupText.="\tperl -S epocrc.pl -I \"$ChopSrcPath\"";
       
  1077 			foreach (@ChopUserIncPaths) {
       
  1078 				$SupText.=" -I \"$_\"";
       
  1079 			}
       
  1080 			$SupText.=" -I-";
       
  1081 			foreach (@ChopSysIncPaths) {
       
  1082 				$SupText.=" -I \"$_\"";
       
  1083 			}
       
  1084 			$SupText.=" -DLANGUAGE_$Lang -u \"$SrcPath$Resrc\"";
       
  1085 			$SupText.=" -o\"$ResrcTrgFullName$Lang\" -h\"$SrcPath$BaseResrc.rs~\" -t\"\$(EPOCBLD$Bld)\"\n";
       
  1086 # 			change because if a .RSC file is output then VC5 tries to link it to the main target as a Win32 resource file
       
  1087 			if ($Lang eq 'SC') {
       
  1088 				$SupText.="\techo this is a dummy output file > \"$ResrcTrgFullName$Lang.dummy\"\n";
       
  1089 			}
       
  1090 			$SupText.=join('',
       
  1091 				"\tperl -w -S ecopyfile.pl \"$SrcPath$BaseResrc.rs~\" \"$ResrcHdr\"\n",
       
  1092 				"\tdel \"$SrcPath$BaseResrc.rs~\"\n",
       
  1093 				"\n"
       
  1094 			);
       
  1095 		}
       
  1096 
       
  1097 		foreach $Lang (@LangList) {
       
  1098 #			change again to avoid VC5 linking the resource
       
  1099 			my $TmpLang=$Lang;
       
  1100 			if ($TmpLang eq 'SC') {
       
  1101 				$TmpLang.='.dummy';
       
  1102 			}
       
  1103 			&main::Output(
       
  1104 				"\n",
       
  1105 				"\"$ResrcTrgFullName$TmpLang\" : \$(SOURCE) \"\$(INTDIR)\"\\\n",
       
  1106 				" \"\$(OUTDIR)\"\n",
       
  1107 				"   \$(BuildCmds)\n",
       
  1108 			);
       
  1109 		}
       
  1110 		&main::Output(
       
  1111 			"# End Custom Build\n",
       
  1112 			"\n"
       
  1113 		);
       
  1114 	}
       
  1115 	&main::Output(
       
  1116 		"!ENDIF \n",
       
  1117 		"\n",
       
  1118 		"# End Source File\n"
       
  1119 	);
       
  1120 }
       
  1121 
       
  1122 sub PMDoc {    
       
  1123 
       
  1124 	my $SrcPath=&main::SrcPath;
       
  1125 
       
  1126 	&main::Output(
       
  1127 		"# Begin Source File\n",
       
  1128 		"\n",
       
  1129 		"SOURCE=",$SrcPath,ucfirst lc &main::Doc,"\n",
       
  1130 		"# PROP Exclude_From_Build 1\n",
       
  1131 		"# End Source File\n"
       
  1132 	);
       
  1133 }
       
  1134 
       
  1135 sub PMStartSrc {    
       
  1136 
       
  1137 	&main::Output(
       
  1138 		"# Begin Source File\n",
       
  1139 		"\n",
       
  1140 		"SOURCE=",&main::SrcPath,ucfirst lc &main::Src,"\n",
       
  1141 		"# End Source File\n"
       
  1142 	);
       
  1143 }
       
  1144 
       
  1145 sub PMSrcDepend {
       
  1146 
       
  1147 	# Generate user header list for this src, merge with list for all sources
       
  1148 	foreach (&main::DepList) {
       
  1149 		$PrjHdrs{$_}='unusedval';
       
  1150 	}
       
  1151 }
       
  1152 
       
  1153 sub PMEndSrcList {
       
  1154 
       
  1155 	my $BaseDsp=&main::BaseMak;
       
  1156 	my $PathBaseDsp=&main::MakeFilePath.$BaseDsp;
       
  1157 
       
  1158 	&main::Output(
       
  1159 		"# End Group\n",
       
  1160 		"# Begin Group \"Resource Files\"\n",
       
  1161 		"\n",
       
  1162 		"# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe\"\n"
       
  1163 	);
       
  1164 	if ($Win32Resrc) {
       
  1165 		&main::Output(
       
  1166 			"# Begin Source File\n",
       
  1167 			"\n",
       
  1168 			"SOURCE=",ucfirst lc $Win32Resrc,"\n",
       
  1169 			"# End Source File\n"
       
  1170 		);
       
  1171 		# Generate user header list for this src, merge with list for all sources
       
  1172 		foreach (&main::Deps_GenDependsL($Win32Resrc)) {
       
  1173 			$PrjHdrs{$_}='unusedval';
       
  1174 		}
       
  1175 	}
       
  1176 	&main::Output(
       
  1177 		"# End Group\n"
       
  1178 	);
       
  1179 
       
  1180 	# Use the global %PrjHdrs Hash to produce user header listing
       
  1181 	&main::Output(
       
  1182 		"# Begin Group \"Header Files\"\n",
       
  1183 		"\n",
       
  1184 		"# PROP Default_Filter \"h;hpp;hxx;hm;inl;fi;fd\"\n"
       
  1185 	);
       
  1186 	foreach (keys %PrjHdrs) {
       
  1187 		&main::Output(
       
  1188 			"# Begin Source File\n",
       
  1189 			"\n",
       
  1190 			"SOURCE=",&main::Path_Split('Path',$_),ucfirst lc &main::Path_Split('File',$_),"\n",
       
  1191 			"# End Source File\n"
       
  1192 		);
       
  1193 	}	
       
  1194 	&main::Output(
       
  1195 		"# End Group\n",
       
  1196 		"# End Target\n",
       
  1197 		"# End Project\n",
       
  1198 	);
       
  1199 
       
  1200 	&main::Path_DelFiles("$PathBaseDsp.MAK","$PathBaseDsp.MDP","$PathBaseDsp.NCB","$PathBaseDsp.OPT","$PathBaseDsp.PLG");
       
  1201 
       
  1202 #	Add target to supplementary makefile to recreate the workspace
       
  1203 #
       
  1204 #	This target is intended for use as a custom tool within the MSVC IDE, for regenerating
       
  1205 #	workspace once the .MMP file has been edited within the IDE.  To install the target as
       
  1206 #	a custom tool in the IDE, select Tools->Customise...->Tools, and choose a name for the
       
  1207 #	tool, e.g. "Recreate Workspace".  Next, type "nmake.exe" as the command and
       
  1208 #	"-nologo -f $(WkspDir)\$(WkspName).sup.make recreateworkspace" as the program arguments.
       
  1209 #	Leave the "initial directory" field blank, and tick the "Close window on exiting" checkbox.
       
  1210 #	Having edited the .MMP file for a project, select the new tool from the tools menu to
       
  1211 #	recreate the workspace.  If the commands have run correctly, you will be prompted to
       
  1212 #	reload the workspace.
       
  1213 	$SupText.=join('',
       
  1214 		"\n",
       
  1215 		"RECREATEWORKSPACE :\n",
       
  1216 		'	cd ', &main::Path_Chop(&main::Path_WorkPath), "\n",
       
  1217 		'	perl -w -S makmake.pl -D ', &main::MmpFile, ' ', &main::PlatName, "\n",
       
  1218 		"\n"
       
  1219 	);
       
  1220 
       
  1221 #	Create the supplementary makefile
       
  1222 	
       
  1223 	&main::CreateExtraFile(&main::MakeFilePath.&main::BaseMak.'.SUP.MAKE', $SupText);
       
  1224 
       
  1225 
       
  1226 # create the .DSW file
       
  1227 	my $DswText=join(
       
  1228 		"\n",
       
  1229 		"Microsoft Developer Studio Workspace File, Format Version 6.00",
       
  1230 		'# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!',
       
  1231 		'',
       
  1232 		'#'x79,
       
  1233 		'',
       
  1234 		"Project: \"$BaseDsp\"=.\\$BaseDsp.dsp - Package Owner=<4>",
       
  1235 		'',
       
  1236 		'Package=<5>',
       
  1237 		'{{{',
       
  1238 		'}}}',
       
  1239 		'',
       
  1240 		'Package=<4>',
       
  1241 		'{{{',
       
  1242 		'}}}',
       
  1243 		'',
       
  1244 		'#'x79,
       
  1245 		'',
       
  1246 		'Global:',
       
  1247 		'',
       
  1248 		'Package=<5>',
       
  1249 		'{{{',
       
  1250 		'}}}',
       
  1251 		'',
       
  1252 		'Package=<3>',
       
  1253 		'{{{',
       
  1254 		'}}}',
       
  1255 		'',
       
  1256 		'#'x79,
       
  1257 		''
       
  1258 	);
       
  1259 
       
  1260 	&main::CreateExtraFile("$PathBaseDsp.DSW",$DswText);
       
  1261 }
       
  1262 
       
  1263 1;