Subversion Repositories DevTools

Rev

Rev 6073 | Rev 6177 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6073 Rev 6133
Line 105... Line 105...
105
use JatsDPackage;
105
use JatsDPackage;
106
use MakeIf;
106
use MakeIf;
107
use ToolsetPrinter;
107
use ToolsetPrinter;
108
use MakeObject;
108
use MakeObject;
109
use JatsVersionUtils;
109
use JatsVersionUtils;
-
 
110
use ToolsetFiles;
110
 
111
 
111
 
112
 
112
our $ScmVersion             = "2.34";
113
our $ScmVersion             = "2.34";
113
our $ScmGlobal              = 0;
114
our $ScmGlobal              = 0;
114
our $ScmExpert              = 0;
115
our $ScmExpert              = 0;
115
our $ScmInterface           = "interface";      # default 'interface'
116
our $ScmInterface           = "interface";      # default 'interface'
116
our $ScmPackage             = 1;                # package active by default.
117
our $ScmPackage             = 1;                # package active by default.
117
our $ScmProcessingRootMake  = 0;                # Processing root makefile.pl
118
our $ScmProcessingRootMake  = 0;                # Processing root makefile.pl
118
our $ScmPlatformSeen        = 0;                # Platform directive has been seen
119
our $ScmPlatformSeen        = 0;                # Platform directive has been seen
-
 
120
my  $ScmNotGeneric          = 1;                # Not a generic build
119
 
121
 
120
our $ScmToolsetVersion      = "";               # version of toolset
122
our $ScmToolsetVersion      = "";               # version of toolset
121
our $ScmToolsetGenerate     = 1;                # generate active by default.
123
our $ScmToolsetGenerate     = 1;                # generate active by default.
122
our $ScmToolsetProgDependancies = 1;            # 1: Write program dependancies
124
our $ScmToolsetProgDependancies = 1;            # 1: Write program dependancies
123
                                                # 0: Don't write progdeps. Prog is Phony
125
                                                # 0: Don't write progdeps. Prog is Phony
Line 125... Line 127...
125
our $ScmToolsetProgSource   = ();               # Toolset Program Source
127
our $ScmToolsetProgSource   = ();               # Toolset Program Source
126
our $ScmToolsetSoName       = 0;                # 1: Shared library supports SoName
128
our $ScmToolsetSoName       = 0;                # 1: Shared library supports SoName
127
our $ScmToolsetNillLibSrc   = 0;                # 1: Librarys created without source specified
129
our $ScmToolsetNillLibSrc   = 0;                # 1: Librarys created without source specified
128
our %ScmToolsetProperties   = ();               # Toolset specific features and limitations
130
our %ScmToolsetProperties   = ();               # Toolset specific features and limitations
129
                                                # Known values: UnitTests, AutoUnitTests
131
                                                # Known values: UnitTests, AutoUnitTests
130
my  %ScmGlobalOptions       = ();               # Hash of Global(platform) options. Access via functions
132
our  %ScmGlobalOptions       = ();              # Hash of Global(platform) options. Access via functions
131
 
133
 
132
our $ScmRoot                = "";
134
our $ScmRoot                = "";
133
our $ScmMakelib             = "";
135
our $ScmMakelib             = "";
134
our $ScmPlatform            = "";
136
our $ScmPlatform            = "";
135
our $ScmMachType            = "";
137
our $ScmMachType            = "";
Line 646... Line 648...
646
 
648
 
647
                                                # Platform specific
649
                                                # Platform specific
648
        MakeIf::PackageDirs( \@ScmPlatformDirs, $ScmPlatform );
650
        MakeIf::PackageDirs( \@ScmPlatformDirs, $ScmPlatform );
649
        push @ScmPlatformDirs, "$::GBE_CONFIG"; # .. plus default
651
        push @ScmPlatformDirs, "$::GBE_CONFIG"; # .. plus default
650
 
652
 
651
        #   Map all GENERIC builds onto the one platformm definition
653
        #   Map all GENERIC builds onto the one platform definition
652
        my $platformDefs = $ScmPlatform;
654
        my $platformDefs = $ScmPlatform;
653
        $platformDefs = 'GENERIC' if ($::BUILDINFO{$ScmPlatform}{IS_GENERIC});
