sbsv1/abld/platform/winutl.pm
author jascui
Tue, 16 Nov 2010 15:54:07 +0800
changeset 682 2c32f186fa1f
parent 599 fa7a3cc6effd
permissions -rw-r--r--
Solving incorrect handling when processing ExportName=SymbolName@Ordinal syntax.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
# Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
# All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
# This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
# under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
# which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
# Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
# Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
# Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
# this package does various ancillary things for windows modules
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
# 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
package Winutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
my $BaseAddress='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
my @Win32LibList=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
my $Win32Resrc='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
my $CopyForStaticLinkage=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
my $Win32StdHeaders=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
my $MSVCVer=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
my $MSVCSubVer=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
require Exporter;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
@ISA=qw(Exporter);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
@EXPORT=qw(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
	Winutl_Help_Mmp
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
	Winutl_DoMmp_Parse
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
	Winutl_DoMmp
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
	Winutl_BaseAddress
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
	Winutl_Win32LibList
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
	Winutl_Win32Resrc
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
	Winutl_CopyForStaticLinkage
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
	Winutl_Win32StdHeaders
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
	Winutl_AdjustTargetPath
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
	Winutl_MSVCVer
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
	Winutl_MSVCSubVer
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
	Winutl_CheckSourceMMPMetaData
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
use Genutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
use E32Variant;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
use CheckSource;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
use Pathutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
use Cwd;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
my %CheckSourceMMPMetaData;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
sub Winutl_Help_Mmp {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
# provide the help text for START <windows platforms> END blocks
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
	print
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
		"BASEADDRESS    [base address for dll loading]\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
		"WIN32_LIBRARY  [win32 libraries]\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
		"WIN32_RESOURCE  [win32 resource]\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
		"COPY_FOR_STATIC_LINKAGE   // copy dll from emulated Z drive\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
		"WIN32_HEADERS // instruct compiler to look into standard header directories\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
		"              // (implied by WIN32_LIBRARY)\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
	;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
sub Winutl_DoMmp_Parse ($$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
	# takes reference to platform text and semicolon-separated list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
	# of compiler-specific include directories
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
	my @PlatTxt=@{$_[0]};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
	my $CompilerIncPaths=$_[1];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
# process the START <windows platforms> END blocks
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
	my $BaseTrg=&main::BaseTrg;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
	my $BasicTrgType=&main::BasicTrgType;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
	my $MakeFilePath=&main::MakeFilePath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
	my $MMPFILE=&main::MmpFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
	# set up START WINS ... END block module variables
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
	my @MmpWarn=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
	my $Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
	LINE: foreach $Line (@PlatTxt) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
		my $LineInfo=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
		$LineInfo =~ /^(.+)\((\d+)\)$/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
		my $CurFile = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
		my $LineNum = $2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
		my $BldInfDir = cwd;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
		$BldInfDir =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
		$BldInfDir =~ s/^\w+://;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
		$BldInfDir .= "\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
		$_=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
		if (/^BASEADDRESS$/oi) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   102
			if (@$Line) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   103
				$BaseAddress=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   104
				$BaseAddress=~s/X/x/o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   105
				next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   106
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   107
			push @MmpWarn, "$LineInfo : No base address specified for keyword BASEADDRESS\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   108
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   109
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   110
		if (/^WIN32_LIBRARY$/oi) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   111
			if (@$Line)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   112
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   113
				$Win32StdHeaders = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   114
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   115
				foreach (@$Line)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   116
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   117
					if (/^\./)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   118
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   119
						# local - check for UNIX slash and physical consistency of file as it exists relative to the bld.inf
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   120
						CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, "WIN32_LIBRARY", $_, $LineNum, $CheckSource_PhysicalCheck, $BldInfDir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   121
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   122
					else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   123
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   124
						# global - check for UNIX slash and assume that it must be lower case
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   125
						CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, "WIN32_LIBRARY", $_, $LineNum);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   126
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   127
					$_ = &Path_Norm($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   128
					push @Win32LibList, $_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   129
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   130
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   131
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   132
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   133
				push @MmpWarn, "$LineInfo : No libraries specified for keyword WIN32_LIBRARY\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   134
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   135
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   136
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   137
		if (/^WIN32_RESOURCE$/oi) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   138
			if (@$Line) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   139
				$Win32Resrc=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   140
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   141
				CheckSource_MetaData(%CheckSourceMMPMetaData, $CurFile, "WIN32_RESOURCE", $Win32Resrc, $LineNum, $CheckSource_PhysicalCheck);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   142
				$Win32Resrc = &Path_Norm($Win32Resrc);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   143
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   144
				$Win32Resrc=&main::Path_MakeAbs($MMPFILE, $Win32Resrc);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   145
				next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   146
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   147
			push @MmpWarn, "$LineInfo : No resource specified for keyword WIN32_RESOURCE\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   148
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   149
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   150
		if (/^COPY_FOR_STATIC_LINKAGE$/oi) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   151
			if ($BasicTrgType!~/^DLL$/oi) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   152
				push @MmpWarn, "$LineInfo : COPY_FOR_STATIC_LINKAGE only applies to DLLs\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   153
				next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   154
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   155
			if (&main::TrgPath eq "") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   156
				push @MmpWarn, "$LineInfo : COPY_FOR_STATIC_LINKAGE requires TARGETPATH\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   157
				next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   158
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   159
			$CopyForStaticLinkage=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   160
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   161
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   162
		if (/^WIN32_HEADERS$/oi) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   163
			$Win32StdHeaders = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   164
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   165
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   166
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   167
		push @MmpWarn, "$LineInfo : Unrecognised Keyword \"$_\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   168
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   169
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   170
	undef $Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   171
	if (@MmpWarn) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   172
		warn
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   173
			"\nMMPFILE \"",$MMPFILE,"\"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   174
			"START .. END BLOCK WARNINGS(S)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   175
			@MmpWarn,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   176
			"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   177
		;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   178
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   179
	undef @MmpWarn;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   180
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   181
	# if Win32 Libraries required - set the Windows standard include paths
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   182
	if ($Win32StdHeaders || $Win32Resrc || &main::Plat eq 'TOOLS' || &main::Plat eq 'CWTOOLS'
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   183
		|| &main::Plat eq 'TOOLS2')
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   184
	{	# show where to find win32 libraries
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   185
		# include env variable takes everything between ';', including spaces and '"', as part of path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   186
		my @StdIncPaths=split ';', $CompilerIncPaths;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   187
		my $path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   188
		foreach $path (@StdIncPaths) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   189
			$path =~ s-/-\\-go;	# for those working with UNIX shells
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   190
			if ($path =~ /^\+/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   191
				# expand CodeWarrior "recursive" entries
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   192
				$path =~ s-^\+--go;		# remove the + from the current entry
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   193
				if (opendir DIR, $path) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   194
					my @list = grep !/^\.\.?$/, readdir DIR;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   195
					closedir DIR;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   196
					foreach (@list) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   197
						my $newpath="$path\\$_";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   198
						if (-d $newpath) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   199
							push @StdIncPaths,"+$newpath";	# add subdirs for later expansion
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   200
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   201
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   202
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   203
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   204
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   205
		&main::SetStdIncPaths(@StdIncPaths);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   206
		&main::AddPlatMacros('WIN32','_WINDOWS');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   207
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   208
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   209
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   210
sub Winutl_DoMmp ($$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   211
	# takes reference to platform text and semicolon-separated list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   212
	# of compiler-specific include directories
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   213
	my @PlatTxt=@{$_[0]};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   214
	my $CompilerIncPaths=$_[1];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   215
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   216
	my $Plat=&main::Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   217
	if ($Plat ne "WINSCW" and $Plat ne "CWTOOLS" and $Plat ne "TOOLS2") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   218
		#	check that we're using VC6 SP3
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   219
		&Winutl_MSVCVer();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   220
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   221
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   222
	&Winutl_DoMmp_Parse(\@PlatTxt, $CompilerIncPaths);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   223
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   224
	my $BaseTrg=&main::BaseTrg;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   225
	my $BasicTrgType=&main::BasicTrgType;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   226
	my $MakeFilePath=&main::MakeFilePath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   227
	my $MMPFILE=&main::MmpFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   228
	my @UidList=&main::UidList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   229
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   230
	if ($BasicTrgType=~/^(EXE|DLL)$/oi) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   231
		# create the UID source file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   232
		my $priority = "EPriorityForeground";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   233
		if (&main::ProcessPriority) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   234
			$priority="EPriority".&main::ProcessPriority;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   235
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   236
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   237
		my $UidText=join(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   238
			"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   239
			'// Makmake-generated uid source file',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   240
			'#include <e32cmn.h>',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   241
			'#pragma data_seg(".SYMBIAN")',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   242
			'__EMULATOR_IMAGE_HEADER2('
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   243
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   244
		foreach (@UidList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   245
			$UidText.="$_,";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   246
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   247
		my $vstr = "0x".&Genutl_VersionToHexString(&main::Version);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   248
		my $vid = &main::VendorId;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   249
		if(!$vid) { $vid="0"; }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   250
		$UidText.="$priority,".(&main::CapabilityFlags)[0]."u,".(&main::CapabilityFlags)[1]."u,".&main::SecureId.",".$vid.",$vstr,";	# second capability word always 0 for now
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   251
		if (&main::AllowDllData) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   252
			$UidText.="1,";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   253
		} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   254
			$UidText.="0,";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   255
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   256
		chop $UidText;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   257
		$UidText.=")\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   258
		$UidText.="#pragma data_seg()\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   259
		unless (&main::Plat eq 'TOOLS' || &main::Plat eq 'CWTOOLS' || &main::Plat eq 'TOOLS2' ) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   260
			&main::AddSrc("$MakeFilePath$BaseTrg.UID.CPP", $UidText);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   261
		};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   262
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   263
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   264
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   265
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   266
sub Winutl_BaseAddress () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   267
	$BaseAddress;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   268
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   269
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   270
sub Winutl_Win32LibList () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   271
	@Win32LibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   272
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   273
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   274
sub Winutl_Win32Resrc () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   275
	$Win32Resrc;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   276
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   277
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   278
sub Winutl_CopyForStaticLinkage () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   279
	$CopyForStaticLinkage;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   280
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   281
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   282
sub Winutl_Win32StdHeaders () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   283
	$Win32StdHeaders;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   284
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   285
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   286
sub Winutl_AdjustTargetPath () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   287
	my ($TrgPathRef) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   288
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   289
	if (&main::EPOCSecurePlatform) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   290
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   291
		my $plan=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   292
		my @macros = &Variant_GetMacroList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   293
		foreach my $macro (@macros) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   294
			if ($macro =~ m/^SYMBIAN_IGNORE_BIN_TARGETPATH.*/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   295
				$plan = 2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   296
				last;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   297
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   298
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   299
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   300
		if ($plan == 1) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   301
			# Intermediate step: TARGETPATH => COPY_FOR_STATIC_LINKAGE
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   302
			$CopyForStaticLinkage = 1 if ($$TrgPathRef ne "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   303
		} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   304
			# Finally: Ignore TARGETPATH and COPY_FOR_STATIC_LINKAGE
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   305
			# unless it's a subdir of sys\bin
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   306
			if (&main::TrgPath !~ /^Z\\sys\\bin\\.+/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   307
				$$TrgPathRef = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   308
				$CopyForStaticLinkage = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   309
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   310
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   311
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   312
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   313
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   314
sub Winutl_MSVCVer ($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   315
	my $platcommand=shift;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   316
	if(!defined $platcommand) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   317
		$platcommand=0; }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   318
	open PIPE, "LINK.EXE 2>&1 |" or die "ERROR: Can't invoke LINK.EXE\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   319
	my $DoneCheck=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   320
	while (<PIPE>) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   321
		unless ($DoneCheck) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   322
			if (/^.+\s+Version\s+(\d)\.(\d{2})\.((\d{4})|(\d{5})(.\d{2}))\s*$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   323
				if (($1<6) or ($1==6 and $2<0) or ($1==6 and $2==0 and $3<8447)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   324
					warn "WARNING: Should install MSVC6 Service Pack 3\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   325
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   326
				$MSVCVer = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   327
				$MSVCSubVer = $2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   328
				$DoneCheck=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   329
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   330
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   331
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   332
	close PIPE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   333
	# Do not throw any error when link.exe not present  while displaying
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   334
	# a list of the supported platforms using bldmake plat command.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   335
	if (!$DoneCheck && !$platcommand) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   336
		# Couldn't find version information? Might not have link.exe at all
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   337
		die "ERROR: failed to find version information for LINK.EXE\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   338
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   339
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   340
	$MSVCVer;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   341
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   342
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   343
sub Winutl_MSVCSubVer ($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   344
	my $platcommand=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   345
	&Winutl_MSVCVer($platcommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   346
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   347
	$MSVCSubVer;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   348
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   349
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   350
sub Winutl_CheckSourceMMPMetaData () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   351
	%CheckSourceMMPMetaData;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   352
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   353
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   354
1;