sbsv1/abld/bldmake/bldmake.pl
author Zheng Shen <zheng.shen@nokia.com>
Mon, 30 Aug 2010 15:04:06 +0800
changeset 631 9435b9008a58
parent 599 fa7a3cc6effd
permissions -rw-r--r--
ROM Tools 13.1.0.1 Bug468 initialized static data built into a static library does not get initialized correctly
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 1997-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
# all variables called *Path* are set up to end with a backslash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
# all variables called *Path or *File are stored as absolute (file)paths within makmake
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
# all variables called UpPath* are stored as relative paths within makmake
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
# 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
use FindBin;		# for FindBin::Bin
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
use Getopt::Long;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
my $PerlLibPath;    # fully qualified pathname of the directory containing our Perl modules
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
BEGIN {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
# check user has a version of perl that will cope
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
	require 5.005_03;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
# establish the path to the Perl libraries: currently the same directory as this script
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
	$PerlLibPath = $FindBin::Bin;	# X:/epoc32/tools
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
	$PerlLibPath =~ s/\//\\/g;	# X:\epoc32\tools
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
	$PerlLibPath .= "\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
sub ExportDirs ($);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
use lib $PerlLibPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
use E32env;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
use E32Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
use Modload;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
use Output;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
use Pathutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
use E32Variant;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
use RVCT_plat2set;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
use BPABIutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
use wrappermakefile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
use CheckSource;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
use File::Path; # for rmtree
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
use featurevariantparser;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
my $BldInfName = 'BLD.INF';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
my %Options;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
my %KeepGoing;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
my @DefaultPlats=('WINSCW', 'GCCXML', 'EDG', 'X86GCC');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
my @BaseUserDefaultPlats=('ARM4', 'ARM4T', 'WINSCW', 'GCCXML', 'EDG', 'X86GCC');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
my @OptionalPlats=('VS6', 'VS2003');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
my @PlatsReq;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
my %CheckSourceEXPORTSMetaData;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
my %CheckSourceEXPORTSIncludes;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
my %CheckSourceMMPFILESMetaData;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
my %CheckSourceEXTENSIONSMetaData;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
my %CheckSourceBldInfIncludes;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
for ('ARMV4', 'ARMV5')
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
	push @BaseUserDefaultPlats, $_ if RVCT_plat2set::compiler_exists($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
# Add ARMV5_ABIV1 platform if ENABLE_ABIV2_MODE is set in variant.cfg
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
my $variantABIV2Keyword = &Variant_GetMacro();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
# Add ARMV5_ABIV1 platform only after determining the presence of RVCT compiler.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
if ($variantABIV2Keyword && RVCT_plat2set::compiler_exists('ARMV5_ABIV1') ) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
	push @OptionalPlats, 'ARMV5_ABIV1';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
# bldmake -k shouldn't die if Extension Makefile is missing
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
our $IgnoreMissingExtensionMakefile = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
# Add the BPABI Platforms to be added 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
my @BPABIPlats = &BPABIutl_Plat_List;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
foreach my $BPABIPlat (@BPABIPlats) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
	# BPABI platform related with ARMV5(eg.ARMV5_ABIV2) is added to the platform list after 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
	# determining the presence of RVCT compiler	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
	if(($BPABIPlat =~/^ARMV5/i))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
			if(!($BPABIPlat =~/^ARMV5$/i) && RVCT_plat2set::compiler_exists('ARMV5'))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
			push @OptionalPlats, $BPABIPlat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
	# All other BPABI platforms(eg. gcce) are added to the platform list.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
			push @OptionalPlats, $BPABIPlat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
if ( RVCT_plat2set::compiler_exists('ARMV5') ) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
	#determine the presence of ARVCT compiler
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
	push @DefaultPlats, 'ARMV5';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   102
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   103
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   104
# Need to add WINS and X86 if MSDEV compiler is present
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   105
# Use MSDevDir to determine the presence of the compiler
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   106
push @BaseUserDefaultPlats, 'WINS', 'X86' if (exists($ENV{'MSDevDir'}));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   107
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   108
my @BaseDefaultPlats = @BaseUserDefaultPlats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   109
push @BaseDefaultPlats, 'X86SMP' if (grep /^X86$/, @BaseUserDefaultPlats);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   110
push @BaseDefaultPlats, 'ARM4SMP' if (grep /^ARM4$/, @BaseUserDefaultPlats);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   111
push @BaseDefaultPlats, 'ARMV4SMP' if (grep /^ARMV4$/, @BaseUserDefaultPlats);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   112
push @BaseDefaultPlats, 'ARMV5SMP' if (grep /^ARMV5$/, @BaseUserDefaultPlats);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   113
push @BaseDefaultPlats, 'X86GMP' if (grep /^X86GCC$/, @BaseUserDefaultPlats);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   114
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   115
my $variantMacroHRHFile = Variant_GetMacroHRHFile();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   116
sub ExportDirs ($);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   117
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   118
# THE MAIN PROGRAM SECTION
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   119
##########################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   120
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   121
# Load default feature variant info - for the hrh file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   122
my %DefaultFeatureVariant = featurevariantparser->GetVariant('DEFAULT') if (featurevariantparser->DefaultExists());
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   123
my @FeatureVariants = featurevariantparser->GetBuildableFeatureVariants();
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
	Load_SetModulePath($PerlLibPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   127
	Plat_Init($PerlLibPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   128
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   129
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   130
		my @PlatList = &Plat_List();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   131
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   132
		if (RVCT_plat2set::compiler_exists('ARMV6')){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   133
			foreach my $ARMV6Target ("ARMV6", "ARMV6_ABIV1", "ARMV6_ABIV2"){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   134
				if (grep /^$ARMV6Target$/, @PlatList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   135
					push @BaseUserDefaultPlats, "$ARMV6Target" if (!grep /^$ARMV6Target$/, @BaseUserDefaultPlats);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   136
					push @BaseDefaultPlats, "$ARMV6Target" if (!grep /^$ARMV6Target$/, @BaseDefaultPlats);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   137
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   138
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   139
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   140
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   141
		if (RVCT_plat2set::compiler_exists('ARMV7')){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   142
 			my $rvct_ver = RVCT_plat2set::get_version_string('ARMV7');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   143
 			if ((defined $rvct_ver) and ($rvct_ver ge "3.1.674")) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   144
 				if (grep /^ARMV7$/, @PlatList ) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   145
					push @DefaultPlats, 'ARMV7' if (!grep /^ARMV7$/, @DefaultPlats);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   146
					push @BaseUserDefaultPlats, "ARMV7" if (!grep /^ARMV7$/, @BaseUserDefaultPlats);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   147
					push @BaseDefaultPlats, "ARMV7" if (!grep /^ARMV7$/, @BaseDefaultPlats);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   148
 				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   149
 			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   150
 		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   151
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   152
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   153
#	process the commmand-line
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   154
	unless (GetOptions(\%Options, 'v', "k|keepgoing", "notest", "file|f=s")) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   155
		exit 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   156
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   157
	unless (@ARGV>=1) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   158
		&Usage();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   159
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   160
	my $Command=uc shift @ARGV;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   161
	unless ($Command=~/^(BLDFILES|CLEAN|INF|PLAT)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   162
		&Usage();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   163
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   164
	my $CLPlat=uc shift @ARGV;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   165
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   166
	unless ($CLPlat) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   167
		$CLPlat='ALL';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   168
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   169
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   170
	if ($Command eq 'INF') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   171
		&ShowBldInfSyntax();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   172
		exit;
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
	if ($Command eq 'PLAT') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   176
		my @PlatList = ($CLPlat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   177
		my $PlatName;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   178
		# Variable introduced to check if the bldmake plat command is called, To be
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   179
		# passed as an argument in Plat_GetL function call.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   180
		my $platcommand=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   181
		if ($CLPlat eq "ALL") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   182
			@PlatList = &Plat_List();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   183
			print(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   184
				"Supported Platforms:\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   185
				"  @PlatList\n\n"
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
		print(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   189
			"Macros defined for BLD.INF preprocessing of MMPFILE sections:\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   190
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   191
		foreach $PlatName (@PlatList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   192
			my %Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   193
			eval { &Plat_GetL($PlatName, \%Plat,{},$platcommand); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   194
			die $@ if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   195
			print(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   196
				"\nPlatform $PlatName:\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   197
				"  @{$Plat{MmpMacros}}\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   198
			);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   199
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   200
		exit;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   201
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   202
	if ($Options{file}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   203
		$BldInfName = $Options{file};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   204
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   205
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   206
#	check that the BLD.INF file exists
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   207
#	maybe BLDMAKE should allow a path to be specified leading to the BLD.INF file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   208
	my $BldInfPath=&Path_WorkPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   209
	unless (-e "${BldInfPath}$BldInfName") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   210
		&FatalError("Can't find \"${BldInfPath}$BldInfName\"");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   211
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   212
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   213
	if (!-d $E32env::Data{EPOCPath}){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   214
		&FatalError("Directory \"$E32env::Data{EPOCPath}\" does not exist");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   215
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   216
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   217
#	decide the output directory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   218
	my $OutDir=&Path_Chop($E32env::Data{BldPath}).$BldInfPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   219
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   220
#	Work out the path for the IBY files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   221
	my $RomDir=&Path_Chop($E32env::Data{RomPath}).$BldInfPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   222
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   223
#	Work out the name for the BLD.INF module
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   224
	my @Dirs=&Path_Dirs($BldInfPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   225
	my $Module = pop @Dirs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   226
	if (lc($Module) eq 'group') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   227
		$Module = pop @Dirs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   228
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   229
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   230
	if ($Command eq 'CLEAN') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   231
		unlink "${BldInfPath}ABLD.BAT";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   232
		$OutDir=~m-(.*)\\-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   233
		if (-d $1) { # remove backslash for test because some old versions of perl can't cope
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   234
			opendir DIR, $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   235
			my @Files=grep s/^([^\.].*)$/$OutDir$1/, readdir DIR;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   236
			closedir DIR;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   237
			unlink @Files;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   238
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   239
		rmtree <$OutDir\\wrappermakefiles>;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   240
# modified start: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   241
		rmtree <$OutDir\\FeatureVariantInfo>;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   242
# modified end: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   243
		exit;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   244
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   245
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   246
#	parse BLD.INF - to get the platforms and the export files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   247
	eval { &Load_ModuleL('PREPFILE'); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   248
	&FatalError($@) if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   249
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   250
	my @RealPlats=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   251
	my @Exports=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   252
	my @TestExports=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   253
	if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   254
		print "Reading \"${BldInfPath}$BldInfName\" for platforms and exports\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   255
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   256
	&ParseBldInf(\@RealPlats, \@Exports, \@TestExports, $BldInfPath, 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   257
		$E32env::Data{EPOCIncPath}, $E32env::Data{EPOCPath}, $E32env::Data{EPOCDataPath});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   258
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   259
#       Add Customizations
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   260
	my @additions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   261
	foreach my $plat (@RealPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   262
	        my @customizations = Plat_Customizations($plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   263
	        foreach my $custom (@customizations) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   264
	                push @additions, $custom 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   265
			        unless grep /$custom/, @additions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   266
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   267
        }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   268
	unless ($CLPlat eq 'ALL') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   269
		push @RealPlats, @additions;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   270
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   271
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   272
 #	Force GCCXML support for anything that compiles as ARMV5
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   273
	if ( (grep /^ARMV5$/, @RealPlats) and not (grep /^GCCXML$/,@RealPlats) ) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   274
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   275
			push @RealPlats, 'GCCXML';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   276
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   277
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   278
 #	Force EDG support for anything that compiles as ARMV5
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   279
	if ( (grep /^ARMV5$/, @RealPlats) and not (grep /^EDG$/,@RealPlats) ) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   280
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   281
			push @RealPlats, 'EDG';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   282
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   283
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   284
if (0) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   285
#	Add ARMV5 to the platforms if ARM4 is defined
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   286
	if (grep /^ARM4$/, @RealPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   287
		unless ( (grep /^ARMV4$/, @RealPlats) or (grep /^ARMV5$/, @RealPlats) ){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   288
		push @RealPlats, 'ARMV5';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   289
		push @RealPlats, 'ARMV4';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   290
		}
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
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   294
#	get any IDE platforms required into a new platforms list, and
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   295
#	Create a hash to contain the 'real' names of the platforms, i.e. WINS rather than VC6
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   296
	my @Plats=@RealPlats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   297
	my %Real;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   298
	foreach (@RealPlats) { # change to get VC6 batch files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   299
		$Real{$_}=$_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   300
		my $AssocIDE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   301
		my @AssocIDEs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   302
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   303
#		Get the IDEs associated with a real platform. A real plat like,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   304
#		WINSCW may have multiple associated IDEs like VC6 .NET2003 or CW IDE.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   305
		&Plat_AssocIDE($_, \@AssocIDEs);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   306
		next unless @AssocIDEs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   307
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   308
		push @Plats, @AssocIDEs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   309
		foreach $AssocIDE (@AssocIDEs)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   310
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   311
			$Real{$AssocIDE}=$Real{$_};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   312
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   313
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   314
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   315
	if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   316
		print "Platforms: \"@Plats\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   317
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   318
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   319
#	check that the platform specified on the command-line is acceptable
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   320
#	and sort out a list of platforms to process
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   321
	my @DoRealPlats=@RealPlats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   322
	my @DoPlats=@Plats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   323
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   324
	unless (@Plats) { 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   325
#	include the optional platform list if no platform is specified
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   326
		my $OptionalPlat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   327
		foreach $OptionalPlat (@OptionalPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   328
			unless (grep /^$OptionalPlat$/i, @DoPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   329
				push @DoPlats, $OptionalPlat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   330
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   331
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   332
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   333
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   334
	unless ($CLPlat eq 'ALL') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   335
		unless (grep /^$CLPlat$/, @Plats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   336
			&FatalError("Platform $CLPlat not supported by \"${BldInfPath}$BldInfName\"\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   337
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   338
		@DoPlats=($CLPlat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   339
		@DoRealPlats=$Real{$CLPlat};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   340
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   341
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   342
#	sort out the export directories we might need to make
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   343
	my @ExportDirs=ExportDirs(\@Exports);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   344
	my @TestExportDirs=ExportDirs(\@TestExports);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   345
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   346
#	parse the BLD.INF file again for each platform supported by the project
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   347
#	storing the information in a big data structure
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   348
	my %AllPlatData;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   349
	my %AllPlatTestData;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   350
	my $Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   351
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   352
	if ($Options{v} and $CLPlat ne 'ALL'){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   353
		print "Reading \"${BldInfPath}$BldInfName\" for $CLPlat \n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   354
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   355
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   356
	foreach $Plat (@RealPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   357
		if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   358
			if ($CLPlat eq 'ALL') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   359
				print "Reading \"${BldInfPath}$BldInfName\" for $Plat\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   360
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   361
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   362
		my (@PlatData, @PlatTestData);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   363
		if ($CLPlat eq 'ALL') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   364
			&ParseBldInfPlat(\@PlatData, \@PlatTestData, $Plat, $BldInfPath, ($DefaultFeatureVariant{VALID} && &Plat_SupportsFeatureVariants($Plat) ? \%DefaultFeatureVariant : undef));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   365
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   366
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   367
			&ParseBldInfPlat(\@PlatData, \@PlatTestData, $CLPlat, $BldInfPath, ($DefaultFeatureVariant{VALID} && &Plat_SupportsFeatureVariants($CLPlat) ? \%DefaultFeatureVariant : undef));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   368
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   369
		$AllPlatData{$Plat}=\@PlatData;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   370
		$AllPlatTestData{$Plat}=\@PlatTestData;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   371
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   372
	undef $Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   373
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   374
	undef $CLPlat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   375
	if ($Command eq 'BLDFILES') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   376
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   377
#		create the perl file, PLATFORM.PM, listing the platforms
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   378
		if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   379
			print "Creating \"${OutDir}PLATFORM.PM\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   380
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   381
		&CreatePlatformPm($OutDir, \@Plats, \@RealPlats, \%Real, \%AllPlatData, \%AllPlatTestData);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   382
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   383
#		create the .BAT files required to call ABLD.PL
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   384
		if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   385
			print "Creating \"${BldInfPath}ABLD.BAT\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   386
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   387
		&CreatePerlBat($BldInfPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   388
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   389
#		create the makefile for exporting files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   390
		if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   391
			print "Creating \"${OutDir}EXPORT.MAKE\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   392
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   393
		&CreateExportMak("${OutDir}EXPORT.MAKE", \@Exports, \@ExportDirs);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   394
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   395
#		create the makefile for exporting test files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   396
		if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   397
			print "Creating \"${OutDir}EXPORTTEST.MAKE\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   398
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   399
		&CreateExportMak("${OutDir}EXPORTTEST.MAKE", \@TestExports, \@TestExportDirs);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   400
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   401
# modified start: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   402
		#create the feature variant infor file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   403
		foreach my $copyofPlat (@DoPlats)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   404
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   405
			my $realplat = $Real{$copyofPlat};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   406
			if(&Plat_SupportsFeatureVariants($copyofPlat))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   407
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   408
				my $variant_info = &Path_Chop($E32env::Data{BldPath}).$BldInfPath."\\FeatureVariantInfo\\".$realplat."\\";	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   409
				eval { &Path_MakePathL($variant_info); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   410
				die $@ if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   411
				if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   412
					print "Creating: \"$variant_info\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   413
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   414
				foreach my $featureVariant (@FeatureVariants)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   415
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   416
					my $variant_file = $variant_info."$realplat.$featureVariant.info";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   417
# modified by SV start: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   418
					my $refdata = $AllPlatData{$realplat};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   419
					my $testrefdata = $AllPlatTestData{$realplat};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   420
					if ( @$refdata ) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   421
						foreach my $RefPro (@$refdata)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   422
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   423
							$variant_file = $variant_info."$realplat.$featureVariant.$$RefPro{Base}.info";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   424
							my $ref_basedir = $variant_file;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   425
							$ref_basedir=~s/(.*[\\\/]).*/$1/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   426
							if ( ! -d $ref_basedir ){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   427
								eval { &Path_MakePathL($ref_basedir); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   428
								die $@ if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   429
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   430
							open VARIANTINFOR,">$variant_file" or die "ERROR: Can't open or create file \"$variant_file\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   431
							print VARIANTINFOR "VARIANT_PLAT_NAME_$$RefPro{Base}:=default \n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   432
							close VARIANTINFOR or die "ERROR: Can't close file \"$variant_file\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   433
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   434
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   435
					else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   436
						open VARIANTINFOR,">$variant_file" or die "ERROR: Can't open or create file \"$variant_file\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   437
						print VARIANTINFOR "VARIANT_PLAT_NAME:=$featureVariant \n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   438
						close VARIANTINFOR or die "ERROR: Can't close file \"$variant_file\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   439
						print "file \"$variant_file\"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   440
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   441
					if ($testrefdata){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   442
						foreach my $RefPro (@$testrefdata)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   443
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   444
							$variant_file = $variant_info."$realplat.$featureVariant.$$RefPro{Base}.info";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   445
							my $ref_basedir = $variant_file;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   446
							$ref_basedir=~s/(.*[\\\/]).*/$1/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   447
							if ( ! -d $ref_basedir ){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   448
								eval { &Path_MakePathL($ref_basedir); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   449
								die $@ if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   450
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   451
							open VARIANTINFOR,">$variant_file" or die "ERROR: Can't open or create file \"$variant_file\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   452
							print VARIANTINFOR "VARIANT_PLAT_NAME_$$RefPro{Base}:=default \n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   453
							close VARIANTINFOR or die "ERROR: Can't close file \"$variant_file\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   454
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   455
						
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   456
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   457
# modified by SV end: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   458
					# Close and cleanup
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   459
					if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   460
						print "Variant info file has been successfully created\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   461
					}
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
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   465
# modified end: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   466
#		create the platform meta-makefiles
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   467
		foreach my $copyofPlat (@DoPlats) {  # Do not use $_ here !!
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   468
			if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   469
				print "Creating \"$OutDir$copyofPlat.MAKE\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   470
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   471
			my $realplat = $Real{$copyofPlat};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   472
			&CreatePlatMak($OutDir, $E32env::Data{BldPath}, $AllPlatData{$realplat}, $copyofPlat, $realplat, $RomDir, $Module, $BldInfPath, \@Exports, '');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   473
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   474
			if (&Plat_SupportsFeatureVariants($copyofPlat))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   475
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   476
				foreach my $featureVariant (@FeatureVariants)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   477
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   478
					print "Creating \"$OutDir$copyofPlat.$featureVariant.MAKE\"\n" if ($Options{v});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   479
					&CreatePlatMak($OutDir, $E32env::Data{BldPath}, $AllPlatData{$realplat}, $copyofPlat, $realplat, $RomDir, $Module, $BldInfPath, \@Exports, '', ".$featureVariant");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   480
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   481
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   482
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   483
		foreach (@DoPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   484
			if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   485
				print "Creating \"$OutDir${_}TEST.MAKE\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   486
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   487
			&CreatePlatMak($OutDir, $E32env::Data{BldPath}, $AllPlatTestData{$Real{$_}}, $_, $Real{$_}, $RomDir, $Module, $BldInfPath, \@TestExports, 'TEST');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   488
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   489
			if (&Plat_SupportsFeatureVariants($_))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   490
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   491
				foreach my $featureVariant (@FeatureVariants)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   492
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   493
					print "Creating \"$OutDir${_}.".$featureVariant."TEST.MAKE\"\n" if ($Options{v});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   494
					&CreatePlatMak($OutDir, $E32env::Data{BldPath}, $AllPlatTestData{$Real{$_}}, $_, $Real{$_}, $RomDir, $Module, $BldInfPath, \@TestExports, 'TEST', ".$featureVariant");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   495
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   496
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   497
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   498
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   499
#		create the platform test batch files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   500
		foreach (@DoRealPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   501
			if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   502
				print "Creating test batch files in \"$OutDir\" for $_\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   503
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   504
			&CreatePlatBatches($OutDir, $AllPlatTestData{$_}, $_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   505
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   506
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   507
# modified by SV start: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   508
# create all sub directories
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   509
	foreach my $refplat (@DoRealPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   510
		my $tmp = $AllPlatData{$refplat};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   511
		foreach my $dref (@$tmp){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   512
			my $builddir = $OutDir . $$dref{Base} ."\\" . $refplat . "\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   513
				if (!-d $builddir){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   514
					if ($Options{v}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   515
						print "Creating directory \"$builddir\" \n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   516
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   517
					eval { &Path_MakePathL($builddir); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   518
					&FatalError($@) if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   519
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   520
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   521
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   522
# modified by SV end: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   523
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   524
#		report any near-fatal errors
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   525
		if (scalar keys %KeepGoing) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   526
		    print STDERR
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   527
			    "\n${BldInfPath}$BldInfName WARNING(S):\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   528
			    sort keys %KeepGoing
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
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   532
		exit;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   533
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   534
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   535
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   536
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   537
################ END OF MAIN PROGRAM SECTION #################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   538
#------------------------------------------------------------#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   539
##############################################################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   540
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   541
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   542
# SUBROUTINE SECTION
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   543
####################
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   544
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   545
sub Usage () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   546
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   547
	eval { &Load_ModuleL('E32TPVER'); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   548
	&FatalError($@) if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   549
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   550
	print
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   551
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   552
		"BLDMAKE - Project building Utility (Build ",&E32tpver,")\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   553
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   554
		"BLDMAKE {options} [<command>] [<platform>]\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   555
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   556
		"<command>: (case insensitive)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   557
		" BLDFILES - create build batch files\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   558
		" CLEAN    - remove all files bldmake creates\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   559
		" INF      - display basic BLD.INF syntax\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   560
		" PLAT     - display platform macros\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   561
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   562
		"<platform>: (case insensitive)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   563
		"  if not specified, defaults to \"ALL\"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   564
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   565
		"Options: (case insensitive)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   566
		" -v   ->  verbose mode\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   567
		" -k   ->  keep going even if files are missing\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   568
	;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   569
	exit 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   570
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   571
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   572
sub ShowBldInfSyntax () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   573
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   574
	print <<ENDHERE1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   575
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   576
BLD.INF - Syntax
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   577
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   578
/* Use C++ comments if required */
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   579
// (Curly braces denote optional arguments)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   580
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   581
PRJ_PLATFORMS
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   582
{DEFAULT} {-<platform> ...} {<list of platforms>}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   583
// list platforms your project supports here if not default
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   584
ENDHERE1
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   585
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   586
	print "// default = ".join(" ",@DefaultPlats)."\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   587
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   588
	print <<ENDHERE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   589
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   590
PRJ_EXPORTS
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   591
[<source path>\<source file>]	{<destination>}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   592
// list each file exported from source on a separate line
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   593
// {<destination>} defaults to \\EPOC32\\Include\\<source file>
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   594
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   595
PRJ_TESTEXPORTS
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   596
[<source path>\<source file>]	{<destination>}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   597
// list each file exported from source on a separate line
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   598
// {<destination>} defaults to BLD.INF dir
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   600
PRJ_MMPFILES
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   601
[<mmp path>\<mmp file>] {<qualifiers>}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   602
{MAKEFILE|NMAKEFILE} [<path>\<makefile>] {build_as_arm}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   603
// <qualifiers> are tidy, ignore, build_as_arm
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   604
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   605
#if defined(<platform>)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   606
// .MMP statements restricted to <platform>
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   607
#endif
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   608
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   609
PRJ_TESTMMPFILES
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   610
[<mmp path>\<mmp file>] {<qualifiers>}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   611
{MAKEFILE|NMAKEFILE} [<path>\<makefile>] {<qualifiers>}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   612
// <qualifiers> are {tidy} {ignore} {manual} {support} {build_as_arm}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   613
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   614
#if defined(<platform>)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   615
// .MMP statements restricted to <platform>
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   616
#endif
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   617
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   618
ENDHERE
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   619
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   620
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   621
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   622
sub WarnOrDie ($$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   623
	my ($dieref, $message) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   624
	if ($Options{k}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   625
		$KeepGoing{$message} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   626
	} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   627
		push @{$dieref}, $message;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   628
	}
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 ExtensionMakefileMissing($)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   632
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   633
	$IgnoreMissingExtensionMakefile = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   634
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   635
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   636
sub ParseBldInf ($$$$$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   637
	my ($PlatsRef, $ExportsRef, $TestExportsRef, $BldInfPath, $EPOCIncPath, $EPOCPath, $EPOCDataPath)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   638
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   639
	my @Prj2D;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   640
	eval { &Prepfile_ProcessL(\@Prj2D, "${BldInfPath}$BldInfName",$variantMacroHRHFile); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   641
	&FatalError($@) if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   642
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   643
	my @SupportedPlats=&Plat_List();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   644
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   645
	my @Plats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   646
	my %RemovePlats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   647
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   648
	my $DefaultPlatsUsed=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   649
	my %PlatformCheck;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   650
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   651
	my %ExportCheck;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   652
	my $Section=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   653
	our @PrjFileDie;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   654
	my $Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   655
	my $CurFile="${BldInfPath}$BldInfName";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   656
	LINE: foreach $Line (@Prj2D) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   657
		my $LineNum=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   658
		$_=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   659
		if ($LineNum eq '#') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   660
			$CurFile=$_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   661
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   662
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   663
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   664
		$CurFile = &Path_Norm ($CurFile); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   665
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   666
		if (/^PRJ_(\w*)$/io) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   667
			$Section=uc $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   668
			if ($Section=~/^(PLATFORMS|EXPORTS|TESTEXPORTS|MMPFILES|TESTMMPFILES|EXTENSIONS|TESTEXTENSIONS)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   669
				if (@$Line) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   670
					push @PrjFileDie, "$CurFile($LineNum) : Can't specify anything on the same line as a section header\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   671
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   672
				next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   673
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   674
			push @PrjFileDie, "$CurFile($LineNum) : Unknown section header - $_\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   675
			$Section=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   676
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   677
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   678
		if ($Section eq 'PLATFORMS') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   679
#			platforms are gathered up into a big list that contains no duplicates.  "DEFAULT" is
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   680
#			expanded to the list of default platforms.  Platforms specified with a "-" prefix
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   681
#			are scheduled for removal from the list.  After processing platforms specified
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   682
#			with the "-" prefix are removed from the list.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   683
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   684
			unshift @$Line, $_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   685
			my $Candidate;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   686
			CANDLOOP: foreach $Candidate (@$Line) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   687
				$Candidate=uc $Candidate;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   688
#				ignore old WINC target
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   689
				if ($Candidate eq 'WINC') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   690
					next CANDLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   691
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   692
#				expand DEFAULT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   693
				if ($Candidate eq 'DEFAULT') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   694
					$DefaultPlatsUsed=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   695
					my $Default;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   696
					foreach $Default (@DefaultPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   697
						unless ($PlatformCheck{$Default}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   698
							push @Plats, $Default;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   699
							$PlatformCheck{$Default}="$CurFile: $LineNum";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   700
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   701
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   702
					next CANDLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   703
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   704
#				expand BASEDEFAULT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   705
				if ($Candidate eq 'BASEDEFAULT') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   706
					$DefaultPlatsUsed=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   707
					my $Default;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   708
					foreach $Default (@BaseDefaultPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   709
						unless ($PlatformCheck{$Default}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   710
							push @Plats, $Default;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   711
							$PlatformCheck{$Default}="$CurFile: $LineNum";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   712
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   713
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   714
					next CANDLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   715
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   716
#				expand BASEUSERDEFAULT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   717
				if ($Candidate eq 'BASEUSERDEFAULT') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   718
					$DefaultPlatsUsed=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   719
					my $Default;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   720
					foreach $Default (@BaseUserDefaultPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   721
						unless ($PlatformCheck{$Default}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   722
							push @Plats, $Default;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   723
							$PlatformCheck{$Default}="$CurFile: $LineNum";
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
					next CANDLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   727
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   728
#				check for removals
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   729
				if ($Candidate=~/^-(.*)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   730
					$Candidate=$1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   731
#					check default is specified
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   732
					unless ($DefaultPlatsUsed) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   733
						push @PrjFileDie, "$CurFile($LineNum) : \"DEFAULT\" must be specified before platform to be removed\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   734
						next CANDLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   735
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   736
					$RemovePlats{$Candidate}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   737
					next CANDLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   738
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   739
# 				If tools platform is specified in bld.inf file then component is built for cwtools as well 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   740
				if ($Candidate =~ /^tools/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   741
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   742
						push @Plats, 'CWTOOLS';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   743
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   744
#				check platform is supported
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   745
				unless (grep /^$Candidate$/, @SupportedPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   746
					WarnOrDie(\@PrjFileDie, "$CurFile($LineNum) : Unsupported platform $Candidate specified\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   747
					next CANDLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   748
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   749
#				check platform is not an IDE
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   750
				if ($Candidate=~/^VC/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   751
					push @PrjFileDie, "$CurFile($LineNum) : No need to specify platform $Candidate here\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   752
					next CANDLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   753
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   754
#				add the platform
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   755
				unless ($PlatformCheck{$Candidate}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   756
					push @Plats, $Candidate;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   757
					my $SubPlat = sprintf("%sEDG", $Candidate);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   758
					push @Plats, $SubPlat 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   759
					    if (grep /^$SubPlat$/, @SupportedPlats);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   760
					$PlatformCheck{$Candidate}="$CurFile: $LineNum";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   761
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   762
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   763
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   764
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   765
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   766
		# Skip PRJ_TESTEXPORT section if -notest flag		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   767
		next LINE if ($Options{notest} && ($Section=~/^(TESTEXPORTS)$/o)); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   768
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   769
		if ($Section=~/^(EXPORTS|TESTEXPORTS)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   770
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   771
#			make path absolute - assume relative to group directory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   772
			my $Type = 'file';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   773
			if (/^\:(\w+)/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   774
				# Export an archive
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   775
				$Type = lc $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   776
				unless ($Type eq 'zip') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   777
					push @PrjFileDie, "$CurFile($LineNum) : Unknown archive type - $Type\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   778
					next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   779
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   780
				$_ = shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   781
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   782
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   783
			my $loggedSourceExport = $_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   784
			$_ = &Path_Norm ($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   785
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   786
			my $Source=&Path_MakeAbs($CurFile, $_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   787
			my $Releasable='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   788
			my $emReleasable='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   789
			my $unzip_option ='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   790
			if (@$Line) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   791
#				get the destination file if it's specified
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   792
				$Releasable=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   793
				CheckSource_MetaData(%CheckSourceEXPORTSMetaData, $CurFile, "PRJ_".$Section, $Releasable, $LineNum);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   794
				$Releasable = &Path_Norm ($Releasable);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   795
				$emReleasable=ucfirst $Releasable;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   796
				if ($emReleasable=~/^([A-Z]):(\\.*)$/)  {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   797
				  	$emReleasable=~s/://;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   798
					$Releasable=$EPOCDataPath.$emReleasable;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   799
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   800
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   801
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   802
			my $sourceExportTypeSuffix = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   803
			$sourceExportTypeSuffix .= " (NO DESTINATION)" if (!$Releasable && $Section =~ /^EXPORTS$/);		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   804
			CheckSource_MetaData(%CheckSourceEXPORTSMetaData, $CurFile, "PRJ_".$Section.$sourceExportTypeSuffix, $loggedSourceExport, $LineNum, $CheckSource_PhysicalCheck);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   805
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   806
			if (@$Line) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   807
				$unzip_option = shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   808
				unless ($unzip_option=~ /overwrite/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   809
					push @PrjFileDie, "$CurFile($LineNum) : Too many arguments in exports section line\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   810
					next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   811
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   812
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   813
			unless ($Type eq 'zip' or &Path_Split('File', $Releasable)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   814
#				use the source filename if no filename is specified in the destination
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   815
#				no filename for archives
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   816
				$Releasable.=&Path_Split('File', $Source);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   817
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   818
			my $defpath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   819
			if ($Type eq 'zip') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   820
#				archives relative to EPOCROOT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   821
				$defpath = $ENV{EPOCROOT};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   822
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   823
			elsif (($Section =~ /EXPORTS$/) && ($Releasable =~ s/^\|[\/|\\]?//)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   824
#			'|' prefix forces "relative to bld.inf file" in PRJ_[TEST]EXPORTS destinations
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   825
				$defpath = $CurFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   826
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   827
			elsif ($Section eq 'EXPORTS') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   828
#				assume the destination is relative to $EPOCIncPath
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   829
				$defpath = $EPOCIncPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   830
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   831
			else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   832
				$defpath = $CurFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   833
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   834
			$Releasable=&Path_MakeEAbs($EPOCPath, $defpath, $Releasable);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   835
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   836
#			sanity checks!
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   837
			if ($Type eq 'file' && $ExportCheck{uc $Releasable}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   838
				push @PrjFileDie, "$CurFile($LineNum) : Duplicate export $Releasable (from line $ExportCheck{uc $Releasable})\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   839
				next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   840
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   841
			$ExportCheck{uc $Releasable}="$CurFile: $LineNum";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   842
			if (! -e $Source) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   843
				WarnOrDie(\@PrjFileDie, "$CurFile($LineNum) : Exported source file $Source not found\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   844
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   845
			elsif ($Type ne 'zip' && -d $Releasable) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   846
				push @PrjFileDie, "$CurFile($LineNum) : Export target $Releasable must be a file.\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   847
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   848
			else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   849
				if ($Section eq 'EXPORTS') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   850
					push @$ExportsRef, {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   851
						'Source'=>$Source,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   852
						'Releasable'=>$Releasable,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   853
						'emReleasable'=>$emReleasable,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   854
						'Type'=>$Type,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   855
						'UnzipOption'=>$unzip_option
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
				else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   859
					push @$TestExportsRef, {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   860
						'Source'=>$Source,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   861
						'Releasable'=>$Releasable,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   862
						'emReleasable'=>$emReleasable,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   863
						'Type'=>$Type,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   864
						'UnzipOption'=>$unzip_option
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   865
					};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   866
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   867
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   868
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   869
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   870
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   871
	if (@PrjFileDie) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   872
		print STDERR
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   873
			"\n${BldInfPath}$BldInfName FATAL ERROR(S):\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   874
			@PrjFileDie
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   875
		;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   876
		exit 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   877
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   878
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   879
#	set the list of platforms to the default if there aren't any platforms specified,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   880
#	else add platforms to the global list unless they're scheduled for removal,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   881
	unless (@Plats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   882
		@$PlatsRef=@DefaultPlats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   883
		# Include the list of BPABI Platforms in a default build.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   884
		my $OptionalPlat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   885
		foreach $OptionalPlat (@OptionalPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   886
			#	VS6 and VS2003 are not real platforms and hence are not included in a default build
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   887
			unless ( $OptionalPlat eq 'VS6' || $OptionalPlat eq 'VS2003') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   888
				if (not grep /^$OptionalPlat$/i, @$PlatsRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   889
					push @$PlatsRef, $OptionalPlat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   890
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   891
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   892
		}		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   893
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   894
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   895
		my $Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   896
		foreach $Plat (@Plats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   897
			unless ($RemovePlats{$Plat}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   898
				push @$PlatsRef, $Plat;
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
		push @PlatsReq , @$PlatsRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   902
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   903
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   904
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   905
sub ExportDirs ($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   906
	my ($ExportsRef)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   907
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   908
	my %ExportDirHash;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   909
	foreach (@$ExportsRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   910
		my $dir = ($$_{Type} eq 'zip') ? $$_{Releasable} : &Path_Split('Path',$$_{Releasable});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   911
		if ($dir) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   912
			$dir=&Path_Chop($dir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   913
			$ExportDirHash{uc $dir}=$dir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   914
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   915
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   916
	my @ExportDirs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   917
	foreach (keys %ExportDirHash) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   918
		push @ExportDirs, $ExportDirHash{$_};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   919
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   920
	@ExportDirs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   921
}
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
sub ParseBldInfPlat ($$$$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   925
	my ($DataRef, $TestDataRef, $Plat, $BldInfPath, $FeatureVar)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   926
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   927
#	get the platform .MMP macros
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   928
	my %Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   929
	eval { &Plat_GetL($Plat,\%Plat); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   930
	&FatalError($@) if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   931
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   932
#	get the raw data from the BLD.INF file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   933
	my @Prj2D;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   934
	eval { &Prepfile_ProcessL(\@Prj2D, "${BldInfPath}$BldInfName", ($FeatureVar ? $FeatureVar->{VARIANT_HRH} : $variantMacroHRHFile), @{$Plat{MmpMacros}}); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   935
	&FatalError($@) if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   936
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   937
	my %dummy;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   938
	my @userIncludes = ('.');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   939
	my @systemIncludes = ();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   940
	$CheckSourceBldInfIncludes{$Plat} = CheckSource_Includes("${BldInfPath}$BldInfName", %dummy, $variantMacroHRHFile, @{$Plat{MmpMacros}}, @userIncludes, @systemIncludes, $CheckSource_NoUserSystemDistinction);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   941
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   942
#	process the raw data
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   943
	my $IsExtensionBlock =0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   944
	my (@ExtensionBlockData, $ErrorString);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   945
	my %Check;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   946
	my $Section=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   947
	my @PrjFileDie;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   948
	my $Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   949
	my $CurFile="${BldInfPath}$BldInfName";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   950
	LINE: foreach $Line (@Prj2D) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   951
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   952
		my %Data;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   953
		my %Temp;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   954
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   955
		my $LineNum=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   956
		if ($LineNum eq '#') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   957
			$CurFile=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   958
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   959
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   960
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   961
		$CurFile = &Path_Norm ($CurFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   962
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   963
#		upper-case all the data here, but record original source case
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   964
#		in a hash so that it can be recalled for CheckSource purposes
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   965
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   966
		my %originalSourceCase;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   967
   		foreach (@$Line) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   968
 			$originalSourceCase{uc $_} = $_;  # needed for extension template makefile MACROs 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   969
   			$_=uc $_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   970
   		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   971
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   972
		$_=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   973
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   974
#		check for section headers - don't test for the right ones here
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   975
#		because we do that in the first parse function
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   976
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   977
		if (/^PRJ_(\w*)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   978
			$Section=$1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   979
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   980
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   981
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   982
#		Skip section if PRJ_TESTMMPFILES and -notest option
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   983
		next LINE if ($Options{notest} && ($Section=~/^(TESTMMPFILES)$/o)); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   984
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   985
#		check for EXTENSION sections
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   986
		if ($Section=~/^(EXTENSIONS|TESTEXTENSIONS)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   987
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   988
#			We have an extension block
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   989
			if (/^start(\w*)$/io) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   990
				if ($IsExtensionBlock) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   991
					&FatalError("$CurFile($LineNum) : Cannot embed Extension Template 'start' sections\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   992
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   993
				$IsExtensionBlock =1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   994
				$ErrorString = "$CurFile($LineNum)";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   995
				foreach (@$Line)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   996
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   997
				if (/^EXTENSION$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   998
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   999
					my $extensionTemplate = @$Line[scalar(@$Line)-1];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1000
					CheckSource_MetaData(%CheckSourceEXTENSIONSMetaData, $CurFile, "PRJ_".$Section, $originalSourceCase{$extensionTemplate}.".mk", $LineNum, $CheckSource_PhysicalCheck) if ($extensionTemplate);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1001
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1002
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1003
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1004
				push @ExtensionBlockData, $Line; 			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1005
				next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1006
			}		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1007
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1008
			if (($IsExtensionBlock) & (! (/^end(\w*)$/io))) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1009
				if (($_ ne "TOOL") & ($_ ne "OPTION") & ($_ ne "TARGET") & ($_ ne "SOURCES") & ($_ ne "DEPENDENCIES")) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1010
							&FatalError("$CurFile($LineNum) : Unrecognised keyword: $_.  Is there an 'end' corresponding to the 'start' for the Extension Template?\n"); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1011
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1012
				if ($_ ne "OPTION") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1013
					unshift(@$Line, $_);					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1014
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1015
#				Need to revert MACROs back to their original case
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1016
				foreach (@$Line) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1017
					$_=$originalSourceCase{$_};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1018
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1019
				push @ExtensionBlockData, $Line; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1020
				next LINE;
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
			if (/^end(\w*)$/io) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1024
				if (! $IsExtensionBlock) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1025
					&FatalError("$CurFile($LineNum) : No 'start' corresponding to this 'end' in Extension Template section\n"); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1026
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1027
				$IsExtensionBlock =0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1028
				my $OutDir=Path_Chop($E32env::Data{BldPath}).$BldInfPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1029
#				Generate wrapper makefile for this platform.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1030
				eval { &Load_ModuleL('WrapperMakefile'); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1031
					&FatalError($@) if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1032
				$OutDir=~ s/\\/\//g;  # convert to unix slashes for wrappermakefile.pm
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1033
				%Data = GenerateWrapper($Plat, $OutDir, $ErrorString, \@PrjFileDie, @ExtensionBlockData);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1034
				if (!$IgnoreMissingExtensionMakefile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1035
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1036
					$Data{ExtensionRoot}=&Path_Split('Path', $CurFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1037
					$Data{Path}=~ s/\//\\/g;  # convert unix slashes back to win32 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1038
					$Data{Base}=~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1039
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1040
				@ExtensionBlockData = ();  # clear array
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1041
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1042
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1043
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1044
#		check for MMP sections and get the .MMP file details
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1045
		if ($Section=~/^(MMPFILES|TESTMMPFILES)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1046
			$Data{Ext}='.MMP';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1047
#			check for MAKEFILE statements for custom building
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1048
			my $SubSection = "MMP";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1049
			if (/^MAKEFILE$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1050
				$SubSection = $_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1051
				$Data{Makefile}=2;  # treat MAKEFILE=>NMAKEFILE   =1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1052
				$_=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1053
				$Data{Ext}=&Path_Split('Ext', $_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1054
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1055
			if (/^NMAKEFILE$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1056
				$SubSection = $_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1057
				$Data{Makefile}=2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1058
				$_=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1059
				$Data{Ext}=&Path_Split('Ext', $_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1060
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1061
			if (/^GNUMAKEFILE$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1062
				$SubSection = $_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1063
				$Data{Makefile}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1064
				$_=shift @$Line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1065
				$Data{Ext}=&Path_Split('Ext', $_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1066
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1067
			CheckSource_MetaData(%CheckSourceMMPFILESMetaData, $CurFile, "PRJ_$Section $SubSection", $originalSourceCase{$_}, $LineNum, $CheckSource_PhysicalCheck);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1068
			$_ = &Path_Norm ($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1069
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1070
#			path considered relative to the current file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1071
			$Data{Path}=&Path_Split('Path', &Path_MakeAbs($CurFile, $_));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1072
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1073
#			this function doesn't care whether the .MMPs are listed with their extensions or not
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1074
			$Data{Base}=&Path_Split('Base', $_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1075
			my $MmpFile= $Data{Path}.$Data{Base};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1076
   
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1077
#			check the file isn't already specified
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1078
  			if ($Check{$MmpFile}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1079
  				push @PrjFileDie, "$CurFile($LineNum) : duplicate $Data{Base} (from line $Check{$MmpFile})\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1080
   				next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1081
   			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1082
  			$Check{$MmpFile}="$CurFile: $LineNum";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1083
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1084
#			check the file exists
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1085
			unless (-e "$Data{Path}$Data{Base}$Data{Ext}") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1086
				WarnOrDie(\@PrjFileDie, "$CurFile($LineNum) : $Data{Path}$Data{Base}$Data{Ext} does not exist\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1087
				next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1088
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1089
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1090
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1091
#			process the file's attributes
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1092
			if ($Section eq 'MMPFILES') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1093
				foreach (@$Line) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1094
					if (/^TIDY$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1095
						$Data{Tidy}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1096
						next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1097
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1098
					if (/^IGNORE$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1099
						next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1100
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1101
					if (/^BUILD_AS_ARM$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1102
					  $Data{BuildAsARM}="-arm";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1103
					  next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1104
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1105
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1106
					push @PrjFileDie, "$CurFile($LineNum) : Don't understand .MMP file argument \"$_\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1107
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1108
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1109
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1110
#			process the test .MMP file's attributes
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1111
			elsif ($Section eq 'TESTMMPFILES') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1112
				foreach (@$Line) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1113
					if (/^TIDY$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1114
						$Data{Tidy}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1115
						next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1116
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1117
					if (/^IGNORE$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1118
						next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1119
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1120
					if (/^BUILD_AS_ARM$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1121
					  $Data{BuildAsARM}="-arm";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1122
					  next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1123
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1124
					if (/^MANUAL$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1125
						$Data{Manual}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1126
						next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1127
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1128
					if (/^SUPPORT$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1129
						$Data{Support}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1130
						next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1131
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1132
					push @PrjFileDie, "$CurFile($LineNum) : Don't understand test .MMP file argument \"$_\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1133
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1134
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1135
		}		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1136
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1137
#		store the data
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1138
		if (($Section eq 'MMPFILES') or ($Section eq 'EXTENSIONS')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1139
			if ($IgnoreMissingExtensionMakefile and $Section eq 'EXTENSIONS')
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1140
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1141
				# More than more ext makefile can be missing so reset indicator
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1142
				$IgnoreMissingExtensionMakefile = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1143
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1144
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1145
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1146
				push @$DataRef, \%Data;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1147
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1148
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1149
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1150
		if (($Section eq 'TESTMMPFILES') or ($Section eq 'TESTEXTENSIONS')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1151
			if ($IgnoreMissingExtensionMakefile and $Section eq 'TESTEXTENSIONS')
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1152
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1153
				# More than more ext makefile can be missing so reset indicator
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1154
				$IgnoreMissingExtensionMakefile = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1155
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1156
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1157
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1158
				push @$TestDataRef, \%Data;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1159
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1160
			next LINE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1161
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1162
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1163
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1164
#	line loop end
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1165
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1166
#	exit if there are errors
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1167
	if (@PrjFileDie) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1168
		print STDERR
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1169
			"\n\"${BldInfPath}$BldInfName\" FATAL ERROR(S):\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1170
			@PrjFileDie
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1171
		;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1172
		exit 1;
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
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1176
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1177
sub FatalError (@) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1178
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1179
	print STDERR "BLDMAKE ERROR: @_\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1180
	exit 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1181
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1182
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1183
sub CreatePlatformPm ($$$$$$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1184
	my ($BatchPath, $PlatsRef, $RealPlatsRef, $RealHRef, $AllPlatDataHRef, $AllPlatTestDataHRef)=@_;
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
# 	exclude GCCXML, EDG and CWTOOLS  from list of RealPlats
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1188
	my @RealPlats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1189
	foreach my $Plat (@$RealPlatsRef){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1190
	unless (($Plat =~ /^gccxml/i)  or  ($Plat =~ /^edg/i) or  ($Plat =~ /^cwtools/i) or ($Plat =~ /^x86gcc/i) or ($Plat =~ /^x86gmp/i)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1191
# 	exclude BPABI targets from list of RealPlats provided they are not specified in the platform list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1192
				if (grep /^$Plat$/i, @OptionalPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1193
					if (grep /^$Plat$/, @PlatsReq) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1194
						push @RealPlats, $Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1195
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1196
					next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1197
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1198
				push @RealPlats, $Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1199
			}
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
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1203
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1204
		"# Bldmake-generated perl file - PLATFORM.PM\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1205
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1206
		"# use a perl integrity checker\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1207
		"use strict;\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1208
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1209
		"package Platform;\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1210
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1211
		"use vars qw(\@Plats \@RealPlats %Programs %TestPrograms %FeatureVariantSupportingPlats);\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1212
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1213
		"\@Plats=(\'",join('\',\'',@$PlatsRef),"\');\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1214
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1215
		"\@RealPlats=(\'", join('\',\'',@RealPlats),"\');\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1216
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1217
		"%Programs=(\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1218
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1219
	my %All; # all programs for all platforms
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1220
	my $TmpStr;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1221
	my $Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1222
	foreach $Plat (@$PlatsRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1223
		$TmpStr="	\'$Plat\'=>[";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1224
		if (@{${$AllPlatDataHRef}{$$RealHRef{$Plat}}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1225
			my $ProgRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1226
			foreach $ProgRef (@{${$AllPlatDataHRef}{$$RealHRef{$Plat}}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1227
				$TmpStr.="'$$ProgRef{Base}',";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1228
				$All{$$ProgRef{Base}}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1229
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1230
			chop $TmpStr;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1231
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1232
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1233
			"$TmpStr],\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1234
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1235
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1236
	$TmpStr="	ALL=>[";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1237
	if (keys %All) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1238
		my $Prog;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1239
		foreach $Prog (keys %All) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1240
			$TmpStr.="'$Prog',";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1241
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1242
		chop $TmpStr;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1243
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1244
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1245
		"$TmpStr]\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1246
		");\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1247
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1248
		"%TestPrograms=(\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1249
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1250
	%All=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1251
	foreach $Plat (@$PlatsRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1252
		$TmpStr="	\'$Plat\'=>[";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1253
		if (@{${$AllPlatTestDataHRef}{$$RealHRef{$Plat}}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1254
			my $ProgRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1255
			foreach $ProgRef (@{${$AllPlatTestDataHRef}{$$RealHRef{$Plat}}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1256
				$TmpStr.="'$$ProgRef{Base}',";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1257
				$All{$$ProgRef{Base}}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1258
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1259
			chop $TmpStr;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1260
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1261
		&Output("$TmpStr],\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1262
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1263
	$TmpStr="	ALL=>[";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1264
	if (keys %All) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1265
		my $Prog;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1266
		foreach $Prog (keys %All) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1267
			$TmpStr.="'$Prog',";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1268
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1269
		chop $TmpStr;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1270
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1271
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1272
		"$TmpStr]\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1273
		");\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1274
		"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1275
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1276
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1277
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1278
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1279
		"%FeatureVariantSupportingPlats=("
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1280
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1281
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1282
	$TmpStr = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1283
	foreach $Plat (@$PlatsRef)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1284
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1285
		$TmpStr .= "\n\t$Plat=>1," if (&Plat_SupportsFeatureVariants($Plat));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1286
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1287
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1288
	chop $TmpStr;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1289
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1290
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1291
		"$TmpStr\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1292
		");\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1293
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1294
		"1;\n"
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
#	write the PLATFORM.PM file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1298
	&WriteOutFileL($BatchPath."PLATFORM.PM");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1299
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1300
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1301
sub CreatePerlBat ($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1302
	my ($BldInfPath)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1303
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1304
#	create ABLD.BAT, which will call ABLD.PL
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1305
#   NB. must quote $BldInfPath because it may contain spaces, but we know it definitely
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1306
#       ends with \ so we need to generate "\foo\bar\\" to avoid quoting the close double quote
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1307
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1308
		"\@ECHO OFF\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1309
		"\n", 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1310
		"REM Bldmake-generated batch file - ABLD.BAT\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1311
		"REM ** DO NOT EDIT **", 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1312
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1313
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1314
		"perl -S ABLD.PL \"${BldInfPath}\\\" %1 %2 %3 %4 %5 %6 %7 %8 %9\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1315
		"if errorlevel==1 goto CheckPerl\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1316
		"goto End\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1317
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1318
		":CheckPerl\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1319
		"perl -v >NUL\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1320
		"if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed?\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1321
		"goto End\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1322
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1323
		":End\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1324
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1325
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1326
#	check that the .BAT file does not already exist and is read-only
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1327
	if ((-e "${BldInfPath}ABLD.BAT")  && !(-w "${BldInfPath}ABLD.BAT")) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1328
		warn "BLDMAKE WARNING: read-only ABLD.BAT will be overwritten\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1329
		chmod 0222, "${BldInfPath}ABLD.BAT";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1330
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1331
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1332
#	create the .BAT file in the group directory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1333
	&WriteOutFileL($BldInfPath."ABLD.BAT",1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1334
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1335
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1336
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1337
sub GetArchiveExportList($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1338
	my ($ExportRef) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1339
	my $Type = $ExportRef->{Type};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1340
	my $Src = $ExportRef->{Source};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1341
	my $Dest = $ExportRef->{Releasable};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1342
	$Dest = '' if (!defined($Dest));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1343
	my @list = ();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1344
	if ($Type eq 'zip') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1345
		unless (open PIPE, "unzip -l $Src | ") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1346
			warn "Can't unzip $Src\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1347
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1348
		while (<PIPE>) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1349
			if (/^\s*\d+\s+\S+\s+\S+\s+(.*?)\s*$/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1350
#				ignore empty lines and anything that finishes with / 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1351
				unless(($1=~/\/\s*$/) || ($1=~/^$/)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1352
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1353
					my $member = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1354
					$member =~ s/\$/\$\$/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1355
					if (!$Dest){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1356
						push @list, "$ENV{EPOCROOT}$member";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1357
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1358
					else{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1359
						push @list, "$Dest\\$member";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1360
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1361
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1362
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1363
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1364
		close PIPE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1365
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1366
	return @list;
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
sub CreateExportMak ($$$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1370
	my ($Makefile, $ExportsRef, $ExpDirsRef)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1371
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1372
#	create EXPORT.MAKE
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1373
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1374
	my $erasedefn = "\@erase";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1375
	$erasedefn = "\@erase 2>>nul" if ($ENV{OS} eq "Windows_NT");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1376
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1377
		"ERASE = $erasedefn\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1378
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1379
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1380
		"EXPORT : EXPORTDIRS"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1381
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1382
	my $ref;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1383
	if (@$ExportsRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1384
		foreach $ref (@$ExportsRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1385
			if ($$ref{Type} eq 'zip') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1386
				my @list = &GetArchiveExportList($ref);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1387
				foreach (@list) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1388
					my $dst=$_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1389
					&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1390
						" \\\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1391
						"\t$dst"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1392
					);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1393
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1394
			} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1395
				my $name=&Path_Quote($$ref{Releasable});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1396
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1397
					" \\\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1398
					"\t$name"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1399
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1400
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1401
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1402
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1403
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1404
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1405
			" \n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1406
			"\t\@echo Nothing to do\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1407
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1408
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1409
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1410
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1411
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1412
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1413
		"EXPORTDIRS :"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1414
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1415
	my $dir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1416
	foreach $dir (@$ExpDirsRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1417
		$dir=&Path_Quote($dir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1418
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1419
			" $dir"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1420
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1421
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1422
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1423
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1424
		"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1425
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1426
	foreach $dir (@$ExpDirsRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1427
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1428
			"$dir :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1429
			    "\t\@perl -S emkdir.pl \"\$\@\"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1430
			"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1431
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1432
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1433
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1434
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1435
		"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1436
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1437
	foreach $ref (@$ExportsRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1438
		my $unzipoption = $$ref{UnzipOption};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1439
		CheckSource_ExportedIncludes($$ref{Source}, $$ref{Releasable}, %CheckSourceEXPORTSIncludes);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1440
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1441
		if ($$ref{Type} eq 'zip') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1442
			my $src = &Path_Quote($$ref{Source});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1443
			my $destdir = &Path_Quote($$ref{Releasable});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1444
			$destdir=$ENV{EPOCROOT} if (!defined($destdir) or ($destdir eq ''));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1445
			my @list = &GetArchiveExportList($ref);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1446
  			foreach (@list) {  				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1447
  				my $dst=$_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1448
  				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1449
 					"$dst : $src\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1450
  				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1451
  			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1452
			if ($unzipoption =~ /overwrite/i){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1453
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1454
				"\t- unzip -o $src -d \"$destdir\"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1455
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1456
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1457
			else{	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1458
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1459
				"\t- unzip -u  -o $src -d \"$destdir\"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1460
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1461
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1462
		} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1463
			my $dst=&Path_Quote($$ref{Releasable});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1464
			my $src=&Path_Quote($$ref{Source});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1465
			&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1466
				"$dst : $src\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1467
					"\tcopy \"\$?\" \"\$\@\"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1468
				"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1469
			);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1470
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1471
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1472
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1473
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1474
		"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1475
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1476
	if (@$ExportsRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1477
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1478
			"CLEANEXPORT :\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1479
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1480
		foreach $ref (@$ExportsRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1481
			if ($$ref{Type} eq 'zip') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1482
				my @list = &GetArchiveExportList($ref);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1483
				foreach (@list) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1484
					my $dst=$_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1485
					$dst =~ s/\//\\/go;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1486
					&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1487
						"\t-\$(ERASE) \"$dst\"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1488
					);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1489
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1490
			} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1491
				my $dst = $$ref{Releasable};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1492
				$dst =~ s/\//\\/go;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1493
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1494
					"\t-\$(ERASE) \"$dst\"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1495
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1496
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1497
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1498
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1499
			"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1500
			"WHAT :\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1501
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1502
		foreach $ref (@$ExportsRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1503
			if ($$ref{Type} eq 'zip') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1504
				my @list = &GetArchiveExportList($ref);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1505
				foreach (@list) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1506
					my $dst=$_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1507
					$dst =~ s/\//\\/go;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1508
					&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1509
						"\t\@echo \"$dst\"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1510
					);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1511
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1512
			} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1513
				my $dst = $$ref{Releasable};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1514
				$dst =~ s/\//\\/go;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1515
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1516
					"\t\@echo \"$dst\"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1517
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1518
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1519
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1520
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1521
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1522
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1523
			"CLEANEXPORT :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1524
			"\t\@echo Nothing to do\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1525
			"WHAT :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1526
			"\t\@rem do nothing\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1527
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1528
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1529
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1530
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1531
		"\nCHECKSOURCE :\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
	&Output (CheckSource_MakefileOutput(%CheckSourceEXPORTSMetaData));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1535
	&Output (CheckSource_MakefileOutput(%CheckSourceEXPORTSIncludes));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1536
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1537
	&Output("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1538
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1539
#	write EXPORT.MAKE
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1540
	&WriteOutFileL($Makefile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1541
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1542
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1543
sub CreatePlatExports ($$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1544
	my ($RealPlat,$Exports)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1545
	my $Ref;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1546
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1547
 	"\n# Rules which handle the case when \$(CFG) is not defined\n\n" ,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1548
 	"EXPORT:		\tEXPORTUREL EXPORTUDEB\n", 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1549
 	"EXPORTCLEAN:	\tEXPORTCLEANUREL EXPORTCLEANUDEB\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1550
 	"EXPORTWHAT:	\tEXPORTWHATUREL EXPORTWHATUDEB\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1551
  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1552
 	"\n# definitions \n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1553
 	"DATAx = $ENV{EPOCROOT}epoc32\\data\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1554
 	"EMULx = $ENV{EPOCROOT}epoc32\\$RealPlat\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1555
 	"URELx = $ENV{EPOCROOT}epoc32\\release\\$RealPlat\\urel\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1556
 	"UDEBx = $ENV{EPOCROOT}epoc32\\release\\$RealPlat\\udeb\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1557
 	"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1558
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1559
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1560
	&Output( 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1561
	"# Exports to emulated drive A: to Y \n\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1562
	"EXPORTGENERIC : EXPORTDIRSGENERIC",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1563
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1564
	 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1565
	my @dirs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1566
	my @expgen;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1567
	my %dirsg;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1568
	foreach $Ref (@$Exports) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1569
	 	if ($$Ref{emReleasable}=~/^([A-Y])(\\.*)$/){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1570
		   my $exp="\\$$Ref{emReleasable}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1571
	 	   if ($$Ref{Type} eq 'zip') {	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1572
			 my @list = &GetArchiveExportList($Ref);	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1573
			  foreach (@list) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1574
				my $dst=&Path_Quote($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1575
				if ($dst=~/([^\\]*)$/o){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1576
					$dst=$1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1577
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1578
				my $zipdest=$dst;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1579
				$zipdest =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1580
			    push  @expgen, "$exp\\$zipdest";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1581
			    my $zippath= &Path_Chop(&Path_Split('Path', $zipdest));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1582
				if(!$zippath){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1583
					$dirsg{$exp}=$exp;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1584
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1585
				else{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1586
					 $dirsg{"$exp\\$zippath"}="$exp\\$zippath";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1587
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1588
				&Output(" \\\n","\t\$(EMULx)$exp\\$zipdest");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1589
			 }      
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1590
		 }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1591
		 else { 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1592
		     my $dir =  &Path_Chop(&Path_Split('Path', $exp));  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1593
			 push @expgen,  $exp;	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1594
			 $dirsg{$dir}=$dir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1595
			 &Output(" \\\n", "\t\$(EMULx)$exp "); 
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
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1599
	&Output("\n\nEXPORTDIRSGENERIC : ");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1600
	foreach (keys %dirsg){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1601
			 push @dirs, "\$(EMULx)$dirsg{$_}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1602
			 &Output(" \\\n", "\t\$(EMULx)$_"); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1603
	} 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1604
	&Output("\n\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1605
	foreach (@expgen){	 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1606
			&Output( 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1607
			"\$(EMULx)$_ : \t\$(DATAx)$_ \n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1608
			"\tcopy \"\$?\" \"\$@\" \n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1609
			);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1610
	}	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1611
	&Output("\nEXPORTCLEANGENERIC :\n");		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1612
	foreach (@expgen){	 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1613
			&Output("\t-@\$(ERASE) \$(EMULx)$_ \n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1614
	} 			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1615
	&Output("\nEXPORTWHATGENERIC :\n");			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1616
	foreach (@expgen){	   
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1617
			&Output("\t\@echo \$(EMULx)$_ \n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1618
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1619
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1620
	&Output( 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1621
	 		"\n\n# Exports to emulated drive Z: - UREL version \n\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1622
	 		"EXPORTUREL : EXPORTDIRSUREL",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1623
	 	   );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1624
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1625
	my @expurel; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1626
	my %dirsurel;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1627
	foreach $Ref (@$Exports) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1628
		if ($$Ref{emReleasable}=~/^(Z)(\\.*)$/){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1629
			my $exp="\\$$Ref{emReleasable}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1630
	 	    if ($$Ref{Type} eq 'zip') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1631
			  my @list = &GetArchiveExportList($Ref);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1632
			  foreach (@list) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1633
				my $dst=&Path_Quote($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1634
				if ($dst=~/([^\\]*)$/o){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1635
					$dst=$1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1636
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1637
				my $zipdest=$dst;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1638
				$zipdest=~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1639
				push  @expurel, "$exp\\$zipdest"; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1640
				my $zippath= &Path_Chop(&Path_Split('Path', $zipdest)); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1641
				if(!$zippath){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1642
				   $dirsurel{$exp}=$exp;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1643
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1644
				else{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1645
					$dirsurel{"$exp\\$zippath"}="$exp\\$zippath";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1646
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1647
				&Output(" \\\n","\t\$(URELx)$exp\\$zipdest");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1648
			}  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1649
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1650
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1651
			  my $dir =  &Path_Chop(&Path_Split('Path', $exp));  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1652
			  push @expurel,  $exp; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1653
			  $dirsurel{$dir}=$dir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1654
			  &Output(" \\\n", "\t\$(URELx)$exp "); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1655
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1656
	  }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1657
	} 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1658
	&Output("\n\nEXPORTDIRSUREL : ");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1659
	foreach (keys %dirsurel){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1660
			push @dirs, "\$(URELx)$dirsurel{$_}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1661
   			&Output(" \\\n", "\t\$(URELx)$_ "); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1662
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1663
	&Output("\n\n");	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1664
	foreach (@expurel){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1665
			 &Output( 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1666
					"\$(URELx)$_ : \t\$(DATAx)$_ \n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1667
					"\tcopy \"\$?\" \"\$@\" \n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1668
			 );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1669
	}		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1670
	&Output("\nEXPORTCLEANUREL :\n"); 		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1671
	foreach (@expurel){	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1672
			 &Output("\t-@\$(ERASE) \$(URELx)$_ \n"); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1673
	}  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1674
	&Output("\nEXPORTWHATUREL :\n");	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1675
	foreach (@expurel){	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1676
			 &Output( "\t\@echo \$(URELx)$_ \n"); 	
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
	&Output( 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1680
	 		"\n\n# Exports to emulated drive Z: - UDEB version \n\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1681
	 		"EXPORTUDEB : EXPORTDIRSUDEB",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1682
	);  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1683
	 	   
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1684
	my %dirsudeb=%dirsurel;          
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1685
	my @expudeb=@expurel;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1686
	foreach (@expudeb){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1687
	         &Output(" \\\n", "\t\$(UDEBx)$_ ");		  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1688
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1689
	&Output("\n\nEXPORTDIRSUDEB : ");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1690
	foreach(keys %dirsudeb){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1691
	  		push @dirs, "\$(UDEBx)$dirsudeb{$_}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1692
	  		&Output(" \\\n", "\t\$(UDEBx)$_ "); 
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
	&Output("\n\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1696
	foreach (@expudeb){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1697
	 		 &Output( 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1698
					"\$(UDEBx)$_ : \t\$(DATAx)$_ \n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1699
					"\tcopy \"\$?\" \"\$@\" \n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1700
			 );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1701
	}			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1702
	&Output("\nEXPORTCLEANUDEB :\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1703
	foreach (@expudeb){	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1704
			 &Output("\t-@\$(ERASE) \$(UDEBx)$_ \n"); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1705
	}  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1706
	&Output("\nEXPORTWHATUDEB :\n");	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1707
	foreach (@expudeb){	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1708
			 &Output("\t\@echo \$(UDEBx)$_ \n"); 	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1709
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1710
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1711
    &Output("\n# Directories \n\n");  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1712
	&Output(join (" \\\n", @dirs)." :")       
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1713
	&Output("\n\t\@perl -S emkdir.pl \$@\n\n");			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1714
		   		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1715
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1716
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1717
sub CreatePlatMak ($$$$$$$$$;$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1718
	my ($BatchPath, $E32MakePath, $DataRef, $Plat, $RealPlat, $RomDir, $Module, $BldInfPath, $Exports, $Test, $FeatureVariant)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1719
	$FeatureVariant = "" if (!$FeatureVariant);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1720
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1721
	unless ($Test) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1722
		$Test='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1723
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1724
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1725
		$Test='TEST';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1726
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1727
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1728
	my $Ref;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1729
	my $eDrive=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1730
	if ($RealPlat =~ /^WINS/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1731
	    foreach $Ref (@$Exports) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1732
			if ($$Ref{emReleasable}=~/^([A-Z])(\\.*)$/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1733
				$eDrive=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1734
				last;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1735
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1736
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1737
	} 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1738
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1739
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1740
	my $OutRomFile="$RomDir$RealPlat$Test.IBY";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1741
	my $GCCDir="gcc\$(PBUILDPID)\\bin";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1742
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1743
	my $erasedefn = "\@erase";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1744
	$erasedefn = "\@erase 2>>nul" if ($ENV{OS} eq "Windows_NT");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1745
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1746
# Get the root platform name to support hierarchy of customizations	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1747
	my $root = Plat_Root($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1748
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1749
	my $config_file = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1750
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1751
	if (grep /^$root$/i, @BPABIPlats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1752
		$config_file = BPABIutl_Config_Path($root);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1753
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1754
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1755
	my $rvct_path = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1756
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1757
	if ( $config_file ) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1758
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1759
		if ($root =~ /^ARMV\d/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1760
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1761
			unless ( RVCT_plat2set::compiler_exists($Plat) )
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1762
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1763
				FatalError("Can't find any RVCT installation.");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1764
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1765
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1766
			my $rvct_ver = RVCT_plat2set::get_version_string($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1767
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1768
			if ($Plat =~ "^ARMV5" && $rvct_ver lt "2.2.559")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1769
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1770
				warn "BLDMAKE WARNING: ARMV5 requires at least RVCT 2.2.559.";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1771
				OutText();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1772
				return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1773
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1774
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1775
			if ($Plat =~ "^ARMV6" && $rvct_ver lt "2.2.559")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1776
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1777
				warn "BLDMAKE WARNING: ARMV6 requires at least RVCT 2.2.559.";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1778
				OutText();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1779
				return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1780
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1781
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1782
			if ($Plat =~ "^ARMV7" && $rvct_ver lt "3.1.674")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1783
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1784
				warn "BLDMAKE WARNING: ARMV7 requires at least RVCT 3.1.674.";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1785
				OutText();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1786
				return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1787
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1788
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1789
			my $rvct_bin_name = RVCT_plat2set::get_bin_name($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1790
			my $rvct_bin_path = RVCT_plat2set::get_bin_path($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1791
			my $rvct_inc_name = RVCT_plat2set::get_inc_name($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1792
			my $rvct_inc_path = RVCT_plat2set::get_inc_path($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1793
			my $rvct_lib_name = RVCT_plat2set::get_lib_name($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1794
			my $rvct_lib_path = RVCT_plat2set::get_lib_path($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1795
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1796
			main::Output("export $rvct_bin_name:=$rvct_bin_path\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1797
			main::Output("export $rvct_inc_name:=$rvct_inc_path\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1798
			main::Output("export $rvct_lib_name:=$rvct_lib_path\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1799
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1800
			my ($rvct_M, $rvct_m, $rvct_b) = RVCT_plat2set::get_version_list($Plat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1801
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1802
			Output( "\n" );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1803
			Output( "export RVCT_VER_MAJOR:=$rvct_M\n" );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1804
			Output( "export RVCT_VER_MINOR:=$rvct_m\n" );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1805
			Output( "export RVCT_VER_BUILD:=$rvct_b\n" );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1806
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1807
			$rvct_path = "\$($rvct_bin_name);"; # Example: '$(RVCT22BIN);'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1808
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1809
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1810
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1811
			"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1812
			"export PLAT:=${Plat}\n\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1813
			"include $config_file\n\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1814
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1815
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1816
# modified start: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1817
	unless($FeatureVariant eq "")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1818
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1819
# modified by SV start: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1820
		foreach $Ref (@$DataRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1821
			&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1822
			"include $BatchPath"."FeatureVariantInfo\\".uc($Plat)."\\"."$Plat$FeatureVariant.$$Ref{Base}.info\n\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1823
			);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1824
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1825
# modified by SV end: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1826
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1827
# modified end: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1828
	# Don't hardcode the rvct path if rvct auto switch feature is not enabled.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1829
	if ($ENV{ABLD_PLAT_INI}) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1830
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1831
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1832
		'export Path:=',&main::Path_Drive,$E32env::Data{EPOCPath},$GCCDir,";", $rvct_path,"\$(Path)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1833
		"export PATH:=\$(Path)\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1834
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1835
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1836
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1837
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1838
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1839
		'export Path:=',&main::Path_Drive,$E32env::Data{EPOCPath},$GCCDir,";", "\$(Path)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1840
		"export PATH:=\$(Path)\n"
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
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1844
	&Output(		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1845
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1846
		"# prevent MAKEFLAGS variable from upsetting calls to NMAKE\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1847
		"unexport MAKEFLAGS\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1848
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1849
		"ERASE = $erasedefn\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1850
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1851
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1852
		"ifdef EFREEZE_ALLOW_REMOVE\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1853
		"REMOVEMACRO := EFREEZE_ALLOW_REMOVE=-remove\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1854
		"endif\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1855
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1856
		"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1857
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1858
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1859
	if ($eDrive) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1860
		# Generate exports into emulated drives
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1861
		&CreatePlatExports($RealPlat,$Exports);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1862
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1863
	my $Command;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1864
	foreach $Command (qw(CLEAN CLEANMAKEFILE CLEANALL FINAL FREEZE LIBRARY MAKEFILE RESOURCE SAVESPACE TARGET LISTING WHATMAKEFILE)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1865
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1866
			"$Command :"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1867
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1868
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1869
			 if ($eDrive and $Command eq 'CLEAN'){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1870
				 &Output(" EXPORTCLEANGENERIC EXPORTCLEAN\$(CFG) ");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1871
				 foreach $Ref (@$DataRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1872
					 &Output(" $Command$$Ref{Base}");
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
			 elsif ($eDrive and $Command eq 'RESOURCE'){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1876
				 &Output(" EXPORTGENERIC EXPORT\$(CFG) ");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1877
			   	 foreach $Ref (@$DataRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1878
					 &Output(" $Command$$Ref{Base}");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1879
				 }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1880
				 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1881
				 foreach $Ref (@$DataRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1882
					 &Output("\n\nRESOURCE$$Ref{Base} : EXPORTGENERIC EXPORT\$(CFG)");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1883
				 }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1884
			  }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1885
			  else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1886
			        if(@$DataRef){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1887
			        	foreach $Ref (@$DataRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1888
			        		&Output(" $Command$$Ref{Base}");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1889
			           }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1890
			          } 		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1891
			         else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1892
			         	&Output("\n","\t\@echo Nothing to do\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1893
			         }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1894
			  }  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1895
		&Output("\n","\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1896
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1897
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1898
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1899
		"WHAT :"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1900
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1901
	if($eDrive){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1902
	  &Output(" EXPORTWHATGENERIC EXPORTWHAT\$(CFG) ");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1903
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1904
	my $whatcount=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1905
	foreach $Ref (@$DataRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1906
		unless ($$Ref{Tidy}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1907
			$whatcount++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1908
			&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1909
				" WHAT$$Ref{Base}"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1910
			);
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
	if ($whatcount==0 and !$eDrive) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1914
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1915
			"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1916
			"\t\@rem do nothing\n" 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1917
		);
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
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1921
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1922
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1923
		"CHECKSOURCE :"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1924
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1925
	my $CheckSource=' CHECKSOURCE_GENERIC';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1926
	foreach $Ref (@$DataRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1927
		$CheckSource.=" CHECKSOURCE$$Ref{Base}" if ($$Ref{Ext} eq ".MMP");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1928
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1929
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1930
		"$CheckSource\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1931
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1932
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1933
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1934
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1935
		"CHECKSOURCE_GENERIC :\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1936
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1937
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1938
	if ($CheckSourceBldInfIncludes{$Plat})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1939
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1940
		my %dummy;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1941
		$dummy{$CheckSourceBldInfIncludes{$Plat}} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1942
		&Output (CheckSource_MakefileOutput(%dummy));		
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
	&Output (CheckSource_MakefileOutput(%CheckSourceMMPFILESMetaData));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1946
	&Output (CheckSource_MakefileOutput(%CheckSourceEXTENSIONSMetaData));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1947
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1948
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1949
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1950
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1951
		"TIDY :"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1952
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1953
	my $Tidy='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1954
	foreach $Ref (@$DataRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1955
		if ($$Ref{Tidy}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1956
			$Tidy.=" TIDY$$Ref{Base}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1957
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1958
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1959
	if ($Tidy) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1960
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1961
			"$Tidy\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1962
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1963
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1964
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1965
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1966
			"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1967
			"\t\@echo Nothing to do\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1968
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1969
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1970
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1971
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1972
		"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1973
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1974
#	change for non-EPOC platforms
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1975
	if ($RealPlat=~/^(WINS|WINSCW|WINC|TOOLS|TOOLS2)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1976
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1977
			"ROMFILE :\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1978
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1979
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1980
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1981
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1982
			'ROMFILE : STARTROMFILE'
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1983
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1984
		foreach $Ref (@$DataRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1985
			&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1986
				" ROMFILE$$Ref{Base}"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1987
			);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1988
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1989
		&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1990
			"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1991
			"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1992
			"STARTROMFILE :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1993
			    "\t\@perl -S emkdir.pl \"", &Path_Chop($RomDir), "\"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1994
			    "\t\@echo // $OutRomFile > $OutRomFile\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1995
			    "\t\@echo // >> $OutRomFile\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1996
		);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1997
		if ($Test) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1998
			my ($Auto, $Manual);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1999
			foreach $Ref (@$DataRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2000
				++$Auto unless ($$Ref{Manual} or $$Ref{Support});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2001
				++$Manual if ($$Ref{Manual});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2002
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2003
			if ($Auto) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2004
				my $IbyTextFrom="data=$BatchPath$Plat.AUTO.BAT";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2005
				my $IbyTextTo="Test\\$Module.AUTO.BAT";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2006
				my $Spaces= 60>length($IbyTextFrom) ? 60-length($IbyTextFrom) : 1; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2007
				&Output("\t\@echo ", $IbyTextFrom, ' 'x$Spaces, $IbyTextTo, ">> $OutRomFile\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2008
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2009
			if ($Manual) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2010
				my $IbyTextFrom="data=$BatchPath$Plat.MANUAL.BAT";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2011
				my $IbyTextTo="Test\\$Module.MANUAL.BAT";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2012
				my $Spaces= 60>length($IbyTextFrom) ? 60-length($IbyTextFrom) : 1; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2013
				&Output("\t\@echo ", $IbyTextFrom, ' 'x$Spaces, $IbyTextTo, ">> $OutRomFile\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2014
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2015
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2016
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2017
	&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2018
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2019
		"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2020
	);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2021
	my $CallNmake='nmake -nologo -x - $(VERBOSE) $(KEEPGOING)';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2022
	my $CallGNUmake='$(MAKE) $(VERBOSE) $(KEEPGOING)';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2023
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2024
	my %PlatHash;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2025
	&Plat_GetL($RealPlat, \%PlatHash);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2026
	my $CallMake=$CallNmake;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2027
	if ($PlatHash{MakeCmd} eq "make") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2028
		$CallMake="$CallGNUmake -r";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2029
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2030
	&Plat_GetL($Plat, \%PlatHash);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2031
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2032
	foreach $Ref (@$DataRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2033
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2034
#		standard commands
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2035
		unless ($$Ref{Makefile}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2036
			my $MakefilePath=join('', &Path_Chop($E32MakePath), $BldInfPath, $$Ref{Base}, "\\", $RealPlat, "\\");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2037
# modified start: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2038
			my $RealMakefile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2039
			if($FeatureVariant eq "")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2040
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2041
				$RealMakefile="-f \"$MakefilePath$$Ref{Base}.$RealPlat$FeatureVariant\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2042
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2043
			else{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2044
				$RealMakefile="-f \"$MakefilePath$$Ref{Base}.$RealPlat.\$(VARIANT_PLAT_NAME_$$Ref{Base})\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2045
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2046
# modified end: makefile improvement 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2047
			my $MakefileBase="$MakefilePath$$Ref{Base}";		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2048
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2049
			if($Plat eq 'VS6' || $Plat eq 'VS2003')
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2050
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2051
				$CallMake .= "-f ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2052
				$RealMakefile = "$MakefileBase$PlatHash{Ext}";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2053
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2054
			&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2055
				"MAKEFILE$$Ref{Base}_FILES= \\\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2056
					"\t\"$MakefileBase$PlatHash{Ext}$FeatureVariant\"",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2057
			);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2058
#			changes for WINS/WINSCW/WINC and VC6
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2059
			if ($Plat =~ /^VC6/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2060
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2061
					" \\\n\t\"$MakefileBase.DSW\"",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2062
					" \\\n\t\"$MakefileBase.SUP.MAKE\""
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2063
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2064
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2065
			if ($Plat eq 'CW_IDE') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2066
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2067
					" \\\n\t\"$MakefileBase.pref\""		# Defect: actually uses $BaseTrg, not mmp file name
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2068
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2069
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2070
			if ($RealPlat=~/^(WINS|WINSCW|WINC)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2071
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2072
					" \\\n\t\"$MakefileBase.UID.CPP\""	# Defect: actually uses $BaseTrg, not mmp file name
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2073
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2074
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2075
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2076
  			my $bld_flags="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2077
			$bld_flags="\$(ABLD_FLAGS)" if (($Plat =~ /^ARMV5(_ABIV1)?$/ || grep /$Plat/i, @BPABIPlats) || (Plat_Root($Plat) =~ /^ARMV5(_ABIV1)?$/ || grep /$Plat/i, @BPABIPlats));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2078
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2079
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2080
			my $build_as_arm_arg="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2081
			$build_as_arm_arg = $$Ref{BuildAsARM} if ($$Ref{BuildAsARM});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2082
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2083
			# Compiler Wrapper option Support  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2084
			# Generate the flag to keep the Compiler Wrapper option information
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2085
			my $cmp_wrap_flag="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2086
			if (($Plat =~ /^ARMV5(_ABIV1)?$/ || grep /$Plat/i, @BPABIPlats) || ($Plat=~/^WINSCW$/) || (Plat_Root($Plat) =~ /^ARMV5(_ABIV1)?$/ || grep /$Plat/i, @BPABIPlats))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2087
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2088
				# for armv5 , armv5_abiv1, winscw and all bpabi plaforms
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2089
				$cmp_wrap_flag="\$(ABLD_COMPWRAP_FLAG)" ;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2090
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2091
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2092
			&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2093
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2094
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2095
				"MAKEFILE$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2096
				    "\tperl -S makmake.pl \$(NO_DEPENDENCIES) -D $$Ref{Path}$$Ref{Base} $Plat$FeatureVariant $build_as_arm_arg $bld_flags $cmp_wrap_flag\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2097
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2098
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2099
				"CLEANMAKEFILE$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2100
				    "\t-\$(ERASE) \$(MAKEFILE$$Ref{Base}_FILES)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2101
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2102
				"WHATMAKEFILE$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2103
				    "\t\@echo \$(MAKEFILE$$Ref{Base}_FILES)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2104
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2105
				"TARGET$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2106
				    "\t$CallMake $RealMakefile \$(CFG)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2107
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2108
				"SAVESPACE$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2109
				    "\t$CallMake $RealMakefile \$(CFG) CLEANBUILD\$(CFG)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2110
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2111
				"LISTING$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2112
				    "\t$CallMake $RealMakefile MAKEWORK\$(CFG) LISTING\$(CFG)\$(SOURCE)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2113
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2114
				"FINAL$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2115
				    "\t\@rem do nothing\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2116
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2117
			);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2118
			foreach $Command (qw(CLEANALL)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2119
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2120
					"CLEANALL$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2121
					"\tperl -S ermdir.pl $MakefilePath\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2122
					"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2123
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2124
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2125
			foreach $Command (qw(CLEAN RESOURCE)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2126
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2127
					"$Command$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2128
					    "\t$CallMake $RealMakefile $Command\$(CFG)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2129
					"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2130
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2131
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2132
			foreach $Command (qw(LIBRARY)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2133
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2134
					"$Command$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2135
					    "\t$CallMake $RealMakefile $Command\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2136
					"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2137
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2138
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2139
			foreach $Command (qw(FREEZE)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2140
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2141
					"$Command$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2142
					    "\t$CallMake $RealMakefile $Command \$(REMOVEMACRO)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2143
					"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2144
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2145
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2146
			unless ($$Ref{Tidy}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2147
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2148
					"WHAT$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2149
					    "\t\@$CallMake -s $RealMakefile WHAT\$(CFG)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2150
					"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2151
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2152
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2153
			else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2154
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2155
					"TIDY$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2156
					    "\t$CallMake $RealMakefile CLEANRELEASE CLEANLIBRARY\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2157
					"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2158
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2159
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2160
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2161
			&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2162
				"CHECKSOURCE$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2163
					"\t\@$CallMake -s $RealMakefile CHECKSOURCE\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2164
					"\t\@$CallMake -s $RealMakefile CHECKSOURCE\$(CFG)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2165
				"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2166
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2167
			&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2168
				"ROMFILE$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2169
				    "\t\@$CallMake $RealMakefile ROMFILE >> $OutRomFile\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2170
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2171
				"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2172
			);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2173
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2174
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2175
#		calls to custom makefiles
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2176
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2177
			my $ChopRefPath=&Path_Chop($$Ref{Path});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2178
			my $ChopBldInfPath=&Path_Chop($BldInfPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2179
			my $MakefileCall;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2180
			if ($$Ref{Makefile}==2) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2181
				$MakefileCall="cd $ChopRefPath;$CallNmake";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2182
			} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2183
				$MakefileCall="$CallGNUmake -C $ChopRefPath";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2184
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2185
			$MakefileCall.=" -f \"$$Ref{Base}$$Ref{Ext}\" TO_ROOT=";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2186
			$MakefileCall.=&Path_Chop(&Path_UpToRoot($$Ref{Path}));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2187
			$MakefileCall.=" EPOCBLD=";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2188
			$MakefileCall.=join('', &Path_Chop(&Path_UpToRoot($$Ref{Path})), &Path_Chop($E32MakePath), $BldInfPath, $$Ref{Base}, "\\", $RealPlat);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2189
			$MakefileCall.=" TO_BLDINF=";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2190
			$MakefileCall.=join('', &Path_Chop(&Path_UpToRoot($$Ref{Path})), $ChopBldInfPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2191
			if ($$Ref{ExtensionRoot}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2192
				$MakefileCall.=" EXTENSION_ROOT=".&Path_Chop($$Ref{ExtensionRoot});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2193
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2194
			if ($$Ref{BuildAsARM}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2195
			  $MakefileCall.=" BUILD_AS_ARM=1";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2196
			}			  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2197
			&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2198
# should change to MAKEFILE
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2199
				"MAKEFILE$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2200
				    "\t$MakefileCall PLATFORM=$Plat MAKMAKE\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2201
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2202
# should call in custom makefiles maybe
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2203
				"CLEANMAKEFILE$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2204
				"#	$MakefileCall PLATFORM=$Plat CLEANMAKEFILE\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2205
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2206
				"WHATMAKEFILE$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2207
				"#	\@$MakefileCall -s PLATFORM=$Plat WHATMAKEFILE\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2208
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2209
# should change to TARGET
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2210
				"TARGET$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2211
				    "\t$MakefileCall PLATFORM=$RealPlat CFG=\$(CFG) BLD\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2212
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2213
# should ignore this target and just call the TARGET target instead?
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2214
				"SAVESPACE$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2215
				    "\t$MakefileCall PLATFORM=$RealPlat CFG=\$(CFG) SAVESPACE\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2216
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2217
				"LISTING$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2218
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2219
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2220
# should change to LIBRARY
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2221
				"LIBRARY$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2222
				    "\t$MakefileCall PLATFORM=$RealPlat LIB\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2223
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2224
				"FREEZE$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2225
					"\t$MakefileCall PLATFORM=$RealPlat FREEZE \$(REMOVEMACRO)\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2226
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2227
			);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2228
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2229
			foreach $Command (qw(CLEANALL)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2230
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2231
					"$Command$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2232
					"\t$MakefileCall PLATFORM=$RealPlat CFG=\$(CFG) CLEAN\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2233
					"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2234
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2235
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2236
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2237
			foreach $Command (qw(CLEAN RESOURCE FINAL)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2238
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2239
					"$Command$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2240
					    "\t$MakefileCall PLATFORM=$RealPlat CFG=\$(CFG) $Command\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2241
					"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2242
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2243
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2244
			unless ($$Ref{Tidy}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2245
# should change to WHAT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2246
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2247
					"WHAT$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2248
					    "\t\@$MakefileCall -s PLATFORM=$RealPlat CFG=\$(CFG) RELEASABLES\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2249
					"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2250
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2251
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2252
			else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2253
				&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2254
					"TIDY$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2255
					    "\t$MakefileCall PLATFORM=$RealPlat TIDY\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2256
# should change to CLEANLIBRARY
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2257
					    "\t$MakefileCall CLEANLIB\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2258
					"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2259
				);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2260
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2261
			&Output(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2262
				"ROMFILE$$Ref{Base} :\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2263
				    "\t\@$MakefileCall PLATFORM=$RealPlat ROMFILE >> $OutRomFile\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2264
				"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2265
				"\n"
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
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2270
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2271
	&WriteOutFileL("$BatchPath$Plat$FeatureVariant$Test.MAKE");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2272
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2273
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2274
sub CreatePlatBatches ($$$) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2275
	my ($OutDir, $DataRef, $Plat)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2276
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2277
#	create the test batch files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2278
#	this function won't work properly if the target basename is different from the .MMP basename
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2279
#	so perhaps it should call makmake on the .mmp file to check
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2280
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2281
	my $AutoText;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2282
	my $ManualText;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2283
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2284
	my $Ref;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2285
	foreach $Ref (@$DataRef) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2286
		if ($$Ref{Manual}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2287
			$ManualText.="$$Ref{Base}\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2288
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2289
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2290
		if ($$Ref{Ext} eq ".MK") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2291
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2292
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2293
		if ($$Ref{Support}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2294
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2295
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2296
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2297
			$AutoText.="$$Ref{Base}\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2298
		}
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
	if ($AutoText) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2302
		&Output($AutoText);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2303
		&WriteOutFileL("$OutDir$Plat.AUTO.BAT");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2304
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2305
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2306
	if ($ManualText) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2307
		&Output($ManualText);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2308
		&WriteOutFileL("$OutDir$Plat.MANUAL.BAT");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2309
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2310
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2311
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2312
sub WriteOutFileL ($$) { # takes batch file and boolean read-only flag
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2313
	my ($BATFILE, $ReadOnly)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2314
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2315
	$BATFILE=~ s/\//\\/g;  # convert unix slashes from wrappermakefile.pm
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2316
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2317
	eval { &Path_MakePathL($BATFILE); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2318
	&FatalError($@) if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2319
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2320
	open BATFILE,">$BATFILE" or &FatalError("Can't open or create Batch File \"$BATFILE\"");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2321
	print BATFILE &OutText or &FatalError("Can't write output to Batch File \"$BATFILE\"");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  2322
	close BATFILE or &FatalError("Can't close Batch File \"$BATFILE\"");
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