655
        if ($::BUILDINFO{$ScmPlatform}{IS_GENERIC})
-
 
656
        {
-
 
657
            $ScmNotGeneric = 0;
-
 
658
            $platformDefs = 'GENERIC' ;
-
 
659
        }
654
 
660
 
655
        $file = Require( "PLATFORM", $platformDefs,
661
        $file = Require( "PLATFORM", $platformDefs,
656
                    "Platform definition ", @ScmPlatformDirs );
662
                    "Platform definition ", @ScmPlatformDirs );
657
    }
663
    }
658
    push( @ScmDepends, "$file" );
664
    push( @ScmDepends, "$file" );
Line 717... Line 723...
717
    my $local_base_dir = "$ScmRoot/gbe/DIRECTIVES";
723
    my $local_base_dir = "$ScmRoot/gbe/DIRECTIVES";
718
    if ( -d $local_base_dir )
724
    if ( -d $local_base_dir )
719
    {
725
    {
720
        foreach my $file  ( glob ("$local_base_dir/*.pm") )
726
        foreach my $file  ( glob ("$local_base_dir/*.pm") )
721
        {
727
        {
-
 
728
DebugDumpData("Include: $file",);
722
            push( @ScmDepends, "$file" );
729
            push( @ScmDepends, "$file" );
723
            require $file;
730
            require $file;
724
        }
731
        }
725
    }
732
    }
726
 
733
 
Line 1769... Line 1776...
1769
 
1776
 
1770
        #
1777
        #
1771
        #   Add to suitable list
1778
        #   Add to suitable list
1772
        #
1779
        #
1773
        push @{$tlist_ref}, $_;
1780
        push @{$tlist_ref}, $_;
-
 
1781
        ToolsetFiles::AddDir($_, 'Include');
1774
 
1782
 
1775
        #
1783
        #
1776
        #   Add to the no dependancy list (ie generated depend file)
1784
        #   Add to the no dependancy list (ie generated depend file)
1777
        #   Only used by AddIncDir, accepted by AddSrcDir
1785
        #   Only used by AddIncDir, accepted by AddSrcDir
1778
        #
1786
        #
Line 1957... Line 1965...
1957
    #
1965
    #
1958
    #   Object files are saved in
1966
    #   Object files are saved in
1959
    #       OBJSOURCE   - Generate a recipe to create the object
1967
    #       OBJSOURCE   - Generate a recipe to create the object
1960
    #       OBJS        - A list of ALL non-shared object files
1968
    #       OBJS        - A list of ALL non-shared object files
1961
    #
1969
    #
1962
    if ( $is_obj && $::o )
1970
    if ( $is_obj && $::o && $ScmNotGeneric )
1963
    {
1971
    {
1964
        $OBJSOURCE{ "$obj" } = $srcfile;
1972
        $OBJSOURCE{ "$obj" } = $srcfile;
1965
        push( @OBJS, $obj )
1973
        push( @OBJS, $obj )
1966
            if ($push);
1974
            if ($push);
1967
    }
1975
    }
Line 3557... Line 3565...
3557
    'BuildVersionNum'   => '$(BUILDVERNUM)',
3565
    'BuildVersionNum'   => '$(BUILDVERNUM)',
3558
 
3566
 
3559
    'PackageDir'        => '$(PKGDIR),+',
3567
    'PackageDir'        => '$(PKGDIR),+',
3560
    'PackagePkgDir'     => '$(PKGDIR)/pkg/pkg.$(GBE_PLATFORM),+',
3568
    'PackagePkgDir'     => '$(PKGDIR)/pkg/pkg.$(GBE_PLATFORM),+',
3561
    'PackageIncDir'     => '$(INCDIR_PKG),+',
3569
    'PackageIncDir'     => '$(INCDIR_PKG),+',
-
 
3570
    'PackageIncPlatDir' => '$(INCDIR_PKG)/$(GBE_PLATFORM),+',
3562
    'PackageLibDir'     => '$(LIBDIR_PKG)/$(GBE_PLATFORM),+',
3571
    'PackageLibDir'     => '$(LIBDIR_PKG)/$(GBE_PLATFORM),+',
