diff -r 9f25be3da657 -r fa7a3cc6effd sbsv1/abld/makmake/makmake.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv1/abld/makmake/makmake.pl Fri Jun 25 17:29:25 2010 +0800
@@ -0,0 +1,1901 @@
+# Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# all variables called *Path* are set up to end with a backslash
+# all variables called *Path or *File are stored as absolute (file)paths within makmake
+# all variables called UpPath* are stored as relative paths within makmake
+#
+#
+
+
+use FindBin; # for FindBin::Bin
+use Getopt::Long;
+use Cwd;
+# modified start: makefile improvement
+use File::stat;
+use Time::localtime;
+# modified end: makefile improvement
+
+my $PerlLibPath; # fully qualified pathname of the directory containing our Perl modules
+
+# Prototype to remove warning.
+sub AddStringTables();
+
+BEGIN {
+# check user has a version of perl that will cope
+ require 5.005_03;
+# establish the path to the Perl libraries: currently the same directory as this script
+ $PerlLibPath = $FindBin::Bin; # X:/epoc32/tools
+ $PerlLibPath =~ s/\//\\/g; # X:\epoc32\tools
+ $PerlLibPath .= "\\";
+}
+
+use lib $PerlLibPath;
+use E32env;
+use E32Plat;
+use E32Variant;
+use Genutl;
+use Modload;
+use Pathutl;
+use Trgtype;
+use CheckSource;
+use featurevariantparser;
+use featurevariantmap;
+
+# THE MAIN PROGRAM SECTION
+##########################
+
+{
+ Load_SetModulePath($PerlLibPath);
+ Plat_Init($PerlLibPath);
+}
+
+my $MAKEFILE;
+my $MMPFILE;
+my %Options;
+my %Plat;
+my %TruePlat;
+my %BldMacros;
+my $PlatArg;
+my @PlatOverrideList=();
+my $EABIDef;
+my $DebugSwitch=undef;
+
+my $IsCompilerWrapperOption = 0;
+my $IsProxyWrapperOption = 0;
+my $FeatureVariantArg;
+my %FeatureVariantInfo;
+
+{
+ # process the command line
+ unless (GetOptions(\%Options, 'd', 'mmp', 'plat=s', 'v', 'arm', 'nd' , 'ithumb' , 'iarm' , 'debug', 'no_debug', 'logfc','wrap:s')) {
+ exit 1;
+ }
+ #Update the variable to set the information of -wrap option
+ if(exists($Options{wrap})) {
+ if ($Options{wrap} eq "") {
+ # Set the Compiler wrapper option information i.e. '1'
+ $IsCompilerWrapperOption = 1;
+ } elsif ($Options{wrap} eq "proxy") {
+ $IsProxyWrapperOption = 1;
+ } else {
+ print "WARNING: Invalid value for option -wrap: $Options{wrap}\n";
+ }
+ }
+
+ $Options{makemakefile}='1' unless ($Options{mmp} || $Options{plat});
+
+ if ($Options{mmp} or $Options{plat}) {
+ eval { &Load_ModuleL('MAKHELP'); };
+ die $@ if $@;
+ }
+
+ if ($Options{mmp}) {
+ &Help_Mmp;
+ exit;
+ }
+
+ if ($Options{plat}) {
+ eval { &Plat_GetL($Options{plat},\%Plat,\%BldMacros); };
+ die $@ if $@;
+ eval { &Load_ModuleL($Plat{MakeMod}); };
+ die $@ if $@;
+ &Help_Plat($Plat{Real},$Plat{CPU}, $Plat{DefFile}, \@{$Plat{MmpMacros}},\@{$Plat{Macros}});
+ exit;
+ }
+
+# show help & exit if necessary
+ if (@ARGV != 2) {
+ &Usage();
+ }
+ if ($Options{v}) {
+ print "perl -S makmake.pl @ARGV\n";
+ &Load_SetVerbose;
+ &Path_SetVerbose;
+ &Plat_SetVerbose;
+ }
+
+ $PlatArg=uc pop @ARGV;
+
+ # Process build platform arguments where they differ from the "norm"
+ if ($PlatArg=~/^(\S+)\.(\S+)$/)
+ {
+ # Explicit feature variant platforms take the form .
+ # e.g. armv5.variant1
+ $PlatArg=$1;
+ $FeatureVariantArg=$2;
+ }
+ elsif ($PlatArg=~/^(\S+):(\S+)$/)
+ {
+ # IDE platforms can take the form cw_ide:++
+ # e.g. cw_ide:plat1+plat2+plat3
+ #
+ $PlatArg=$1;
+ @PlatOverrideList=split(/\+/,$2);
+ }
+
+ eval { &Plat_GetL($PlatArg,\%TruePlat,\%BldMacros); };
+ die $@ if $@;
+ if (scalar @PlatOverrideList) {
+ $PlatArg=$PlatOverrideList[0];
+ }
+
+
+ $MMPFILE=pop @ARGV;
+ die "ERROR: Can't specify MMP file on a different drive\n" if $MMPFILE=~/^\w:\\/o;
+ if ($MMPFILE!~/.MMP$/io) {
+ $MMPFILE.='.MMP';
+ }
+ $MMPFILE=&Path_AbsToWork($MMPFILE);
+
+ eval { &Load_ModuleL('Mmp'); };
+ die $@ if $@;
+ if ($Options{v}) {
+ &Mmp_SetVerbose;
+ }
+ if ($Options{d}) {
+ die "ERROR: $E32env::Data{EPOCPath} does not exist\n" if (!-d $E32env::Data{EPOCPath});
+ }
+
+ if ($Options{debug}) {
+ $DebugSwitch = 1;
+ }
+ elsif($Options{no_debug}){
+ $DebugSwitch = 0;
+ }
+}
+
+my %LinkerOptions;
+my %WarningLevel;
+my $ABI;
+my @AifStruct;
+my $AllowDllData;
+my $CompressTarget;
+my $CompressTargetMode; #NONE
+my $ASSPExports;
+my @ASSPLibList;
+my @BitMapStruct;
+my $BuildAsARM=$Options{arm};
+my $CallDllEntryPoints;
+my $Capability;
+my @CapabilityFlags;
+my $DataLinkAddress;
+my @DebugLibList;
+my %Def;
+my %DocHash;
+my $ExportUnfrozen;
+my $FirstLib;
+my $FixedProcess;
+my %HeapSize;
+my @LibList;
+my $LinkAs;
+my $LinkAsBase;
+my $ExportLibrary;
+my $NoExportLibrary;
+my %MmpFlag;
+my @PlatTxt2D;
+my $ProcessPriority;
+my @RamTargets;
+my @ResourceStruct;
+my @RomTargets;
+my $SmpSafe;
+my @SourceStruct;
+my $StackSize;
+my @StatLibList;
+my $StdCpp;
+my $NoStdCpp;
+my $NewLib;
+my @SysIncPaths;
+my @ResourceSysIncPaths;
+my $ResourceVariantMacroHRHFile;
+my $Trg;
+my %TrgType;
+my @UidList;
+my @UserIncPaths;
+my $SrcDbg;
+my %Path;
+my %Version;
+my $SecureId;
+my $VendorId;
+my $variantMacroHRHFile = Variant_GetMacroHRHFile(); # HRH file containing macros specific to a variant
+my %ReplaceOptions;
+my $ARMFPU;
+my @StringTable;
+my @StringTableUserIncPaths;
+my $CodePagingTargetMode; # 0-N/A, 1-UNPAGED, 2-PAGED
+my $DataPagingTargetMode; # 0-N/A, 1-UNPAGED, 2-PAGED
+my %CheckSourceUDEBIncludes;
+my %CheckSourceURELIncludes;
+my %CheckSourceMMPMetaData;
+my %CheckSourceMMPIncludes;
+my $IsWideCharMain=0;
+my $IsDebuggable; # 0-NONDEBUGGABLE, 1-DEBUGGABLE, 2-DEBUGGABLE_UDEBONLY
+
+
+use constant NOTPAGED => 0;
+use constant UNPAGED => 1;
+use constant PAGED => 2;
+
+use constant INFLATECOMPRESSIONMETHOD => 1;
+use constant BYTEPAIRCOMPRESSIONMETHOD => 2;
+
+use constant NOTDEBUGGABLE => 0;
+use constant DEBUGGABLE => 1;
+use constant DEBUGGABLE_UDEBONLY => 2;
+
+# If the platform does support feature variants but none are specified, then we assume the use of "DEFAULT" if it exists
+# If default doesn't exist feature variantion is basically disabled?
+$FeatureVariantArg = 'default' if (!$FeatureVariantArg && defined &PMSupportsFeatureVariants && featurevariantparser->DefaultExists());
+
+# Preload the details of the variant requested if any - we need the HRH file for MMP file processing
+if ($FeatureVariantArg)
+ {
+ # First check the feature variant is valid
+ my @buildableFeatureVariants = featurevariantparser->GetBuildableFeatureVariants();
+ die "ERROR: \"$PlatArg.$FeatureVariantArg\" feature variant is either invalid or virtual.\n" if !(grep /^$FeatureVariantArg$/i, @buildableFeatureVariants);
+
+ # Now load the variant
+ %FeatureVariantInfo = featurevariantparser->GetVariant($FeatureVariantArg);
+
+ # Change the HRH file to use
+ $variantMacroHRHFile = $FeatureVariantInfo{VARIANT_HRH} if $FeatureVariantInfo{VARIANT_HRH};
+ }
+
+&SetVarsFromMmp($PlatArg);
+die $@ if $@;
+
+{
+ # set up the makefile filepath - need to do this before loading the platform module
+ # because UID source file will be added and set up in the makefile path under WINS
+ if ($Options{d}) {
+ $MAKEFILE=join ('', $Path{Bld}, &Path_Split('Base',$MMPFILE), $TruePlat{Ext});
+ }
+ else {
+ $MAKEFILE=join "", &Path_WorkPath, &Path_Split('Base',$MMPFILE), $TruePlat{Ext};
+ }
+}
+
+{
+ # Generate an X86GCC def file from eabi def file in build dir if needed
+ if (($PlatArg eq "X86GCC" || $PlatArg eq "X86GMP") && $Def{Base} && not -e &DefFile)
+ {
+ # Find the equivalent eabi def file
+ my $eabiDefFile = File::Spec->canonpath("$Def{Path}../eabi/$Def{Base}$Def{Ext}");
+ if (-e $eabiDefFile)
+ {
+ # Need to create MAKEFILE directory early in this case
+ eval { &Path_MakePathL($MAKEFILE); };
+ die $@ if $@;
+ # Change def file path to build path
+ $Def{Path} = $Path{Bld};
+ &generateX86GCCDefFile($eabiDefFile, &DefFile);
+ }
+ else
+ {
+ print "WARNING: Unable to find EABI def file at $eabiDefFile to generate X86GCC def file with\n";
+ }
+ }
+}
+
+{
+
+
+# load the platform module
+ eval { &Load_ModuleL($TruePlat{MakeMod}); };
+ die $@ if $@;
+
+ unless (defined &PMHelp_Mmp) {
+# check this function is defined - all modules must have it - if not perhaps the
+# platform module has not loaded is compiler module successfully via "use"
+ die "ERROR: Module \"$Plat{MakeMod}\" not loaded successfully\n";
+ }
+}
+
+ # Allow the platform to bow out if feature variants have been specified but it doesn't support them
+ if ($FeatureVariantArg && !defined &PMSupportsFeatureVariants)
+ {
+ die "ERROR: The \"$PlatArg\" platform does not support feature variants.\n";
+ }
+
+{
+ # allow the platform to bow out if it can't support some .MMP file specifications
+ if (defined &PMCheckPlatformL) {
+ eval { &PMCheckPlatformL(); };
+ die $@ if $@;
+ }
+}
+
+my @StdIncPaths=();
+
+{
+ # get the platform module to do it's mmpfile processing - WINS modules may set up an extra source file
+ # for UIDs here depending upon the targettype
+ &PMPlatProcessMmp(@PlatTxt2D) if defined &PMPlatProcessMmp;
+}
+
+%CheckSourceMMPMetaData = &Mmp_CheckSourceMMPMetaData();
+%CheckSourceMMPIncludes = &Mmp_CheckSourceMMPIncludes();
+
+# merge checksource processing from platform specific .mmp sections, if applicable
+%CheckSourceMMPMetaData = (%CheckSourceMMPMetaData, &PMPlatCheckSource()) if defined &PMPlatCheckSource;
+
+@ResourceSysIncPaths = @SysIncPaths;
+$ResourceVariantMacroHRHFile = $variantMacroHRHFile;
+
+AddStringTables();
+
+# Process feature variants if applicable
+
+if ($FeatureVariantArg)
+ {
+ if ($Options{v})
+ {
+ $featurevariantmap::verbose = 1;
+ $featurevariantparser::verbose = 1;
+ }
+
+ # Get the default variant details
+ my %DefaultFeatureVariantInfo = $FeatureVariantInfo{NAME} =~ /^default$/i ? %FeatureVariantInfo : featurevariantparser->GetVariant("DEFAULT");
+ die "ERROR: Feature variant \"$PlatArg.default\" is invalid.\n" if !$DefaultFeatureVariantInfo{VALID};
+
+ # The following IF statement decides whether to use the default variant and not use the hash in the filename
+ # This prevents the generation of dll's/exe's for which variants are not needed (i.e they are invariant)
+ # It also avoids the time-consuming and redundant hash generation
+ # A component is considered invariant if it's not a DLL or EXE or FEATUREVARIANT isn't present in the .mmp file
+
+# modified start: makefile improvement
+ if ($TrgType{Basic} =~ /^(EXEDLL|EXE|DLL|LIB)$/ && &Mmp_IsFeatureVariant)
+# modified end: makefile improvement
+ {
+ # Load the requested variant if it hasn't already been preloaded
+ %FeatureVariantInfo = featurevariantparser->GetVariant($FeatureVariantArg) if !$FeatureVariantInfo{NAME} || $FeatureVariantInfo{NAME} ne $FeatureVariantArg;
+ }
+ else
+ {
+ # Use the default variant
+ %FeatureVariantInfo = %DefaultFeatureVariantInfo;
+ $FeatureVariantInfo{INVARIANT} = 1;
+ $FeatureVariantInfo{NAME} = uc $FeatureVariantArg;
+ }
+
+ die "ERROR: Feature variant \"$PlatArg.$FeatureVariantInfo{NAME}\" is invalid.\n" if !$FeatureVariantInfo{VALID};
+
+ my @featureVariantSysIncPaths = (@{$FeatureVariantInfo{BUILD_INCLUDES}},@SysIncPaths);
+
+ # Further process paths and filenames so that they include a drive letter.
+ # We store this in a hash specifically for passing on to featurevariantmap->Hash
+
+ my @processedIncludes = &Path_PrefixWithDrive(&Path_Chop(@UserIncPaths), &Path_Chop(@featureVariantSysIncPaths));
+ push @processedIncludes, &Path_Chop(&PMToolChainIncDir) if defined &PMToolChainIncDir && &PMToolChainIncDir;
+
+ my $processedPreInclude = "";
+ if (defined &PMPrefixFile)
+ {
+ $processedPreInclude = &PMPrefixFile;
+ $processedPreInclude =~ s/\"//g;
+ $processedPreInclude = &Path_PrefixWithDrive($processedPreInclude);
+ }
+
+ my %processedFeatureVariantInfo;
+ $processedFeatureVariantInfo{PREINCLUDE} = $processedPreInclude if $processedPreInclude;
+ $processedFeatureVariantInfo{BUILD_INCLUDES} = \@processedIncludes if @processedIncludes;
+ $processedFeatureVariantInfo{VALID} = 1;
+
+ # Pass in the details of the macros tested in the MMP
+ $processedFeatureVariantInfo{MMPTESTED} = &Mmp_TestedMacros();
+
+ my @pathedSrcList = ();
+ push @pathedSrcList, Path_PrefixWithDrive($$_{SrcPath}.$$_{CurFile}) foreach (@SourceStruct);
+
+ foreach my $bld (@{$Plat{Blds}})
+ {
+# modified start: makefile improvement
+ my @reusedHash;
+# modified end: makefile improvement
+ if ($FeatureVariantInfo{INVARIANT}) # Invariant override
+ {
+ $FeatureVariantInfo{$bld."_LABEL"} = "INVARIANT";
+ }
+ else
+ {
+# modified by SV start: makefile improvement
+ my $vmap = "$E32env::Data{RelPath}".lc($Plat{Real})."\\".lc($bld)."\\".Trg()."." . $FeatureVariantInfo{NAME}.".vmap";
+# modified by SV end: makefile improvement
+ $vmap = Path_PrefixWithDrive($vmap);
+ if(-e $vmap){
+ my @variantlist = featurevariantmap->GetVariantListFromVmap($vmap);
+ my @calls;
+ foreach(@variantlist)
+ {
+ my $target = "CHECKVMAP".uc($bld);
+ my $makefile = $MAKEFILE.".".$_;
+ if(-e $makefile){
+ push @calls, "make -r -f \"$makefile\" $target";
+ }
+ }
+ foreach my $call (@calls)
+ {
+ print "call: $call" if $Options{v};
+ open PIPE, "$call |";
+ while() {
+ print $_;
+ }
+ close PIPE;
+ }
+ if(-e $vmap){
+ @reusedHash = featurevariantmap->CheckOldVmapFile($vmap, \%FeatureVariantInfo);
+ }
+ }
+ if(defined(@reusedHash))
+ {
+ $FeatureVariantInfo{$bld."_LABEL"} = $reusedHash[0];
+ $FeatureVariantInfo{$bld."_FEATURES"} = $reusedHash[1];
+ next;
+ }
+# modified end: makefile improvement
+ my @macros = (@{$Plat{Macros}}, @{$BldMacros{$bld}}, "__SUPPORT_CPP_EXCEPTIONS__");
+ push @macros, "__PRODUCT_INCLUDE__=\"".&Path_PrefixWithDrive($FeatureVariantInfo{VARIANT_HRH})."\"" if $FeatureVariantInfo{VARIANT_HRH};
+ $processedFeatureVariantInfo{MACROS} = \@macros;
+
+ print ("Feature variant hash processing: \"$FeatureVariantInfo{NAME} $bld\"\n") if $Options{v};
+
+ my @result = featurevariantmap->HashAndFeatures(\@pathedSrcList, \%processedFeatureVariantInfo);
+ $FeatureVariantInfo{$bld."_LABEL"} = $result[0];
+ $FeatureVariantInfo{$bld."_FEATURES"} = $result[1];
+
+ die "ERROR: Can't obtain hash for \"$PlatArg.$FeatureVariantInfo{NAME}\" feature variant.\n" if !$FeatureVariantInfo{$bld."_LABEL"};
+ }
+ }
+
+ # Customise standard content based on feature variant updates
+ @SysIncPaths = @featureVariantSysIncPaths;
+ $variantMacroHRHFile = $FeatureVariantInfo{VARIANT_HRH};
+ $MAKEFILE .= ".$FeatureVariantInfo{NAME}";
+
+ # Resources are always processed in the context of the default variant's system include and variant files when
+ # feature variants are in use
+ @ResourceSysIncPaths = (@{$DefaultFeatureVariantInfo{BUILD_INCLUDES}},@ResourceSysIncPaths);
+ $ResourceVariantMacroHRHFile = $DefaultFeatureVariantInfo{VARIANT_HRH};
+ }
+
+
+{
+ # if verbose mode set, output some info
+ #--------------------------------------
+ if ($Options{v}) {
+ print
+ "Target: \"$Trg\"\n",
+ "TargetType: \"$TrgType{Name}\"\n",
+ "Libraries: \"@LibList\"\n",
+ "Debug Libraries: \"@DebugLibList\"\n",
+ "Static Libraries: \"@StatLibList\"\n",
+ "Uids: \"@UidList\"\n",
+ "BuildVariants: \"@{$Plat{Blds}}\"\n",
+ "TargetMakeFile: \"$MAKEFILE\"\n",
+ "UserIncludes: \"