sbsv1/abld/platform/ide_cw.pm
author Bob Rosenberg <bob.rosenberg@nokia.com>
Mon, 06 Sep 2010 09:57:24 +0100
changeset 639 0e65f93be3cb
parent 599 fa7a3cc6effd
permissions -rw-r--r--
Joinsysdef schema calculation handles missing files. rootsystef generation does not modify embedded metatdata.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
# All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
# This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
# under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
# which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
# Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
# Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
# Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
# Makmake-module for creating XML files which can be imported as CodeWarrior IDE projects
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
# 
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
package Ide_cw;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
my $CW_minimum_supported_version = 2.8;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
# declare variables global for module
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
my $BaseAddress="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
my %IdeBlds=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
my %PrjHdrs=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
my @Win32LibList=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
my $Win32Resrc;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
my $Win32StdHeaders;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
my $ExtraFilesPath="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
my @KnownRoots=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
my @addedFiles=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
my $addHeaders = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
my $addDocuments = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
my %processedPlatforms;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
require Exporter;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
@ISA=qw(Exporter);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
@EXPORT=qw(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
	PMHelp_Mmp
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
	PMCheckPlatformL
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
	PMPlatProcessMmp
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
	PMStartBldList
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
		PMBld
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
			PMResrcBld
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
	PMEndSrcList
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
require Cl_bpabi;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
use BPABIutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
use E32Variant;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
use E32Plat; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
use Winutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
use Armutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
use Pathutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
use Win32API::Registry qw( :ALL );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
use Preprocessor;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
use RVCT_plat2set;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
sub PMHelp_Mmp {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
	&Winutl_Help_Mmp;
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
my $RVCTMajorVersion = Armutl_RVCTMajorVersion();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
my $RVCTMinorVersion = Armutl_RVCTMinorVersion();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
my $RVCTVersion = "${RVCTMajorVersion}_${RVCTMinorVersion}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
my $oP = "--";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
$oP = "-" if ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
my $cfgMacro = &Variant_GetMacro();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
use FindBin;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
use lib $FindBin::Bin."\\perllib";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
#use the DOM xml module
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
use XML::DOM;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
my $projectTemplate;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
my $linkDescriptorTemplate;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
my $xmlParser;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
my $xmlProjectDoc;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
my $xmlLinkDescriptorDoc;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
my $xmlLinkDescriptorCommandParent;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
my $xmlLinkDescriptorSymbolParent;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
my $xmlLinkDescriptorDumpFileParent;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
my $xmlLinkOrder;		# for accumulating the link order
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
my $xmlFileList;		# for accumulating the file list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
my $xmlSourceGroup;		# for accumulating the source
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
my $xmlHeadersGroup;	# for accumulating local header files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
my $xmlRootGroup;		# for accumulating files to be added outside of project groups
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
my $xmlLinkGroup;		# for accumulating the link descriptor files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   102
my $xmlLibGroup;		# for accumulating the libraries
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   103
my $xmlResourcesGroup;	# for accumulating resource related files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   104
my $xmlDocumentsGroup;	# for accumulating supported files specified with DOCUMENT in the .mmp file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   105
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   106
my $MmpFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   107
my $VariantFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   108
my $PrefixFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   109
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   110
my $CW_major_version;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   111
my $CW_minor_version;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   112
my $CW_libpath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   113
my @CW_librarypath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   114
my @ToolChainLibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   115
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   116
# Hash to store configuration makefile data for furthur processing
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   117
my %configdata;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   118
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   119
sub RoundUp1k($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   120
	# Accept C hexadecimal number (0xNNN).  Convert argument to Kb
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   121
	# rounded up to the next 1kb boundary.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   122
	use integer;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   123
	return (hex($_[0]) + 1023) / 1024;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   124
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   125
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   126
use Genutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   127
use cl_generic;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   128
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   129
my $ToolPrefix='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   130
my $HelperLib='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   131
my %PlatOpt=(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   132
	'Dlltool'=>'',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   133
	'Entry'=>'-e',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   134
	'Gcc'=>'',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   135
	'Ld'=>'',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   136
	'Petran'=>'',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   137
	'Optimize'=>'-O'
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   138
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   139
my $Dlltool;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   140
my $Archive;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   141
my $Link;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   142
my $Objcopy;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   143
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   144
my %CompatibleABIs=(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   145
	ARMI=>['ARM4', 'THUMB'],
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   146
	ARM4=>['ARMI'],
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   147
	THUMB=>['ARMI'],
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   148
	ARMV5=>['ARMV5_ABIV1'],
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   149
	GCCE=>['GCCE'],
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   150
	BPABI=>['ARMV5_ABIV2']
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   151
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   152
my @CompatibleABIs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   153
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   154
my $Makecmd;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   155
my %ABILibPath=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   156
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   157
sub SystemTarget() {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   158
	return 1 if &main::SystemTrg;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   159
	my $ExportLibrary=&main::ExportLibrary;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   160
	# N.B. should get better way to detect kernel probably!!
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   161
	return 1 if ($ExportLibrary =~ /EKERN/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   162
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   163
	return 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   164
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   165
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   166
sub SysTrg () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   167
	return 1 if &main::SystemTrg;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   168
	my $ExportLibrary=&main::ExportLibrary;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   169
	return 1 if ($ExportLibrary =~ /EKERN/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   170
	my $Trg=&main::Trg;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   171
	return 1 if ($Trg =~ /KSRT/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   172
	return 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   173
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   174
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   175
sub PMUnderlyingABI($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   176
	my ($ABI) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   177
	if ($ABI eq 'ARM4T') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   178
		if (&main::BuildAsARM) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   179
			return 'ARMI';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   180
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   181
		elsif (SystemTarget()) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   182
			return 'ARM4';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   183
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   184
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   185
			return 'ARMV4';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   186
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   187
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   188
	return $ABI;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   189
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   190
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   191
##### ARMV5 specific options #####
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   192
my $diag_suppressions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   193
my $diag_warnings;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   194
my $diag_errors;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   195
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   196
#The options here are handcoded for ABIV1 mode.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   197
my $contingentOptions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   198
my $exceptions = ' --exceptions --exceptions_unwind';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   199
my $thumbOptions = '--thumb ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   200
my $armOptions = '--arm ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   201
my $kernelOptions = '--arm --no_exceptions --no_exceptions_unwind';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   202
my $invariantOptions = 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   203
  '--cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --export_all_vtbl --no_vfe --apcs /inter';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   204
$invariantOptions .= ' --dllimport_runtime' unless ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2);  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   205
# specify floating point model here
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   206
my $floatingpointmodel = "softvfp";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   207
if (&main::ARMFPU && (&main::ARMFPU =~ /^VFPV2$/i)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   208
	$floatingpointmodel = "vfpv2";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   209
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   210
my $floatingpoint = ' --fpu '.$floatingpointmodel.'';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   211
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   212
# Set compiler settings
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   213
$diag_suppressions = '--diag_suppress 66,161,611,654,997,1152,1300,1464,1488,6318,6331';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   214
$diag_warnings = '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   215
$diag_errors = '--diag_error 1267';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   216
my $commonOptions = "$diag_suppressions $diag_warnings $diag_errors";  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   217
# variables added to fetch the options from the BSF files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   218
my @commonOptions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   219
my @thumbOptions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   220
my @armOptions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   221
my @kernelOptions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   222
my @invariantOptions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   223
my @linkerOptions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   224
my @archiverOptions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   225
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   226
my $linkCommand = "";		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   227
# variables to process and store the default and BSF file options
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   228
my $invopts = $invariantOptions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   229
my $linkeropts;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   230
my $archiveropts;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   231
#varible to store the BSF add options
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   232
my $bsfaddoptions = undef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   233
#variable to store the compiler flags, defs and other options
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   234
my $CCFLAGS = undef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   235
my $CCDEFS = undef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   236
my $CCUREL = undef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   237
my $CCUDEB = undef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   238
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   239
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   240
#GCCE specific OPIONS
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   241
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   242
my $GCCE_CompilerOption = '-march=armv5t -mthumb-interwork -mapcs';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   243
$GCCE_CompilerOption .= " -msoft-float -fexceptions -pipe -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   244
#Flag to check for the customized GCCE platform
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   245
my $CustGCCE=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   246
#Variable to fetch the Customized platform
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   247
my %CustPlat=&main::PlatRec;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   248
#Flags to read the options
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   249
my $kernelOption=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   250
my $buildAsArmOption=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   251
my $thumbOption=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   252
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   253
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   254
my $ArmIncDir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   255
my @ArmLibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   256
my $ArmRT;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   257
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   258
my %BSF_keywords = (
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   259
		    COMMON_OPTIONS => 1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   260
		    THUMB_OPTIONS => 1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   261
		    ARM_OPTIONS => 1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   262
		    KERNEL_OPTIONS => 1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   263
		    INVARIANT_OPTIONS => 1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   264
			LD_OPTIONS => 1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   265
			AR_OPTIONS => 1
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   266
		   );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   267
sub PMStartBldList($) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   268
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   269
	($Makecmd) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   270
	my @BldList=&main::BldList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   271
	my $BasicTrgType=&main::BasicTrgType;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   272
	my $ABI=&main::ABI;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   273
	my $kernelOption=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   274
	my $buildAsArmOption=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   275
	my $thumbOption=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   276
	my @MacroList=&main::MacroList();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   277
	push @MacroList, "__SUPPORT_CPP_EXCEPTIONS__ ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   278
	my %plat = &main::PlatRec();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   279
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   280
	$CCFLAGS = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   281
	$CCDEFS = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   282
	$CCUREL = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   283
	$CCUDEB = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   284
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   285
	$VariantFile=&main::VariantFile();	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   286
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   287
	#read the configuration make file into the hash for only the BPABI platforms
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   288
	my $config_file = BPABIutl_Config_Path(&main::Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   289
	if ($config_file) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   290
		collect_config_data($config_file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   291
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   292
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   293
	Read_BSF_Options() if ($plat{'CUSTOMIZES'});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   294
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   295
	if (SysTrg()) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   296
		$kernelOption=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   297
	} elsif (main::BuildAsARM() or ($ABI eq 'ARMV4')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   298
		$buildAsArmOption=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   299
	} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   300
		$thumbOption=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   301
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   302
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   303
	my $OtherOpts = undef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   304
	my $toolchain = $configdata{COMPILER_PLAT};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   305
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   306
	$OtherOpts = &main::CompilerOption($toolchain);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   307
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   308
	if($kernelOption==1)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   309
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   310
		if(@kernelOptions) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   311
# Kernel options as read from BSF file (KERNEL_OPTIONS keyword)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   312
			Set_BSF_Options('KERNEL_OPTIONS',\@kernelOptions);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   313
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   314
		$OtherOpts .= " ".fetch_config_data($configdata{KERNEL_OPTIONS});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   315
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   316
	elsif($buildAsArmOption==1)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   317
	{	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   318
		if(@armOptions) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   319
# Arm options as read from BSF file (ARM_OPTIONS keyword)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   320
			Set_BSF_Options('ARM_OPTIONS',\@armOptions);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   321
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   322
		$OtherOpts .= " ".fetch_config_data($configdata{ARM_OPTIONS});	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   323
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   324
	elsif($thumbOption==1)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   325
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   326
		if(@thumbOptions) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   327
# Thumb options as read from BSF file (THUMB_OPTIONS keyword)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   328
			Set_BSF_Options('THUMB_OPTIONS',\@thumbOptions);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   329
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   330
		$OtherOpts .= " ".fetch_config_data($configdata{THUMB_OPTIONS});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   331
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   332
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   333
	if($thumbOption==1 || $buildAsArmOption==1)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   334
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   335
		if (&main::ARMFPU && (&main::ARMFPU =~ /^VFPV2$/i))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   336
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   337
			$OtherOpts .= "	".$configdata{VFP2MODE_OPTION};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   338
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   339
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   340
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   341
			$OtherOpts .= "	".$configdata{SOFTVFPMODE_OPTION};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   342
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   343
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   344
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   345
	if ($thumbOption==1)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   346
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   347
		$OtherOpts .= "	".$configdata{COMPILER_THUMB_DEFINES};
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
	$OtherOpts .= "	".$configdata{COMPILER_INTERWORK_DEFINES};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   351
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   352
	if((&main::Plat eq "ARMV5_ABIV1") || (&main::Plat eq "ARMV5" && !$cfgMacro)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   353
	|| ($CustPlat{'CUSTOMIZES'} 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   354
	&& (($CustPlat{'ROOTPLATNAME'} eq "ARMV5_ABIV1" && $cfgMacro) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   355
	|| ($CustPlat{'ROOTPLATNAME'} eq "ARMV5" && !$cfgMacro)))) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   356
		ComputeCompilerOpts();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   357
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   358
	elsif($config_file) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   359
		$CCFLAGS = &Cl_bpabi::getConfigVariable('CCFLAGS');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   360
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   361
	$CCFLAGS .= $OtherOpts;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   362
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   363
	if(@invariantOptions)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   364
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   365
	# Invariant options as read from BSF file (INVARIANT_OPTIONS keyword)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   366
		Set_BSF_Options('INVARIANT_OPTIONS',\@invariantOptions);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   367
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   368
	if(@commonOptions)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   369
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   370
	# Common options as read from BSF file (COMMON_OPTIONS keyword)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   371
		Set_BSF_Options('COMMON_OPTIONS',\@commonOptions);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   372
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   373
	if(@linkerOptions)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   374
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   375
	# Invariant options as read from BSF file (LD_OPTIONS keyword)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   376
		Set_BSF_Options('LD_OPTIONS',\@linkerOptions);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   377
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   378
	if ($BasicTrgType=~/^LIB$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   379
		if(@archiverOptions)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   380
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   381
		# Invariant options as read from BSF file (AR_OPTIONS keyword)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   382
			Set_BSF_Options('AR_OPTIONS',\@archiverOptions);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   383
		}	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   384
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   385
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   386
	if($bsfaddoptions)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   387
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   388
		fixbsfoptions($bsfaddoptions);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   389
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   390
	$CCFLAGS .= $bsfaddoptions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   391
	$CCDEFS = $configdata{COMPILER_DEFINES};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   392
	$CCDEFS .= printlist("-D", @MacroList);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   393
	$CCDEFS .= $configdata{PLATFORM_DEFINES};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   394
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   395
	if($kernelOption==1)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   396
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   397
		$CCDEFS .= -D__KERNEL_MODE__;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   398
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   399
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   400
	if($VariantFile) { 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   401
		$CCDEFS .= " -D__PRODUCT_INCLUDE__="."\\\"".&main::Path_Split('File',$VariantFile)."\\\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   402
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   403
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   404
	foreach (@BldList) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   405
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   406
		if($kernelOption == 0)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   407
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   408
			if (/DEB$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   409
				$CCUDEB .= " ".$configdata{EXCEPTIONS};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   410
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   411
			else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   412
				$CCUREL .= " ".$configdata{EXCEPTIONS};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   413
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   414
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   415
		#collect the options and macro's depending on the whether it is a UREL or UDEB		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   416
		my @ml = &main::MacroList($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   417
		if (/DEB$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   418
			$CCUDEB .= " ".$CCFLAGS;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   419
			$CCUDEB .= printlist("-D", @ml);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   420
			$CCUDEB .= " ".$CCDEFS;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   421
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   422
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   423
			$CCUREL .= " ".$CCFLAGS;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   424
			$CCUREL .= printlist("-D", @ml);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   425
			$CCUREL .= " ".$CCDEFS;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   426
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   427
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   428
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   429
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   430
sub ComputeCompilerOpts() {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   431
	my %plat = &main::PlatRec();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   432
	my $ABI=&main::ABI;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   433
	my $TrgType=&main::TrgType;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   434
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   435
	if (SysTrg()) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   436
	        $contingentOptions = $kernelOptions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   437
        } elsif (main::BuildAsARM() or ($ABI eq 'ARMV4')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   438
	        $contingentOptions = $armOptions.$floatingpoint.$exceptions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   439
	    } else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   440
			$contingentOptions = $thumbOptions.$floatingpoint.$exceptions.' -D__MARM_THUMB__';	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   441
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   442
	# change support for ARMV4
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   443
	if ($ABI eq 'ARMV4') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   444
		$invopts =~ s/5T/4/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   445
		$invopts =~ s/inter/nointer/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   446
	} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   447
		$contingentOptions .= ' -D__MARM_INTERWORK__';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   448
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   449
	$CCFLAGS = $commonOptions.' '.$contingentOptions.' '.$invopts.' -c '.' '.&main::CompilerOption("ARMCC");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   450
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   451
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   452
sub GetMajorVersion ($)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   453
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   454
	my ($versionString) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   455
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   456
	if ($versionString =~ /^\d\.\d\.\d$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   457
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   458
		$versionString =~ s/\.\d$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   459
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   460
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   461
	return $versionString;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   462
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   463
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   464
sub GetMinorVersion ($)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   465
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   466
	my ($versionString) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   467
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   468
	if ($versionString =~ /^\d\.\d\.\d$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   469
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   470
		$versionString =~ s/^\d\.\d\.//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   471
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   472
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   473
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   474
		$versionString = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   475
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   476
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   477
	return $versionString;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   478
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   479
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   480
sub PMCheckPlatformL {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   481
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   482
	# check version of CodeWarrior for Symbian OS
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   483
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   484
	my @compatibleCWInstallations;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   485
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   486
	$CW_major_version = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   487
	$CW_minor_version = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   488
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   489
	my $minimumMajorVersion = GetMajorVersion ($CW_minimum_supported_version);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   490
	my $minimumMinorVersion = GetMinorVersion ($CW_minimum_supported_version);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   491
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   492
	if (defined $ENV{CW_SYMBIAN_VERSION})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   493
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   494
		# CW_SYMBIAN_VERSION is set - either MAKMAKE is being executed by an IDE's .mmp Importer,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   495
		# or the user is specifying a specific CW version to target from the command line.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   496
		# Either way, we've been given a single version to target, so we attempt to do just that.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   497
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   498
		$CW_major_version = GetMajorVersion ($ENV{CW_SYMBIAN_VERSION});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   499
		$CW_minor_version = GetMinorVersion ($ENV{CW_SYMBIAN_VERSION});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   500
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   501
		push @compatibleCWInstallations, $ENV{CW_SYMBIAN_VERSION};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   502
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   503
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   504
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   505
		# CW_SYMBIAN_VERSION isn't set - either MAKMAKE is being executed by a pre-OEM3.0 IDE .mmp
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   506
		# Importer or from the command line.  Either way, we delve into the registry and attempt to
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   507
		# target the latest CW for Symbian OS installed, recording all CW for Symbian OS installations
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   508
		# too.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   509
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   510
		my $regKeyHandle;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   511
		my $topLevelKey = HKEY_LOCAL_MACHINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   512
		my $productVersionKey = 'SOFTWARE\\Metrowerks\\CodeWarrior\\Product Versions';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   513
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   514
		if (!RegOpenKeyEx($topLevelKey, $productVersionKey, 0, KEY_READ, $regKeyHandle))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   515
			{		    		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   516
			die "Can't read \"HKEY_LOCAL_MACHINE\\$productVersionKey\" : ", regLastError(), "\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   517
		    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   518
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   519
		my $subKeyIndex = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   520
		my $subKeySize = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   521
		my $subKeyName;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   522
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   523
		my @installedCWForSymbianKeys;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   524
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   525
		while (RegEnumKeyEx($regKeyHandle, $subKeyIndex, $subKeyName, $subKeySize, [], [], [], []))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   526
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   527
			push (@installedCWForSymbianKeys, $productVersionKey."\\".$subKeyName) unless ($subKeyName !~ /Symbian/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   528
			$subKeyIndex++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   529
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   530
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   531
		RegCloseKey($regKeyHandle) || print STDERR "WARNING: Could not close registry key.";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   532
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   533
		my $versionType;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   534
		my $versionValue;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   535
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   536
		foreach my $installedCWForSymbianKey (@installedCWForSymbianKeys)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   537
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   538
			if (!RegOpenKeyEx($topLevelKey, $installedCWForSymbianKey, 0, KEY_READ, $regKeyHandle))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   539
				{		    		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   540
				die "Can't read \"HKEY_LOCAL_MACHINE\\$installedCWForSymbianKey\" : ", regLastError(), "\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   541
			    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   542
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   543
			if (!RegQueryValueEx($regKeyHandle, "VERSION", [], $versionType, $versionValue, []))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   544
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   545
				die "Can't read \"HKEY_LOCAL_MACHINE\\$installedCWForSymbianKey\\VERSION\" : ", regLastError(), "\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   546
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   547
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   548
			my $temp_major_version = GetMajorVersion ($versionValue);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   549
			my $temp_minor_version = GetMinorVersion ($versionValue);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   550
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   551
			if (($temp_major_version > $CW_major_version) ||
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   552
				(($temp_minor_version > $CW_minor_version) &&
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   553
				   ($temp_major_version >= $CW_major_version)))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   554
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   555
				$CW_major_version = $temp_major_version;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   556
				$CW_minor_version = $temp_minor_version;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   557
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   558
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   559
			if (($temp_major_version > $minimumMajorVersion) ||
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   560
				(($temp_minor_version > $minimumMinorVersion) &&
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   561
				   ($temp_major_version >= $minimumMajorVersion)))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   562
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   563
				push @compatibleCWInstallations, $versionValue;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   564
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   565
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   566
			RegCloseKey($regKeyHandle);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   567
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   568
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   569
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   570
	# We've determined a CW version to target, now we validate if we actually support this
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   571
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   572
	if (!$CW_major_version ||
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   573
		($CW_major_version < $minimumMajorVersion) ||
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   574
		(($CW_major_version >= $minimumMajorVersion) && ($CW_minor_version < $minimumMinorVersion)))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   575
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   576
		if (defined $ENV{CW_SYMBIAN_VERSION})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   577
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   578
			die "Error: CW_SYMBIAN_VERSION is set to $ENV{CW_SYMBIAN_VERSION}.\n       The minimum version supported by these tools is $CW_minimum_supported_version.\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   579
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   580
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   581
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   582
			die "ERROR: Unable to identify a compatible CodeWarrior for Symbian OS installation.\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   583
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   584
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   585
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   586
	if (@compatibleCWInstallations > 1)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   587
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   588
		my $targetVersion = $CW_major_version;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   589
		$targetVersion .= ".$CW_minor_version" if $CW_minor_version;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   590
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   591
		print ("Info: More than one compatible CodeWarrior for Symbian OS installation has been detected.\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   592
		print ("      The generated project will target $targetVersion - to override this, set the CW_SYMBIAN_VERSION\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   593
		print ("      environment variable to the version number you wish to target and re-run this command.\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   594
		print ("      Supported version numbers detected : @compatibleCWInstallations.\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   595
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   596
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   597
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   598
		print ("Info: Detected CodeWarrior Version Major=$CW_major_version Minor=$CW_minor_version\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   599
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   600
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   601
	# CW version has been validated, tailor generated projects on this basis
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   602
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   603
	$CW_libpath = 'Symbian_Support\Win32-x86 Support\Libraries\Win32 SDK';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   604
 	push @CW_librarypath,$CW_libpath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   605
 	# Lib path to support the Carbide runtime libraries
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   606
 	$CW_libpath = 'Symbian_Support\Runtime\Runtime_x86\Runtime_Win32\Libs';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   607
 	push @CW_librarypath,$CW_libpath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   608
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   609
	if ($CW_major_version == 2.8)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   610
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   611
		$projectTemplate = "CW_project_template_v3.xml";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   612
		$linkDescriptorTemplate = "cw_link_descriptor_template.cwlink";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   613
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   614
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   615
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   616
		$projectTemplate = "CW_project_template_v4.xml";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   617
		$linkDescriptorTemplate = "cw_link_descriptor_template_v2.cwlink";		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   618
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   619
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   620
	$xmlParser = new XML::DOM::Parser; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   621
	$xmlProjectDoc = $xmlParser->parsefile ($FindBin::Bin."\\$projectTemplate");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   622
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   623
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   624
# Check if a platform is a customization
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   625
sub IsCustomization($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   626
	my ($plat) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   627
	return 1 if (Plat_Customizes($plat));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   628
	return 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   629
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   630
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   631
sub PMPlatProcessMmp (@) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   632
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   633
	my $currentPlat=&main::Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   634
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   635
	return if ($processedPlatforms{$currentPlat});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   636
	$processedPlatforms{$currentPlat}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   637
	@ToolChainLibList = &GetLibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   638
	my $TrgType=&main::TrgType;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   639
	if ($CustPlat{'CUSTOMIZES'} && ($CustPlat{'ROOTPLATNAME'} eq "GCCE"))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   640
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   641
		$CustGCCE=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   642
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   643
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   644
	if ($currentPlat =~ /^WINSCW$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   645
		{	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   646
		my $includes = $ENV{MWCWinx86Includes};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   647
		&Winutl_DoMmp_Parse(\@_, $includes);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   648
		@Win32LibList=&Winutl_Win32LibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   649
		$Win32Resrc=&Winutl_Win32Resrc;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   650
		$Win32StdHeaders=&Winutl_Win32StdHeaders;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   651
		$BaseAddress=&Winutl_BaseAddress unless ($TrgType eq 'EXE');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   652
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   653
	elsif ($currentPlat =~ /^ARMV5/ || IsCustomization($currentPlat))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   654
		{	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   655
		&Armutl_DoMmp(@_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   656
		$ArmIncDir = &Armutl_ArmIncDir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   657
		&main::SetStdIncPaths($ArmIncDir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   658
		@ArmLibList = &Armutl_ArmLibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   659
		$ArmRT = &Armutl_ArmRT;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   660
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   661
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   662
	my $BaseTrg=&main::BaseTrg;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   663
	my $MakeFilePath=&main::MakeFilePath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   664
	$MmpFile=&main::MmpFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   665
	$VariantFile=&main::VariantFile();		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   666
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   667
	# Set up the list of known roots
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   668
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   669
	my $epocroot=&main::Path_Drive . &main::EPOCPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   670
	$epocroot =~ s/EPOC32\\$//i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   671
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   672
	if ($currentPlat eq "GCCE" || $CustGCCE)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   673
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   674
		$PrefixFile=$epocroot.'epoc32\\include\\gcce\\gcce.h';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   675
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   676
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   677
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   678
		$PrefixFile=$epocroot.'epoc32\\include\\rvct'.$RVCTVersion.'\\rvct'.$RVCTVersion.'.h';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   679
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   680
	my $mmproot = &main::Path_Drive . &main::Path_Split('Path',$MmpFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   681
	my $mmprootname = "MMPDir";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   682
	my $mmpisglobal = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   683
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   684
	if (defined $ENV{CW_ROOT_NAME})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   685
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   686
		# generate KnownRoots suitable for the IDE MMP importer
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   687
		# This has a global source tree for EPOCROOT, and puts the
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   688
		# project next to the MMP file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   689
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   690
		addKnownRoot($ENV{CW_ROOT_NAME}, 1, $epocroot, "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   691
		$mmprootname = "Project";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   692
		$mmpisglobal = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   693
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   694
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   695
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   696
		# generate KnownRoots suitable for command-line generated XML files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   697
		# We will add a user source tree for MMPDir and EPOCROOT, but can't use
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   698
		# EPOCROOT for the OutputDirectory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   699
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   700
		addKnownRoot("EPOCROOT", 0, $epocroot, "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   701
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   702
	addKnownRoot($mmprootname, $mmpisglobal, $mmproot, "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   703
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   704
	# Allow for MMP files in component subdirectories by matching multiple levels
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   705
	# up to get {MMPDir}..\whatever paths. Stop one level down from the root,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   706
	# since "everything on this drive" seems a bit extreme
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   707
	#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   708
	my $tmppath = $mmproot;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   709
	my $dotdots = '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   710
	while ($tmppath =~ /^(.:.+\\)[^\\]+\\$/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   711
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   712
		$tmppath = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   713
		$dotdots .= "..\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   714
		addKnownRoot($mmprootname, $mmpisglobal, $tmppath, $dotdots);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   715
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   716
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   717
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   718
sub findTarget($$$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   719
	my ($name,$platbld,$abibld) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   720
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   721
	my @targets = $xmlProjectDoc->getElementsByTagName("TARGET",1); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   722
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   723
	foreach my $target (@targets)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   724
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   725
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   726
		my $element = $target->getElementsByTagName("NAME",0)->item(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   727
		$element = $element->getFirstChild;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   728
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   729
	#   here we want to get the plat build that is specified in the cw project tempalte
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   730
	#   and not the abi build - there are more platbuilds than abibuilds so other targets
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   731
	#   (e.g. GCCE) can get the wrong tempalte "NAME" (i.e. it will be ARMV5 rather than GCCE, which is not want we want)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   732
		if ($element->getData() =~ /$platbld$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   733
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   734
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   735
			my $newtarget=$target->cloneNode(1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   736
			$target->getParentNode()->appendChild($newtarget);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   737
			$element = $newtarget->getElementsByTagName("NAME",0)->item(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   738
			$element = $element->getFirstChild;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   739
			$element->setData("$platbld");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   740
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   741
			# remember name as an attribute: this is removed before
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   742
			# writing out the project.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   743
			$newtarget->setAttribute("NAME", "$platbld");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   744
			return $newtarget;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   745
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   746
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   747
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   748
				my $newtarget=$target->cloneNode(1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   749
				my $newplat=&main::Plat." ".&main::Bld;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   750
				$target->getParentNode()->appendChild($newtarget);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   751
				$element = $newtarget->getElementsByTagName("NAME",0)->item(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   752
				$element = $element->getFirstChild;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   753
				$element->setData("$newplat");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   754
	 			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   755
				# remember name as an attribute: this is removed before
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   756
				# writing out the project.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   757
				$newtarget->setAttribute("NAME", "$newplat");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   758
				return $newtarget;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   759
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   760
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   761
	return undef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   762
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   763
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   764
sub newList($$$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   765
	my ($target, $tag, $replace) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   766
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   767
	my $newlist = new XML::DOM::Element($xmlProjectDoc,$tag);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   768
	if ($replace==1)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   769
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   770
		my $elements = $target->getElementsByTagName($tag,0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   771
		my $element = $elements->item(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   772
		$target->replaceChild($newlist, $element);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   773
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   774
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   775
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   776
		$target->appendChild($newlist);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   777
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   778
	return $newlist;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   779
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   780
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   781
sub changeValue($$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   782
	my ($setting, $replacement) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   783
	my $value = $setting->getElementsByTagName("VALUE",0)->item(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   784
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   785
	if (defined $value)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   786
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   787
		if ($value->hasChildNodes)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   788
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   789
			$value->getFirstChild->setData($replacement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   790
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   791
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   792
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   793
			$value->addText($replacement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   794
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   795
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   796
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   797
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   798
sub textSetting($$$$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   799
	my ($element,$name,$value,$insertionpoint)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   800
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   801
	my $setting = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   802
	&textElement($setting, "NAME", $name);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   803
	&textElement($setting, "VALUE", $value);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   804
	$element->insertBefore($setting, $insertionpoint);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   805
	$element->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   806
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   807
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   808
sub addKnownRoot($$$$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   809
	my ($rootname, $global, $rootpath, $pathprefix) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   810
	$rootpath=&main::Path_Chop($rootpath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   811
	push @KnownRoots, [$rootname, $global, quotemeta($rootpath), $pathprefix];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   812
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   813
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   814
sub addRootedPath($$$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   815
	my ($setting,$needglobal,$path) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   816
	my $root = "Absolute";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   817
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   818
	if ($path =~ /^\\/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   819
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   820
		$path = &main::Path_Drive . $path;	# ensure it has a drive letter
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   821
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   822
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   823
	foreach (@KnownRoots)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   824
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   825
		my ($rootname, $global, $rootpath, $pathprefix) = @{$_};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   826
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   827
		next if ($needglobal && !$global);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   828
		if ($path =~ /^$rootpath\\/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   829
			{			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   830
			$path =~ s/^$rootpath\\/$pathprefix/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   831
			$root = $rootname;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   832
			last;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   833
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   834
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   835
	$path=&main::Path_Chop($path);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   836
	if ($root eq "Absolute" && $path =~ /^(.:)$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   837
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   838
		$path .= "\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   839
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   840
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   841
	&textSetting($setting, "Path", $path);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   842
	&textSetting($setting, "PathFormat", "Windows");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   843
	&textSetting($setting, "PathRoot", $root);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   844
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   845
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   846
sub changePathSetting($$$) {	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   847
	my ($setting,$global,$value) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   848
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   849
	my @oldstuff = $setting->getElementsByTagName("SETTING",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   850
	foreach my $old (@oldstuff)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   851
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   852
		&removeNode($old);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   853
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   854
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   855
	&addRootedPath($setting,$global,$value);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   856
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   857
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   858
sub addSourceTrees($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   859
	my ($node) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   860
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   861
	my $element = $node->getElementsByTagName("VALUE",0)->item(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   862
	&removeNode($element) if (defined $element);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   863
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   864
	if (defined $ENV{CW_ROOT_NAME})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   865
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   866
		return;	# paths were converted to be relative to global source trees
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   867
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   868
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   869
	my $sourcepath = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   870
	$sourcepath->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   871
	&textSetting($sourcepath, "Name", "EPOCROOT");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   872
	&textSetting($sourcepath, "Kind", "AbsolutePath");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   873
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   874
	my $pathdata = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   875
	&textElement($pathdata, "NAME", "Path"); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   876
	$pathdata->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   877
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   878
	my $epocroot=&main::EPOCPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   879
	$epocroot =~ s/\\EPOC32\\$/\\/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   880
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   881
	&addRootedPath($pathdata, 1, $epocroot);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   882
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   883
	$sourcepath->appendChild($pathdata);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   884
	$node->appendChild($sourcepath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   885
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   886
	my $mmproot = &main::Path_Split('Path',$MmpFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   887
	my $sourcepath2 = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   888
	$sourcepath2->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   889
	&textSetting($sourcepath2, "Name", "MMPDir");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   890
	&textSetting($sourcepath2, "Kind", "AbsolutePath");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   891
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   892
	my $pathdata2 = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   893
	&textElement($pathdata2, "NAME", "Path"); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   894
	$pathdata2->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   895
	&addRootedPath($pathdata2, 1, $mmproot);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   896
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   897
	$sourcepath2->appendChild($pathdata2);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   898
	$node->appendChild($sourcepath2);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   899
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   900
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   901
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   902
sub addUserSearchPaths($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   903
	my ($node) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   904
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   905
	my @elements = $node->getElementsByTagName("SETTING",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   906
	foreach (@elements)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   907
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   908
		&removeNode($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   909
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   910
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   911
	my %ordereddirs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   912
	my @ordereddirlist=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   913
	foreach my $dir (&main::UserIncPaths)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   914
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   915
		next if (!defined $dir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   916
		$dir = &main::Path_Chop($dir)."\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   917
		my $key = uc $dir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   918
		if (! defined($ordereddirs{$key}))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   919
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   920
			$ordereddirs{$key}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   921
			push @ordereddirlist, $dir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   922
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   923
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   924
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   925
	# now add the directories used to find source files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   926
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   927
	my %dirs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   928
	my $SourceStructRef=&main::SourceStructRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   929
	foreach my $SourceRef (@$SourceStructRef)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   930
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   931
		 $dirs{$$SourceRef{SrcPath}}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   932
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   933
	my $DefFile = &main::DefFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   934
	if ($DefFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   935
		{			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   936
		$DefFile = &main::Path_Split('Path',$DefFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   937
		$dirs{$DefFile}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   938
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   939
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   940
	my $MmpFilePath = &main::Path_Split('Path',$MmpFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   941
	$dirs{$MmpFilePath}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   942
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   943
	$dirs{$ExtraFilesPath}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   944
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   945
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   946
	foreach my $srcdir (sort keys %dirs)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   947
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   948
		if (!defined($ordereddirs{uc $srcdir}))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   949
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   950
			push @ordereddirlist, $srcdir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   951
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   952
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   953
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   954
	foreach my $srcdir (@ordereddirlist)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   955
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   956
		my $accesspath = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   957
		$accesspath->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   958
		my $pathdata = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   959
		&textElement($pathdata, "NAME", "SearchPath"); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   960
		$pathdata->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   961
		&addRootedPath($pathdata, 0, $srcdir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   962
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   963
		$accesspath->appendChild($pathdata);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   964
		&textSetting($accesspath, "Recursive", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   965
		&textSetting($accesspath, "FrameworkPath", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   966
		&textSetting($accesspath, "HostFlags", "All");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   967
		$node->appendChild($accesspath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   968
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   969
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   970
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   971
sub addSystemSearchPaths($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   972
	my ($node) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   973
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   974
	my @elements = $node->getElementsByTagName("SETTING",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   975
	foreach (@elements)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   976
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   977
		&removeNode($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   978
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   979
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   980
	my $ASSPLinkPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   981
	$ASSPLinkPath = &main::ASSPLinkPath if (&main::ASSPLibList);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   982
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   983
	my @extraIncPaths=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   984
	push @extraIncPaths, $ArmIncDir if $ArmIncDir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   985
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   986
	my %ordereddirs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   987
	my @ordereddirlist=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   988
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   989
	foreach my $dir (&main::SysIncPaths, @extraIncPaths, &main::StatLinkPath, $ASSPLinkPath, &main::LinkPath)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   990
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   991
		next if (!defined $dir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   992
		$dir = &main::Path_Chop($dir)."\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   993
		my $key = uc $dir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   994
		if (! defined($ordereddirs{$key}))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   995
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   996
			$ordereddirs{$key}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   997
			push @ordereddirlist, $dir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   998
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   999
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1000
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1001
	my %dirs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1002
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1003
	if ($VariantFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1004
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1005
		my $VariantFilePath = &main::Path_Split('Path',$VariantFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1006
		$dirs{$VariantFilePath}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1007
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1008
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1009
	if (((&main::Plat =~ /^ARMV5/) || (&main::Plat =~ /^GCCE$/) ||(IsCustomization(&main::Plat))) && $PrefixFile) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1010
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1011
		my $PrefixFilePath = &main::Path_Split('Path',$PrefixFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1012
		$dirs{$PrefixFilePath}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1013
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1014
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1015
	foreach my $srcdir (sort keys %dirs)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1016
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1017
		if (!defined($ordereddirs{uc $srcdir}))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1018
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1019
			push @ordereddirlist, $srcdir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1020
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1021
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1022
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1023
	foreach my $srcdir (@ordereddirlist)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1024
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1025
		my $accesspath = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1026
		$accesspath->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1027
		my $pathdata = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1028
		&textElement($pathdata, "NAME", "SearchPath"); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1029
		$pathdata->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1030
		&addRootedPath($pathdata, 0, $srcdir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1031
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1032
		$accesspath->appendChild($pathdata);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1033
		&textSetting($accesspath, "Recursive", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1034
		&textSetting($accesspath, "FrameworkPath", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1035
		&textSetting($accesspath, "HostFlags", "All");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1036
		$node->appendChild($accesspath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1037
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1038
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1039
	if (&main::Plat =~ /^WINSCW$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1040
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1041
 		my $lpath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1042
 		foreach $lpath (@CW_librarypath)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1043
 		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1044
 			# only add Win32 SDK for WINSCW system access paths	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1045
 			my $accesspath = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1046
 			$accesspath->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1047
 			my $pathdata = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1048
 			&textElement($pathdata, "NAME", "SearchPath"); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1049
 			$pathdata->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1050
 			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1051
 			&textSetting($pathdata, "Path", $lpath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1052
 			&textSetting($pathdata, "PathFormat", "Windows");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1053
 			&textSetting($pathdata, "PathRoot", "CodeWarrior");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1054
 			$accesspath->appendChild($pathdata);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1055
 			&textSetting($accesspath, "Recursive", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1056
 			&textSetting($accesspath, "FrameworkPath", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1057
 			&textSetting($accesspath, "HostFlags", "All");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1058
 			$node->appendChild($accesspath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1059
 		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1060
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1061
	if ($CustPlat{'CUSTOMIZES'} && ($CustPlat{'ROOTPLATNAME'} eq "GCCE"))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1062
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1063
		$CustGCCE=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1064
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1065
	if (&main::Plat =~ /^GCCE$/ || $CustGCCE)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1066
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1067
		my $accesspath = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1068
		$accesspath->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1069
		my $pathdata = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1070
		&textElement($pathdata, "NAME", "SearchPath"); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1071
		$pathdata->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1072
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1073
		my $GCCE_IncludePath = GetGCCELibPath("-print-libgcc-file-name");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1074
		$GCCE_IncludePath .= '\\include';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1075
		&textSetting($pathdata, "Path", $GCCE_IncludePath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1076
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1077
		&textSetting($pathdata, "PathFormat", "Windows");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1078
		&textSetting($pathdata, "PathRoot", "Absolute");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1079
		$accesspath->appendChild($pathdata);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1080
		&textSetting($accesspath, "Recursive", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1081
		&textSetting($accesspath, "FrameworkPath", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1082
		&textSetting($accesspath, "HostFlags", "All");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1083
		$node->appendChild($accesspath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1084
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1085
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1086
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1087
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1088
sub addDownloadFileList($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1089
	my ($node, @DownloadList) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1090
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1091
	my @elements = $node->getElementsByTagName("SETTING",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1092
	foreach (@elements)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1093
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1094
		&removeNode($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1095
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1096
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1097
	my $epocdata = &main::EPOCPath . "data\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1098
	foreach my $srcfile (@DownloadList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1099
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1100
		my $targetpath = $srcfile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1101
		$targetpath =~ s/^Z\\/C:\\/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1102
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1103
		my $download = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1104
		$download->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1105
		my $pathdata = new XML::DOM::Element($xmlProjectDoc,"SETTING");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1106
		&textElement($pathdata, "NAME", "HostFilePath"); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1107
		$pathdata->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1108
		&addRootedPath($pathdata, 0, "$epocdata$srcfile");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1109
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1110
		$download->appendChild($pathdata);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1111
		&textSetting($download, "TargetFilePath", $targetpath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1112
		$node->appendChild($download);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1113
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1114
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1115
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1116
sub kitRelativePath ($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1117
	my ($kitRootBasedPath) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1118
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1119
	my $kitRoot = &main::EPOCPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1120
	$kitRoot =~ s/EPOC32\\$//i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1121
	$kitRoot = quotemeta (&main::Path_Chop($kitRoot));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1122
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1123
	$kitRootBasedPath =~ s/^$kitRoot//i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1124
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1125
	$kitRootBasedPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1126
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1127
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1128
sub PMBld() {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1129
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1130
	my %changedsettings;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1131
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1132
	my $ABI=&main::ABI;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1133
	my $Bld=&main::Bld;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1134
	my $Plat=&main::Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1135
	my $BaseName=&main::BaseMak;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1136
	my @SrcList=&main::SrcList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1137
	my $BaseTrg=&main::BaseTrg;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1138
	my @BldList=&main::BldList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1139
	my $DefFile=&main::DefFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1140
	my $FirstLib=&main::FirstLib;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1141
	# IsCustomDllUseCase() subroutine is called to check if the given executable 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1142
	# is a custom dll or not.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1143
	my $IsCustomDll = Cl_bpabi::IsCustomDllUseCase();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1144
	# ABI flags set depending on the ENABLE_ABIV2_MODE macro set in the variant file.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1145
	my $ABIV1 = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1146
	my $ABIV2 = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1147
	if (($Plat eq "ARMV5_ABIV1" && $cfgMacro) || ($Plat eq "ARMV5" && !$cfgMacro)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1148
	|| ($CustPlat{'CUSTOMIZES'} 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1149
	&& (($CustPlat{'ROOTPLATNAME'} eq "ARMV5_ABIV1" && $cfgMacro) || ($CustPlat{'ROOTPLATNAME'} eq "ARMV5" && !$cfgMacro))))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1150
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1151
		$ABIV1=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1152
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1153
	elsif (($Plat eq "ARMV5_ABIV2" && !$cfgMacro) || ($Plat eq "ARMV5" && $cfgMacro)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1154
	|| ($CustPlat{'CUSTOMIZES'} 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1155
	&& (($CustPlat{'ROOTPLATNAME'} eq "ARMV5_ABIV2" && !$cfgMacro) || ($CustPlat{'ROOTPLATNAME'} eq "ARMV5" && $cfgMacro))))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1156
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1157
		$ABIV2=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1158
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1159
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1160
	if ($CustPlat{'CUSTOMIZES'} && ($CustPlat{'ROOTPLATNAME'} eq "GCCE"))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1161
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1162
		$CustGCCE=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1163
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1164
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1165
 	if ($ABIV1 && ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1166
	        # Temporary Workaround for RVCT2.1 static libs problem with RVCT2.2 builds
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1167
		# Rename FirstLib.lib static lib used with RVCT2.1 as FirstLib2_1.lib
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1168
		if ($FirstLib=~/^\s*(\S+)(\.lib)$/io) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1169
		        if ($1!~/$RVCTVersion/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1170
				$FirstLib=$1.$RVCTVersion.".lib";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1171
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1172
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1173
	}	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1174
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1175
	my $BasicTrgType=&main::BasicTrgType;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1176
	my @LibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1177
	my @StatLibList=&main::StatLibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1178
	if ($ABIV1 && ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1179
	        # Temporary Workaround for RVCT2.1 static libs problem with RVCT2.2 builds
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1180
		# Rename all the static libs used with RVCT2.1 as libname2_1.lib
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1181
		for (my $i =0; $i < scalar(@StatLibList); $i++) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1182
		        if ($StatLibList[$i]=~/^\s*(\S+)(\.lib)$/io) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1183
			        if ($1!~/$RVCTVersion/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1184
				        $StatLibList[$i]=$1.$RVCTVersion.".lib";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1185
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1186
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1187
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1188
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1189
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1190
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1191
	my @ASSPLibList = &main::ASSPLibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1192
	my $Trg=&main::Trg;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1193
	if ($ABIV1 && ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1194
		if ($BasicTrgType=~/^LIB$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1195
			# Temporary Workaround for RVCT2.1 static libs problem with RVCT2.2 builds
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1196
			# Rename all the static libs produced with RVCT2.1 as {libname}2_1.lib
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1197
		        if ($Trg=~/^\s*(\S+)(\.lib)$/io) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1198
			        if ($1!~/$RVCTVersion/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1199
				        $Trg=$1.$RVCTVersion.".lib";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1200
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1201
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1202
			if ($BaseTrg!~/$RVCTVersion/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1203
			        $BaseTrg .= $RVCTVersion;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1204
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1205
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1206
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1207
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1208
	my $TrgPath=&main::TrgPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1209
	my $TrgType=&main::TrgType;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1210
	my $epocroot=&main::Path_Drive . &main::EPOCPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1211
	$epocroot =~ s/EPOC32\\$//i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1212
	my $UIDFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1213
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1214
	$ExtraFilesPath = &main::MakeFilePath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1215
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1216
	if ($Bld =~ /DEB/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1217
		@LibList=&main::DebugLibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1218
	} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1219
		@LibList=&main::LibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1220
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1221
	my $xmlTarget;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1222
	if ($ABI =~ /BPABI/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1223
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1224
		$ABI = "GCCE";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1225
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1226
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1227
	if ($Plat eq "GCCE" || $CustGCCE || $ABIV2) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1228
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1229
		if ($CW_major_version < 3.1) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1230
			die "FATAL ERROR: Target $Plat requires CodeWarrior for Symbian release 3.1 at minimum.\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1231
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1232
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1233
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1234
	if ($ABIV2 && ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1235
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1236
		die "FATAL ERROR: Target ARMV5_ABIV2 requires RVCT version 2.2 and greater. Detected RVCT $RVCTMajorVersion.$RVCTMinorVersion.\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1237
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1238
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1239
	if (($RVCTMajorVersion == 2 && $RVCTMinorVersion >= 2) && $CW_major_version < 3.1 && $ABIV2)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1240
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1241
		die "FATAL ERROR: Detected RVCT Version $RVCTMajorVersion.$RVCTMinorVersion and CodeWarrior version $CW_major_version. RVCT 2.2 and greater requies CodeWarrior version 3.1 at minimum.\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1242
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1243
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1244
    $xmlTarget = findTarget($BaseName, "$Plat $Bld", "$ABI $Bld");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1245
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1246
	return if (!defined($xmlTarget));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1247
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1248
	my $targetname = $xmlTarget->getAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1249
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1250
	my $UnderlyingABI=PMUnderlyingABI($ABI);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1251
	my @ChopRTWSysIncPaths=&main::Path_Chop(&main::Path_RltToWork(&main::SysIncPaths));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1252
	my @ChopRTWUserIncPaths=&main::Path_Chop(&main::Path_RltToWork(&main::UserIncPaths));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1253
	my $EPOCPath=&main::EPOCPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1254
	my $LinkAs=&main::LinkAs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1255
	my $LibPath=&main::LibPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1256
	my @UidList=&main::UidList;	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1257
	my $WarningLevelGCC=&main::CompilerOption("GCC");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1258
	my $ExportLibrary=&main::ExportLibrary;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1259
	my $NoExportLibrary=&main::NoExportLibrary;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1260
	my $SystemTrg = SystemTarget();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1261
	my %Version = &main::Version();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1262
	my $ExtraExportLibrary;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1263
	my $PrimaryExportLibrary = $ExportLibrary;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1264
	unless ($Version{explicit}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1265
		$ExtraExportLibrary = $ExportLibrary;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1266
		$ExtraExportLibrary =~ s/\{(\d|a|b|c|d|e|f){8}\}//i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1267
		$PrimaryExportLibrary = $ExtraExportLibrary;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1268
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1269
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1270
	my $ChopBldPath=&main::Path_Chop(&main::BldPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1271
	my $EPOCIncPath=&main::EPOCIncPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1272
	my $ChopRelPath=&main::Path_Chop(&main::RelPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1273
	my $RelPath=&main::RelPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1274
	my $StatLinkPath=&main::StatLinkPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1275
	my $ParentPlat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1276
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1277
# 	Check if a platform is customization, if yes find the parent platform.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1278
	my $IsPlatCustomization=IsCustomization($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1279
	if ($IsPlatCustomization) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1280
		$ParentPlat = Plat_Customizes($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1281
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1282
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1283
	my @RTLibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1284
	if ($ABIV1) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1285
	    @RTLibList = ('dfpaeabi.lib', "dfprvct${RVCTVersion}.lib", 'drtaeabi.lib', 'drtaeabi.lib(VtblExports.o)');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1286
	    if ($RVCTMajorVersion == 2 && $RVCTMinorVersion >= 2) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1287
		# The scppnwdl.lib should come before drtrvct2_2.lib
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1288
		push @RTLibList, "scppnwdl.lib";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1289
		push @RTLibList, "drtrvct${RVCTVersion}.lib";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1290
	    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1291
	    else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1292
	    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1293
		push @RTLibList, "dfprvct${RVCTVersion}-thunk.lib";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1294
		push @RTLibList, "drtrvct${RVCTVersion}.lib";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1295
	    }    
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1296
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1297
	elsif ($ABIV2)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1298
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1299
		@RTLibList = ('drtaeabi.dso', 'dfpaeabi.dso', "dfprvct${RVCTVersion}.dso");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1300
	    if ($RVCTMajorVersion == 2 && $RVCTMinorVersion >= 2) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1301
		# The scppnwdl.lib should come before drtrvct2_2.lib
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1302
		push @RTLibList, "scppnwdl.dso";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1303
		push @RTLibList, "drtrvct${RVCTVersion}.dso";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1304
	    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1305
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1306
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1307
	my @compatibleDOCUMENTExtensions = ("cfg", "h", "hrh", "iby", "inf", "ini", "loc", "mmpi", "policy", "ra", "rh", "rls", "rss", "script", "txt");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1308
	my @DocList = &main::DocList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1309
	@addedFiles=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1310
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1311
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1312
#	set up LinkAs
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1313
	$UidList[2]=~/^0x(.*)$/o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1314
	if ($1 ne '00000000') { # have to make sure than series of noughts in brackets doesn't appear in name for null uids
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1315
		$LinkAs=join '', &main::Path_Split('Base',$LinkAs),"[$1]",&main::Path_Split('Ext',$LinkAs);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1316
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1317
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1318
#	set up dlltool flag hash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1319
	my %ABIDlltool=(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1320
		ARMI=>'-m arm_interwork',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1321
		ARM4=>'-m arm',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1322
		THUMB=>'-m thumb'
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1323
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1324
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1325
#	work out the flags for various platforms
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1326
	if ($ABI eq 'ARMI') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1327
		$PlatOpt{Gcc}='-march=armv4t -mthumb-interwork';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1328
		$PlatOpt{Dlltool}=$ABIDlltool{ARMI};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1329
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1330
	elsif ($ABI eq 'ARM4T') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1331
		if (&main::BuildAsARM) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1332
			$PlatOpt{Gcc}='-march=armv4t -mthumb-interwork';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1333
			$PlatOpt{Dlltool}=$ABIDlltool{ARMI};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1334
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1335
		elsif ($SystemTrg) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1336
			$PlatOpt{Gcc}='-march=armv4';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1337
#			allow thumb for ARM4 ABI where necessary
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1338
			unless (&main::PlatABI eq 'ARM4') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1339
				$PlatOpt{Gcc}.='t';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1340
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1341
			$PlatOpt{Dlltool}=$ABIDlltool{ARM4};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1342
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1343
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1344
			$PlatOpt{Gcc}='-mthumb-interwork -D__MARM_THUMB__';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1345
			$PlatOpt{Dlltool}=$ABIDlltool{THUMB};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1346
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1347
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1348
	elsif ($ABI eq 'ARM4') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1349
		$PlatOpt{Gcc}='-march=armv4';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1350
#		allow thumb for ARM4 ABI where necessary
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1351
		unless (&main::PlatABI eq 'ARM4') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1352
			$PlatOpt{Gcc}.='t';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1353
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1354
		$PlatOpt{Dlltool}=$ABIDlltool{ARM4};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1355
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1356
	elsif ($ABI eq 'THUMB') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1357
		$PlatOpt{Gcc}='-mthumb-interwork';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1358
		$PlatOpt{Dlltool}=$ABIDlltool{THUMB};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1359
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1360
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1361
	elsif ($Plat ne 'WINSCW' && $Plat ne 'ARMV5' && !$IsPlatCustomization && $Plat ne 'GCCE' && $Plat ne 'ARMV5_ABIV2' && $Plat ne 'ARMV5_ABIV1') { 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1362
		&main::FatalError("Platform module - ABI \"$ABI\" unrecognised");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1363
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1364
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1365
	if ($Plat ne 'WINSCW') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1366
		@CompatibleABIs=@{$CompatibleABIs{$UnderlyingABI}};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1367
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1368
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1369
#	set up CompatibleABI lib path hash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1370
	foreach (@CompatibleABIs) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1371
		$ABILibPath{$_}=&main::Path_Strip("$LibPath..\\..\\$_\\");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1372
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1373
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1374
	$Dlltool=$ToolPrefix.'dlltool.exe';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1375
	$Archive=$ToolPrefix.'ar.exe';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1376
	$Link=$ToolPrefix.'ld.exe';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1377
	$Objcopy=$ToolPrefix.'objcopy.exe';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1378
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1379
	my $WarningLevelCW=&main::CompilerOption("CW");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1380
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1381
	$xmlFileList = newList($xmlTarget,"FILELIST",1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1382
	$xmlFileList->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1383
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1384
	$xmlLinkOrder = newList($xmlTarget,"LINKORDER",1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1385
	$xmlLinkOrder->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1386
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1387
	# Create temporary sublists, which will be
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1388
	# removed during finaliseProject
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1389
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1390
	$xmlSourceGroup = newList($xmlTarget,"SOURCEGROUP",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1391
	$xmlSourceGroup->setAttribute("TARGET", $targetname);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1392
	$xmlSourceGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1393
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1394
	$xmlHeadersGroup = newList($xmlTarget,"HEADERSGROUP",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1395
	$xmlHeadersGroup->setAttribute("TARGET", $targetname);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1396
	$xmlHeadersGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1397
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1398
	$xmlRootGroup = newList($xmlTarget,"ROOTGROUP",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1399
	$xmlRootGroup->setAttribute("TARGET", $targetname);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1400
	$xmlRootGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1401
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1402
	$xmlLinkGroup = newList($xmlTarget,"LINKGROUP",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1403
	$xmlLinkGroup->setAttribute("TARGET", $targetname);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1404
	$xmlLinkGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1405
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1406
	$xmlLibGroup = newList($xmlTarget,"LIBGROUP",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1407
	$xmlLibGroup->setAttribute("TARGET", $targetname);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1408
	$xmlLibGroup->setAttribute("PLAT", $Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1409
	$xmlLibGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1410
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1411
	$xmlResourcesGroup = newList($xmlTarget,"RESOURCESGROUP",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1412
	$xmlResourcesGroup->setAttribute("TARGET", $targetname);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1413
	$xmlResourcesGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1414
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1415
	$xmlDocumentsGroup = newList($xmlTarget,"DOCUMENTSGROUP",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1416
	$xmlDocumentsGroup->setAttribute("TARGET", $targetname);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1417
	$xmlDocumentsGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1418
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1419
	my $debug="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1420
	$debug="Debug" if ($Bld =~ /DEB$/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1421
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1422
	my @RuntimeLibs = ();	# add platform-specific runtime libraries here
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1423
	if (&main::PlatCompiler eq "GCC32")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1424
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1425
		if ($BasicTrgType=~/^DLL$/o) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1426
			{ # Add the DLL stub library
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1427
			push @RuntimeLibs, "EDLLSTUB.LIB";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1428
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1429
		if ($BasicTrgType=~/^(DLL|EXE)/o) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1430
			{ # Add the GCC helper fns
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1431
			push @RuntimeLibs, "EGCC.LIB";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1432
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1433
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1434
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1435
	if ($Plat eq "GCCE" || $CustGCCE)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1436
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1437
			push @RuntimeLibs, "usrt2_2.lib";    # UDEB/UREL Specific
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1438
			push @RuntimeLibs, "dfpaeabi.dso";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1439
			push @RuntimeLibs, "dfprvct2_2.dso";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1440
			push @RuntimeLibs, "drtaeabi.dso"; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1441
			push @RuntimeLibs, "scppnwdl.dso"; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1442
			push @RuntimeLibs, "drtrvct2_2.dso";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1443
			if ($BasicTrgType=~/^DLL$/o) { # Add the DLL stub library
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1444
				push @RuntimeLibs, "EDLLSTUB.LIB";   # UDEB/UREL Specific
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1445
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1446
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1447
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1448
	addFile(&main::Path_Split('File',$MmpFile), "Text", "", "", "Root");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1449
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1450
	# Create the uid.cpp file	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1451
	if ($Plat eq "WINSCW" && $BasicTrgType=~/^(EXE|DLL)$/oi)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1452
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1453
		my @UidList=&main::UidList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1454
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1455
		# create the UID source file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1456
		my $priority = "EPriorityForeground";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1457
		if (&main::ProcessPriority) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1458
			$priority="EPriority".&main::ProcessPriority;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1459
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1460
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1461
		my $UidText=join(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1462
			"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1463
			'// Makmake-generated uid source file',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1464
			'#include <e32cmn.h>',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1465
			'#pragma data_seg(".SYMBIAN")',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1466
			'__EMULATOR_IMAGE_HEADER2('
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1467
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1468
		foreach (@UidList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1469
			$UidText.="$_,";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1470
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1471
		my $vstr = "0x".&Genutl_VersionToHexString(&main::Version);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1472
		my $vid = &main::VendorId;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1473
		if(!$vid) { $vid="0"; }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1474
		$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
  1475
		if (&main::AllowDllData) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1476
			$UidText.="1,";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1477
		} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1478
			$UidText.="0,";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1479
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1480
		chop $UidText;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1481
		$UidText.=")\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1482
		$UidText.="#pragma data_seg()\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1483
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1484
		$UIDFile = $BaseTrg.'_UID_.cpp';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1485
		&main::CreateExtraFile("${ExtraFilesPath}$UIDFile", $UidText);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1486
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1487
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1488
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1489
	if (-e $DefFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1490
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1491
		addFile(&main::Path_Split('File',$DefFile), "Text", "", &main::DefFileType."\\");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1492
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1493
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1494
	# Add resources: rsc files, mbm files and aif files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1495
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1496
	my $mmpdir = &main::Path_Split('Path',$MmpFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1497
	$changedsettings{"SymbianResourcesMMPFileLocation"} = "{0}$mmpdir";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1498
	my $ResourcesText="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1499
	my @ResourceDownloadList=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1500
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1501
	# --- MBM files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1502
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1503
	my $BitMapStructRef = &main::BitMapStructRef();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1504
	my $BitMapRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1505
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1506
	foreach my $BitMapRef (@$BitMapStructRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1507
		my $trgfile = $$BitMapRef{Trg};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1508
# change - only use colour resource files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1509
		next if ($trgfile =~ /\.MBW$/i);	# ignore greyscale MBM files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1510
		$trgfile =~ s/\.MCL$/.MBM/;			# convert MCL to MBM for immediate use
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1511
		my $entry = "  <mbm targetfile = \"$trgfile\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1512
		$entry .= " targetpath = \"".&main::Path_Chop($$BitMapRef{TrgPath})."\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1513
		push @ResourceDownloadList, $$BitMapRef{TrgPath}.$trgfile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1514
		if (defined $$BitMapRef{Hdr})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1515
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1516
			$entry .= " header = \"true\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1517
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1518
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1519
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1520
			$entry .= " header = \"false\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1521
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1522
		$entry .= ">\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1523
		foreach my $SrcRef (@{$$BitMapRef{Source}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1524
			$entry .= "    <bmp bpp = \"$$SrcRef{ClDepth}\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1525
			my $bmpfile = &main::Path_Split('File',$$SrcRef{Src});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1526
			my $bmppath = &main::Path_Split('Path',$$SrcRef{Src});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1527
			my $sourcepath = &main::Path_Chop(&main::Path_MakeRltToBase($mmpdir,$bmppath));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1528
			$entry .= " sourcepath = \"$sourcepath\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1529
			$entry .= " sourcefile = \"$bmpfile\"/>\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1530
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1531
		$ResourcesText .= $entry . "  </mbm>\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1532
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1533
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1534
	# --- AIF files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1535
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1536
	my $AifStructRef = &main::AifStructRef();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1537
	my $AifRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1538
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1539
	foreach $AifRef (@$AifStructRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1540
# regression change - workaround lack of AIF directory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1541
		my $trgpath=&main::TrgPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1542
		my $trgfile=&main::Path_Split('File',$$AifRef{Trg});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1543
		my $path=&main::Path_Split('Path',"$trgpath$$AifRef{Trg}");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1544
		$path=&main::Path_Chop($path);  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1545
# change - only use colour resource files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1546
		next if ($trgfile =~ /\.ABW$/i);	# ignore greyscale AIF files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1547
		$trgfile =~ s/\.ACL$/.AIF/;			# convert ACL to AIF for immediate use
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1548
 		my $rssfile = &main::Path_Split('File',$$AifRef{Source});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1549
 		my $rsspath = &main::Path_Split('Path',$$AifRef{Source});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1550
 		my $sourcepath=&main::Path_Chop(&main::Path_MakeRltToBase($mmpdir,$rsspath));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1551
 		my $entry = "  <aif sourcefile = \"$rssfile\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1552
   		$entry .= " sourcepath = \"$sourcepath\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1553
   		$entry .= " targetfile = \"$trgfile\" targetpath = \"$path\">\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1554
   		push @ResourceDownloadList, "$path\\$trgfile";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1555
 		foreach my $BitmapRef (@{$$AifRef{BitMaps}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1556
 			$entry .= "    <bmp bpp = \"$$BitmapRef{ClDepth}\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1557
 			my $bmpfile = &main::Path_Split('File',$$BitmapRef{Src});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1558
 			my $bmppath = &main::Path_Split('Path',$$BitmapRef{Src});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1559
 			$sourcepath = &main::Path_Chop(&main::Path_MakeRltToBase($mmpdir,$bmppath));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1560
 			$entry .= " sourcepath = \"$sourcepath\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1561
 			$entry .= " sourcefile = \"$bmpfile\"/>\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1562
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1563
   		$ResourcesText .= $entry . "  </aif>\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1564
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1565
   	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1566
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1567
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1568
	# --- RSC files, which must come after .MBM files since they may use the .MBG header files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1569
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1570
	my $ResourceStructRef=&main::ResourceStructRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1571
	my @resourcefiles;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1572
	my %resourcetargets;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1573
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1574
	# NOTE: An <rsc/> block is now created for each START RESOURCE blocks LANG entries.  This
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1575
	# shouldn't be necessary as <rsc/> blocks support multiple <language/> tags, and the generation
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1576
	# of separate localised binaries should be dealt with by the Symbian Resources IDE plugin.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1577
	# However, a defect in the plugin's processing of <rsc/> "targetfile" attributes means that is
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1578
	# doesn't correctly generate separate localised binaries with per-LANG extensions.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1579
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1580
	my %headerProcessed;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1581
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1582
	foreach my $ResourceRef (@$ResourceStructRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1583
		my $fullsource=$$ResourceRef{Source};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1584
		my $rssfile=&main::Path_Split('File', $fullsource);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1585
		my $rsspath=&main::Path_Split('Path', $fullsource);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1586
		my $entry = "  <rsc sourcefile = \"$rssfile\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1587
		$entry .= " targetpath = \"".&main::Path_Chop($$ResourceRef{TrgPath})."\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1588
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1589
		#############################################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1590
		# if CW version is 3.1 or greater, add TARGET file if present
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1591
		# tkelly 4-May-05
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1592
		if ($CW_major_version >= 3.1)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1593
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1594
			my $trgfile=&main::Path_Split('File',$$ResourceRef{Trg}); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1595
			$entry .= " targetfile = \"$trgfile\"\n"; #tk
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1596
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1597
		##############################################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1598
		if ((defined $$ResourceRef{Hdr}) && (!$headerProcessed{$fullsource}))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1599
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1600
			$entry .= " header = \"true\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1601
			$headerProcessed{$fullsource} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1602
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1603
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1604
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1605
			$entry .= " header = \"false\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1606
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1607
		my $sourcepath=&main::Path_Chop(&main::Path_MakeRltToBase($mmpdir,$rsspath));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1608
		$entry .= " sourcepath = \"$sourcepath\">\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1609
		# ignore the UidList for now..
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1610
		$resourcetargets{$fullsource} = $$ResourceRef{TrgPath}.&main::Path_Split('Base', $rssfile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1611
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1612
		$entry .= "    <language id = \"$$ResourceRef{Lang}\"/>\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1613
		push @resourcefiles, $entry;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1614
		push @ResourceDownloadList, $resourcetargets{$fullsource}.".R".$$ResourceRef{Lang};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1615
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1616
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1617
 	foreach my $resourceEntry (@resourcefiles) {	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1618
 			$ResourcesText .= $resourceEntry . "  </rsc>\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1619
 			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1620
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1621
	# --- If required, generate .resources file per platform
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1622
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1623
	if ($ResourcesText ne "")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1624
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1625
		my $resourcesfile = "$BaseTrg$Plat.resources";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1626
		&main::CreateExtraFile("${ExtraFilesPath}$resourcesfile", "<resources>\n$ResourcesText</resources>\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1627
		addFile($resourcesfile, "Text", "", "", "Resources");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1628
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1629
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1630
	# Build the rest of the file list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1631
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1632
	if ($BasicTrgType!~/^LIB$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1633
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1634
		addFile($FirstLib, "Library", $debug, "$Bld\\");	# static library, build-specific
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1635
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1636
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1637
	my $file;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1638
	foreach $file (@SrcList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1639
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1640
		# ensure the case of the extension is what GCC expects
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1641
		$file =~ s/\.CPP$/.cpp/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1642
		$file =~ s/\.C$/.c/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1643
		$file =~ s/\.s$/.S/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1644
		my $srcfile=&main::Path_Split('File',$file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1645
		addFile($srcfile, "Text", $debug, "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1646
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1647
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1648
	# If required, add the uid.cpp file so that it appears after all other source files in the link order
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1649
	if (defined $UIDFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1650
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1651
		addFile($UIDFile, "Text", "", "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1652
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1653
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1654
	if ($Plat ne "GCCE" && !$CustGCCE)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1655
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1656
	# linking with GCCE, Runtime libs need to be at the end to match with make, otherwise evalid can fail.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1657
	foreach $file (@RuntimeLibs)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1658
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1659
		next if ( $file eq $FirstLib );		#skip if file equals FirstLib.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1660
		addFile($file, "Library", $debug, "$Bld\\"); # static library, build specific
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1661
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1662
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1663
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1664
	foreach $file (@StatLibList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1665
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1666
		next if ( $file eq $FirstLib );		#skip if file equals FirstLib.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1667
		addFile($file, "Library", $debug, "$Bld\\"); # static library, build specific
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1668
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1669
	foreach $file (@ASSPLibList, @LibList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1670
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1671
		next if ( $file eq $FirstLib );		#skip if file equals FirstLib.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1672
		if ($Plat eq "GCCE" or $ABIV2 or $CustGCCE) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1673
			$file =~ s/\.LIB$/.DSO/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1674
			$file =~ s/\.lib$/.dso/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1675
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1676
		addFile($file, "Library", $debug, "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1677
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1678
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1679
	if ($Plat eq "GCCE" || $CustGCCE)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1680
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1681
		foreach $file (@RuntimeLibs)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1682
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1683
			next if ( $file eq $FirstLib );		#skip if file equals FirstLib.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1684
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1685
			#change to prevent multiple libs being listed when they are shared between targets.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1686
			if ($file eq "usrt2_2.lib" || $file eq "EDLLSTUB.LIB") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1687
				addFile($file, "Library", $debug, "$Bld\\"); # static library, build specific
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1688
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1689
			else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1690
				addFile($file, "Library", $debug, ""); # static library, build non-specific
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1691
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1692
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1693
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1694
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1695
	if ($Plat eq "WINSCW")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1696
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1697
		my $defaults = $ENV{'MWSym2LibraryFiles'};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1698
		# look out for paths?
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1699
		foreach $file (@Win32LibList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1700
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1701
			# skip default libs and FirstLib
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1702
			next if ( ($defaults =~ /;$file/) || ($file eq $FirstLib) );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1703
			addFile($file, "Library", $debug, "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1704
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1705
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1706
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1707
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1708
	# Update the project settings
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1709
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1710
	$changedsettings{"UserSourceTrees"} = "{}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1711
	$changedsettings{"UserSearchPaths"} = "{}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1712
	$changedsettings{"SystemSearchPaths"} = "{}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1713
	$changedsettings{"Targetname"} = $targetname;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1714
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1715
	my $outputdir = $RelPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1716
	if ($Plat eq "WINSCW")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1717
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1718
		my $trgpath = &main::TrgPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1719
		&Winutl_AdjustTargetPath(\$trgpath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1720
		$outputdir .= $trgpath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1721
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1722
	$changedsettings{"OutputDirectory"} = "{1}".&main::Path_Chop($outputdir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1723
	$changedsettings{"SymbianInstallationContentSearchLocation"} = "{0}".&main::Path_Chop($RelPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1724
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1725
	$changedsettings{"SymbianResourcesHeaderFileOutputLocation"} = "{0}".&main::Path_Chop(&main::EPOCIncPath());
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1726
	if ($Plat eq "WINSCW")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1727
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1728
		$changedsettings{"SymbianResourcesBinaryOutputLocation"} = "{0}".&main::Path_Chop($RelPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1729
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1730
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1731
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1732
		$changedsettings{"SymbianResourcesBinaryOutputLocation"} = "{0}".&main::Path_Chop(&main::EPOCDataPath());
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1733
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1734
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1735
	if ($Plat eq "WINSCW")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1736
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1737
		if ($TrgType eq "EXE")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1738
			{	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1739
			# IDE would do the right thing, but we might as well make sure...
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1740
			$changedsettings{"MWRuntimeSettings_HostApplication"} = "{0}$outputdir$Trg";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1741
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1742
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1743
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1744
			$changedsettings{"MWRuntimeSettings_HostApplication"} = "{0}${RelPath}epoc.exe";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1745
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1746
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1747
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1748
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1749
	$changedsettings{"SymbianEpocToolsPath"} = "{0}${epocroot}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1750
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1751
	if ($Plat ne "WINSCW")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1752
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1753
		my $downloadpath = &main::TrgPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1754
		if (&main::EPOCSecurePlatform && $downloadpath !~ /^Z\\sys\\bin\\/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1755
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1756
			my @hrhMacros = &Variant_GetMacroList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1757
			if (grep /^SYMBIAN_IGNORE_BIN_TARGETPATH\s*$/, @hrhMacros)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1758
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1759
				$downloadpath = "Z\\sys\\bin\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1760
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1761
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1762
		$downloadpath =~ s/^Z\\/C:\\/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1763
		$changedsettings{"DownloadPath"} = $downloadpath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1764
		$changedsettings{"FileList"} = "{}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1765
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1766
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1767
	my @MacroList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1768
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1769
	@MacroList = &main::MacroList();			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1770
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1771
	push @MacroList, "__${Plat}__" if ($Plat ne $ABI);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1772
	push @MacroList, "__SUPPORT_CPP_EXCEPTIONS__" if ($Plat eq "WINSCW");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1773
	push @MacroList, "__SUPPORT_CPP_EXCEPTIONS__" if (($Plat eq "ARMV5") || ($Plat eq "ARMV5_ABIV2") || ($Plat eq "ARMV5_ABIV1") || ($Plat eq "GCCE") || $IsPlatCustomization);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1774
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1775
	# Symbian Compiler Panel
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1776
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1777
	my $compiler="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1778
	my $compilerargs="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1779
	my $macros="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1780
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1781
	if ((($Plat eq "ARMV5") || ($Plat eq "ARMV5_ABIV2") || ($Plat eq "ARMV5_ABIV1") || ($Plat eq "GCCE") || $IsPlatCustomization) && $VariantFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1782
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1783
		push @MacroList, '__PRODUCT_INCLUDE__=\\"'.&main::Path_Split('File',$VariantFile).'\\"' if $VariantFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1784
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1785
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1786
	foreach (@MacroList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1787
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1788
		$_ =~ s/\s+$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1789
		$_ =~ s/^\s+//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1790
		$macros .= "$_,";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1791
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1792
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1793
###############################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1794
# WINSCW compilation settings #
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1795
###############################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1796
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1797
	if ($Plat eq "WINSCW")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1798
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1799
		$compiler = "WINSCW";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1800
		$compilerargs .= "-wchar_t off -align 4 -warnings on -w nohidevirtual, nounusedexpr -msgstyle gcc -enum int -str pool ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1801
		$compilerargs .= "-exc ms ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1802
		$compilerargs .= "-trigraphs on ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1803
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1804
		if ($Bld =~ /DEB/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1805
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1806
			$compilerargs .= "-O0 ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1807
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1808
			# euser change to apply inlining on the _NAKED functions
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1809
			if ($BaseTrg !~ /^EUSER$/oi)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1810
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1811
				$compilerargs .= "-inline off ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1812
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1813
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1814
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1815
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1816
			$compilerargs .= "-O4,s ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1817
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1818
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1819
		if ($Win32StdHeaders || $Win32Resrc ) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1820
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1821
			$macros .= "WIN32,_WINDOWS,";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1822
			# Callisto defect workaround
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1823
			# NOTE: persisting with this for consistency
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1824
			$compilerargs .= "-stdinc ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1825
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1826
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1827
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1828
			$compilerargs .= "-nostdinc ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1829
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1830
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1831
		$compilerargs .= &main::CompilerOption("CW");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1832
		$changedsettings{"Macros"} = $macros;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1833
		if ($VariantFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1834
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1835
			$changedsettings{"PrefixFile"} = &main::Path_Split('File',$VariantFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1836
			}			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1837
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1838
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1839
#############################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1840
# RVCT compilation settings #
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1841
#############################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1842
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1843
	elsif ((($Plat eq "ARMV5") || ($Plat eq "ARMV5_ABIV2") || ($Plat eq "ARMV5_ABIV1") || $ABIV1 || $ABIV2) && ($CW_major_version >= 3)) #|| $IsPlatCustomization
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1844
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1845
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1846
		if ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1847
			$changedsettings{"CompilerXMLDescriptor"} = "ARM RVCT";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1848
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1849
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1850
			if(($CW_major_version == 3))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1851
			{ 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1852
				$changedsettings{"CompilerXMLDescriptor"} = "ARM RVCT";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1853
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1854
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1855
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1856
				# RVCT 2.2
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1857
				$changedsettings{"CompilerXMLDescriptor"} = "ARM RVCT2_2";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1858
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1859
		}	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1860
		if ($Bld =~ /REL$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1861
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1862
				$compilerargs .= $configdata{"REL_OPTIMISATION"}." ".$configdata{"RUNTIME_SYMBOL_VISIBILITY_OPTION"}.$CCUREL;		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1863
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1864
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1865
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1866
			unless (&main::SrcDbg)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1867
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1868
					$compilerargs .= $configdata{"DEBUG_OPTIMISATION"}." ".$configdata{"RUNTIME_SYMBOL_VISIBILITY_OPTION"}.$CCUDEB;		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1869
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1870
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1871
		$changedsettings{"PrefixFile"} = &main::Path_Split('File',$PrefixFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1872
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1873
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1874
############################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1875
# GCC compilation settings #
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1876
############################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1877
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1878
	elsif ($Plat eq "ARM4")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1879
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1880
		$compiler = "ARM";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1881
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1882
		if ($Bld =~ /REL$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1883
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1884
			$compilerargs .= "-s -fomit-frame-pointer -O "
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1885
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1886
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1887
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1888
			unless (&main::SrcDbg)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1889
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1890
				$compilerargs .= "-O ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1891
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1892
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1893
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1894
		if ($ABI eq "ARMI")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1895
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1896
			$compilerargs .= "-march=armv4t -mthumb-interwork";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1897
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1898
		elsif ($ABI eq "ARM4T")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1899
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1900
			if (&main::BuildAsARM)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1901
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1902
				$compilerargs .= "-march=armv4t -mthumb-interwork";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1903
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1904
			elsif ($SystemTrg)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1905
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1906
				$compilerargs .= "-march=armv4";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1907
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1908
				unless (&main::PlatABI eq "ARM4")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1909
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1910
					$compilerargs .= "t";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1911
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1912
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1913
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1914
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1915
				$compiler = "THUMB";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1916
				$compilerargs .= "-mthumb-interwork";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1917
				$macros .= "__MARM_THUMB__,";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1918
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1919
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1920
		elsif ($ABI eq "ARM4")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1921
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1922
			$compilerargs .= "-march=armv4";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1923
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1924
			unless (&main::PlatABI eq "ARM4")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1925
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1926
				$compilerargs .= "t";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1927
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1928
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1929
		elsif ($ABI eq "THUMB")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1930
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1931
			$compiler = "THUMB";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1932
			$compilerargs .= "-mthumb-interwork";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1933
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1934
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1935
		if ($VariantFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1936
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1937
			$changedsettings{"PrefixFile"} = &main::Path_Split('File',$VariantFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1938
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1939
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1940
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1941
############################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1942
# GCCE BPABI compilation settings #
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1943
############################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1944
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1945
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1946
	elsif ((($Plat eq "GCCE") || $CustGCCE)) # || $IsPlatCustomization) && ($CW_major_version >= 3)) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1947
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1948
		$compiler = "ARM GCCE";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1949
		#Change setting CompilerXMLDescriptor is only good for CW 3.0 and greater.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1950
		$changedsettings{"CompilerXMLDescriptor"} = "ARM GCCE";	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1951
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1952
		if ($Bld =~ /REL$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1953
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1954
			$compilerargs .= $configdata{"REL_OPTIMISATION"}." ".$configdata{"RUNTIME_SYMBOL_VISIBILITY_OPTION"}.$CCUREL;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1955
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1956
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1957
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1958
			unless (&main::SrcDbg)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1959
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1960
				$compilerargs .= $configdata{"DEBUG_OPTIMISATION"}." ".$configdata{"RUNTIME_SYMBOL_VISIBILITY_OPTION"}.$CCUDEB
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1961
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1962
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1963
		$changedsettings{"PrefixFile"} = &main::Path_Split('File',$PrefixFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1964
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1965
####################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1966
# General settings #
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1967
####################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1968
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1969
	$macros =~ s/,$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1970
	$compilerargs =~ s/ $//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1971
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1972
	$changedsettings{"Compiler"} = $compiler; # in CW 3.0, "Compiler" no longer exists. This line has no effect on those versions
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1973
	$changedsettings{"Arguments"} = $compilerargs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1974
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1975
	# Symbian Linker Panel
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1976
	$changedsettings{"LinkOutputFile"} = $Trg;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1977
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1978
	if ($Plat eq "GCCE" || $CustGCCE || $ABIV2) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1979
		$changedsettings{"SymbianImportLibrary"} = $ExportLibrary.'.dso';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1980
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1981
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1982
		$changedsettings{"SymbianImportLibrary"} = $ExportLibrary.'.lib';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1983
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1984
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1985
	# Template defaults for canDebug/canRun are both "true"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1986
	if ($Bld =~ /REL/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1987
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1988
		$changedsettings{"canDebug"} = "false";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1989
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1990
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1991
	if ($Plat eq "WINSCW")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1992
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1993
		if ($TrgType ne "APP" && $TrgType ne "EXE" && $TrgType ne "EXEDLL" && $TrgType ne "EPOCEXE")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1994
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1995
			$changedsettings{"canDebug"} = "false";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1996
			$changedsettings{"canRun"} = "false";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1997
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1998
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1999
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2000
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2001
		$changedsettings{"canRun"} = "false";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2002
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2003
		if ($TrgType eq "LIB" || $TrgType eq "KLIB")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2004
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2005
			$changedsettings{"canDebug"} = "false";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2006
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2007
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2008
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2009
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2010
	$xmlLinkDescriptorDoc = $xmlParser->parsefile ($FindBin::Bin."\\$linkDescriptorTemplate");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2011
	$xmlLinkDescriptorCommandParent = $xmlLinkDescriptorDoc->getElementsByTagName("array",1)->item(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2012
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2013
	if ($CW_major_version >= 3)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2014
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2015
		$xmlLinkDescriptorSymbolParent = $xmlLinkDescriptorDoc->getElementsByTagName("array",1)->item(1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2016
		$xmlLinkDescriptorDumpFileParent = $xmlLinkDescriptorDoc->getElementsByTagName("array",1)->item(2);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2017
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2018
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2019
	my $linkDescriptorFile = "$BaseTrg$Plat$Bld.cwlink";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2020
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2021
	my $copyCommand = 'perl.exe -S ecopyfile.pl ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2022
	my $deleteCommand = 'cmd.exe /C del ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2023
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2024
	my $tempFilenameRoot = '${var:IMPORT_LIBRARY_NO_EXT}';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2025
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2026
	if ($CW_major_version < 3)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2027
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2028
		$tempFilenameRoot = $ExportLibrary;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2029
		}	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2030
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2031
	my $exportUnfrozenWarningMessage = 'Created "${var:KIT_EPOCROOT}'.kitRelativePath($LibPath).'${var:IMPORT_LIBRARY}" '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2032
										'from "${target.data}\\'.$tempFilenameRoot.'.def" as EXPORTUNFROZEN specified.';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2033
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2034
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2035
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2036
############################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2037
# WINSCW library generation and link stage #
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2038
############################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2039
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2040
	if ($Plat eq "WINSCW")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2041
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2042
		# Generate library
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2043
		if ($DefFile and !$NoExportLibrary)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2044
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2045
			unless (&main::ExportUnfrozen)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2046
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2047
					my $LibLinkAs = ($BasicTrgType=~/^IMPLIB$/io) ? $LinkAs : $Trg;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2048
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2049
					$linkCommand = 'perl.exe -S prepdef.pl "${var:DEF_FILE}" "${target.data}\\'.$tempFilenameRoot.'.prep.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2050
					addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2051
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2052
					$linkCommand = 'mwldsym2.exe "${target.data}\\'.$tempFilenameRoot.'.prep.def" -importlib -o "'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2053
									'${var:KIT_EPOCROOT}'.kitRelativePath($LibPath).'${var:IMPORT_LIBRARY}" -addcommand "out:'.$LibLinkAs.'" -warnings off';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2054
					addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2055
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2056
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2057
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2058
		if ((2.8 == $CW_major_version) && (0 == $CW_minor_version))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2059
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2060
			# For OEM2.8, create a file containing all objects required in the link.  This is used in all
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2061
			# calls to mwldsym2 in order to avoid exceeding the Windows command line
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2062
			# length in projects containing a large amount of source files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2063
			$linkCommand ='cmd.exe /C echo ${var:LINK_OBJS}>"${target.data}\${output.file.root}.lst"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2064
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2065
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2066
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2067
		my $stage1linkflags = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2068
		my $linkflags = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2069
		my $commonLinkFlags = '-msgstyle gcc -stdlib';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2070
		my $libPath = "epoc32\\release\\winscw\\".lc $Bld;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2071
		if ($SystemTrg){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2072
			$commonLinkFlags .=" ${libPath}\\scppnwdl_kern.lib";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2073
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2074
		else{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2075
			$commonLinkFlags .=" ${libPath}\\scppnwdl.lib";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2076
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2077
		if ($BasicTrgType=~/^(EXE|DLL)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2078
					$commonLinkFlags .= ' ${var:FIRST_LIB} '
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2079
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2080
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2081
		foreach my $lib (@Win32LibList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2082
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2083
			my $win32lib = $lib;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2084
			$win32lib = "-l$win32lib" unless ($win32lib =~ /\\/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2085
			$commonLinkFlags .= " ". lc $win32lib;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2086
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2087
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2088
		if ($BasicTrgType =~ /^DLL$/o || $TrgType =~ /^EXEXP$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2089
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2090
			if ($BaseAddress ne "")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2091
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2092
				$commonLinkFlags .= " -imagebase $BaseAddress";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2093
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2094
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2095
			$commonLinkFlags .= ' -noentry -shared';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2096
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2097
		elsif ($BasicTrgType =~ /^EXE$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2098
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2099
			$commonLinkFlags .= ' -m "?_E32Bootstrap@@YGXXZ"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2100
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2101
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2102
		$commonLinkFlags .= ' -subsystem windows';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2103
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2104
		if (&main::HeapSize)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2105
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2106
			my %HeapSize = &main::HeapSize;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2107
			$commonLinkFlags .= ' -heapreserve='.RoundUp1k($HeapSize{Max}).' -heapcommit='.RoundUp1k($HeapSize{Min}); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2108
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2109
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2110
		if ($BasicTrgType =~ /^(DLL|EXE)$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2111
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2112
			if ($Bld =~ /DEB$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2113
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2114
				$commonLinkFlags .= ' -g';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2115
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2116
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2117
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2118
		my $EntrySymbol='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2119
		if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2120
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2121
			my $Include="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2122
			if ($BasicTrgType=~/^DLL$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2123
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2124
				$Include="-m __E32Dll";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2125
				$EntrySymbol='__E32Dll';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2126
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2127
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2128
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2129
				$Include="-m __E32Startup";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2130
				$EntrySymbol='__E32Startup';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2131
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2132
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2133
			$stage1linkflags = $commonLinkFlags.' ${var:LIBS}'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2134
				' -o "${target.data}\\${output.file.name}"'. 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2135
				' -export dllexport '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2136
				$Include.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2137
				' -nocompactimportlib'. 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2138
				' -implib "${target.data}\\${var:IMPORT_LIBRARY}"'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2139
				' -addcommand "out:${output.file.name}"'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2140
				' -warnings off';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2141
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2142
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2143
		my $AbsentSubst = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2144
		if ($EntrySymbol)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2145
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2146
			$AbsentSubst = " -absent $EntrySymbol";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2147
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2148
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2149
		$linkflags = $commonLinkFlags.' ${var:LIBS}'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2150
			' -o "${output}\\${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2151
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2152
		if ($Bld=~/REL$/o && $BasicTrgType!~/^LIB$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2153
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2154
			# Generate map file for release build executables
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2155
			$linkflags .= ' -map "${output}\\${output.file.name}.map"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2156
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2157
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2158
		if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2159
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2160
			$linkflags .= ' -f "${target.data}\\'.$tempFilenameRoot.'.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2161
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2162
			if (&main::ExportUnfrozen)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2163
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2164
				$linkflags .= ' -implib "${var:KIT_EPOCROOT}'.kitRelativePath($LibPath).'${var:IMPORT_LIBRARY}"'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2165
					' -addcommand "out:${output.file.name}" -warnings off';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2166
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2167
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2168
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2169
				$linkflags .= ' -noimplib ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2170
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2171
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2172
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2173
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2174
			$linkflags .= ' -noimplib ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2175
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2176
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2177
		if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2178
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2179
			if (($CW_major_version >= 3) ||
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2180
				((2.8 == $CW_major_version) && ($CW_minor_version >= 1)))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2181
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2182
				# For OEM2.8.1 onwards, make use of ${var:LINK_OBJS_NO_PATH} in order to reduce link
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2183
				# command line lengths
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2184
				$linkCommand = 'mwldsym2.exe '.$stage1linkflags.' ${var:COMMON_LINK_FLAGS} -l "${target.data}\\ObjectCode" -search ${var:LINK_OBJS_NO_PATH}';				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2185
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2186
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2187
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2188
				$linkCommand = 'mwldsym2.exe '.$stage1linkflags.' ${var:COMMON_LINK_FLAGS} @"${target.data}\${output.file.root}.lst"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2189
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2190
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2191
			addLinkDescriptorCommand ($linkCommand, undef, undef, undef, $FirstLib);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2192
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2193
			$linkCommand = $deleteCommand.'"${target.data}\\${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2194
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2195
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2196
			my $show_options = 'names,unmangled,verbose';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2197
			$linkCommand = 'mwldsym2.exe -S -show only,'.$show_options.' -o "${target.data}\\'.$tempFilenameRoot.'.inf" "${target.data}\\${var:IMPORT_LIBRARY}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2198
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2199
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2200
			$linkCommand = 'perl.exe -S makedef.pl '.$AbsentSubst.' -Inffile "${target.data}\\'.$tempFilenameRoot.'.inf"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2201
			if (-e $DefFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2202
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2203
				$linkCommand .= ' -Frzfile "'.$DefFile.'"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2204
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2205
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2206
			my $Export;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2207
			my $Ordinal=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2208
			foreach $Export (&main::Exports)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2209
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2210
				$linkCommand .= " -$Ordinal $Export";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2211
				$Ordinal++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2212
				}					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2213
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2214
			$linkCommand .= ' "${target.data}\\'.$tempFilenameRoot.'.def"';					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2215
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2216
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2217
			$linkCommand = $deleteCommand.'"${target.data}\\'.$tempFilenameRoot.'.inf"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2218
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2219
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2220
			$linkCommand = $deleteCommand.'"${target.data}\\${var:IMPORT_LIBRARY}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2221
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2222
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2223
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2224
		$linkCommand = "mwldsym2.exe ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2225
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2226
		if ($BasicTrgType =~/^LIB$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2227
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2228
			$linkCommand .= '-library ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2229
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2230
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2231
		if (($CW_major_version >= 3) ||
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2232
			((2.8 == $CW_major_version) && ($CW_minor_version >= 1)))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2233
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2234
			# For OEM2.8.1 onwards, make use of ${var:LINK_OBJS_NO_PATH} in order to reduce link
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2235
			# command line lengths
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2236
			$linkCommand .= $linkflags.' ${var:COMMON_LINK_FLAGS} -l "${target.data}\\ObjectCode" -search ${var:LINK_OBJS_NO_PATH}';	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2237
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2238
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2239
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2240
			$linkCommand .= $linkflags.'${var:COMMON_LINK_FLAGS} @"${target.data}\${output.file.root}.lst"';				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2241
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2242
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2243
		my $warningMessage;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2244
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2245
		if (&main::ExportUnfrozen)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2246
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2247
			$warningMessage = $exportUnfrozenWarningMessage;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2248
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2249
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2250
		if ($BasicTrgType =~/^LIB$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2251
			{				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2252
			addLinkDescriptorCommand ($linkCommand, undef, undef, undef, undef, $warningMessage);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2253
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2254
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2255
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2256
			addLinkDescriptorCommand ($linkCommand, undef, undef, undef, $FirstLib, $warningMessage);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2257
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2258
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2259
		if (&Winutl_CopyForStaticLinkage)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2260
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2261
			$linkCommand = $copyCommand.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2262
							'"${output}\\${output.file.name}" '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2263
							'"${var:KIT_EPOCROOT}'.kitRelativePath($RelPath).'${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2264
			addLinkDescriptorCommand ($linkCommand, "false", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2265
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2266
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2267
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2268
##########################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2269
# RVCT library generation and link stage #
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2270
##########################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2271
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2272
	elsif ($ABIV1 && ($CW_major_version >= 3)) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2273
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2274
		my $InterWorking = ($ABI eq 'ARMV4') ? "" : "--inter";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2275
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2276
		# Generate library
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2277
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2278
		if ($DefFile and !$NoExportLibrary)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2279
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2280
			unless (&main::ExportUnfrozen)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2281
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2282
				$linkCommand = 'perl.exe -S prepdef.pl "${var:DEF_FILE}" "${target.data}\\'.$tempFilenameRoot.'.prep.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2283
				addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2284
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2285
				$linkCommand = 'def2dll.bat --path="${var:KIT_EPOCROOT}'.kitRelativePath($LibPath).'\\" --bldpath="${target.data}" --import='.$tempFilenameRoot.' '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2286
					'--deffile="${target.data}\\'.$tempFilenameRoot.'.prep.def" --linkAs='.$LinkAs.' '.$InterWorking;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2287
				addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2288
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2289
				if ($ExtraExportLibrary)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2290
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2291
					$linkCommand = $copyCommand.'"${var:KIT_EPOCROOT}'.kitRelativePath($LibPath).'${var:IMPORT_LIBRARY}" '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2292
									'"${var:KIT_EPOCROOT}'.kitRelativePath($LibPath).$ExtraExportLibrary.'.lib"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2293
					addLinkDescriptorCommand ($linkCommand,"false", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2294
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2295
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2296
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2297
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2298
		return if ($BasicTrgType=~/^IMPLIB$/io);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2299
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2300
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2301
		# Create custom symbols only required in RVCT builds
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2302
		my $implibs_no_path_vtblexport = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2303
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2304
		foreach my $lib (@LibList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2305
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2306
			$implibs_no_path_vtblexport.="$lib(VtblExports.o) ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2307
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2308
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2309
		addLinkDescriptorSymbol ('${var:IMPLIBS_NO_PATH_VTBLEXPORT}', $implibs_no_path_vtblexport);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2310
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2311
		my $AbsentSubst = '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2312
		my $EntrySymbol;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2313
		my $Link = '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2314
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2315
		if ($BasicTrgType=~/^DLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2316
			$EntrySymbol = '_E32Dll';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2317
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2318
		elsif ($BasicTrgType=~/^EXE$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2319
			$EntrySymbol = '_E32Startup';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2320
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2321
		if ($EntrySymbol) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2322
			$AbsentSubst = " -absent $EntrySymbol";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2323
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2324
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2325
		$Link = 'armlink '.$oP.'diag_suppress 6331,6780'.$linkeropts.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2326
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2327
		if ($Bld =~ /DEB$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2328
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2329
			$Link .= ' '.$oP.'debug';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2330
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2331
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2332
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2333
	    # TARGET *.IN
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2334
	    #------------
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2335
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2336
		# Create "via" file containing all link objects in order to reduce link
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2337
		# command line length
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2338
		addLinkDescriptorDumpFile ('${var:LINK_OBJS}', '${target.data}\\${output.file.root}_'.$Bld.'_objects.via');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2339
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2340
		if ($BasicTrgType!~/^LIB$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2341
			$linkCommand = $Link .' '.$oP.'partial -o ${var:COMMON_LINK_FLAGS} "${target.data}\\${output.file.root}.in" '.$oP.'via "${target.data}\\${output.file.root}_'.$Bld.'_objects.via"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2342
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2343
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2344
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2345
		# Perform link
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2346
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2347
	    if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2348
	#		reorder the .DEF file taking frozen exports into account if there are any
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2349
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2350
			$linkCommand = 'perl -S elf2inf.pl -o "${target.data}\\'.$tempFilenameRoot.'.inf" "${target.data}\\${output.file.root}.in"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2351
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2352
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2353
			$linkCommand = 'perl -S makedef.pl '.$AbsentSubst.' -Inf "${target.data}\\'.$tempFilenameRoot.'.inf"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2354
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2355
	    	if (!$DefFile || $NoExportLibrary) {    			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2356
	    		$linkCommand .= ' -ignore_unfrozen_noncallable ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2357
	    	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2358
		if (SysTrg()) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2359
	    		$linkCommand .= ' -SystemTargetType ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2360
	    	}		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2361
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2362
		    if (-e $DefFile) {	# effectively "if project frozen ..."
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2363
		        $linkCommand .= " -Frzfile \"".'${var:DEF_FILE}'."\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2364
		    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2365
		    # freeze ordinals, a maximum of 2, for polymorphic dlls
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2366
		    my $Ordinal;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2367
		    my $Num=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2368
		    foreach $Ordinal (&main::Exports) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2369
		    	$linkCommand .= " -$Num $Ordinal";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2370
			    $Num++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2371
		    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2372
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2373
		    $linkCommand.= ' "${target.data}\\'.$tempFilenameRoot.'.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2374
		    addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2375
    
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2376
		    my $theDefFile = '"${target.data}\\'.$tempFilenameRoot.'.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2377
		    $theDefFile = '"${var:DEF_FILE}"' if (-e $DefFile && !&main::ExportUnfrozen);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2378
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2379
			$linkCommand = 'def2dll.bat'.$AbsentSubst.' --path="${target.data}" --bldpath="${target.data}" --export='.$tempFilenameRoot.' --deffile='.$theDefFile.' --linkAs='.$LinkAs.' '.$InterWorking;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2380
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2381
	    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2382
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2383
        if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2384
#		generate an export object from the ordered .DEF file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2385
		if (&main::ExportUnfrozen) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2386
			$linkCommand = 'def2dll.bat --path="${var:KIT_EPOCROOT}'.kitRelativePath($LibPath).'\\" --bldpath="${target.data}" --import='.$tempFilenameRoot.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2387
				' --deffile="${target.data}\\'.$tempFilenameRoot.'.def" --linkAs='.$LinkAs.' '.$InterWorking;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2388
		    addLinkDescriptorCommand ($linkCommand, undef, undef, undef, undef, $exportUnfrozenWarningMessage);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2389
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2390
        }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2391
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2392
#       get rid of any -symbols produced .map file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2393
        if ($BasicTrgType=~/^(DLL|EXE)/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2394
			$linkCommand = $deleteCommand.'"${output}\\${output.file.name}.map"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2395
			addLinkDescriptorCommand ($linkCommand, "false", "false", undef, undef, undef, undef, (0,1));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2396
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2397
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2398
        if ($BasicTrgType=~/^(DLL|EXE)/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2399
	        my $datalinkbase = "0x400000";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2400
	        $datalinkbase = &main::DataLinkAddress if (&main::DataLinkAddress);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2401
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2402
	        $linkCommand = "$Link ".$oP.'shl '.$oP.'reloc '.$oP.'split '.$oP."rw-base $datalinkbase ".$oP.'noscanlib '."$PlatOpt{Ld}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2403
	        
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2404
	        if ($BasicTrgType=~/^DLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2405
	            # get the right object file for the entry point
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2406
	            my $ObjFile = "UC_DLL_.o";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2407
	            if ($FirstLib =~ /EDEV/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2408
		            $ObjFile = "D_ENTRY_.o";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2409
	            }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2410
	            if ($FirstLib =~ /EKLL/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2411
		            $ObjFile = "L_ENTRY_.o";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2412
	            }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2413
	            if ($FirstLib =~ /EEXT/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2414
		            $ObjFile = "X_ENTRY_.o";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2415
	            }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2416
	            if ($FirstLib =~ /EVAR/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2417
		            $ObjFile = "V_ENTRY_.o";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2418
	            }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2419
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2420
#		    If platform is a customization, take libs from parent directory.		   
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2421
			$linkCommand .= $oP.'entry _E32Dll "'.$FirstLib.'('.$ObjFile.')"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2422
		    if($IsCustomDll)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2423
		    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2424
				$linkCommand .=	' "${target.data}\\'.$tempFilenameRoot.'.exp"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2425
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2426
		    
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2427
	        } elsif ($BasicTrgType=~/^EXE$/o || $TrgType=~/^EXEXP$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2428
			    # get the right object file for the entry point
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2429
			    my $ObjFile = "UC_EXE_.o" ;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2430
			    if ($FirstLib =~ /KC_EXE/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2431
					$ObjFile = "K_ENTRY_.o";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2432
			    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2433
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2434
			if($IsPlatCustomization) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2435
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2436
				$linkCommand .= $oP.'entry _E32Startup "'.$FirstLib.'('.$ObjFile.')"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2437
			} 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2438
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2439
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2440
			    	$linkCommand .= $oP.'entry _E32Startup "'.$FirstLib.'('.$ObjFile.')"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2441
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2442
		    
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2443
			    if ($TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2444
					$linkCommand .= ' "${target.data}\\'.$tempFilenameRoot.'.exp"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2445
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2446
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2447
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2448
			$linkCommand .= ' -o "${target.data}\\${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2449
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2450
			$linkCommand .= ' '.$oP.'symbols '.$oP.'list "${output}\\${output.file.name}.map"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2451
			$linkCommand .= ' "${target.data}\\${output.file.root}.in"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2452
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2453
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2454
			if ($BasicTrgType=~/^DLL$/o) { # Add the DLL stub library
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2455
				if($IsPlatCustomization) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2456
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2457
				if ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2458
				   $linkCommand .= ' "${var:KIT_EPOCROOT}\\EPOC32\RELEASE\ARMV5\\'.$Bld.'\EDLLSTUB'.$RVCTVersion.'.LIB"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2459
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2460
				else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2461
				   $linkCommand .= ' "${var:KIT_EPOCROOT}\\EPOC32\RELEASE\ARMV5\\'.$Bld.'\EDLLSTUB.LIB"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2462
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2463
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2464
				else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2465
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2466
				if ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2467
				   $linkCommand .= ' "${var:KIT_EPOCROOT}\\EPOC32\RELEASE\ARMV5\\'.$Bld.'\EDLLSTUB'.$RVCTVersion.'.LIB"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2468
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2469
				else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2470
				   $linkCommand .= ' "${var:KIT_EPOCROOT}\\EPOC32\RELEASE\ARMV5\\'.$Bld.'\EDLLSTUB.LIB"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2471
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2472
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2473
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2474
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2475
			$linkCommand .= ' ${var:LIBS}';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2476
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2477
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2478
			my $runtimeLibs = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2479
			my $StaticRTLib = "usrt".$RVCTVersion;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2480
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2481
			# use ksrt for system code and for user ARM code
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2482
			$StaticRTLib = "ksrt".$RVCTVersion if ($SystemTrg);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2483
			$runtimeLibs .= $StaticRTLib.".lib" unless ($Trg =~ /(U|K)SRT/i || ($BasicTrgType=~/^LIB$/o));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2484
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2485
			unless ($ArmRT || ($BasicTrgType=~/^LIB$/o)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2486
				my $TargLib = "$ExportLibrary.lib";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2487
				$TargLib =~ s/\{(\d|a|b|c|d|e|f){8}\}//i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2488
				unless ($SystemTrg) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2489
					foreach (@RTLibList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2490
						$runtimeLibs .= " ".$_ unless ($_ =~ /$TargLib/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2491
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2492
			    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2493
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2494
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2495
			foreach (@ArmLibList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2496
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2497
				$runtimeLibs.= " ".$_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2498
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2499
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2500
			addLinkDescriptorSymbol ('${var:RUNTIME_LIBS}', $runtimeLibs);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2501
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2502
			if($IsPlatCustomization) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2503
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2504
			     $linkCommand .= ' --userlibpath "${var:KIT_EPOCROOT}\\EPOC32\RELEASE\\'.$ParentPlat.'\\'.$Bld.'","${var:KIT_EPOCROOT}\\EPOC32\RELEASE\\'.$ParentPlat.'\LIB" ${var:RUNTIME_LIBS} ${var:IMPLIBS_NO_PATH_VTBLEXPORT}';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2505
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2506
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2507
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2508
				addLinkDescriptorSymbol ('${var:RUNTIME_LIBS}', 'usrt'.$RVCTVersion.'.lib dfpaeabi.lib dfprvct'.$RVCTVersion.'.lib dfprvct'.$RVCTVersion.'-thunk.lib drtaeabi.lib drtaeabi.lib(VtblExports.o) drtrvct'.$RVCTVersion.'.lib');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2509
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2510
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2511
			$linkCommand .= ' --userlibpath "${var:KIT_EPOCROOT}\\EPOC32\RELEASE\ARMV5\\'.$Bld.'","${var:KIT_EPOCROOT}\\EPOC32\RELEASE\ARMV5\LIB" ${var:RUNTIME_LIBS} ${var:IMPLIBS_NO_PATH_VTBLEXPORT}';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2512
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2513
			addLinkDescriptorCommand ($linkCommand, undef, undef, undef, $FirstLib);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2514
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2515
	    	if ($Bld=~/^U?DEB$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2516
			$linkCommand = $copyCommand. ' "${target.data}\\${output.file.name}" "${output}\\${output.file.root}.sym"'; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2517
			addLinkDescriptorCommand ($linkCommand, "false", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2518
	    	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2519
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2520
			$linkCommand = 'elftran -version '. &Genutl_VersionToUserString(%Version).' -sid '. &main::SecureId(); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2521
			if (&main::CompressTarget) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2522
				$linkCommand .= ' -nocompress ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2523
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2524
			# change - exexps are allowed data, but they look like dlls to elftran....
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2525
			if (&main::AllowDllData || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2526
				$linkCommand.=' -allow';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2527
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2528
			if (not &main::CallDllEntryPoints ) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2529
				$linkCommand.=' -nocall';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2530
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2531
			if (&main::DataLinkAddress) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2532
				$linkCommand.=' -datalinkaddress '.&main::DataLinkAddress;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2533
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2534
			if (&main::FixedProcess) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2535
				$linkCommand.=' -fixed';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2536
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2537
			if (&main::HeapSize) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2538
				my %HeapSize=&main::HeapSize;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2539
				$linkCommand.=' -heap '.$HeapSize{Min}.' '.$HeapSize{Max};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2540
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2541
			if (&main::ProcessPriority) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2542
				$linkCommand.=' -priority '.&main::ProcessPriority;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2543
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2544
			if (&main::StackSize) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2545
				$linkCommand.=' -stack '.&main::StackSize;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2546
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2547
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2548
			my $i=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2549
			foreach (@UidList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2550
				$linkCommand.=" -uid$i $_";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2551
				$i++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2552
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2553
			if(&main::VendorId) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2554
				$linkCommand.=' -vid '.&main::VendorId;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2555
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2556
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2557
			$linkCommand.=' -fpu '.$floatingpointmodel;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2558
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2559
			$linkCommand.=' -capability '.&main::Capability. ' "${target.data}\\${output.file.name}" "${output}\\${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2560
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2561
			addLinkDescriptorCommand ($linkCommand, "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2562
        	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2563
        elsif ($BasicTrgType=~/^LIB$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2564
			$linkCommand = 'armar '.$oP.'create "${output}\\${output.file.name}" '.$oP.'via "${target.data}\\${output.file.root}_'.$Bld.'_objects.via"'.' '.$archiveropts;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2565
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2566
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2567
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2568
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2569
##############################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2570
# BPABI library generation and link stage    #
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2571
# Assumes use of RVCT 2.2					 #
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2572
##############################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2573
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2574
	elsif ($ABIV2 && ($CW_major_version >= 3.1)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2575
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2576
		# prolly don't need this...
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2577
		my $InterWorking = ($ABI eq 'ARMV4') ? "" : "--inter";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2578
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2579
		return if ($BasicTrgType=~/^IMPLIB$/io);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2580
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2581
		if ($BasicTrgType=~/^LIB$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2582
			$linkCommand = 'armar --create ${output}\\${output.file.name} ${var:LINK_OBJS} ${var:LIBS}'.' '.$archiveropts;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2583
	        addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2584
         }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2585
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2586
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2587
		my $AbsentSubst = '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2588
		my $EntrySymbol;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2589
		my $Link = '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2590
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2591
		if ($BasicTrgType=~/^DLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2592
			$EntrySymbol = '_E32Dll';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2593
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2594
		elsif ($BasicTrgType=~/^EXE$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2595
			$EntrySymbol = '_E32Startup';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2596
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2597
		if ($EntrySymbol) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2598
			$AbsentSubst = " -absent $EntrySymbol";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2599
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2600
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2601
		$Link = 'armlink '.$oP.'diag_suppress 6331,6780'.$linkeropts.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2602
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2603
		if ($Bld =~ /DEB$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2604
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2605
			$Link .= ' '.$oP.'debug';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2606
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2607
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2608
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2609
	    # TARGET *.IN
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2610
	    #------------
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2611
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2612
		# Create "via" file containing all link objects in order to reduce link
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2613
		# command line length
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2614
		addLinkDescriptorDumpFile ('${var:LINK_OBJS}', '${target.data}\\${output.file.root}_'.$Bld.'_objects.via');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2615
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2616
		if ($BasicTrgType!~/^LIB$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2617
			$linkCommand = $Link .' '.$oP.'partial -o ${var:COMMON_LINK_FLAGS} "${target.data}\\${output.file.root}.in" '.$oP.'via "${target.data}\\${output.file.root}_'.$Bld.'_objects.via"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2618
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2619
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2620
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2621
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2622
#       get rid of any -symbols produced .map file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2623
        if ($BasicTrgType=~/^(DLL|EXE)/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2624
			$linkCommand = $deleteCommand.'"${output}\\${output.file.name}.map"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2625
			addLinkDescriptorCommand ($linkCommand, "false", "false", undef, undef, undef, undef, (0,1));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2626
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2627
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2628
        if ($BasicTrgType=~/^(DLL|EXE)/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2629
	        my $datalinkbase = "0x400000";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2630
			my $librarylist;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2631
			my $expr;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2632
			@ToolChainLibList = &GetLibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2633
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2634
			foreach $expr (@ToolChainLibList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2635
				$librarylist .= $expr.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2636
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2637
	        
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2638
  	        $datalinkbase = &main::DataLinkAddress if (&main::DataLinkAddress);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2639
	        $linkCommand = "$Link ".$oP.'bpabi '.$oP.'reloc '.$oP.'split '.$oP.'no_scanlib '.$oP.'datacompressor=off '.$oP."rw-base $datalinkbase "."$PlatOpt{Ld}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2640
			$linkCommand .= ' --dll --symver_soname --soname '.$LinkAs.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2641
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2642
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2643
	        if ($BasicTrgType=~/^DLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2644
	            # get the right object file for the entry point
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2645
	            my $ObjFile = "UC_DLL_.o";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2646
	            if ($FirstLib =~ /EDEV/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2647
		            $ObjFile = "D_ENTRY_.o";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2648
	            }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2649
	            if ($FirstLib =~ /EKLL/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2650
		            $ObjFile = "L_ENTRY_.o";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2651
	            }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2652
	            if ($FirstLib =~ /EEXT/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2653
		            $ObjFile = "X_ENTRY_.o";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2654
	            }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2655
	            if ($FirstLib =~ /EVAR/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2656
		            $ObjFile = "V_ENTRY_.o";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2657
	            }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2658
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2659
#		    If platform is a customization, take libs from parent directory.		   
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2660
		    if($IsCustomDll)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2661
		    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2662
		    
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2663
			$linkCommand .= $oP.'entry _E32Dll "'.$FirstLib.'('.$ObjFile.')"'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2664
					' "${target.data}\\'.$tempFilenameRoot.'.exp"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2665
			    
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2666
		    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2667
		    else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2668
		    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2669
		    # ARMV5 hardcoded here...
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2670
		    $linkCommand .= $oP.'entry _E32Dll "'.$FirstLib.'('.$ObjFile.')"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2671
		    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2672
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2673
	        } elsif ($BasicTrgType=~/^EXE$/o || $TrgType=~/^EXEXP$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2674
			    # get the right object file for the entry point
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2675
			    my $ObjFile = "UC_EXE_.o" ;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2676
			    if ($FirstLib =~ /KC_EXE/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2677
					$ObjFile = "K_ENTRY_.o";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2678
			    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2679
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2680
		    # Should this use $ParentPlat rather than hardcoded ARMV5 dir?
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2681
		   $linkCommand .= $oP.'entry _E32Startup "'.$FirstLib.'('.$ObjFile.')"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2682
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2683
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2684
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2685
			$linkCommand .= ' -o "${target.data}\\${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2686
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2687
			if ($BasicTrgType=~/^DLL$/o) { # Add the DLL stub library
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2688
				if($IsPlatCustomization) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2689
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2690
				if ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2691
				   $linkCommand .= ' "${var:KIT_EPOCROOT}\\EPOC32\RELEASE\\'.$ParentPlat.'\\'.$Bld.'\EDLLSTUB'.$RVCTVersion.'.LIB"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2692
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2693
				else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2694
				   $linkCommand .= ' "${var:KIT_EPOCROOT}\\EPOC32\RELEASE\\'.$ParentPlat.'\\'.$Bld.'\EDLLSTUB.LIB"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2695
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2696
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2697
				else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2698
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2699
				if ($RVCTMajorVersion == 2 && $RVCTMinorVersion < 2) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2700
				   $linkCommand .= ' "${var:KIT_EPOCROOT}\\EPOC32\RELEASE\ARMV5\\'.$Bld.'\EDLLSTUB'.$RVCTVersion.'.LIB"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2701
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2702
				else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2703
				   $linkCommand .= ' "${var:KIT_EPOCROOT}\\EPOC32\RELEASE\ARMV5\\'.$Bld.'\EDLLSTUB.LIB"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2704
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2705
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2706
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2707
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2708
			$linkCommand .= ' ${var:LIBS}';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2709
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2710
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2711
			my $runtimeLibs = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2712
			my $StaticRTLib = "usrt".$RVCTVersion;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2713
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2714
			# use ksrt for system code and for user ARM code
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2715
			$StaticRTLib = "ksrt".$RVCTVersion if ($SystemTrg);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2716
			$runtimeLibs .= $StaticRTLib.".lib" unless ($Trg =~ /(U|K)SRT/i || ($BasicTrgType=~/^LIB$/o));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2717
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2718
			unless ($ArmRT || ($BasicTrgType=~/^LIB$/o)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2719
				my $TargLib = "$ExportLibrary.lib";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2720
				$TargLib =~ s/\{(\d|a|b|c|d|e|f){8}\}//i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2721
				unless ($SystemTrg) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2722
					foreach (@RTLibList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2723
						$runtimeLibs .= " ".$_ unless ($_ =~ /$TargLib/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2724
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2725
			    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2726
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2727
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2728
			foreach (@ArmLibList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2729
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2730
				$runtimeLibs.= " ".$_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2731
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2732
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2733
			addLinkDescriptorSymbol ('${var:RUNTIME_LIBS}', $runtimeLibs);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2734
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2735
			$linkCommand .= ' --userlibpath "${var:KIT_EPOCROOT}\\EPOC32\RELEASE\ARMV5\\'.$Bld.'","${var:KIT_EPOCROOT}\\EPOC32\RELEASE\ARMV5\LIB" '.$oP.'via "${target.data}\\${output.file.root}_'.$Bld.'_objects.via" ${var:RUNTIME_LIBS} '.$librarylist.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2736
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2737
			addLinkDescriptorCommand ($linkCommand, undef, undef, undef, $FirstLib);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2738
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2739
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2740
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2741
		#### Create the .sym file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2742
		$linkCommand = 'cmd.exe /C copy "${target.data}\\${output.file.name}" "${output}\\${output.file.root}.sym"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2743
		addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2744
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2745
		#### copy the project .def file for prep
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2746
		if ($DefFile and !$NoExportLibrary)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2747
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2748
			unless (&main::ExportUnfrozen)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2749
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2750
        	$linkCommand = 'cmd.exe /C copy "${var:DEF_FILE}" "${target.data}\\${var:IMPORT_LIBRARY_NO_EXT}.prep.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2751
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2752
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2753
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2754
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2755
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2756
		#### ELF2E32 POST-LINK COMMAND ####
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2757
		# Section needs to be generic for BPABI (e.g. GCCE & ARMV5_ABIV2)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2758
		$linkCommand  = '${var:KIT_EPOCROOT}\\epoc32\\tools\\elf2e32.exe ';		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2759
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2760
		# Change - exexps are allowed data, but they look like dlls to elftran....
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2761
		if (&main::AllowDllData || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2762
			$linkCommand .= ' --dlldata';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2763
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2764
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2765
		if (&main::DataLinkAddress) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2766
			$linkCommand .= ' --datalinkaddress=',&main::DataLinkAddress;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2767
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2768
		if (&main::FixedProcess) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2769
			$linkCommand .=	' --fixedaddress';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2770
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2771
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2772
		$linkCommand .= ' --sid='.&main::SecureId();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2773
		$linkCommand .= ' --version='. &Genutl_VersionToUserString(%Version);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2774
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2775
		if (&main::HeapSize) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2776
			my %HeapSize=&main::HeapSize;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2777
			$linkCommand.=' --heap '.$HeapSize{Min} .','.$HeapSize{Max};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2778
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2779
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2780
		if (&main::ProcessPriority) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2781
			$linkCommand .=	' --priority='.&main::ProcessPriority;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2782
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2783
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2784
		if (&main::StackSize) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2785
			$linkCommand .= ' --stack='.&main::StackSize;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2786
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2787
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2788
		my $i=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2789
		foreach (@UidList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2790
			$linkCommand .= " --uid$i=$_";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2791
			$i++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2792
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2793
		if (&main::VendorId) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2794
			$linkCommand .= ' --vid='.&main::VendorId;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2795
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2796
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2797
		$linkCommand .= ' --capability='.&main::Capability;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2798
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2799
		# ARMFPU only currently supported for RVCT BPABI builds
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2800
		if (&main::ARMFPU && (&main::ARMFPU =~ /^VFPV2$/i)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2801
			$linkCommand .= ' --fpu=vfpv2'
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2802
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2803
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2804
			$linkCommand .= ' --fpu=softvfp'
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2805
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2806
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2807
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2808
		if(($BasicTrgType=~/^DLL/ && $TrgType!~/^DLL/ ) || $TrgType=~/^EXEXP/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2809
	 		$linkCommand .= ' --targettype='.$TrgType;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2810
 		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2811
 		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2812
 			$linkCommand .= ' --targettype='.$BasicTrgType;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2813
 		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2814
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2815
		$linkCommand .= ' --output="${output}\\${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2816
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2817
		my $warningMessage;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2818
		if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2819
			if ($DefFile and !$NoExportLibrary) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2820
				$linkCommand .= ' --definput="${target.data}\\${var:IMPORT_LIBRARY_NO_EXT}.prep.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2821
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2822
			$linkCommand .= ' --dso=';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2823
			$linkCommand .= '"${var:KIT_EPOCROOT}\\EPOC32\\RELEASE\\ARMV5\\LIB\\${var:IMPORT_LIBRARY}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2824
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2825
			$linkCommand .= ' --defoutput=';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2826
			$linkCommand .= '"${target.data}\\${var:IMPORT_LIBRARY_NO_EXT}.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2827
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2828
			if (&main::ExportUnfrozen) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2829
				$warningMessage = $exportUnfrozenWarningMessage;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2830
				$linkCommand .= ' --unfrozen';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2831
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2832
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2833
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2834
		$linkCommand .= ' --elfinput="${target.data}\\${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2835
		$linkCommand .= ' --linkas='.$LinkAs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2836
		#Change - LIB path is hardcoded here...
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2837
		$linkCommand .= ' --libpath="${var:KIT_EPOCROOT}\\EPOC32\\RELEASE\\ARMV5\\LIB"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2838
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2839
        if ($BasicTrgType=~/^DLL$/o && $TrgType!~/^DLL/){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2840
			my $Export;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2841
			my $Ordinal=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2842
			foreach $Export (&main::Exports)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2843
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2844
				if ($Ordinal eq 1) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2845
					$linkCommand .= ' --sysdef=';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2846
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2847
				elsif ($Ordinal ne 1) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2848
					$linkCommand .= ';';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2849
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2850
					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2851
				$linkCommand .= "$Export,".$Ordinal;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2852
				$Ordinal++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2853
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2854
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2855
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2856
		addLinkDescriptorCommand ($linkCommand, undef, undef, undef, undef, $warningMessage);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2857
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2858
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2859
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2860
		# copy def file output
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2861
		if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2862
			$linkCommand = 'cmd.exe /C copy  "${target.data}\\${var:IMPORT_LIBRARY_NO_EXT}.def" "${Project}\${var:IMPORT_LIBRARY_NO_EXT}.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2863
			addLinkDescriptorCommand($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2864
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2865
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2866
		# copy the import lib (dso) created
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2867
		if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2868
			if ($DefFile and !$NoExportLibrary) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2869
				$linkCommand = 'cmd.exe /C copy ${var:KIT_EPOCROOT}\\EPOC32\\RELEASE\\ARMV5\\LIB\\${var:IMPORT_LIBRARY} ${var:KIT_EPOCROOT}\\EPOC32\\RELEASE\\ARMV5\\LIB\\${output.file.root}.dso';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2870
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2871
			addLinkDescriptorCommand($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2872
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2873
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2874
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2875
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2876
#########################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2877
# GCC library generation and link stage #
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2878
#########################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2879
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2880
	elsif ($Plat eq "ARM4")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2881
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2882
		# Generate library
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2883
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2884
		if ($DefFile and !$NoExportLibrary)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2885
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2886
			unless (&main::ExportUnfrozen)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2887
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2888
				$linkCommand = 'perl.exe -S prepdef.pl "${var:DEF_FILE}" "${target.data}\\'.$tempFilenameRoot.'.prep.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2889
				addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2890
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2891
				$linkCommand = "$Dlltool $PlatOpt{Dlltool}".' --output-lib "${var:KIT_EPOCROOT}'.kitRelativePath($LibPath).'${var:IMPORT_LIBRARY}" --def "'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2892
						'${target.data}\\'.$tempFilenameRoot.'.prep.def" --dllname "'.$LinkAs.'"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2893
				addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2894
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2895
				if ($ExtraExportLibrary)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2896
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2897
					$linkCommand = $copyCommand.'"${var:KIT_EPOCROOT}'.kitRelativePath($LibPath).'${var:IMPORT_LIBRARY}" '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2898
									'"${var:KIT_EPOCROOT}'.kitRelativePath($LibPath).$ExtraExportLibrary.'.lib"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2899
					addLinkDescriptorCommand ($linkCommand,"false", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2900
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2901
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2902
				foreach (@CompatibleABIs)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2903
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2904
					$linkCommand = "$Dlltool $ABIDlltool{$_}".' --output-lib "${var:KIT_EPOCROOT}'.kitRelativePath($ABILibPath{$_}).'UREL\\${var:IMPORT_LIBRARY}" --def "'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2905
							'${target.data}\\'.$tempFilenameRoot.'.prep.def" --dllname "'.$LinkAs.'"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2906
					addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2907
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2908
					if ($ExtraExportLibrary)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2909
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2910
						$linkCommand = $copyCommand.'"${var:KIT_EPOCROOT}'.kitRelativePath($ABILibPath{$_}).'UREL\\${var:IMPORT_LIBRARY}" '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2911
										'"${var:KIT_EPOCROOT}'.kitRelativePath($ABILibPath{$_}).'UREL\\'.$ExtraExportLibrary.'.lib"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2912
						addLinkDescriptorCommand ($linkCommand,"false", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2913
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2914
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2915
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2916
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2917
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2918
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2919
		# TARGET *.IN
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2920
		#------------
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2921
		$linkCommand = $deleteCommand.'"${target.data}\\${output.file.root}.in"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2922
		addLinkDescriptorCommand ($linkCommand, "false", "false", undef, undef, undef, undef, (0,1));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2923
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2924
		$linkCommand = 'ar.exe cr "${target.data}\\${output.file.root}.in" ${var:LINK_OBJS}';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2925
		addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2926
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2927
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2928
		# Perform Link
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2929
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2930
	#	Establish the entry point symbol
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2931
		my $EntrySymbol;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2932
		if ($BasicTrgType=~/^DLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2933
			$EntrySymbol = '_E32Dll';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2934
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2935
		elsif ($BasicTrgType=~/^EXE$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2936
			$EntrySymbol = '_E32Startup';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2937
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2938
		my $AbsentSubst = '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2939
		if ($EntrySymbol) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2940
			$AbsentSubst = " -absent $EntrySymbol";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2941
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2942
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2943
		if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2944
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2945
	#		generate a .DEF file from the objects and static libraries
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2946
			$linkCommand = "$Dlltool $PlatOpt{Dlltool} --output-def ".'"${target.data}\\'.$tempFilenameRoot.'.inf" "${target.data}\\${output.file.root}.in"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2947
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2948
			foreach (@StatLibList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2949
				$linkCommand .= ' "${var:KIT_EPOCROOT}'.kitRelativePath($StatLinkPath).$_.'"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2950
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2951
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2952
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2953
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2954
	#		reorder the .DEF file taking frozen exports into account if there are any
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2955
	#			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
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2956
			$linkCommand = 'perl.exe -S makedef.pl -Deffile "${target.data}\\'.$tempFilenameRoot.'.inf" '.$AbsentSubst;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2957
			if (-e $DefFile) { # effectively "if project frozen ..."
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2958
				$linkCommand .= " -Frzfile \"".'${var:DEF_FILE}'."\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2959
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2960
			# freeze ordinals, a maximum of 2, for polymorphic dlls
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2961
			my $Ordinal;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2962
			my $Num=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2963
			foreach $Ordinal (&main::Exports) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2964
				$linkCommand .= " -$Num $Ordinal";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2965
				$Num++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2966
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2967
			$linkCommand .= ' "${target.data}\\'.$tempFilenameRoot.'.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2968
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2969
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2970
	#		delete the unordered definition file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2971
			$linkCommand = $deleteCommand.'"${target.data}\\'.$tempFilenameRoot.'.inf"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2972
			addLinkDescriptorCommand ($linkCommand, "false", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2973
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2974
	#		generate an export object from the ordered .DEF file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2975
			$linkCommand = "$Dlltool $PlatOpt{Dlltool} --def".' "${target.data}\\'.$tempFilenameRoot.'.def"'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2976
				' --output-exp "${target.data}\\'.$tempFilenameRoot.'.exp"'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2977
				" --dllname \"$LinkAs\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2978
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2979
			my $warningMessage;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2980
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2981
			if (&main::ExportUnfrozen) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2982
				$warningMessage = $exportUnfrozenWarningMessage;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2983
				$linkCommand .= ' --output-lib "${var:KIT_EPOCROOT}'.kitRelativePath($LibPath).'${var:IMPORT_LIBRARY}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2984
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2985
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2986
			addLinkDescriptorCommand ($linkCommand, undef, undef, undef, undef, $warningMessage);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2987
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2988
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2989
	#	call ld to do base relocations (and dll exports)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2990
		if ($BasicTrgType=~/^(DLL|EXE)/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2991
			$linkCommand = "$Link $PlatOpt{Ld} -s";	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2992
			if ($BasicTrgType=~/^DLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2993
				$linkCommand .= " $PlatOpt{Entry} $EntrySymbol -u $EntrySymbol ".'"${target.data}\\'.$tempFilenameRoot.'.exp" --dll ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2994
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2995
			elsif ($BasicTrgType=~/^EXE$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2996
				$linkCommand .= " $PlatOpt{Entry} $EntrySymbol -u $EntrySymbol ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2997
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2998
	#		--whole-archive is required here apparently because of a defect in the gcc toolchain
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2999
	#		the flag can probably be removed with a later version of gcc
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3000
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3001
			$linkCommand .= '--base-file "${target.data}\\${output.file.root}.bas" -o "${target.data}\\${output.file.name}" '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3002
				'${var:FIRST_LIB} --whole-archive "${target.data}\\${output.file.root}.in" '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3003
				"--no-whole-archive";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3004
			$linkCommand .= ' ${var:COMMON_LINK_FLAGS} ${var:LIBS}';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3005
			addLinkDescriptorCommand ($linkCommand, undef, undef, undef, $FirstLib);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3006
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3007
	#		delete temporary files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3008
			if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3009
				$linkCommand = $deleteCommand.'"${target.data}\\'.$tempFilenameRoot.'.exp"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3010
				addLinkDescriptorCommand ($linkCommand, "false", "false", undef, undef, undef, undef, (0,1));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3011
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3012
			$linkCommand = $deleteCommand.'"${target.data}\\${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3013
			addLinkDescriptorCommand ($linkCommand, "false", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3014
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3015
	#		call dlltool to do base relocations (and dll exports)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3016
			$linkCommand = "$Dlltool $PlatOpt{Dlltool} ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3017
			if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3018
				$linkCommand .= '--def "${target.data}\\'.$tempFilenameRoot.'.def" '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3019
					"--dllname \"$LinkAs\" ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3020
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3021
			$linkCommand .= '--base-file "${target.data}\\${output.file.root}.bas" '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3022
				'--output-exp "${target.data}\\'.$tempFilenameRoot.'.exp" ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3023
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3024
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3025
	#		delete temporary files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3026
			$linkCommand = $deleteCommand.'"${target.data}\\${output.file.root}.bas"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3027
			addLinkDescriptorCommand ($linkCommand, "false", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3028
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3029
	#		call ld to link the target
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3030
			$linkCommand = "$Link $PlatOpt{Ld}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3031
			if ($Bld=~/^U?REL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3032
				$linkCommand .= " -s";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3033
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3034
			if ($BasicTrgType=~/^DLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3035
				$linkCommand .= " $PlatOpt{Entry} $EntrySymbol -u $EntrySymbol --dll ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3036
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3037
			elsif ($BasicTrgType=~/^EXE$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3038
				$linkCommand .= " $PlatOpt{Entry} $EntrySymbol -u $EntrySymbol ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3039
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3040
	#		--whole-archive is required here apparently because of a defect in the gcc toolchain
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3041
	#		the flag can probably be removed with a later version of gcc
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3042
			$linkCommand .= '"${target.data}\\'.$tempFilenameRoot.'.exp" '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3043
				'-Map "${output}\\${output.file.name}.map" -o "${target.data}\\${output.file.name}" '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3044
				'${var:FIRST_LIB} --whole-archive "${target.data}\\${output.file.root}.in" '.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3045
				"--no-whole-archive";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3046
			$linkCommand .= ' ${var:LIBS}';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3047
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3048
			if ($BasicTrgType=~/^LIB$/o) {				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3049
			addLinkDescriptorCommand ($linkCommand, undef, undef, undef, undef);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3050
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3051
			else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3052
			addLinkDescriptorCommand ($linkCommand, undef, undef, undef, $FirstLib);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3053
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3054
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3055
	#		delete temporary files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3056
			$linkCommand = $deleteCommand.'"${target.data}\\'.$tempFilenameRoot.'.exp"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3057
			addLinkDescriptorCommand ($linkCommand, "false", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3058
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3059
			if ($Bld=~/DEB$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3060
				$linkCommand = $Objcopy.' -X "${target.data}\\${output.file.name}" "${output}\\${output.file.root}.sym"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3061
				addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3062
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3063
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3064
			$linkCommand = "petran.exe $PlatOpt{Petran} -version ". &Genutl_VersionToUserString(%Version). " -sid ". &main::SecureId(). ' "${target.data}\\${output.file.name}" "${output}\\${output.file.name}" ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3065
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3066
			if (&main::CompressTarget) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3067
				$linkCommand .= ' -nocompress';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3068
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3069
			if (&main::AllowDllData) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3070
				$linkCommand .= ' -allow';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3071
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3072
			if (not &main::CallDllEntryPoints) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3073
				$linkCommand .= ' -nocall';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3074
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3075
			if (&main::DataLinkAddress) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3076
				$linkCommand .= ' -datalinkaddress '.&main::DataLinkAddress;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3077
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3078
			if (&main::FixedProcess) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3079
				$linkCommand .= ' -fixed';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3080
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3081
			if (&main::HeapSize) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3082
				my %HeapSize=&main::HeapSize;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3083
				$linkCommand .= ' -heap '.$HeapSize{Min}.' '.$HeapSize{Max};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3084
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3085
			if (&main::ProcessPriority) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3086
				$linkCommand .= ' -priority '.&main::ProcessPriority;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3087
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3088
			if (&main::StackSize) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3089
				$linkCommand .= ' -stack '.&main::StackSize;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3090
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3091
			my $i=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3092
			foreach (@UidList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3093
				$linkCommand .= " -uid$i $_";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3094
				$i++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3095
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3096
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3097
			$linkCommand .= ' -capability '.&main::Capability;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3098
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3099
			if (&main::VendorId) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3100
			$linkCommand .= ' -vid '.&main::VendorId;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3101
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3102
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3103
			addLinkDescriptorCommand ($linkCommand, "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3104
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3105
			$linkCommand = $deleteCommand.'"${target.data}\\${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3106
			addLinkDescriptorCommand ($linkCommand, "false", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3107
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3108
		elsif ($BasicTrgType=~/^LIB$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3109
			$linkCommand = $copyCommand.'"${target.data}\\${output.file.root}.in" "${var:KIT_EPOCROOT}'.kitRelativePath($StatLinkPath).'${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3110
			addLinkDescriptorCommand ($linkCommand,"false", "false");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3111
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3112
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3113
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3114
###############################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3115
# GCCE library generation and link stage      #
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3116
# GCCE only supported for CW 3.1 and greater #
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3117
###############################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3118
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3119
	elsif ($Plat eq "GCCE" || $CustGCCE)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3120
	{	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3121
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3122
        if ($BasicTrgType=~/^LIB$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3123
	        $linkCommand = 'ar cr ${output}\\${output.file.name} ${var:LINK_OBJS} ${var:LIBS}';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3124
	        addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3125
         }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3126
         
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3127
		elsif ($BasicTrgType=~/^(DLL|EXE)/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3128
        
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3129
        $linkCommand = 'arm-none-symbianelf-ld';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3130
        my $GCCE_LibGCCPath = ' -L';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3131
        $GCCE_LibGCCPath .= '"'.GetGCCELibPath("-print-file-name=libsupc++.a").'"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3132
        $GCCE_LibGCCPath .= ' -L';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3133
        $GCCE_LibGCCPath .= '"'.GetGCCELibPath("-print-libgcc-file-name").'"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3134
		$linkCommand .= $GCCE_LibGCCPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3135
		$linkCommand .=	' ${var:COMMON_LINK_FLAGS}';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3136
		$linkCommand .= ' --target1-abs --no-undefined -nostdlib -Ttext 0x8000 -Tdata 0x400000';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3137
		$linkCommand .= ' -shared --default-symver -soname '.$LinkAs." ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3138
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3139
		if ($Bld=~/REL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3140
			$linkCommand .= ' -Map "${output}\\${output.file.name}.map"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3141
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3142
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3143
		if ($BasicTrgType=~/^DLL$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3144
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3145
			$linkCommand .= ' --entry _E32Dll -u _E32Dll';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3146
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3147
		elsif ($BasicTrgType=~/^EXE$/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3148
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3149
			$linkCommand .= ' --entry _E32Startup -u _E32Startup';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3150
			}		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3151
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3152
		$linkCommand .= ' ${var:FIRST_LIB}';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3153
		$linkCommand .= ' -o "${target.data}\\${output.file.name}" ${var:LINK_OBJS} ${var:LIBS}';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3154
		$linkCommand .= ' -lsupc++ -lgcc'.' '.$linkeropts; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3155
		addLinkDescriptorCommand ($linkCommand, undef, undef, undef, $FirstLib);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3156
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3157
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3158
		$linkCommand = 'cmd.exe /C copy "${target.data}\\${output.file.name}" "${output}\\${output.file.root}.sym"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3159
		addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3160
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3161
		# copy the project .def file for prep
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3162
		if ($DefFile and !$NoExportLibrary)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3163
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3164
			unless (&main::ExportUnfrozen)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3165
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3166
        	$linkCommand = 'cmd.exe /C copy "${var:DEF_FILE}" "${target.data}\\${var:IMPORT_LIBRARY_NO_EXT}.prep.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3167
			addLinkDescriptorCommand ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3168
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3169
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3170
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3171
		$linkCommand  = '${var:KIT_EPOCROOT}\\epoc32\\tools\\elf2e32.exe ';		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3172
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3173
		# Change - exexps are allowed data, but they look like dlls to elftran....
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3174
		if (&main::AllowDllData || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3175
			$linkCommand .= ' --dlldata';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3176
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3177
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3178
		if (&main::DataLinkAddress) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3179
			$linkCommand .= ' --datalinkaddress=',&main::DataLinkAddress;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3180
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3181
		if (&main::FixedProcess) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3182
			$linkCommand .=	' --fixedaddress';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3183
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3184
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3185
		$linkCommand .= ' --sid='.&main::SecureId();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3186
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3187
		if (&main::HeapSize) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3188
			my %HeapSize=&main::HeapSize;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3189
			$linkCommand.=' --heap '.$HeapSize{Min} .','.$HeapSize{Max};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3190
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3191
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3192
		if (&main::ProcessPriority) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3193
			$linkCommand .=	' --priority='.&main::ProcessPriority;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3194
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3195
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3196
		if (&main::StackSize) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3197
			$linkCommand .= ' --stack='.&main::StackSize;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3198
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3199
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3200
		my $i=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3201
		foreach (@UidList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3202
			$linkCommand .= " --uid$i=$_";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3203
			$i++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3204
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3205
		if (&main::VendorId) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3206
			$linkCommand .= ' --vid='.&main::VendorId;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3207
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3208
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3209
		$linkCommand .= ' --capability='.&main::Capability;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3210
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3211
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3212
		if(($BasicTrgType=~/^DLL/ && $TrgType!~/^DLL/ ) || $TrgType=~/^EXEXP/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3213
	 		$linkCommand .= ' --targettype='.$TrgType;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3214
 		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3215
 		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3216
 			$linkCommand .= ' --targettype='.$BasicTrgType;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3217
 		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3218
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3219
		$linkCommand .= ' --output="${output}\\${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3220
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3221
		my $warningMessage;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3222
		if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3223
			if ($DefFile and !$NoExportLibrary) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3224
				$linkCommand .= ' --definput="${target.data}\\${var:IMPORT_LIBRARY_NO_EXT}.prep.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3225
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3226
			$linkCommand .= ' --dso=';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3227
			$linkCommand .= '"${var:KIT_EPOCROOT}\\EPOC32\\RELEASE\\ARMV5\\LIB\\${var:IMPORT_LIBRARY}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3228
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3229
			$linkCommand .= ' --defoutput=';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3230
			$linkCommand .= '"${target.data}\\${var:IMPORT_LIBRARY_NO_EXT}.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3231
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3232
			if (&main::ExportUnfrozen) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3233
				$warningMessage = $exportUnfrozenWarningMessage;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3234
				$linkCommand .= ' --unfrozen';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3235
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3236
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3237
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3238
		$linkCommand .= ' --elfinput="${target.data}\\${output.file.name}"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3239
		$linkCommand .= ' --linkas='.$LinkAs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3240
		#Change - LIB path is hardcoded here...
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3241
		$linkCommand .= ' --libpath="${var:KIT_EPOCROOT}\\EPOC32\\RELEASE\\ARMV5\\LIB"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3242
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3243
        if ($BasicTrgType=~/^DLL$/o && $TrgType!~/^DLL/){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3244
			my $Export;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3245
			my $Ordinal=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3246
			foreach $Export (&main::Exports)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3247
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3248
				if ($Ordinal eq 1) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3249
					$linkCommand .= ' --sysdef=';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3250
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3251
				elsif ($Ordinal ne 1) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3252
					$linkCommand .= ';';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3253
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3254
					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3255
				$linkCommand .= "$Export,".$Ordinal;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3256
				$Ordinal++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3257
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3258
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3259
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3260
		addLinkDescriptorCommand ($linkCommand, undef, undef, undef, undef, $warningMessage);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3261
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3262
		} # end...elsif if ($BasicTrgType=~/^(DLL|EXE)/o)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3263
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3264
		# copy def file output
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3265
		if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3266
			$linkCommand = 'cmd.exe /C copy  "${target.data}\\${var:IMPORT_LIBRARY_NO_EXT}.def" "${Project}\${var:IMPORT_LIBRARY_NO_EXT}.def"';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3267
			addLinkDescriptorCommand($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3268
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3269
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3270
		# copy the import lib (dso) created
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3271
		if ($BasicTrgType=~/^DLL$/o || $TrgType=~/^EXEXP$/o || $TrgType=~/^EXEDLL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3272
			if ($DefFile and !$NoExportLibrary) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3273
				$linkCommand = 'cmd.exe /C copy ${var:KIT_EPOCROOT}\\EPOC32\\RELEASE\\ARMV5\\LIB\\${var:IMPORT_LIBRARY} ${var:KIT_EPOCROOT}\\EPOC32\\RELEASE\\ARMV5\\LIB\\${output.file.root}.dso';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3274
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3275
			addLinkDescriptorCommand($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3276
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3277
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3278
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3279
	} # end  GCCE link stage... elsif ($Plat eq "GCCE")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3280
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3281
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3282
	if ($addHeaders)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3283
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3284
		# Ideally we would do this for all targets, both UREL and UDEB.  This would,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3285
		# however, be very slow - so we just do it for the first target we come to.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3286
		my $cpp = &PreprocessorToUseExe();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3287
		my $cppCommandLine = "$cpp.EXE -M -MG -nostdinc ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3288
		my $preInclude = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3289
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3290
		if (($Plat eq "ARMV5" || $Plat eq "ARMV5_ABIV2" || $Plat eq "ARMV5_ABIV1" || $Plat eq "GCCE" || $IsPlatCustomization) && $PrefixFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3291
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3292
			$preInclude = $PrefixFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3293
			$preInclude =~ s/^.*://;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3294
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3295
		elsif($VariantFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3296
			{	    
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3297
		    $preInclude = $VariantFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3298
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3299
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3300
		$cppCommandLine .= '-include '.Path_RltToWork($preInclude).' ' if $preInclude;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3301
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3302
		foreach (&main::UserIncPaths, &main::SysIncPaths)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3303
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3304
			$cppCommandLine .= '-I '.&Path_Chop(&Path_RltToWork($_)).' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3305
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3306
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3307
		foreach (@MacroList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3308
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3309
			#ARMCC requires escaped '"', but CPP doesn't like them
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3310
			s/\\\"/\"/g if /^__PRODUCT_INCLUDE__/; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3311
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3312
			$cppCommandLine .= '-D'.$_.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3313
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3314
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3315
		my $SourceStructRef=&main::SourceStructRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3316
		my %localIncludes;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3317
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3318
		foreach my $SourceRef (@$SourceStructRef)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3319
	   		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3320
			$file = Path_RltToWork(($$SourceRef{SrcPath}.$$SourceRef{CurFile}));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3321
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3322
			# ensure the case of the extension is what GCC expects
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3323
			$file =~ s/\.CPP$/.cpp/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3324
			$file =~ s/\.C$/.c/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3325
			$file =~ s/\.s$/.S/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3326
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3327
			open CPPPIPE,$cppCommandLine.$file." |" or die "ERROR: Can't invoke CPP.EXE\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3328
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3329
			while (<CPPPIPE>)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3330
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3331
				#convert any Unix slashes found in CPP output to DOS slashes
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3332
				s/\//\\/g;	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3333
				while (/\.(\.\\|\\){1}\S+\.(hrh|h|inl){1}/gi)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3334
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3335
					my $file = $&;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3336
					my $filePath = &main::Path_Split('Path',$file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3337
						
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3338
					# Ignore files that are clearly not local to the project
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3339
					next if ($filePath =~ /\\epoc32\\/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3340
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3341
					# Ignore files that are #included with intermediate directories -
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3342
					# we can't guarantee these will be on an Access Path.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3343
					next if ($filePath =~ /\w+\\\.\./);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3344
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3345
					# Finally confirm that the file we have is definitely on an Access Path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3346
					my $presentOnAccessPath = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3347
					foreach my $accessPath (&main::UserIncPaths, &main::SysIncPaths)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3348
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3349
						my $accessPathCompare = $accessPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3350
						$accessPathCompare =~ s/\\/_/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3351
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3352
						my $filePathCompare = $filePath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3353
						$filePathCompare =~ s/(\.\\|\.\.\\)//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3354
						$filePathCompare =~ s/\\/_/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3355
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3356
						$presentOnAccessPath = 1 if ($accessPathCompare =~ /$filePathCompare$/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3357
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3358
					next if (!$presentOnAccessPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3359
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3360
					# Maintain availability of original case of filename using a lc keyed hash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3361
					my $localInclude = &main::Path_Split('Base',$file).&main::Path_Split('Ext',$file);					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3362
					$localIncludes{lc ($localInclude)} = $localInclude unless (!-e $file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3363
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3364
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3365
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3366
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3367
		foreach my $localInclude (sort keys %localIncludes)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3368
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3369
			addFile($localIncludes{$localInclude}, "Text", 0, "", "Headers");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3370
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3371
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3372
		$addHeaders = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3373
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3374
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3375
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3376
	# Add DOCUMENT specified files that we know we can add - we only add these for one target,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3377
	# as they should be identical through-out
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3378
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3379
	if ($addDocuments)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3380
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3381
		foreach my $document (@DocList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3382
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3383
			# Only add files as Documents if they haven't already been added to
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3384
			# the target (it's not possible to have duplicate entries) and if they
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3385
			# have an extension we know about.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3386
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3387
			next if (grep (/$document/i, @addedFiles));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3388
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3389
			my $extension = $document;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3390
			$extension =~ s/^.*\.//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3391
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3392
			next if (!grep (/$extension/i, @compatibleDOCUMENTExtensions));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3393
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3394
			addFile($document, "Text", "", "", "Documents");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3395
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3396
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3397
		$addDocuments = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3398
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3399
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3400
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3401
	# Create the link descriptor file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3402
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3403
	$xmlLinkDescriptorCommandParent->addText("\n\t\t\t");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3404
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3405
	if ($CW_major_version >= 3)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3406
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3407
		$xmlLinkDescriptorDumpFileParent->addText("\n\t\t\t");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3408
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3409
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3410
	&main::CreateExtraFile("${ExtraFilesPath}$linkDescriptorFile", $xmlLinkDescriptorDoc->toString);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3411
	addFile($linkDescriptorFile, "Text", "", "", "Link");	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3412
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3413
	# Apply the changed settings
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3414
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3415
	my $settinglist = $xmlTarget->getElementsByTagName("SETTINGLIST",0)->item(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3416
	my @settingnodes = $settinglist->getElementsByTagName("SETTING",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3417
	foreach my $setting (@settingnodes)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3418
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3419
		my $element = $setting->getElementsByTagName("NAME",0)->item(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3420
		my $settingname = $element->getFirstChild->getData();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3421
		my $replacement = $changedsettings{$settingname};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3422
		if (defined $replacement) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3423
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3424
			if ($replacement eq "{}")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3425
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3426
				if ($settingname eq "UserSearchPaths")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3427
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3428
					&addUserSearchPaths($setting);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3429
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3430
				elsif ($settingname eq "SystemSearchPaths")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3431
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3432
					&addSystemSearchPaths($setting);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3433
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3434
				elsif ($settingname eq "UserSourceTrees")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3435
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3436
					&addSourceTrees($setting);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3437
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3438
				elsif ($settingname eq "FileList")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3439
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3440
					&addDownloadFileList($setting, @ResourceDownloadList);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3441
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3442
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3443
			elsif ($replacement =~ /^{(.+)}(.+)$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3444
				{					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3445
				&changePathSetting($setting,$1,$2);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3446
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3447
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3448
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3449
				&changeValue($setting,$replacement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3450
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3451
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3452
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3453
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3454
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3455
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3456
sub addLinkDescriptorCommand($$;$;$;$;$;$;$;) {		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3457
	my ($linkCommand, $parseStdOut, $parseStdErr, $outputParser, $firstLibProcessing,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3458
	    $linkWarning, $linkInformation, @successCodes) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3459
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3460
	my $structIndent = "\n\t\t\t\t";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3461
	my $settingIndent = "$structIndent\t";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3462
	my $simpleIndent = "$settingIndent\t";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3463
	my $successCodeArrayIndent = $simpleIndent;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3464
	my $successCodeSimpleIndent = "$successCodeArrayIndent\t";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3465
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3466
	my $structElement = new XML::DOM::Element($xmlLinkDescriptorDoc,"struct");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3467
	$xmlLinkDescriptorCommandParent->addText("$structIndent");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3468
	$xmlLinkDescriptorCommandParent->appendChild ($structElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3469
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3470
	my $settingElementTemplate = new XML::DOM::Element($xmlLinkDescriptorDoc,"setting");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3471
	$settingElementTemplate->setAttribute("uuid-alias", ".");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3472
	my $simpleElementTemplate = new XML::DOM::Element($xmlLinkDescriptorDoc,"simple");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3473
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3474
	my $settingElement;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3475
	my $simpleElement;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3476
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3477
	$settingElement = $settingElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3478
	$simpleElement = $simpleElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3479
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3480
	$settingElement->setAttribute ("entry", "linkCommand");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3481
	$structElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3482
	$structElement->appendChild ($settingElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3483
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3484
	$simpleElement->addText ($linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3485
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3486
	$settingElement->addText ($simpleIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3487
	$settingElement->appendChild ($simpleElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3488
	$settingElement->addText($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3489
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3490
	if (defined $parseStdOut)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3491
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3492
		$settingElement = $settingElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3493
		$simpleElement = $simpleElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3494
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3495
		$settingElement->setAttribute("entry", "parseStdOut");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3496
		$simpleElement->addText($parseStdOut);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3497
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3498
		$structElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3499
		$structElement->appendChild ($settingElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3500
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3501
		$settingElement->addText ($simpleIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3502
		$settingElement->appendChild ($simpleElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3503
		$settingElement->addText($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3504
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3505
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3506
	if (defined $parseStdErr)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3507
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3508
		$settingElement = $settingElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3509
		$simpleElement = $simpleElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3510
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3511
		$settingElement->setAttribute("entry", "parseStdErr");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3512
		$simpleElement->addText($parseStdErr);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3513
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3514
		$structElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3515
		$structElement->appendChild ($settingElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3516
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3517
		$settingElement->addText ($simpleIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3518
		$settingElement->appendChild ($simpleElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3519
		$settingElement->addText($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3520
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3521
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3522
	if (defined $outputParser)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3523
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3524
		$settingElement = $settingElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3525
		$simpleElement = $simpleElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3526
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3527
		$settingElement->setAttribute("entry", "outputParser");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3528
		$simpleElement->addText($outputParser);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3529
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3530
		$structElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3531
		$structElement->appendChild ($settingElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3532
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3533
		$settingElement->addText ($simpleIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3534
		$settingElement->appendChild ($simpleElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3535
		$settingElement->addText($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3536
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3537
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3538
	if (defined $firstLibProcessing)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3539
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3540
		$settingElement = $settingElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3541
		$simpleElement = $simpleElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3542
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3543
		$settingElement->setAttribute("entry", "firstLibProcessing");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3544
		$simpleElement->addText($firstLibProcessing);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3545
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3546
		$structElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3547
		$structElement->appendChild ($settingElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3548
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3549
		$settingElement->addText ($simpleIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3550
		$settingElement->appendChild ($simpleElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3551
		$settingElement->addText($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3552
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3553
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3554
	if (defined $linkWarning)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3555
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3556
		$settingElement = $settingElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3557
		$simpleElement = $simpleElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3558
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3559
		$settingElement->setAttribute("entry", "linkWarning");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3560
		$simpleElement->addText($linkWarning);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3561
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3562
		$structElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3563
		$structElement->appendChild ($settingElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3564
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3565
		$settingElement->addText ($simpleIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3566
		$settingElement->appendChild ($simpleElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3567
		$settingElement->addText($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3568
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3569
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3570
	if (defined $linkInformation)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3571
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3572
		$settingElement = $settingElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3573
		$simpleElement = $simpleElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3574
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3575
		$settingElement->setAttribute("entry", "linkInformation");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3576
		$simpleElement->addText($linkInformation);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3577
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3578
		$structElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3579
		$structElement->appendChild ($settingElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3580
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3581
		$settingElement->addText ($simpleIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3582
		$settingElement->appendChild ($simpleElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3583
		$settingElement->addText($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3584
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3585
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3586
	if (@successCodes)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3587
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3588
		$settingElement = $settingElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3589
		$settingElement->setAttribute("entry", "successCodes");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3590
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3591
		my $arrayElement = new XML::DOM::Element($xmlLinkDescriptorDoc,"array");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3592
		$arrayElement->setAttribute("inheritance", "none");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3593
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3594
		foreach my $successCode (@successCodes)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3595
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3596
			$simpleElement = $simpleElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3597
			$simpleElement->addText($successCode);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3598
			$arrayElement->addText ($successCodeSimpleIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3599
			$arrayElement->appendChild ($simpleElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3600
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3601
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3602
		$arrayElement->addText ($successCodeArrayIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3603
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3604
		$settingElement->addText ($successCodeArrayIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3605
		$settingElement->appendChild ($arrayElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3606
		$settingElement->addText($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3607
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3608
		$structElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3609
		$structElement->appendChild ($settingElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3610
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3611
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3612
	$structElement->addText($structIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3613
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3614
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3615
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3616
sub addLinkDescriptorSymbol ($$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3617
	my ($symbolName, $symbolValue) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3618
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3619
	my $structIndent = "\n\t\t\t\t";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3620
	my $settingIndent = "$structIndent\t";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3621
	my $simpleIndent = "$settingIndent\t";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3622
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3623
	my $structElement = new XML::DOM::Element($xmlLinkDescriptorDoc,"struct");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3624
	$xmlLinkDescriptorSymbolParent->addText("$structIndent");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3625
	$xmlLinkDescriptorSymbolParent->appendChild ($structElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3626
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3627
	my $settingElementTemplate = new XML::DOM::Element($xmlLinkDescriptorDoc,"setting");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3628
	$settingElementTemplate->setAttribute("uuid-alias", ".");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3629
	my $simpleElementTemplate = new XML::DOM::Element($xmlLinkDescriptorDoc,"simple");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3630
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3631
	my $symbolNameSettingElement;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3632
	my $symbolNameSimpleElement;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3633
	my $symbolValueSettingElement;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3634
	my $symbolValueSimpleElement;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3635
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3636
	$symbolNameSettingElement = $settingElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3637
	$symbolNameSimpleElement = $simpleElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3638
	$symbolValueSettingElement = $settingElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3639
	$symbolValueSimpleElement = $simpleElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3640
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3641
	$symbolNameSettingElement->setAttribute("entry", "symbolName");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3642
	$symbolNameSimpleElement->addText ($symbolName);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3643
	$symbolValueSettingElement->setAttribute("entry", "symbolValue");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3644
	$symbolValueSimpleElement->addText ($symbolValue);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3645
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3646
	$symbolNameSettingElement->addText ($simpleIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3647
	$symbolNameSettingElement->appendChild ($symbolNameSimpleElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3648
	$symbolNameSettingElement->addText($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3649
	$symbolValueSettingElement->addText ($simpleIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3650
	$symbolValueSettingElement->appendChild ($symbolValueSimpleElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3651
	$symbolValueSettingElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3652
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3653
	$structElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3654
	$structElement->appendChild ($symbolNameSettingElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3655
	$structElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3656
	$structElement->appendChild ($symbolValueSettingElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3657
	$structElement->addText ($structIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3658
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3659
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3660
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3661
sub addLinkDescriptorDumpFile ($$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3662
	my ($dumpFileContent, $dumpFileName) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3663
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3664
	my $structIndent = "\n\t\t\t\t";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3665
	my $settingIndent = "$structIndent\t";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3666
	my $simpleIndent = "$settingIndent\t";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3667
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3668
	my $structElement = new XML::DOM::Element($xmlLinkDescriptorDoc,"struct");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3669
	$xmlLinkDescriptorDumpFileParent->addText("$structIndent");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3670
	$xmlLinkDescriptorDumpFileParent->appendChild ($structElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3671
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3672
	my $settingElementTemplate = new XML::DOM::Element($xmlLinkDescriptorDoc,"setting");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3673
	$settingElementTemplate->setAttribute("uuid-alias", ".");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3674
	my $simpleElementTemplate = new XML::DOM::Element($xmlLinkDescriptorDoc,"simple");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3675
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3676
	my $dumpFileContentSettingElement;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3677
	my $dumpFileContentSimpleElement;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3678
	my $dumpFileNameSettingElement;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3679
	my $dumpFileNameSimpleElement;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3680
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3681
	$dumpFileContentSettingElement = $settingElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3682
	$dumpFileContentSimpleElement = $simpleElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3683
	$dumpFileNameSettingElement = $settingElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3684
	$dumpFileNameSimpleElement = $simpleElementTemplate->cloneNode(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3685
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3686
	$dumpFileContentSettingElement->setAttribute("entry", "dumpFileContent");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3687
	$dumpFileContentSimpleElement->addText ($dumpFileContent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3688
	$dumpFileNameSettingElement->setAttribute("entry", "dumpFileName");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3689
	$dumpFileNameSimpleElement->addText ($dumpFileName);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3690
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3691
	$dumpFileContentSettingElement->addText ($simpleIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3692
	$dumpFileContentSettingElement->appendChild ($dumpFileContentSimpleElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3693
	$dumpFileContentSettingElement->addText($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3694
	$dumpFileNameSettingElement->addText ($simpleIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3695
	$dumpFileNameSettingElement->appendChild ($dumpFileNameSimpleElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3696
	$dumpFileNameSettingElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3697
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3698
	$structElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3699
	$structElement->appendChild ($dumpFileContentSettingElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3700
	$structElement->addText ($settingIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3701
	$structElement->appendChild ($dumpFileNameSettingElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3702
	$structElement->addText ($structIndent);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3703
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3704
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3705
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3706
sub ExtraPlat($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3707
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3708
# Call PmBld again after reprocessing the MMP file and tweaking various main:: variables
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3709
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3710
	my ($Plat) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3711
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3712
	&main::SetVarsFromMmp($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3713
	&main::InitLinkPaths();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3714
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3715
	foreach (&main::BldList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3716
		&main::SetCurBld($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3717
		&PMPlatProcessMmp(&main::PlatTxt2D);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3718
		&PMStartBldList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3719
		&PMBld;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3720
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3721
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3722
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3723
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3724
sub disconnectNode($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3725
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3726
# Remove a node from its parent, also removing the following text node (if any)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3727
# The text node is assumed to contain whitespace for file formatting.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3728
 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3729
	my ($node)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3730
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3731
	my $parent = $node->getParentNode;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3732
	my $sibling = $node->getNextSibling;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3733
	$parent->removeChild($node);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3734
	if (defined $sibling && $sibling->getNodeType == TEXT_NODE)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3735
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3736
		$parent->removeChild($sibling);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3737
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3738
	return $node;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3739
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3740
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3741
sub removeNode($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3742
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3743
# disconnect the node and dispose of it
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3744
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3745
	my ($node) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3746
	&disconnectNode($node);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3747
	$node->dispose;		# setAttribute("disposed",1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3748
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3749
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3750
sub textElement($$$$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3751
	my ($element,$name,$value,$insertionpoint)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3752
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3753
	my $subElement = new XML::DOM::Element($xmlProjectDoc,$name);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3754
	$subElement->appendChild($xmlProjectDoc->createTextNode($value));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3755
	$element->insertBefore($subElement, $insertionpoint);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3756
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3757
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3758
sub addFile($$$$;$) {    
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3759
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3760
	my ($src, $kind, $debug, $shared, $group) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3761
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3762
	my $linkElement = new XML::DOM::Element($xmlProjectDoc,"FILEREF");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3763
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3764
	&textElement($linkElement, "PATHTYPE",   "Name");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3765
	&textElement($linkElement, "PATH",       $src);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3766
	&textElement($linkElement, "PATHFORMAT", "Windows");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3767
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3768
	my $fileElement = $linkElement->cloneNode(1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3769
	$fileElement->setTagName("FILE");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3770
	&textElement($fileElement, "FILEKIND",   $kind);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3771
	&textElement($fileElement, "FILEFLAGS",  "Debug") if ($debug);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3772
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3773
	$xmlLinkOrder->appendChild($linkElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3774
	$xmlFileList->appendChild($fileElement);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3775
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3776
	$xmlLinkOrder->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3777
	$xmlFileList->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3778
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3779
	# Accumulate source group information
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3780
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3781
	my $groupfile = $linkElement->cloneNode(1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3782
	$groupfile->setAttribute("NAME", "$shared$src");			# convenience - remove this later!
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3783
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3784
	push (@addedFiles, $src) unless ($kind eq "Documents");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3785
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3786
	if ($kind eq "Library")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3787
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3788
		$xmlLibGroup->appendChild($groupfile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3789
		$xmlLibGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3790
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3791
	elsif (defined $group)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3792
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3793
		if ($group eq "Link")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3794
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3795
			$xmlLinkGroup->appendChild($groupfile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3796
			$xmlLinkGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3797
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3798
		elsif ($group eq "Resources")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3799
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3800
			$xmlResourcesGroup->appendChild($groupfile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3801
			$xmlResourcesGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3802
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3803
		elsif ($group eq "Root")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3804
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3805
			$xmlRootGroup->appendChild($groupfile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3806
			$xmlRootGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3807
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3808
		elsif ($group eq "Headers")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3809
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3810
			$xmlHeadersGroup->appendChild($groupfile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3811
			$xmlHeadersGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3812
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3813
		elsif ($group eq "Documents")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3814
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3815
			$xmlDocumentsGroup->appendChild($groupfile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3816
			$xmlDocumentsGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3817
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3818
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3819
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3820
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3821
		$xmlSourceGroup->appendChild($groupfile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3822
		$xmlSourceGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3823
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3824
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3825
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3826
sub addGroup($$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3827
	my ($grouplist,$name)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3828
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3829
	my $group = new XML::DOM::Element($xmlProjectDoc,"GROUP");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3830
	$grouplist->appendChild($group);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3831
	$grouplist->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3832
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3833
	&textElement($group, "NAME", $name);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3834
	$group->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3835
	return $group;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3836
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3837
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3838
sub addSubTarget($$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3839
	my ($subtargetlist,$name)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3840
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3841
	my $subtarget = new XML::DOM::Element($xmlProjectDoc,"SUBTARGET");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3842
	$subtargetlist->appendChild($subtarget);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3843
	$subtargetlist->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3844
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3845
	&textElement($subtarget, "TARGETNAME", $name);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3846
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3847
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3848
sub addOrderedTarget($$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3849
	my ($targetorder,$name)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3850
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3851
	my $orderedtarget = new XML::DOM::Element($xmlProjectDoc,"ORDEREDTARGET");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3852
	$targetorder->appendChild($orderedtarget);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3853
	$targetorder->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3854
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3855
	&textElement($orderedtarget, "NAME", $name);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3856
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3857
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3858
sub finaliseProject {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3859
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3860
	# Run through the project, removing all unused targets
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3861
	# and build up the TARGETORDER list and the "Build All" target
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3862
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3863
	my $target;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3864
	my $targetname;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3865
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3866
	my $xmlSubTargetList = new XML::DOM::Element($xmlProjectDoc,"SUBTARGETLIST");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3867
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3868
	my $xmlTargetOrder = new XML::DOM::Element($xmlProjectDoc,"TARGETORDER");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3869
	$xmlTargetOrder->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3870
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3871
	my @targets = $xmlProjectDoc->getElementsByTagName("TARGET",1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3872
	my @emulatortargetnames;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3873
	my @othertargetnames;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3874
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3875
	foreach $target (@targets)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3876
		{			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3877
		$targetname = $target->getAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3878
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3879
		if ($targetname eq "")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3880
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3881
			&removeNode($target);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3882
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3883
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3884
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3885
			$target->removeAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3886
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3887
			if ($targetname =~ /^WINSCW/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3888
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3889
				push (@emulatortargetnames, $targetname);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3890
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3891
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3892
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3893
				push (@othertargetnames, $targetname);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3894
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3895
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3896
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3897
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3898
	foreach $targetname ((sort @emulatortargetnames), (sort @othertargetnames))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3899
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3900
		&addSubTarget($xmlSubTargetList, $targetname);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3901
		&addOrderedTarget($xmlTargetOrder, $targetname);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3902
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3903
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3904
	# Build the GROUPLIST
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3905
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3906
	my $xmlGroupList = new XML::DOM::Element($xmlProjectDoc,"GROUPLIST");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3907
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3908
	# Build the "Root" group
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3909
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3910
	my %rootfiles;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3911
	my @rootgroups = $xmlProjectDoc->getElementsByTagName("ROOTGROUP",1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3912
	foreach my $group (@rootgroups)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3913
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3914
		$targetname = $group->getAttribute("TARGET");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3915
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3916
		my @files = $group->getElementsByTagName("FILEREF",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3917
		foreach my $file (@files)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3918
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3919
			my $name = $file->getAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3920
			if (!defined $rootfiles{$name})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3921
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3922
				# first occurrence - add to list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3923
				$rootfiles{$name}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3924
				&textElement($file, "TARGETNAME", $targetname, $file->getFirstChild);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3925
				$file->removeAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3926
				&disconnectNode($file);					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3927
				$xmlGroupList->appendChild($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3928
				$xmlGroupList->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3929
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3930
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3931
		&removeNode($group);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3932
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3933
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3934
	# Build the "Source" group
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3935
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3936
	my $xmlSourceGroup = &addGroup($xmlGroupList,"Source");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3937
	my %sourcefiles;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3938
	my @sourcegroups = $xmlProjectDoc->getElementsByTagName("SOURCEGROUP",1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3939
	foreach my $group (@sourcegroups)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3940
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3941
		$targetname = $group->getAttribute("TARGET");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3942
		my @files = $group->getElementsByTagName("FILEREF",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3943
		foreach my $file (@files)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3944
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3945
			my $name = $file->getAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3946
			if (!defined $sourcefiles{$name})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3947
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3948
				# first occurrence - add to list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3949
				$sourcefiles{$name}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3950
				&textElement($file, "TARGETNAME", $targetname, $file->getFirstChild);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3951
				$file->removeAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3952
				&disconnectNode($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3953
				$xmlSourceGroup->appendChild($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3954
				$xmlSourceGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3955
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3956
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3957
		&removeNode($group);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3958
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3959
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3960
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3961
	# Build the "Headers" group
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3962
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3963
	my $xmlHeadersGroup;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3964
	my %headerfiles;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3965
	my @headersgroups = $xmlProjectDoc->getElementsByTagName("HEADERSGROUP",1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3966
	foreach my $group (@headersgroups)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3967
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3968
		$targetname = $group->getAttribute("TARGET");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3969
		my @files = $group->getElementsByTagName("FILEREF",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3970
		foreach my $file (@files)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3971
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3972
			# Only create the "Headers" group if there are some files to add to it
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3973
			if (!defined $xmlHeadersGroup)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3974
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3975
				$xmlHeadersGroup = &addGroup($xmlGroupList,"Headers");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3976
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3977
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3978
			my $name = $file->getAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3979
			if (!defined $headerfiles{$name})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3980
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3981
				# first occurrence - add to list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3982
				$headerfiles{$name}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3983
				&textElement($file, "TARGETNAME", $targetname, $file->getFirstChild);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3984
				$file->removeAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3985
				&disconnectNode($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3986
				$xmlHeadersGroup->appendChild($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3987
				$xmlHeadersGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3988
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3989
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3990
		&removeNode($group);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3991
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3992
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3993
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3994
	# Build the "Resources" group
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3995
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3996
	my $xmlResourcesGroup;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3997
	my %resourcesfiles;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3998
	my @resourcesgroups = $xmlProjectDoc->getElementsByTagName("RESOURCESGROUP",1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  3999
	foreach my $group (@resourcesgroups)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4000
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4001
		$targetname = $group->getAttribute("TARGET");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4002
		my @files = $group->getElementsByTagName("FILEREF",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4003
		foreach my $file (@files)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4004
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4005
			# Only create the main "Resources" groups if there are some files to add
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4006
			# to them
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4007
			if (!defined $xmlResourcesGroup)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4008
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4009
				$xmlResourcesGroup = &addGroup($xmlGroupList,"Resources");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4010
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4011
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4012
			my $name = $file->getAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4013
			if (!defined $resourcesfiles{$name})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4014
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4015
				# first occurrence - add to list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4016
				$resourcesfiles{$name}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4017
				&textElement($file, "TARGETNAME", $targetname, $file->getFirstChild);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4018
				$file->removeAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4019
				&disconnectNode($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4020
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4021
				$xmlResourcesGroup->appendChild($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4022
				$xmlResourcesGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4023
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4024
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4025
		&removeNode($group);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4026
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4027
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4028
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4029
	# Build the "Link" group
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4030
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4031
	my $xmlLinkGroup = &addGroup($xmlGroupList,"Link");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4032
	my %linkfiles;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4033
	my @linkgroups = $xmlProjectDoc->getElementsByTagName("LINKGROUP",1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4034
	foreach my $group (@linkgroups)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4035
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4036
		$targetname = $group->getAttribute("TARGET");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4037
		my @files = $group->getElementsByTagName("FILEREF",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4038
		foreach my $file (@files)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4039
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4040
			my $name = $file->getAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4041
			if (!defined $linkfiles{$name})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4042
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4043
				# first occurrence - add to list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4044
				$linkfiles{$name}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4045
				&textElement($file, "TARGETNAME", $targetname, $file->getFirstChild);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4046
				$file->removeAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4047
				&disconnectNode($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4048
				$xmlLinkGroup->appendChild($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4049
				$xmlLinkGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4050
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4051
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4052
		&removeNode($group);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4053
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4054
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4055
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4056
	# Build the "Documents" group
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4057
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4058
	my $xmlDocumentsGroup;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4059
	my %documentfiles;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4060
	my @documentgroups = $xmlProjectDoc->getElementsByTagName("DOCUMENTSGROUP",1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4061
	foreach my $group (@documentgroups)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4062
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4063
		$targetname = $group->getAttribute("TARGET");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4064
		my @files = $group->getElementsByTagName("FILEREF",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4065
		foreach my $file (@files)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4066
			{				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4067
			# Only create the "Documents" group if there are some files to add to it
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4068
			if (!defined $xmlDocumentsGroup)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4069
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4070
				$xmlDocumentsGroup = &addGroup($xmlGroupList,"Documents");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4071
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4072
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4073
			my $name = $file->getAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4074
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4075
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4076
			if (!defined $documentfiles{$name})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4077
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4078
				# first occurrence - add to list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4079
				$documentfiles{$name}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4080
				&textElement($file, "TARGETNAME", $targetname, $file->getFirstChild);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4081
				$file->removeAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4082
				&disconnectNode($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4083
				$xmlDocumentsGroup->appendChild($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4084
				$xmlDocumentsGroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4085
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4086
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4087
		&removeNode($group);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4088
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4089
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4090
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4091
	# Build the "Lib" group and its subgroups
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4092
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4093
	my $xmlLibGroup = &addGroup($xmlGroupList, "Libraries");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4094
	my %libplats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4095
	my @libgroups = $xmlProjectDoc->getElementsByTagName("LIBGROUP",1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4096
	foreach my $group (@libgroups)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4097
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4098
		$targetname = $group->getAttribute("TARGET");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4099
		my $plat = $group->getAttribute("PLAT");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4100
		if (!defined $libplats{$plat})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4101
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4102
			$libplats{$plat} = &addGroup($xmlLibGroup, $plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4103
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4104
		my $platgroup = $libplats{$plat};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4105
		my @files = $group->getElementsByTagName("FILEREF",0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4106
		foreach my $file (@files)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4107
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4108
			my $name = $file->getAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4109
			if (!defined $sourcefiles{"$plat\\$name"})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4110
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4111
				# first occurrence - add to list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4112
				$sourcefiles{"$plat\\$name"}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4113
				&textElement($file, "TARGETNAME", $targetname, $file->getFirstChild);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4114
				$file->removeAttribute("NAME");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4115
				&disconnectNode($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4116
				$platgroup->appendChild($file);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4117
				$platgroup->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4118
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4119
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4120
		&removeNode($group);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4121
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4122
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4123
	# Replace the GROUPLIST & TARGETORDER in the template document
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4124
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4125
	my $node = $xmlProjectDoc->getElementsByTagName("GROUPLIST",1)->item(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4126
	$node->getParentNode->replaceChild($xmlGroupList, $node);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4127
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4128
	$node = $xmlProjectDoc->getElementsByTagName("TARGETORDER",1)->item(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4129
	$node->getParentNode->replaceChild($xmlTargetOrder, $node);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4130
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4131
	# Insert the "Build All" target
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4132
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4133
	my $xmlBuildAll = new XML::DOM::Element($xmlProjectDoc,"TARGET");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4134
	$xmlBuildAll->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4135
	&textElement($xmlBuildAll, "NAME", "Build All");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4136
	my $settinglist = new XML::DOM::Element($xmlProjectDoc,"SETTINGLIST");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4137
	&textSetting($settinglist, "Linker", "None");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4138
	&textSetting($settinglist, "Targetname", "Build All");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4139
	$xmlBuildAll->appendChild($settinglist);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4140
	$xmlBuildAll->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4141
	&textElement($xmlBuildAll, "FILELIST", "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4142
	$xmlBuildAll->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4143
	&textElement($xmlBuildAll, "LINKORDER", "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4144
	$xmlBuildAll->addText("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4145
	$xmlBuildAll->appendChild($xmlSubTargetList);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4146
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4147
	&addOrderedTarget($xmlTargetOrder, "Build All");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4148
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4149
	$node = $xmlProjectDoc->getElementsByTagName("TARGETLIST",1)->item(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4150
	$node->appendChild($xmlBuildAll);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4151
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4152
	# Output the result
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4153
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4154
	&main::Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4155
		$xmlProjectDoc->toString
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4156
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4157
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4158
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4159
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4160
sub PMEndSrcList {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4161
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4162
	my @PlatList=&main::PlatOverrideList();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4163
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4164
	if (scalar @PlatList == 0)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4165
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4166
		@PlatList = ("WINSCW", "ARM4", "ARMV5");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4167
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4168
		if ($CW_major_version >= 3)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4169
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4170
			push @PlatList, "ARMV5_ABIV1";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4171
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4172
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4173
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4174
	shift @PlatList;	# we've already done the first one in the list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4175
	foreach (@PlatList)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4176
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4177
		ExtraPlat($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4178
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4179
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4180
	&finaliseProject();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4181
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4182
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4183
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4184
sub GetGCCELibPath($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4185
	my $gnulibgccPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4186
	open PIPE, "arm-none-symbianelf-g++ $_[0] 2>&1 | ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4187
	while(<PIPE>){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4188
		$gnulibgccPath = $_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4189
		$gnulibgccPath =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4190
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4191
	close PIPE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4192
	my $SearchlibgccDir = &main::Path_Chop(&main::Path_Split('Path', $gnulibgccPath));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4193
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4194
	return $SearchlibgccDir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4195
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4196
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4197
sub Read_BSF_Options() {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4198
        my %plat = (main::PlatRec());
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4199
		my @Customization_Data = split(/\n/,$plat{'CUSTOMIZATION_DATA'});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4200
	foreach my $option (@Customization_Data) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4201
			next if ($option =~ /^$/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4202
	        warn "Unrecognized BSF syntax: $option.\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4203
		        unless ($option =~ /\s*(\S+)\s+(.+)$/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4204
		my $key = uc $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4205
		my $val = $2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4206
	        warn "Unrecognized BSF keyword: $key.\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4207
		        unless ($BSF_keywords{$key});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4208
		if ($key =~ /COMMON_OPTIONS/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4209
		        push @commonOptions, $val;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4210
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4211
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4212
		if ($key =~ /THUMB_OPTIONS/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4213
		        push @thumbOptions, $val;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4214
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4215
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4216
		if ($key =~ /ARM_OPTIONS/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4217
		        push @armOptions, $val;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4218
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4219
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4220
		if ($key =~ /KERNEL_OPTIONS/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4221
		        push @kernelOptions, $val;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4222
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4223
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4224
		if ($key =~ /INVARIANT_OPTIONS/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4225
		        push @invariantOptions, $val;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4226
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4227
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4228
		if ($key =~ /LD_OPTIONS/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4229
		        push @linkerOptions, $val;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4230
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4231
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4232
		if ($key =~ /AR_OPTIONS/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4233
		        push @archiverOptions, $val;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4234
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4235
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4236
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4237
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4238
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4239
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4240
# Set the options passed from BSF file 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4241
# @param OptionName    - BSF Keyword using which the options would be overridden in the BSF file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4242
# @param Options       - List of options read from the BSF keyword
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4243
sub Set_BSF_Options($$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4244
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4245
	my ($OptionName,$Options) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4246
	my @Fragments=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4247
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4248
	if ($CustPlat{'CUSTOMIZES'} && ($CustPlat{'ROOTPLATNAME'} eq "GCCE"))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4249
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4250
		$CustGCCE=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4251
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4252
	foreach my $val (@{$Options})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4253
	{		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4254
		# Check if the value of BSF option is to be set or added/removed.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4255
		if($val =~ /\+\[.*\]\+|\-\[.*\]\-/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4256
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4257
			if (@Fragments = Cl_bpabi::Split_BSF_Options($val,'RemoveOptions'))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4258
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4259
				foreach my $Opt (@Fragments) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4260
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4261
					# Remove trailing white spaces
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4262
					$Opt =~ s/\s+$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4263
					# Substitute '=' with '%' which is a wild card character in makefile.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4264
					# This is required for cases where option to be removed contains '=' (e.g.'-march=armv5t').
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4265
					# When such options are to be removed, "$(INVARIANT_OPTIONS:-march=armv5t=)" is written in the makefile.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4266
					# However, because of the occurence of '=', pattern match fails in the makefile and such options are not removed. 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4267
					# To resolve this, '=' is replaced with '%'  in the makefile so that the substitution pattern looks like 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4268
					# "$(INVARIANT_OPTIONS:-march%armv5t=)" in makefile (e.g."$(INVARIANT_OPTIONS:-march%armv5t=)").
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4269
					$Opt =~ s/=/%/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4270
					if((($OptionName =~ /COMMON_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4271
					|| ($OptionName =~ /THUMB_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4272
					|| ($OptionName =~ /ARM_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4273
					|| ($OptionName =~ /KERNEL_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4274
					|| ($OptionName =~ /INVARIANT_OPTIONS/))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4275
					&& ($CustGCCE))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4276
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4277
						$GCCE_CompilerOption = RemoveBsfOptions($Opt,$GCCE_CompilerOption);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4278
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4279
					elsif($OptionName =~ /COMMON_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4280
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4281
						$CCFLAGS = RemoveBsfOptions($Opt,$CCFLAGS);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4282
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4283
					elsif(($OptionName =~ /THUMB_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4284
					|| ($OptionName =~ /ARM_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4285
					|| ($OptionName =~ /KERNEL_OPTIONS/))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4286
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4287
						$CCFLAGS = RemoveBsfOptions($Opt,$CCFLAGS);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4288
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4289
					elsif($OptionName =~ /INVARIANT_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4290
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4291
						$CCFLAGS = RemoveBsfOptions($Opt,$CCFLAGS);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4292
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4293
					elsif($OptionName =~ /LD_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4294
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4295
						$linkeropts = RemoveBsfOptions($Opt,$Link);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4296
						$linkCommand = RemoveBsfOptions($Opt,$Link);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4297
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4298
					elsif($OptionName =~ /AR_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4299
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4300
						$archiveropts = RemoveBsfOptions($Opt,$linkCommand);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4301
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4302
				}					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4303
				@Fragments=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4304
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4305
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4306
			if (@Fragments = Cl_bpabi::Split_BSF_Options($val,'AddOptions')) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4307
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4308
				my $v;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4309
				foreach $v (@Fragments)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4310
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4311
					if((($OptionName =~ /COMMON_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4312
					|| ($OptionName =~ /THUMB_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4313
					|| ($OptionName =~ /ARM_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4314
					|| ($OptionName =~ /KERNEL_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4315
					|| ($OptionName =~ /INVARIANT_OPTIONS/))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4316
					&& ($CustGCCE))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4317
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4318
						$GCCE_CompilerOption .= ' '.$v.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4319
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4320
					elsif($OptionName =~ /COMMON_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4321
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4322
						$bsfaddoptions .= ' '.$v.' '; 						
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4323
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4324
					elsif(($OptionName =~ /THUMB_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4325
					|| ($OptionName =~ /ARM_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4326
					|| ($OptionName =~ /KERNEL_OPTIONS/))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4327
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4328
						$bsfaddoptions .= ' '.$v.' ';	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4329
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4330
					elsif($OptionName =~ /INVARIANT_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4331
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4332
						$bsfaddoptions .= ' '.$v.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4333
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4334
					elsif($OptionName =~ /LD_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4335
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4336
						$linkeropts .= ' '.$v.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4337
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4338
					elsif($OptionName =~ /AR_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4339
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4340
						$archiveropts .= ' '.$v.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4341
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4342
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4343
				@Fragments=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4344
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4345
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4346
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4347
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4348
			if((($OptionName =~ /COMMON_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4349
			|| ($OptionName =~ /THUMB_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4350
			|| ($OptionName =~ /ARM_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4351
			|| ($OptionName =~ /KERNEL_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4352
			|| ($OptionName =~ /INVARIANT_OPTIONS/))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4353
			&& ($CustGCCE))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4354
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4355
				$GCCE_CompilerOption .= ' '.$val.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4356
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4357
			elsif($OptionName =~ /COMMON_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4358
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4359
				$bsfaddoptions .= ' '.$val.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4360
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4361
			elsif(($OptionName =~ /THUMB_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4362
			|| ($OptionName =~ /ARM_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4363
			|| ($OptionName =~ /KERNEL_OPTIONS/))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4364
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4365
				$bsfaddoptions .= ' '.$val.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4366
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4367
			elsif($OptionName =~ /INVARIANT_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4368
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4369
				$bsfaddoptions .= ' '.$val.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4370
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4371
			elsif($OptionName =~ /LD_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4372
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4373
				$linkeropts .= ' '.$val.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4374
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4375
			elsif($OptionName =~ /AR_OPTIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4376
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4377
				$archiveropts .= ' '.$val.' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4378
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4379
		}	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4380
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4381
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4382
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4383
sub RemoveBsfOptions($$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4384
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4385
	my ($Opt_to_replace,$Opt_replaced_in) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4386
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4387
	$Opt_replaced_in =~ s/$Opt_to_replace//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4388
	return $Opt_replaced_in;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4389
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4390
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4391
# function to expand the macro as pass with appropriate options
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4392
sub printlist {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4393
	my $option =shift @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4394
	my @list = @_,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4395
	my $data;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4396
	my $finalval=undef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4397
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4398
	foreach $data (@list)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4399
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4400
		if($option =~ "-D") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4401
			$finalval .= " ".$option.$data;	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4402
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4403
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4404
			$finalval .= " ".$option." ".$data;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4405
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4406
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4407
	return $finalval;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4408
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4409
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4410
#read the configuration make file into the HASH and use them for further processing
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4411
sub collect_config_data {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4412
	my($configfile) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4413
	open(DATA, "<$configfile");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4414
	while(<DATA>) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4415
	{	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4416
		my $line = $_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4417
		if($line =~ /=/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4418
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4419
			if ($line =~ /(.*):=(.*)/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4420
			{ 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4421
				$configdata{$1}=$2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4422
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4423
			elsif ($line =~ /(.*)=(.*=.*)/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4424
			{ 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4425
				$configdata{$1}=$2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4426
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4427
			elsif ($line =~ /(.*)=(.*)/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4428
			{ 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4429
				$configdata{$1}=$2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4430
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4431
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4432
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4433
	close(DATA)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4434
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4435
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4436
#function is ti fetch the contents of the config data which is read from the configuration make file, 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4437
# for ex: KERNEL_OPTIONS=$(ARM_INSTRUCTION_SET) $(NO_EXCEPTIONS), this function extracts the value for ARM_INSTRUCTION_SET & NO_EXCEPTIONS
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4438
sub fetch_config_data {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4439
	my($list) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4440
	my $op;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4441
	my $op1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4442
	my $finaldata = undef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4443
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4444
	my @ip_options = split(/\s+/, $list);	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4445
	foreach $op (@ip_options)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4446
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4447
		$op =~ s/\)//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4448
		$op =~ s/\$\(//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4449
		if($op =~ /-/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4450
			$finaldata .= " ".$op;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4451
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4452
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4453
			$finaldata .= " ".$configdata{$op};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4454
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4455
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4456
	return $finaldata;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4457
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4458
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4459
# function to fix the bsf options, if the bsf option is already present in the CCFLAGS then remove from it so that it can be added from bsf,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4460
# this is to avoid the duplication of the options passed to the compiler.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4461
sub fixbsfoptions {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4462
	my ($options) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4463
	my $ccflgs = $CCFLAGS;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4464
	my $d;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4465
	my $Pattern = '-{1,2}\S+\s*(?!-)\S*';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4466
	my @list = $options =~ /$Pattern/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4467
	foreach $d (@list) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4468
		if($ccflgs =~ /$d/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4469
				$ccflgs =~ s/$d//g;	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4470
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4471
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4472
			if($d =~ /(.*)\s+(.*)/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4473
				my $a = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4474
				if($ccflgs =~ /$a\s+\S+/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4475
					$ccflgs =~ s/$a\s+\S+//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4476
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4477
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4478
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4479
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4480
	$CCFLAGS = $ccflgs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4481
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4482
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4483
# funtion to get the list if the libraries to be linked during linking
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4484
sub GetLibList() {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4485
	my @LibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4486
	my @StaticLibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4487
	my $Plat=&main::Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4488
	unless(defined($ENV{RVCT_VER_MAJOR})){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4489
		my ($rvct_M, $rvct_m, $rvct_b) = RVCT_plat2set::get_version_list($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4490
		$ENV{RVCT_VER_MAJOR}=$rvct_M;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4491
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4492
	&Cl_bpabi::getVariableForNewPlat();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4493
	my $list = &Cl_bpabi::getConfigVariable('STATIC_LIBS_LIST') ;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4494
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4495
	if (length($list) >0)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4496
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4497
		@StaticLibList = split(/\s+/, $list);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4498
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4499
	if($Plat eq "ARMV5" || $Plat eq "ARMV5_ABIV2" || IsCustomization($Plat)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4500
		@LibList=&Armutl_ArmLibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4501
		if(@LibList==0) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4502
			my $LibDir = Armutl_ArmLibDir();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4503
			if (@StaticLibList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4504
				foreach my $lib (@StaticLibList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4505
					push @LibList, ("$LibDir\\$lib");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4506
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4507
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4508
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4509
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4510
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4511
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4512
		@LibList = ('$(STATIC_LIBS_LIST)');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4513
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4514
	return @LibList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4515
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4516
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  4517
1;