3563
    'PackageBinDir'     => '$(BINDIR_PKG)/$(GBE_PLATFORM)$(GBE_TYPE),+',
3572
    'PackageBinDir'     => '$(BINDIR_PKG)/$(GBE_PLATFORM)$(GBE_TYPE),+',
3564
 
3573
 
3565
    'PackageToolDir'    => '$(PKGDIR)/tools,+',
3574
    'PackageToolDir'    => '$(PKGDIR)/tools,+',
3566
    'PackageToolBin'    => '$(PKGDIR)/tools/bin/$(GBE_HOSTMACH),+',
3575
    'PackageToolBin'    => '$(PKGDIR)/tools/bin/$(GBE_HOSTMACH),+',
Line 3593... Line 3602...
3593
 
3602
 
3594
    'Verbose'           => '$(CC_PRE)',
3603
    'Verbose'           => '$(CC_PRE)',
3595
    'LeaveTmp'          => '$(LEAVETMP)',
3604
    'LeaveTmp'          => '$(LEAVETMP)',
3596
    'Cwd'               => '$(CURDIR),-',
3605
    'Cwd'               => '$(CURDIR),-',
3597
 
3606
 
-
 
3607
    # Generated when used
3598
    'CompilerPath'      => '$(SCM_COMPILERPATH)',
3608
    'CompilerPath'      => '$(SCM_COMPILERPATH)',
3599
    'PkgArch'           => '$(PACKAGE_ARCH)',
3609
    'PkgArch'           => '$(PACKAGE_ARCH)',
-
 
3610
 
-
 
3611
    'Native'            => '0',
-
 
3612
    'Toolset'           => '0',
-
 
3613
 
3600
    );
3614
    );
3601
 
3615
 
3602
sub ExpandGenVar
3616
sub ExpandGenVar
3603
{
3617
{
3604
    my ($dname, $args, @uopts) = @_;
3618
    my ($dname, $args, @uopts) = @_;
Line 3637... Line 3651...
3637
    #   Most of it can be initialised at startup - but not all of it.
3651
    #   Most of it can be initialised at startup - but not all of it.
3638
    #
3652
    #
3639
    $ExpandGenVarConvert{CompilerPath} = undef unless $::ScmToolsetCompilerPath;
3653
    $ExpandGenVarConvert{CompilerPath} = undef unless $::ScmToolsetCompilerPath;
3640
    $ExpandGenVarConvert{Product}      = '$(GBE_PLATFORM)' unless $ScmProduct;
3654
    $ExpandGenVarConvert{Product}      = '$(GBE_PLATFORM)' unless $ScmProduct;
3641
 
3655
 
-
 
3656
    $ExpandGenVarConvert{Native}      = '1'  if isAnAlias ('NATIVE');
-
 
3657
    $ExpandGenVarConvert{Toolset}     = '1'  if isAnAlias ('TOOLSET');
-
 
3658
 
-
 
3659
 
3642
    #
3660
    #
3643
    #   Look up a hash of conversions
3661
    #   Look up a hash of conversions
3644
    #   Could allow for a code ref, but not needed yet
3662
    #   Could allow for a code ref, but not needed yet
3645
    #
3663
    #
3646
    Error ("$dname: Unknown expansion --Var($tag)")
3664
    Error ("$dname: Unknown expansion --Var($tag)")
Line 3697... Line 3715...
3697
    return $prefix , $expansion, $is_path ? 1 : 0, $is_abs;
3715
    return $prefix , $expansion, $is_path ? 1 : 0, $is_abs;
3698
 
3716
 
3699
}
3717
}
3700
 
3718
 
3701
#-------------------------------------------------------------------------------
3719
#-------------------------------------------------------------------------------
-
 
3720
# Function        : isAnAlias 
-
 
3721
#
-
 
3722
# Description     : Internal Helper
-
 
3723
#                   Determine if this platform is an alias for ...
-
 
3724
#
-
 
3725
# Inputs          :  $target    - Test against this target
-
 
3726
#
-
 
3727
# Returns         :  True - Is an alais for $target.
-
 
3728
#
-
 
3729
sub isAnAlias
-
 
