sbsv1/abld/bldmake/abld.pl
author Bob Rosenberg <bob.rosenberg@nokia.com>
Wed, 28 Jul 2010 13:20:46 +0100
changeset 624 f70b728ea30c
parent 599 fa7a3cc6effd
permissions -rw-r--r--
Move sysdeftools from buildtools package into build package
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
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
use FindBin;		# for FindBin::Bin
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
use Getopt::Long;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
my $PerlLibPath;    # fully qualified pathname of the directory containing our Perl modules
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
BEGIN {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
# check user has a version of perl that will cope
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
	require 5.005_03;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
# establish the path to the Perl libraries: currently the same directory as this script
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
	$PerlLibPath = $FindBin::Bin;	# X:/epoc32/tools
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
	$PerlLibPath =~ s/\//\\/g;	# X:\epoc32\tools
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
	$PerlLibPath .= "\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
use lib $PerlLibPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
use E32env;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
use CheckSource;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
use FCLoggerUTL;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
use featurevariantparser;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
			$ENV{MAKE} = 'make' unless defined $ENV{MAKE};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
# command data structure
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
my %Commands=(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
	BUILD=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
		build=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
		what=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
		function=>'Combines commands EXPORT,MAKEFILE,LIBRARY,RESOURCE,TARGET,FINAL',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
		subcommands=>['EXPORT','MAKEFILE', 'LIBRARY', 'RESOURCE', 'TARGET', 'FINAL'],
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
		savespace=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
        instructionset=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
		debug=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
		no_debug=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
		logfc=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
		checksource=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
		wrap=>1, #To support Compiler wrapper option along with BUILD command
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
	CLEAN=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
		build=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
		function=>'Removes everything built with ABLD TARGET',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
		what=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
	CLEANALL=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
		function=>'Removes everything built with ABLD TARGET',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
		what=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
	CLEANEXPORT=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
		function=>'Removes files created by ABLD EXPORT',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
		what=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
		noplatform=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
	CLEANMAKEFILE=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
		function=>'Removes files generated by ABLD MAKEFILE',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
		what=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
		hidden=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
	EXPORT=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
		noplatform=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
		what=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
		function=>'Copies the exported files to their destinations',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
	FINAL=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
		build=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
		function=>'Allows extension makefiles to execute final commands',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
	FREEZE=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
		remove=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
		function=>'Freezes exported functions in a .DEF file',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
	HELP=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
		noplatform=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
		function=>'Displays commands, options or help about a particular command',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
		notest=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
	LIBRARY=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   102
		function=>'Creates import libraries from the frozen .DEF files',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   103
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   104
	LISTING=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   105
		build=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   106
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   107
		function=>'Creates assembler listing file for corresponding source file',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   108
		source=>1,	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   109
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   110
	MAKEFILE=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   111
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   112
		function=>'Creates makefiles or IDE workspaces',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   113
		what=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   114
		savespace=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   115
		instructionset=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   116
		debug=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   117
		no_debug=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   118
		logfc=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   119
		wrap=>1, #To support Compiler wrapper option along with MAKEFILE command
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   120
        },
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   121
	REALLYCLEAN=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   122
		build=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   123
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   124
		function=>'As CLEAN, but also removes exported files and makefiles',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   125
		what=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   126
		subcommands=>['CLEANEXPORT', 'CLEAN', 'CLEANALL'],
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   127
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   128
	RESOURCE=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   129
		build=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   130
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   131
		function=>'Creates resource files, bitmaps and AIFs',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   132
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   133
#	ROMFILE=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   134
#		function=>'Under development - syntax not finalised',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   135
#		noverbose=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   136
#		nokeepgoing=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   137
#		hidden=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   138
#	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   139
	ROMFILE=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   140
		noverbose=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   141
		build=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   142
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   143
		function=>'generates an IBY file to include in a ROM'
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   144
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   145
	SAVESPACE=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   146
		build=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   147
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   148
		what=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   149
		function=>'As TARGET, but deletes intermediate files on success',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   150
		hidden=>1, # hidden because only used internally from savespace flag
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   151
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   152
	TARGET=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   153
		build=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   154
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   155
		what=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   156
		function=>'Creates the main executable and also the resources',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   157
		savespace=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   158
		checksource=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   159
		wrap=>1, #To support Compiler wrapper option along with TARGET command
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   160
	},
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   161
	TIDY=>{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   162
		build=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   163
		program=>1,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   164
		function=>'Removes executables which need not be released',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   165
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   166
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   167
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   168
# get the path to the bldmake-generated files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   169
# we can perhaps work this out from the current working directory in later versions
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   170
my $BldInfDir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   171
my $PrjBldDir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   172
BEGIN {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   173
	$BldInfDir=shift @ARGV;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   174
	$PrjBldDir=$E32env::Data{BldPath};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   175
	$PrjBldDir=~s-^(.*)\\-$1-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   176
	$PrjBldDir.=$BldInfDir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   177
	$PrjBldDir=~m-(.*)\\-o; # remove backslash because some old versions of perl can't cope
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   178
	unless (-d $1) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   179
		die "ABLD ERROR: Project Bldmake directory \"$PrjBldDir\" does not exist\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   180
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   181
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   182
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   183
# check the platform module exists and then load it
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   184
BEGIN {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   185
	unless (-e "${PrjBldDir}Platform.pm") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   186
		die "ABLD ERROR: \"${PrjBldDir}Platform.pm\" not yet created\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   187
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   188
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   189
use lib $PrjBldDir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   190
use Platform;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   191
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   192
# change directory to the BLD.INF directory - we might begin to do
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   193
# things with relative paths in the future.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   194
chdir($BldInfDir) or die "ABLD ERROR: Can't CD to \"$BldInfDir\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   195
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   196
# MAIN PROGRAM SECTION
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   197
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   198
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   199
#	PROCESS THE COMMAND LINE
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   200
	my %Options=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   201
	unless (@ARGV) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   202
		&Usage();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   203
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   204
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   205
#	Process options and check that all are recognised
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   206
# modified start: added functionality checkwhat
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   207
	unless (GetOptions(\%Options, 'checkwhat|cw','check|c', 'keepgoing|k', 'savespace|s', 'verbose|v',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   208
						'what|w', 'remove|r', 'instructionset|i=s',
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   209
						'checksource|cs', 'debug','no_debug', 'logfc|fc','wrap:s')) { 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   210
		exit 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   211
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   212
# modified end: added functionality checkwhat
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   213
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   214
#	check the option combinations
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   215
# modified start: added functionality checkwhat
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   216
	if ($Options{checkwhat} ) { 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   217
		$Options{check}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   218
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   219
# modified end: added functionality checkwhat
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   220
	if (($Options{check} and $Options{what})) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   221
		&Options;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   222
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   223
	if (($Options{check} or $Options{what}) and ($Options{keepgoing} or $Options{savespace} or $Options{verbose})) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   224
		&Options();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   225
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   226
	if ($Options{checksource} and $Options{what}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   227
		&Options();
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
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   231
#	take the test parameter out of the command-line if it's there
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   232
	my $Test='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   233
	if (@ARGV && $ARGV[0]=~/^test$/io) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   234
		$Test='test';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   235
		shift @ARGV;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   236
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   237
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   238
#	if there's only the test parameter there, display usage
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   239
	unless (@ARGV) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   240
		&Usage();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   241
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   242
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   243
#	get the command parameter out of the command line
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   244
	my $Command=uc shift @ARGV;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   245
	unless (defined $Commands{$Command}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   246
		&Commands();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   247
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   248
	my %CommandHash=%{$Commands{$Command}};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   249
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   250
#	check the test parameter is not specified where it shouldn't be
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   251
	if ($Test and $CommandHash{notest}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   252
		&Help($Command);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   253
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   254
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   255
#	check the options are suitable for the commands
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   256
#	-verbose and -keepgoing have no effect in certain cases
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   257
	if ($Options{what} or $Options{check}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   258
		unless ($CommandHash{what}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   259
			&Help($Command);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   260
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   261
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   262
	#Function Call Logger
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   263
	if ($Options{logfc}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   264
		unless ($CommandHash{logfc}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   265
			&Help($Command);
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
	if ($Options{savespace}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   269
		unless ($CommandHash{savespace}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   270
			&Help($Command);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   271
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   272
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   273
	if ($Options{instructionset}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   274
		unless ($CommandHash{instructionset}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   275
			&Help($Command);
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
	if ($Options{debug}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   279
		unless ($CommandHash{debug}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   280
			&Help($Command);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   281
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   282
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   283
	if ($Options{no_debug}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   284
		unless ($CommandHash{no_debug}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   285
			&Help($Command);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   286
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   287
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   288
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   289
	if ($Options{keepgoing}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   290
		if ($CommandHash{nokeepgoing}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   291
			&Help($Command);
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
	if ($Options{verbose}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   295
		if ($CommandHash{noverbose}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   296
			&Help($Command);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   297
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   298
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   299
	if ($Options{remove}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   300
		unless ($CommandHash{remove}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   301
			&Help($Command);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   302
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   303
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   304
	if ($Options{checksource}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   305
		unless ($CommandHash{checksource}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   306
			&Help($Command);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   307
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   308
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   309
	#Compiler Wrapper support 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   310
	if (exists $Options{wrap}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   311
		unless ($CommandHash{wrap}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   312
			&Help($Command);
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
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   316
#	process help command if necessary
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   317
	if ($Command eq 'HELP') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   318
		if (@ARGV) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   319
			my $Tmp=uc shift @ARGV;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   320
			if (defined $Commands{$Tmp}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   321
				&Help($Tmp);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   322
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   323
			elsif ($Tmp eq 'OPTIONS') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   324
				&Options();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   325
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   326
			elsif ($Tmp eq 'COMMANDS') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   327
				&Commands();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   328
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   329
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   330
		&Usage();
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
#	process parameters
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   334
	my ($Plat, $Bld, $Program, $Source)=('','','','');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   335
	my %MakefileVariations;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   336
	my $FeatureVariantArg;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   337
        
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   338
#	platform parameter first
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   339
	unless ($CommandHash{noplatform}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   340
		unless ($Plat=uc shift @ARGV) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   341
			$Plat='ALL'; # default
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   342
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   343
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   344
			# Explicit feature variant platforms take the form <base platform>.<variant name>
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   345
			# e.g. armv5.variant1.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   346
			# If valid, we actually create and invoke a distinct variation of the "base" makefile
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   347
			if ($Plat =~ /^(\S+)\.(\S+)$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   348
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   349
				$Plat = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   350
				$FeatureVariantArg = uc($2);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   351
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   352
				if (!$Platform::FeatureVariantSupportingPlats{$Plat})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   353
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   354
					die "This project does not support platform \"$Plat\.$FeatureVariantArg\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   355
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   356
				else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   357
					{						
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   358
					$MakefileVariations{$Plat} = &GetMakefileVariations($Plat, $FeatureVariantArg);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   359
					}
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
			COMPARAM1 : {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   363
				if (grep(/^$Plat$/, ('ALL', @Platform::Plats))) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   364
					last COMPARAM1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   365
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   366
				if ($Plat =~ /(.*)EDG$/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   367
				    my $SubPlat = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   368
				    if (grep(/^$SubPlat$/, ('ALL', @Platform::Plats))) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   369
					last COMPARAM1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   370
				    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   371
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   372
#				check whether the platform might in fact be a build, and
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   373
#				set the platform and build accordingly if it is
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   374
				if ($CommandHash{build}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   375
					if ($Plat=~/^(UDEB|UREL|DEB|REL)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   376
						$Bld=$Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   377
						$Plat='ALL';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   378
						last COMPARAM1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   379
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   380
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   381
#				check whether the platform might in fact be a program, and
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   382
#				set the platform, build and program accordingly if it is
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   383
				if ($CommandHash{program}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   384
					if  (((not $Test) and grep /^$Plat$/, @{$Platform::Programs{ALL}})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   385
							or ($Test and grep /^$Plat$/, @{$Platform::TestPrograms{ALL}})) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   386
						$Program=$Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   387
						$Plat='ALL';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   388
						$Bld='ALL';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   389
						last COMPARAM1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   390
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   391
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   392
#				report the error
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   393
				if ($CommandHash{build} and $CommandHash{program}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   394
					die "This project does not support platform, build or $Test program \"$Plat\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   395
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   396
				if ($CommandHash{build} and not $CommandHash{program}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   397
					die "This project does not support platform or build \"$Plat\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   398
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   399
				if ($CommandHash{program} and not $CommandHash{build}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   400
					die "This project does not support platform or $Test program \"$Plat\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   401
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   402
				if (not ($CommandHash{build} or $CommandHash{program})) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   403
					die "This project does not support platform \"$Plat\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   404
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   405
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   406
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   407
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   408
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   409
	#Compiler Wrapper support 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   410
	my $CompilerWrapperFlagMacro = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   411
	if(exists $Options{wrap})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   412
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   413
		my $error = "Environment variable 'ABLD_COMPWRAP' is not set\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   414
		# If tool name for wrapping compiler is set in environment variable
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   415
		if($ENV{ABLD_COMPWRAP})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   416
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   417
			$CompilerWrapperFlagMacro =" ABLD_COMPWRAP_FLAG=-wrap" .  ($Options{wrap} ? "=$Options{wrap}":"");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   418
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   419
		elsif($Options{keepgoing})  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   420
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   421
		    # If Tool name is not set and keepgoing option is specified then ignore -wrap option and continue processing
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   422
		    print $error;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   423
		    delete $Options{wrap};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   424
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   425
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   426
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   427
		    # Issue error and exit if neither keepgoing option nor tool name is specified		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   428
		    die $error;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   429
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   430
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   431
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   432
#	process the build parameter for those commands which require it
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   433
	if ($CommandHash{build}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   434
		unless ($Bld) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   435
			unless ($Bld=uc shift @ARGV) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   436
				$Bld='ALL'; # default
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   437
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   438
			else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   439
				COMPARAM2 : {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   440
					if ($Bld=~/^(ALL|UDEB|UREL|DEB|REL)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   441
#						Change for TOOLS, TOOLS2 and VC6TOOLS platforms
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   442
						if ($Plat ne 'ALL') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   443
							if (($Plat!~/TOOLS2?$/o and $Bld=~/^(DEB|REL)$/o) or ($Plat=~/TOOLS2?$/o and $Bld=~/^(UDEB|UREL)$/o)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   444
								die  "Platform \"$Plat\" does not support build \"$Bld\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   445
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   446
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   447
						last COMPARAM2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   448
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   449
#					check whether the build might in fact be a program, and
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   450
#					set the build and program if it is
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   451
					if ($CommandHash{program}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   452
						if  (((not $Test) and grep /^$Bld$/, @{$Platform::Programs{$Plat}})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   453
								or ($Test and grep /^$Bld$/, @{$Platform::TestPrograms{$Plat}})) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   454
							$Program=$Bld;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   455
							$Bld='ALL';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   456
							last COMPARAM2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   457
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   458
						my $Error="This project does not support build or $Test program \"$Bld\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   459
						if ($Plat eq 'ALL') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   460
							$Error.=" for any platform\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   461
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   462
						else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   463
							$Error.=" for platform \"$Plat\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   464
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   465
						die $Error;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   466
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   467
					my $Error="This project does not support build \"$Bld\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   468
					if ($Plat eq 'ALL') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   469
						$Error.=" for any platform\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   470
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   471
					else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   472
						$Error.=" for platform \"$Plat\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   473
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   474
					die $Error;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   475
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   476
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   477
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   478
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   479
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   480
#	get the program parameter for those commands which require it
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   481
	if ($CommandHash{program}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   482
		unless ($Program) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   483
			unless ($Program=uc shift @ARGV) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   484
				$Program=''; #default - means ALL
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   485
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   486
			else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   487
#				check that the program is supported
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   488
				unless (((not $Test) and grep /^$Program$/, @{$Platform::Programs{$Plat}})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   489
						or ($Test and grep /^$Program$/, @{$Platform::TestPrograms{$Plat}})) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   490
					my $Error="This project does not support $Test program \"$Program\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   491
					if ($Plat eq 'ALL') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   492
						$Error.=" for any platform\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   493
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   494
					else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   495
						$Error.=" for platform \"$Plat\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   496
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   497
					die $Error;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   498
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   499
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   500
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   501
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   502
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   503
#	get the source file parameter for those commands which require it
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   504
	if ($CommandHash{source}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   505
		unless ($Source=uc shift @ARGV) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   506
			$Source=''; #default - means ALL
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   507
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   508
		else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   509
			$Source=" SOURCE=$Source";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   510
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   511
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   512
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   513
#	check for too many arguments
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   514
	if (@ARGV) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   515
		&Help($Command);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   516
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   517
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   518
	if ( $Options{instructionset} )
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   519
	{	# we have a -i option.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   520
		if ($Plat eq 'ARMV5')
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   521
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   522
			if  ( !( ( uc( $Options{instructionset} ) eq "ARM") || ( uc( $Options{instructionset} ) eq "THUMB" ) ) ) {		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   523
				# Only ARM and THUMB options are valid. 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   524
				&Options();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   525
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   526
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   527
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   528
		{ # Can only use -i for armv5 builds. 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   529
			&Options();
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
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   533
#	process CHECKSOURCE_OVERRIDE
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   534
	if ($ENV{CHECKSOURCE_OVERRIDE} && (($Plat =~ /^ARMV5/) || ($Plat eq 'WINSCW')) && ($Command eq 'TARGET')  && !$Options{what})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   535
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   536
		$Options{checksource} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   537
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   538
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   539
	my $checksourceMakeVariables = " ";	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   540
	if ($Options{checksource}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   541
		$checksourceMakeVariables .= "CHECKSOURCE_VERBOSE=1 " if ($Options{verbose});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   542
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   543
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   544
#	expand the platform list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   545
	my @Plats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   546
	unless ($CommandHash{noplatform}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   547
		if ($Plat eq 'ALL') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   548
			@Plats=@Platform::RealPlats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   549
#			Adjust the "ALL" list according to the availability of compilers
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   550
			@Plats=grep !/WINSCW$/o, @Plats unless (defined $ENV{MWSym2Libraries});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   551
			@Plats=grep !/WINS$/o, @Plats unless (defined $ENV{MSDevDir});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   552
			@Plats=grep !/X86$/o, @Plats unless (defined $ENV{MSDevDir});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   553
			@Plats=grep !/X86SMP$/o, @Plats unless (defined $ENV{MSDevDir});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   554
			@Plats=grep !/X86GCC$/o, @Plats unless (defined $ENV{MSDevDir});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   555
			@Plats=grep !/X86GMP$/o, @Plats unless (defined $ENV{MSDevDir});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   556
			if ($CommandHash{build}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   557
#				remove unnecessary platforms if just building for tools, or building everything but tools
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   558
#				so that the makefiles for other platforms aren't created with abld build
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   559
				if ($Bld=~/^(UDEB|UREL)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   560
					@Plats=grep !/TOOLS2?$/o, @Plats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   561
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   562
				elsif ($Bld=~/^(DEB|REL)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   563
					@Plats=grep /TOOLS2?$/o, @Plats;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   564
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   565
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   566
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   567
        else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   568
        {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   569
			@Plats=($Plat);
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
		foreach $Plat (@Plats)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   573
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   574
			# Skip platforms resolved above
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   575
			next if $MakefileVariations{$Plat};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   576
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   577
			# Implicit feature variant platforms apply when a default feature variant exists and the platform supports it
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   578
			# If valid, we actually create and invoke a distinct variation of the "base" makefile
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   579
			if ($Platform::FeatureVariantSupportingPlats{$Plat} && featurevariantparser->DefaultExists())
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   580
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   581
				if($Command eq "REALLYCLEAN")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   582
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   583
					my @myfeature = featurevariantparser->GetBuildableFeatureVariants();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   584
					push @{$MakefileVariations{$Plat}}, ".".$_ foreach(@myfeature);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   585
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   586
					else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   587
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   588
					$MakefileVariations{$Plat} = &GetMakefileVariations($Plat, "DEFAULT");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   589
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   590
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   591
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   592
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   593
				# For non-feature variant platforms we always store a single makefile variation of nothing i.e.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   594
				# we use the "normal" makefile generated for the platform
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   595
				$MakefileVariations{$Plat} = &GetMakefileVariations($Plat, "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   596
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   597
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   598
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   600
		foreach $Plat (@Plats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   601
			foreach my $makefileVariation (@{$MakefileVariations{$Plat}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   602
				unless (-e "$PrjBldDir$Plat$makefileVariation$Test.make") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   603
					die "ABLD ERROR: \"$PrjBldDir$Plat$makefileVariation$Test.make\" not yet created\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   604
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   605
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   606
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   607
		undef $Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   608
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   609
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   610
#	set up a list of commands where there are sub-commands
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   611
	my @Commands=($Command);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   612
	if ($CommandHash{subcommands}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   613
		@Commands=@{$CommandHash{subcommands}};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   614
		if ($Command eq 'BUILD') { # avoid makefile listings here
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   615
			if ($Options{what} or $Options{check}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   616
				@Commands=grep !/^MAKEFILE$/o, @{$CommandHash{subcommands}};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   617
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   618
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   619
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   620
#	implement savespace if necessary
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   621
	if ($Options{savespace}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   622
		foreach $Command (@Commands) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   623
			if ($Command eq 'TARGET') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   624
				$Command='SAVESPACE';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   625
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   626
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   627
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   628
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   629
#	set up makefile call flags and macros from the options
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   630
	my $KeepgoingFlag='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   631
	my $KeepgoingMacro='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   632
        my $NoDependencyMacro='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   633
	my $VerboseMacro=' VERBOSE=-s';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   634
	if ($Options{keepgoing}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   635
		$KeepgoingFlag=' -k';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   636
		$KeepgoingMacro=' KEEPGOING=-k';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   637
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   638
	if ($Options{verbose}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   639
		$VerboseMacro='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   640
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   641
	my $RemoveMacro='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   642
	if ($Options{remove}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   643
		$RemoveMacro=' EFREEZE_ALLOW_REMOVE=1';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   644
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   645
	if ( ($Options{savespace}) and ($Options{keepgoing}) ){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   646
		$NoDependencyMacro=' NO_DEPENDENCIES=-nd';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   647
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   648
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   649
    my $AbldFlagsMacro="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   650
	$AbldFlagsMacro = "-iarm " if (uc $Options{instructionset} eq "ARM");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   651
	$AbldFlagsMacro = "-ithumb " if (uc $Options{instructionset} eq "THUMB");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   652
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   653
	if ($Options{debug}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   654
		$AbldFlagsMacro .= "-debug ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   655
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   656
	elsif($Options{no_debug}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   657
		$AbldFlagsMacro .= "-no_debug ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   658
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   659
    
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   660
	#Function call logging flag for makmake
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   661
	if ($Options{logfc}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   662
		#Check the availability and version of logger
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   663
		if (&FCLoggerUTL::PMCheckFCLoggerVersion()) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   664
			$AbldFlagsMacro .= "-logfc ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   665
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   666
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   667
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   668
	if(!($AbldFlagsMacro eq "") ){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   669
		$AbldFlagsMacro =" ABLD_FLAGS=\"$AbldFlagsMacro\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   670
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   671
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   672
#	set up a list of make calls
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   673
	my @Calls;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   674
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   675
#	handle the exports related calls first
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   676
	if (($Command)=grep /^(.*EXPORT)$/o, @Commands) { # EXPORT, CLEANEXPORT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   677
		unless (-e "${PrjBldDir}EXPORT$Test.make") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   678
			die "ABLD ERROR: \"${PrjBldDir}EXPORT$Test.make\" not yet created\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   679
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   680
		unless ($Options {checksource}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   681
			if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   682
				unless ($Options{what} or $Options{check}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   683
					push @Calls, "$ENV{MAKE} -r $KeepgoingFlag -f \"${PrjBldDir}EXPORT$Test.make\" $Command$VerboseMacro$KeepgoingMacro";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   684
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   685
				else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   686
					push @Calls, "$ENV{MAKE} -r -f \"${PrjBldDir}EXPORT$Test.make\" WHAT";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   687
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   688
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   689
			else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   690
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   691
				unless ($Options{what} or $Options{check}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   692
					push @Calls, "make -r $KeepgoingFlag -f \"${PrjBldDir}EXPORT$Test.make\" $Command$VerboseMacro$KeepgoingMacro";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   693
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   694
				else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   695
					push @Calls, "make -r -f \"${PrjBldDir}EXPORT$Test.make\" WHAT";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   696
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   697
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   698
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   699
		@Commands=grep !/EXPORT$/o, @Commands;
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
#	then do the rest of the calls
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   703
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   704
	COMMAND: foreach $Command (@Commands) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   705
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   706
		if ($Options {checksource} && ($Command eq "TARGET" || $Command eq "SAVESPACE")) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   707
			if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   708
				push @Calls, "$ENV{MAKE} -r -f \"".$PrjBldDir."EXPORT.make\"".$checksourceMakeVariables."CHECKSOURCE";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   709
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   710
			else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   711
				push @Calls, "make -r -f \"".$PrjBldDir."EXPORT.make\"".$checksourceMakeVariables."CHECKSOURCE";
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
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   715
		my $Plat;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   716
		PLATFORM: foreach $Plat (@Plats) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   717
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   718
#			set up a list of builds to carry out commands for if appropriate
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   719
			my @Blds=($Bld);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   720
			if (${$Commands{$Command}}{build}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   721
				if ($Bld eq 'ALL') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   722
					unless ($Plat=~/TOOLS2?$/o) { # change for platforms TOOLS, TOOLS2 and VC6TOOLS
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   723
						@Blds=('UDEB', 'UREL');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   724
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   725
					else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   726
						@Blds=('DEB', 'REL');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   727
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   728
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   729
				else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   730
#					check the build is suitable for the platform - TOOLS, TOOLS2 and VC6TOOLS are annoyingly atypical
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   731
					unless (($Plat!~/TOOLS2?$/o and $Bld=~/^(UDEB|UREL)$/o) or ($Plat=~/TOOLS2?$/o and $Bld=~/^(DEB|REL)$/o)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   732
						next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   733
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   734
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   735
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   736
			else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   737
				@Blds=('IRRELEVANT');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   738
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   739
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   740
			# You get CHECKSOURCE_GENERIC "for free" if no component is specified in the call
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   741
			if ($Options {checksource} && ($Command eq "TARGET" || $Command eq "SAVESPACE") && $Program) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   742
				foreach my $makefileVariation (@{$MakefileVariations{$Plat}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   743
					if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   744
						push @Calls, "$ENV{MAKE} -r -f \"$PrjBldDir$Plat$makefileVariation$Test.make\"".$checksourceMakeVariables."CHECKSOURCE_GENERIC";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   745
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   746
					else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   747
						push @Calls, "make -r -f \"$PrjBldDir$Plat$makefileVariation$Test.make\"".$checksourceMakeVariables."CHECKSOURCE_GENERIC";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   748
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   749
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   750
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   751
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   752
			my $LoopBld;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   753
			foreach $LoopBld (@Blds) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   754
				my $CFG='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   755
				if ($LoopBld ne 'IRRELEVANT') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   756
					$CFG=" CFG=$LoopBld";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   757
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   758
				if ($Options {checksource}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   759
					if ($Command eq "TARGET" || $Command eq "SAVESPACE") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   760
						foreach my $makefileVariation (@{$MakefileVariations{$Plat}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   761
							if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   762
								push @Calls, "$ENV{MAKE} -r -f \"$PrjBldDir$Plat$makefileVariation$Test.make\"".$checksourceMakeVariables."CHECKSOURCE$Program$CFG";	  
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   763
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   764
							else {	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   765
								push @Calls, "make -r -f \"$PrjBldDir$Plat$makefileVariation$Test.make\"".$checksourceMakeVariables."CHECKSOURCE$Program$CFG";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   766
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   767
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   768
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   769
					next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   770
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   771
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   772
				unless ($Options{what} or $Options{check}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   773
					if ($Program) { # skip programs if they're not supported for a platform
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   774
						unless ($Test) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   775
							unless (grep /^$Program$/, @{$Platform::Programs{$Plat}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   776
								next PLATFORM;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   777
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   778
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   779
						else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   780
							unless (grep /^$Program$/, @{$Platform::TestPrograms{$Plat}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   781
								next PLATFORM;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   782
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   783
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   784
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   785
   					my $AbldFlagsMacroTmp="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   786
					my $CompilerWrapperFlagMacroTemp="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   787
					if ($Command eq "MAKEFILE")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   788
					{	# Only want ABLD_FLAGS for Makefile
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   789
                        $AbldFlagsMacroTmp=$AbldFlagsMacro;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   790
						if(exists ($Options{wrap}))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   791
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   792
							# Require ABLD_COMPWRAP_FLAG when --wrap option is specified
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   793
							$CompilerWrapperFlagMacroTemp = $CompilerWrapperFlagMacro;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   794
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   795
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   796
					foreach my $makefileVariation (@{$MakefileVariations{$Plat}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   797
							if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   798
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   799
								if ( ($Command eq "TARGET") && (-e $PerlLibPath . "tracecompiler.pl") )
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   800
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   801
									not scalar grep(/tracecompiler\.pl $Plat/,@Calls) and push @Calls, "perl " . $PerlLibPath . "tracecompiler.pl $Plat $Program";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   802
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   803
								push @Calls, "$ENV{MAKE} -r $KeepgoingFlag -f \"$PrjBldDir$Plat$makefileVariation$Test.make\""
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   804
								." $Command$Program$CFG$Source$VerboseMacro" .
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   805
								"$KeepgoingMacro$RemoveMacro$NoDependencyMacro" .
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   806
								"$AbldFlagsMacroTmp$CompilerWrapperFlagMacroTemp";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   807
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   808
								#Compiler Wrapper support
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   809
								if ( exists($Options{wrap}) && ($Options{wrap} eq "") && ($Command eq "TARGET") )
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   810
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   811
									my $CFGCOMPWRAP='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   812
									if ($LoopBld ne 'IRRELEVANT')
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   813
									{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   814
										$CFGCOMPWRAP =" CFG=COMPWRAP".$LoopBld;	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   815
									}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   816
									push @Calls, "$ENV{MAKE} -r $KeepgoingFlag -f \"$PrjBldDir$Plat$makefileVariation$Test.make\""." TARGET$Program$CFGCOMPWRAP";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   817
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   818
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   819
							else {	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   820
								push @Calls, "make -r $KeepgoingFlag -f \"$PrjBldDir$Plat$makefileVariation$Test.make\""
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   821
								." $Command$Program$CFG$Source$VerboseMacro" .
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   822
								"$KeepgoingMacro$RemoveMacro$NoDependencyMacro" .
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   823
								"$AbldFlagsMacroTmp$CompilerWrapperFlagMacroTemp";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   824
              
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   825
								#Compiler Wrapper support
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   826
								if ( exists($Options{wrap}) && ($Options{wrap} eq "") && ($Command eq "TARGET") )
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   827
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   828
									my $CFGCOMPWRAP='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   829
									if ($LoopBld ne 'IRRELEVANT')
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   830
									{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   831
										$CFGCOMPWRAP =" CFG=COMPWRAP".$LoopBld;	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   832
									}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   833
									push @Calls, "make -r $KeepgoingFlag -f \"$PrjBldDir$Plat$makefileVariation$Test.make\""." TARGET$Program$CFGCOMPWRAP";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   834
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   835
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   836
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   837
						next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   838
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   839
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   840
				unless (${$Commands{$Command}}{what}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   841
					next COMMAND;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   842
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   843
				if ($Program) { # skip programs if they're not supported for a platform
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   844
					unless ($Test) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   845
						unless (grep /^$Program$/, @{$Platform::Programs{$Plat}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   846
							next PLATFORM;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   847
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   848
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   849
					else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   850
						unless (grep /^$Program$/, @{$Platform::TestPrograms{$Plat}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   851
							next PLATFORM;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   852
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   853
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   854
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   855
				my $Makefile='';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   856
				if ($Command=~/MAKEFILE$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   857
					$Makefile='MAKEFILE';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   858
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   859
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   860
				foreach my $makefileVariation (@{$MakefileVariations{$Plat}}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   861
					if (defined $ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} &&  ($ENV{ABLD_TOOLSMOD_COMPATIBILITY_MODE} eq 'alpha')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   862
					push @Calls, "$ENV{MAKE} -r -f \"$PrjBldDir$Plat$makefileVariation$Test.make\" WHAT$Makefile$Program $CFG";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   863
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   864
					else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   865
					push @Calls, "make -r -f \"$PrjBldDir$Plat$makefileVariation$Test.make\" WHAT$Makefile$Program $CFG";
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
			}
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
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   872
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   873
#	make the required calls
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   874
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   875
	my $Call;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   876
	my %checkSourceUniqueOutput;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   877
	unless ($Options{what} or $Options{check}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   878
		foreach $Call (@Calls) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   879
			print "  $Call\n" unless ($Options{checksource} && !$Options {verbose});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   880
			open PIPE, "$Call |";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   881
			$|=1; # bufferring is disabled
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   882
			while (<PIPE>) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   883
				if ($Options {checksource})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   884
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   885
					if ($Options{verbose})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   886
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   887
						print $_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   888
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   889
					else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   890
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   891
						$checkSourceUniqueOutput{$_} = 1;
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
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   896
					print;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   897
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   898
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   899
			close PIPE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   900
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   901
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   902
		print $_ foreach (sort keys %checkSourceUniqueOutput);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   903
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   904
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   905
		my %WhatCheck; # check for duplicates
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   906
		foreach $Call (@Calls) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   907
			open PIPE, "$Call |";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   908
			while (<PIPE>) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   909
				next if (/(Nothing to be done for|Entering directory|Leaving directory) \S+\.?$/o);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   910
#				releasables split on whitespace - quotes possible -stripped out
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   911
				while (/("([^"\t\n\r\f]+)"|([^ "\t\n\r\f]+))/go) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   912
					my $Releasable=($2 ? $2 : $3);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   913
					$Releasable =~ s/\//\\/g;	# convert forward slash into backslash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   914
					unless ($WhatCheck{$Releasable}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   915
						$WhatCheck{$Releasable}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   916
						if ($Options{what}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   917
							print "$Releasable\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   918
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   919
						else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   920
							if (!-e $Releasable) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   921
								print STDERR "MISSING: $Releasable\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   922
							} 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   923
							# modified start: added functionality checkwhat
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   924
							elsif ($Options{checkwhat}) {						 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   925
								print "$Releasable\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   926
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   927
							# modified end: added functionality checkwhat
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   928
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   929
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   930
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   931
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   932
			close PIPE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   933
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   934
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   935
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   936
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   937
sub Usage () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   938
	print <<ENDHERESTRING;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   939
Common usage : abld [test] command [options] [platform[.Feature Variant]] [build] [program]
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   940
  where command is build, target, etc.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   941
    (type \"abld help commands\" for a list of commands)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   942
  where options are -c, -k, etc.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   943
    (type \"abld help options\" for a list of options)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   944
  where parameters depend upon the command
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   945
    (type \"abld help <command>\" for command-specific help)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   946
  where parameters default to 'ALL' if unspecified
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   947
ENDHERESTRING
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   948
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   949
	print
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   950
		"project platforms:\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   951
		"   @Platform::Plats\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   952
	;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   953
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   954
	if (%Platform::FeatureVariantSupportingPlats)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   955
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   956
		my @featureVariants;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   957
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   958
		foreach my $featureVariantSupportingPlat (keys %Platform::FeatureVariantSupportingPlats)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   959
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   960
			push @featureVariants, $featureVariantSupportingPlat.".".$_ foreach (featurevariantparser->GetValidVariants());
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   961
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   962
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   963
		if (@featureVariants)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   964
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   965
			@featureVariants = map{uc($_)} @featureVariants;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   966
			print
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   967
				"feature variant platforms:\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   968
				"   @featureVariants\n";		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   969
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   970
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   971
	exit 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   972
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   973
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   974
# modified start: added functionality checkwhat
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   975
sub Options () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   976
	print <<ENDHERESTRING;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   977
Options (case-insensitive) :
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   978
  -c or -check          check the releasables are present
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   979
  -cw or -checkwhat     combined check and what
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   980
  -k or -keepgoing      build unrelated targets on error
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   981
  -s or -savespace      delete intermediate files on success
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   982
  -v or -verbose        display tools calls as they happen
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   983
  -w or -what           list the releasables
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   984
  -r or -remove         allow FREEZE to remove exports
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   985
  -i thumb or -i arm    override for build ARMV5 platform options
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   986
  -cs or -checksource   checks source conformance to Symbian's filename policy
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   987
  -debug or -no_debug   enable/disable generation of symbolic debug information for ARM ABI compliant platforms
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   988
  -fc or -logfc	        enable function call logging
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   989
  -wrap[=proxy]         enable invocation of external wrapper tool
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   990
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   991
 possible combinations :
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   992
	(([-check]|[-what]|[-checkwhat])|([-k][-s][-v][-i [thumb|arm]][-cs][-debug|-no_debug][-fc][-wrap[=proxy]]))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   993
ENDHERESTRING
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   994
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   995
	exit;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   996
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   997
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   998
# modified end: added functionality checkwhat
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   999
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1000
sub Help ($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1001
	my ($Command)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1002
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1003
	my %CommandHash=%{$Commands{$Command}};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1004
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1005
	print 'ABLD';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1006
	unless ($CommandHash{notest}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1007
		print ' [test]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1008
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1009
	print " $Command ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1010
	if ($Command eq 'HELP') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1011
		print '([OPTIONS|COMMANDS]|[<command>])';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1012
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1013
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1014
		if ($CommandHash{what}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1015
			print '(([-c]|[-w])|';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1016
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1017
		if ($CommandHash{savespace}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1018
			print '[-s]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1019
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1020
		if ($CommandHash{instructionset}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1021
			print '[-i thumb|arm]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1022
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1023
        if ($CommandHash{remove}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1024
			print '[-r]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1025
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1026
        if ($CommandHash{checksource}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1027
			print '[-cs]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1028
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1029
		unless ($CommandHash{nokeepgoing}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1030
			print '[-k]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1031
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1032
		unless ($CommandHash{noverbose}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1033
			print '[-v]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1034
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1035
		if ($CommandHash{debug}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1036
			print '[-debug|-no_debug]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1037
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1038
		if ($CommandHash{logfc}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1039
			print '[-logfc]|[-fc]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1040
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1041
		if ($CommandHash{what}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1042
			print '))';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1043
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1044
		unless ($CommandHash{noplatform}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1045
			print ' [<platform>]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1046
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1047
		if ($CommandHash{build}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1048
			print ' [<build>]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1049
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1050
		if ($CommandHash{program}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1051
			print ' [<program>]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1052
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1053
		if ($CommandHash{source}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1054
			print ' [<source>]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1055
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1056
		if ($CommandHash{wrap}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1057
			print '[-wrap[=proxy]]';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1058
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1059
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1060
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1061
	print
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1062
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1063
		"\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1064
		"$CommandHash{function}\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1065
	;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1066
	exit;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1067
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1068
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1069
sub Commands () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1070
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1071
	print "Commands (case-insensitive):\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1072
	foreach (sort keys %Commands) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1073
		next if ${$Commands{$_}}{hidden};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1074
		my $Tmp=$_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1075
		while (length($Tmp) < 12) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1076
			$Tmp.=' ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1077
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1078
		print "  $Tmp ${$Commands{$_}}{function}\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1079
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1080
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1081
	exit;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1082
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1083
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1084
sub GetMakefileVariations ($$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1085
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1086
	my ($plat, $featureVariantArg) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1087
	my @variations = ();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1088
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1089
	if (!$featureVariantArg)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1090
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1091
		push @variations, "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1092
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1093
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1094
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1095
		my @resolvedVariants = featurevariantparser->ResolveFeatureVariant($featureVariantArg);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1096
# modified start: makefile improvement
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1097
		my %temp_hash =("default" => "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1098
		foreach (@resolvedVariants){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1099
			$temp_hash{$_}="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1100
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1101
			push @variations, ".".$_ foreach (keys %temp_hash);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1102
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1103
# modified end: makefile improvement
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1104
	return \@variations;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1105
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1106
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
  1107