3730
{
-
 
3731
    my ($target) = @_;
-
 
3732
    if (exists ($::BUILDINFO{$ScmPlatform}{'USERALIAS'}) )
-
 
3733
    {
-
 
3734
        if ( grep /^$target$/, @{$::BUILDINFO{$ScmPlatform}{'USERALIAS'}} )
-
 
3735
        {
-
 
3736
                return 1;    
-
 
3737
        }
-
 
3738
 
-
 
3739
    }
-
 
3740
    if (exists ($::BUILDINFO{$ScmPlatform}{'ALIAS'}) )
-
 
3741
    {
-
 
3742
        if ( $target eq $::BUILDINFO{$ScmPlatform}{'ALIAS'} )
-
 
3743
        {
-
 
3744
                return 1;    
-
 
3745
        }
-
 
3746
    }
-
 
3747
 
-
 
3748
    return 0;
-
 
3749
}
-
 
3750
 
-
 
3751
#-------------------------------------------------------------------------------
3702
# Function        : ProcessPathName
3752
# Function        : ProcessPathName
3703
#
3753
#
3704
# Description     : Massage a pathname according to a set of flags
3754
# Description     : Massage a pathname according to a set of flags
3705
#
3755
#
3706
# Inputs          : $fn         - Patchname to massage
3756
# Inputs          : $fn         - Patchname to massage
Line 6314... Line 6364...
6314
    my( $platforms, @elements ) = @_;
6364
    my( $platforms, @elements ) = @_;
6315
    my( $base, $dir, $full, $path, $dist, $strip, $exefile, $type );
6365
    my( $base, $dir, $full, $path, $dist, $strip, $exefile, $type );
6316
    my( $name, $basename, $len, $srcfile );
6366
    my( $name, $basename, $len, $srcfile );
6317
    my( $dir_tree, @dir_tree_exclude, @dir_tree_include, $strip_base, $strip_dots );
6367
    my( $dir_tree, @dir_tree_exclude, @dir_tree_include, $strip_base, $strip_dots );
6318
    my $recurse = 1;
6368
    my $recurse = 1;
-
 
6369
    my $preserveSymlink = 0;
6319
 
6370
 
6320
    Debug2( "PackageFile($platforms, @elements)" );
6371
    Debug2( "PackageFile($platforms, @elements)" );
6321
 
6372
 
6322
    return if ( !$ScmPackage );                 # Packaging enabled ?
6373
    return if ( !$ScmPackage );                 # Packaging enabled ?
6323
    return if ( ! ActivePlatform($platforms) );
6374
    return if ( ! ActivePlatform($platforms) );
Line 6353... Line 6404...
6353
            $strip = 1;
6404
            $strip = 1;
6354
 
6405
 
6355
        } elsif (/^--Executable$/) {            # Mark the file as executable
6406
        } elsif (/^--Executable$/) {            # Mark the file as executable
6356
            $exefile = "X";
6407
            $exefile = "X";
6357
 
6408
 
-
 
6409
        } elsif (/^--PreserveSymlink/i) {       # Preserve symlink to local file
-
 
6410
            $preserveSymlink = 1;
-
 
6411
 
6358
        } elsif ( /^--DirTree=(.*)/ ) {
6412
        } elsif ( /^--DirTree=(.*)/ ) {
6359
            Error("DirTree. Multiple directories not allowed.") if ( $dir_tree );
6413
            Error("DirTree. Multiple directories not allowed.") if ( $dir_tree );
6360
            $dir_tree =  $1;
6414
            $dir_tree =  $1;
6361
            Error("DirTree. No path specified") unless ( defined($dir_tree) && $dir_tree ne "" );
6415
            Error("DirTree. No path specified") unless ( defined($dir_tree) && $dir_tree ne "" );
6362
 
6416
 
Line 6444... Line 6498...
6444
#
6498
#
6445
    foreach ( @elements )
6499
    foreach ( @elements )
6446
    {
6500
    {
6447
        my %package_entry;
6501
        my %package_entry;
6448
        $name = $_;
6502
        $name = $_;
-
 
6503
        my $symlink;
6449
 
6504
 
6450
        #
6505
        #
6451
        #   Trap special files
6506
        #   Trap special files
6452
        #       DPACKAGE - but only if we have a DPackageLibrary directive
6507
        #       DPACKAGE - but only if we have a DPackageLibrary directive
6453
        #                  in the same makefile.
6508
        #                  in the same makefile.
Line 6486... Line 6541...
6486
 
6541
 
6487
            $dir =~ s~//~/~g;
6542
            $dir =~ s~//~/~g;
6488
            $dir =~ s~/$~~;
6543
            $dir =~ s~/$~~;
6489
 
6544
 
6490
            #
6545
            #
-
 
6546
            #   Preserve Symlink
-
 
6547
            #
-
 
6548
            if ($preserveSymlink && -l $srcfile)
-
 
6549
            {
-
 
6550
                $symlink = 1;
-
 
6551
            }
-
 
6552
 
-
 
6553
            #
6491
            #   Sanity test the source filename
6554
            #   Sanity test the source filename
6492
            #   User may have misused an option
6555
            #   User may have misused an option
6493
            #
6556
            #
6494
            if ( ( $srcfile =~ m/=/ ) || ( $srcfile =~ m/^-/ ) || ( $srcfile =~ m~/-~ )  )
6557
            if ( ( $srcfile =~ m/=/ ) || ( $srcfile =~ m/^-/ ) || ( $srcfile =~ m~/-~ )  )
6495
            {
6558
            {
Line 6502... Line 6565...
6502
            $package_entry{'src'} = $srcfile;
6565
            $package_entry{'src'} = $srcfile;
6503
            $package_entry{'dir'} = StripFileExt( "$dir/$name" );
6566
            $package_entry{'dir'} = StripFileExt( "$dir/$name" );
6504
            $package_entry{'set'} = $dist;
6567
            $package_entry{'set'} = $dist;
6505
            $package_entry{'exe'} = $exefile if $exefile;
6568
            $package_entry{'exe'} = $exefile if $exefile;
6506
            $package_entry{'type'} = $type if ( $type );
6569
            $package_entry{'type'} = $type if ( $type );
-
 
6570
            $package_entry{'symlink'} = 1 if ( $symlink );
6507
 
6571
 
6508
            $PACKAGE_FILES{ "$dir/$name" } = {%package_entry};
6572
            $PACKAGE_FILES{ "$dir/$name" } = {%package_entry};
6509
        }
6573
        }
6510
    }
6574
    }
6511
}
6575
}
Line 8135... Line 8199...
8135
    }
8199
    }
8136
    return 0;
8200
    return 0;
8137
}
8201
}
8138
 
8202
 
8139
#-------------------------------------------------------------------------------
8203
#-------------------------------------------------------------------------------
-
 
8204
# Function        : ActiveAlias
-
 
8205
#
-
 
8206
# Description     : Determine if the specified Alias is currenly 'active'
-
 
8207
#
-
 
8208
# Inputs          : $mtype              - one or more alias names separated
-
 
8209
#                                         by either a comma or a colon
-
 
8210
#
-
 
8211
# Returns         : TRUE    if any of the current Aliases is in the list
-
 
8212
#
-
 
8213
sub ActiveAlias
-
 
8214
{
-
 
8215
    my ($mtype) = @_;
-
 
8216
    foreach (  split( '\s*[:,]\s*', $mtype ) )
-
 
8217
    {
-
 
8218
        return 1
-
 
8219
            if ( isAnAlias( uc($_) ) );
-
 
8220
    }
-
 
8221
    return 0;
-
 
8222
}
-
 
8223
 
-
 
8224
 
-
 
8225
#-------------------------------------------------------------------------------
8140
# Function        : ActivePlatform
8226
# Function        : ActivePlatform
8141
#
8227
#
8142
# Description     : Determine if the specified platform is currently 'active'
8228
# Description     : Determine if the specified platform is currently 'active'
8143
#                   This is used by all user directives in order to determine
8229
#                   This is used by all user directives in order to determine
8144
#                   if the directive should be ignored for the current platform
8230
#                   if the directive should be ignored for the current platform
Line 8147... Line 8233...
8147
#                                         This is a bit complex.
8233
#                                         This is a bit complex.
8148
#
8234
#
8149
#                   Format of platform_spec. One or more of
8235
#                   Format of platform_spec. One or more of
8150
#                       PlatformName
8236
#                       PlatformName
8151
#                       AliasName
8237
#                       AliasName
8152
#                       TargetName,--Target
8238
#                       TargetName[,--Target]
8153
#                   Special Options (Must all be True)
8239
#                   Special Options (Must all be True)
8154
#                       --Project=ProjectName[:ProjectName]+
8240
#                       --Project=ProjectName[:ProjectName]+
8155
#                       --Defined=SomeValue[:SomeValue]+
8241
#                       --Defined=SomeValue[:SomeValue]+
8156
#                       --MachType=SomeValue[:SomeValue]+
8242
#                       --MachType=SomeMachType[:SomeMachType]+
8157
 
-
 
-
 
8243
#                       --Alias=SomeAlias[:SomeAlias]+
-
 
8244
#                   Some shortcuts
8158
#                   Each can be prefixed with a '!' to negate the test
8245
#                       '*'     ==> Always true
8159
#
8246
#
-
 
8247
#                   Each can be prefixed with a '!' to negate the test
-
 
8248
#                   
-
 
8249
#                   PlatformNames are either additive or negative(prefixed with !)
-
 
8250
#                       Order is not important                   
-
 
8251
#                       All additive names are accumulated before the negative items are considered.
-
 
8252
#                           ie: aa,!bb => !bb,aa
-
 
8253
#                       If only negative names are provided then JATS assumes a leading '*'
-
 
8254
#                           ie: !aaa => *,!aaa
-
 
8255
#                   
8160
#                   Valid options are:
8256
#                   Valid options are:
8161
#                       --Target        - indicates that the platform is a 'target'
8257
#                       --Target        - indicates that the platform is a 'target'
8162
#
8258
#
8163
# Returns         : TRUE if the platform spec is satisfied
8259
# Returns         : TRUE if the platform spec is satisfied
8164
#
8260
#
8165
sub ActivePlatform
8261
sub ActivePlatform
8166
{
8262
{
8167
    my( $platform_spec ) = @_;
8263
    my( $platform_spec ) = @_;
8168
    my( @platforms, $scmplatform, $platform );
8264
    my( @platforms, $scmplatform, $platform );
8169
    my( %arguments, @args, $filter );
8265
    my( %arguments, @args );
8170
    my @plist;
8266
    my @plist;
8171
    my ($match_count, $count_invert, $count_vert) = (0,0,0);
-
 
8172
 
8267
 
8173
    #
8268
    #
8174
    #   Short circuit check
8269
    #   Short circuit check
8175
    #   '*' is used so often that it pays to check it first
8270
    #       '*' is used so often that it pays to check it first
8176
    #
8271
    #
8177
    if ( $platform_spec eq '*' )
8272
    if ( $platform_spec eq '*' )
8178
    {
8273
    {
8179
        Debug3( " ActivePlatform(@_) = TRUE" );
8274
        Debug3( " ActivePlatform(@_) = TRUE" );
8180
        return 1;
8275
        return 1;
Line 8199... Line 8294...
8199
 
8294
 
8200
        } elsif ( m~^(!?)--MachType=(.+)~ ) {
8295
        } elsif ( m~^(!?)--MachType=(.+)~ ) {
8201
            $not = $1;
8296
            $not = $1;
8202
            $result = ActiveMachType($2);
8297
            $result = ActiveMachType($2);
8203
 
8298
 
-
 
8299
        } elsif ( m~^(!?)--Alias=(.+)~ ) {
-
 
8300
            $not = $1;
-
 
8301
            $result = ActiveAlias($2);
-
 
8302
 
8204
        } else {
8303
        } else {
8205
            #
8304
            #
8206
            #   Must be a platform argument
8305
            #   Must be a platform argument
8207
            #   Add to a list
8306
            #   Add to a list
8208
            #
8307
            #
Line 8219... Line 8318...
8219
        return 0 unless ( $result );
8318
        return 0 unless ( $result );
8220
    }
8319
    }
8221
 
8320
 
8222
    #
8321
    #
8223
    #   If we have no platforms then the test was purely non-platform arguments.
8322
    #   If we have no platforms then the test was purely non-platform arguments.
8224
    #   
-
 
8225
    #
8323
    #
8226
    if ($platform_spec ne '' && ! @platforms)
8324
    if ($platform_spec ne '' && ! @platforms) {
8227
    {
-
 
-
 
8325
        Debug3( " ActivePlatform(@_ == $ScmPlatform) = TRUE" );
8228
        return 1;
8326
        return 1;
8229
    }
8327
    }
8230
 
8328
 
-
 
8329
    unless (@platforms) {
-
 
8330
        Debug3( " ActivePlatform(@_ == $ScmPlatform) = FALSE" );
-
 
8331
        return 0;
-
 
8332
    }
-
 
8333
 
-
 
8334
 
8231
    #   Platform specified may be an Alias
8335
    #   Platform specified may be an Alias
8232
    #   Perform alias expansion
8336
    #   Perform alias expansion
8233
    #
8337
    #
8234
    @platforms = ExpandPlatforms( @platforms );         # aliasing
8338
    @platforms = ExpandPlatforms( @platforms );         # aliasing
8235
    Debug3( " ActivePlatform(@_)" );
8339
    Debug3( " ActivePlatform(@_)" );
Line 8265... Line 8369...
8265
    }
8369
    }
8266
 
8370
 
8267
#.. Scan the expression
8371
#.. Scan the expression
8268
#
8372
#
8269
    $scmplatform = uc( $ScmPlatform );          # current platform
8373
    $scmplatform = uc( $ScmPlatform );          # current platform
8270
 
8374
    my @add;
-
 
8375
    my @remove;
8271
    foreach ( @plist )
8376
    foreach ( @plist ) {
8272
    {
-
 
8273
        $platform = uc( Trim( $_ ) );           # trim white and convert case
8377
        my $platform = uc( Trim( $_ ) );           # trim white and convert case
-
 
8378
        my $pname = $platform;
-
 
8379
        my $invert = 0;
-
 
8380
        if (substr($platform, 0, 1) eq '!') {
-
 
8381
            $invert = 1;
-
 
8382
            $pname = substr($platform, 1)
-
 
8383
        }
8274
 
8384
 
8275
        #
8385
        #
8276
        #   Determine filter comparison
8386
        #   Determine filter comparison
8277
        #   Either a Platform or a Target
8387
        #       Either a Platform or a Target
8278
        #
8388
        #
8279
        if ( $arguments{$platform}{'Target'} )
8389
        if ( $arguments{$platform}{'Target'} ) {
8280
        {
-
 
8281
            $filter = uc( $ScmTarget );
-
 
8282
        }
-
 
8283
        else
-
 
8284
        {
-
 
8285
            $filter = $scmplatform;             # filter specification
8390
            $pname = $scmplatform if ($pname eq  uc( $ScmTarget ));
8286
        }
8391
        }
8287
 
8392
 
-
 
8393
        #
-
 
8394
        #   Catch some historically bad practices
-
 
8395
        #
-
 
8396
        $pname = $scmplatform if ( $pname eq '*'  || $pname eq '1' ); 
-
 
8397
 
8288
        Debug3( "   Platform=$platform, Filter=$filter" );
8398
        Debug3( "   Platform=$platform, PName=$pname" );
8289
 
8399
 
8290
        #
8400
        #
8291
        #   Examine platform names
8401
        #   Examine platform names
8292
        #   Allow negation of name (!), but all the names must be negated
8402
        #   Allow negation (removal) of the name
8293
        #   as a mix does not make sense.
-
 
8294
        #   ie:     !P1,!P2,!P3     - All except P1,P2 or P3
-
 
8295
        #            P1,P2,P2       - Only P1,P2,P3
-
 
8296
        #
8403
        #
8297
        my $invert = 0;
-
 
8298
        if ( substr($platform, 0, 1) eq '!' )
8404
        if ( substr($platform, 0, 1) eq '!' )  {
8299
        {
-
 
8300
            $count_invert++;
8405
            push @remove, $pname; 
8301
            $platform = substr($platform, 1);
-
 
8302
        }
-
 
8303
        else
8406
        } else {
8304
        {
-
 
8305
            $count_vert++;
8407
            push @add, $pname; 
8306
        }
8408
        }
8307
 
-
 
8308
        $match_count++ if ( $platform eq ''  ||
-
 
8309
                            $platform eq '*' ||
-
 
8310
                            $platform eq '1' ||
-
 
8311
                            $platform eq $filter );
-
 
8312
    }
8409
    }
8313
 
8410
 
8314
    #
8411
    #
8315
    #   Sanity test
8412
    #   Build complete list of allowed platforms
8316
    #   Force failure on bad sanity
8413
    #       Process additive rules before removal rules
-
 
8414
    #       If there are no additive rules, then assume all protaforms
8317
    #
8415
    #
-
 
8416
    my %calcList;
8318
    if ( $count_vert && $count_invert )
8417
    @add = @::BUILDPLATFORMS unless @add;
8319
    {
8418
    $calcList{$_} = 1 foreach (@add);
8320
        Warning( "Platform expression makes no sense. Mixed use of '!' operator",
8419
    delete $calcList{$_} foreach (@remove);
8321
                 "Expression: @_" );
8420
#DebugDumpData("Add", \@add);
8322
        return 0;
8421
#DebugDumpData("Remove", \@remove);
8323
    }
8422
#DebugDumpData("calcList", \%calcList);
8324
 
8423
 
8325
    #
8424
    #
8326
    #   Test for pass
-
 
8327
    #   If not using '!', then any match passes : P1 or P2 or P3
-
 
8328
    #   If are using '!', then any match is bad : !P1 and !P2 and !P3 == !(P1 or P2 or P3)
8425
    #   If the current build target is left in the platform list, then we are building for it
8329
    #
8426
    #   
8330
    if ( ( $count_vert && $match_count ) || ( $count_invert && ( not $match_count) )   )
8427
    if (exists $calcList{$ScmPlatform}) {
8331
    {
-
 
8332
        Debug3( " ActivePlatform(@_ == $ScmPlatform) = TRUE" );
8428
        Debug3( " ActivePlatform(@_ == $ScmPlatform) = TRUE" );
8333
        return 1;
8429
        return 1;
8334
    }
8430
    }
8335
 
8431
 
8336
    Debug3( " ActivePlatform(@_ == $ScmPlatform) = FALSE" );
8432
    Debug3( " ActivePlatform(@_ == $ScmPlatform) = FALSE" );
Line 8545... Line 8641...
8545
    }
8641
    }
8546
    
8642
    
8547
    #
8643
    #
8548
    #   Now start to create the makefile
8644
    #   Now start to create the makefile
8549
    #
8645
    #
8550
    ::ToolsetFile ($Makefile);
8646
    ToolsetFiles::AddFile($Makefile);
8551
    open( MAKEFILE, '>', $Makefile ) || Error( "Cannot create $Makefile" );
8647
    open( MAKEFILE, '>', $Makefile ) || Error( "Cannot create $Makefile" );
8552
    ::MakefileHeader( *MAKEFILE,
8648
    ::MakefileHeader( *MAKEFILE,
8553
                      'Auto-generated Platform Dependent Makefile',
8649
                      'Auto-generated Platform Dependent Makefile',
8554
                      "$ScmMakelib (version $ScmVersion)",
8650
                      "$ScmMakelib (version $ScmVersion)",
8555
                      "# Copyright (c) VIX TECHNOLOGY (AUST) LTD",
8651
                      "# Copyright (c) VIX TECHNOLOGY (AUST) LTD",
Line 9757... Line 9853...
9757
#   NODEPEND is used to disable, at make-time, the dependency generation
9853
#   NODEPEND is used to disable, at make-time, the dependency generation
9758
#   and inclusion process.
9854
#   and inclusion process.
9759
#
9855
#
9760
#
9856
#
9761
MakeHeader ("Depend");
9857
MakeHeader ("Depend");
9762
if ($::o && (@CSRCS || @CXXSRCS))
9858
if ($::o && (@CSRCS || @CXXSRCS) && $ScmNotGeneric)
9763
{
9859
{
9764
    $ScmDependTags = 1;
9860
    $ScmDependTags = 1;
9765
    print MAKEFILE <<EOF;
9861
    print MAKEFILE <<EOF;
9766
depend:			\$(OBJDIR)/depend
9862
depend:			\$(OBJDIR)/depend
9767
 
9863