Subversion Repositories DevTools

Rev

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

Rev 7303 Rev 7304
Line 651... Line 651...
651
#                   the othe based on the MOS68 toolset.
651
#                   the othe based on the MOS68 toolset.
652
#
652
#
653
# Inputs          : $product[,opts]+    The name of the product
653
# Inputs          : $product[,opts]+    The name of the product
654
#                                       This will be the base name for the family
654
#                                       This will be the base name for the family
655
#                                       Allowed options are:
655
#                                       Allowed options are:
656
#                                           --NotDefault    : This is not a default build platform
656
#                                           --NotDefault       : This is not a default build platform
657
#                                           --Uses=xxx      : All use another platform
657
#                                           --Uses=x1,x2:x3    : All use another platform
658
#                                           --Alias=yyy     : All alias to this name
658
#                                           --Alias=y1,y2:x3   : All alias to this name
659
#
659
#
660
#                   platforms           One or more root platforms, with options
660
#                   platforms           One or more root platforms, with options
661
#                                       The platform is macro expanded.
661
#                                       The platform is macro expanded.
662
#                                       Options may be a part of the platform or
662
#                                       Options may be a part of the platform or
663
#                                       distinct.
663
#                                       distinct.
Line 667... Line 667...
667
 
667
 
668
sub BuildProduct
668
sub BuildProduct
669
{
669
{
670
    my( $product, @arguments ) = @_;
670
    my( $product, @arguments ) = @_;
671
    my $notdefault = 0;
671
    my $notdefault = 0;
672
    my @uses = ();
-
 
673
    my @alias = ();
672
    my @commonArgs = ();
674
 
673
 
675
    Debug( "BuildProduct($product, @arguments)" );
674
    Debug( "BuildProduct($product, @arguments)" );
676
    Error( "BuildProduct must appear before BuildName()..." )
675
    Error( "BuildProduct must appear before BuildName()..." )
677
        if ( $BUILDNAME ne "" );
676
        if ( $BUILDNAME ne "" );
678
 
677
 
Line 684... Line 683...
684
    foreach ( @attrs ) {
683
    foreach ( @attrs ) {
685
        if ( /^--/ ) {
684
        if ( /^--/ ) {
686
            if ( /^--NotDefault$/ ) {
685
            if ( /^--NotDefault$/ ) {
687
                $notdefault++;
686
                $notdefault++;
688
 
687
 
689
            } elsif ( /^--Uses=(.*)/ ) {
688
            } elsif ( /^(--Uses=.*)/ ) {
690
                UniquePush (\@uses, $1);
689
                UniquePush (\@commonArgs, $1 );
691
 
690
 
692
            } elsif ( /^(--Alias=.*)/ ) {
691
            } elsif ( /^(--Alias=.*)/ ) {
693
                UniquePush (\@alias, $1);
692
                UniquePush (\@commonArgs, $1 );
694
 
693
 
695
            } else {
694
            } else {
696
                Warning( "BuildProduct() unknown attribute: $_ -- ignored" );
695
                Warning( "BuildProduct() unknown attribute: $_ -- ignored" );
697
            }
696
            }
698
 
697
 
Line 721... Line 720...
721
    #
720
    #
722
    #   Expand the user specified targets to allow the use of BuildAlias
721
    #   Expand the user specified targets to allow the use of BuildAlias
723
    #   The (bad) side effect of this is that target options get reorganised
722
    #   The (bad) side effect of this is that target options get reorganised
724
    #       PLATFORM,--Uses=ANOTHER  ==> PLATFORM --Uses=ANOTHER
723
    #       PLATFORM,--Uses=ANOTHER  ==> PLATFORM --Uses=ANOTHER
725
    #
724
    #
726
    #   Insert markers(++) into @aruments to mark when to process collected data
725
    #   Insert markers(++) into @arguments to mark when to process collected data
727
    #   Insert before each PLATFORM and at the end of the list
726
    #   Insert before each PLATFORM and at the end of the list
728
    #   platform specifier or the end of the list. Scan the arguments
727
    #   platform specifier or the end of the list. Scan the arguments
729
    #
728
    #
730
    @arguments = ExpandPlatforms( @arguments );
729
    @arguments = ExpandPlatforms( @arguments );
731
    my @new_args;
730
    my @new_args;
Line 735... Line 734...
735
        push (@new_args, $_ );
734
        push (@new_args, $_ );
736
    }
735
    }
737
    push (@new_args, '++');
736
    push (@new_args, '++');
738
    shift @new_args if $new_args[0] eq '++';
737
    shift @new_args if $new_args[0] eq '++';
739
 
738
 
740
    my @targs = @alias;
739
    my @targs = @commonArgs;
741
    my $target;
740
    my $target;
742
    my @tuses = @uses;
-
 
743
    foreach my $arg ( @new_args )
741
    foreach my $arg ( @new_args )
744
    {
742
    {
745
        #
743
        #
746
        #   Collect per-platform arguments
744
        #   Collect per-platform arguments
747
        #
745
        #
748
        if ( $arg =~ /^--Uses=(.*)/ ) {
-
 
749
            UniquePush (\@tuses, $1);
-
 
750
            next;
-
 
751
 
-
 
752
        } elsif ( $arg =~ /^--/ ) {
746
        if ( $arg =~ /^--/ ) {
753
            push @targs, $arg;
747
            push @targs, $arg;
754
            next;
748
            next;
755
        }
749
        }
756
 
750
 
757
        #
751
        #
Line 768... Line 762...
768
        #
762
        #
769
        #   Infer a BuildPlatform
763
        #   Infer a BuildPlatform
770
        #   Do not provide a platform name. This will be created later when the
764
        #   Do not provide a platform name. This will be created later when the
771
        #   full name is known - or can be calculated.
765
        #   full name is known - or can be calculated.
772
        #
766
        #
773
        CreateBuildPlatformEntry('BuildProduct', $notdefault, $product, $target, \@tuses, \@targs );
767
        CreateBuildPlatformEntry('BuildProduct', $notdefault, $product, $target, \@targs );
774
 
768
 
775
        @targs = @alias;
769
        @targs = @commonArgs;
776
        @tuses = @uses;
-
 
777
        $target = undef;
770
        $target = undef;
778
    }
771
    }
779
}
772
}
780
 
773
 
781
#-------------------------------------------------------------------------------
774
#-------------------------------------------------------------------------------
Line 787... Line 780...
787
# Inputs          : $fname                  - Name of invoking directive
780
# Inputs          : $fname                  - Name of invoking directive
788
#                   $notdefault             - True if the platform is not to be added to the
781
#                   $notdefault             - True if the platform is not to be added to the
789
#                                             list of default platforms
782
#                                             list of default platforms
790
#                   $product                - Optional product name
783
#                   $product                - Optional product name
791
#                   $target                 - Target platform name
784
#                   $target                 - Target platform name
792
#                   $pUses                  - Ref to an array of 'Uses'
-
 
793
#                   $pArgs                  - Ref to an array of platform arguments
785
#                   $pArgs                  - Ref to an array of platform arguments
-
 
786
#                                             Known: --Uses=aaa,bbb and --Alias=xxx,yyy
794
#
787
#
795
# Returns         :
788
# Returns         :
796
#
789
#
797
 
790
 
798
sub CreateBuildPlatformEntry
791
sub CreateBuildPlatformEntry
799
{
792
{
800
    my ($fname, $notdefault, $product, $target, $pUses, $pArgs ) = @_;
793
    my ($fname, $notdefault, $product, $target, $pArgs ) = @_;
801
    my %buildentry;
794
    my %buildentry;
802
    my $platform;
795
    my $platform;
803
 
796
 
804
    #
797
    #
805
    #   Create a basic BUILDINFO entry
798
    #   Create a basic BUILDINFO entry
Line 807... Line 800...
807
    $buildentry{FNAME} = $fname;
800
    $buildentry{FNAME} = $fname;
808
    $buildentry{NOT_DEFAULT} = $notdefault;
801
    $buildentry{NOT_DEFAULT} = $notdefault;
809
    $buildentry{PRODUCT} = $product;
802
    $buildentry{PRODUCT} = $product;
810
    $buildentry{TARGET} = $target;
803
    $buildentry{TARGET} = $target;
811
    $buildentry{BASE} = $target;
804
    $buildentry{BASE} = $target;
812
    $buildentry{USES} = [ @$pUses ] if $pUses;
-
 
813
    foreach ( @$pArgs )
805
    foreach ( @$pArgs )
814
    {
806
    {
815
        if ( m~^--Alias=(.+)~ ) {
807
        if ( m~^--Alias=(.+)~ ) {
816
            foreach my $alias (split(',',$1))
808
            foreach my $alias (split('[:,]',$1))
817
            {
809
            {
818
                Error ("$fname() attempt to alias a keyword: $alias")
810
                Error ("$fname() attempt to alias a keyword: $alias")
819
                    if ( isKeyword($alias) );
811
                    if ( isKeyword($alias) );
820
                push @{$buildentry{USERALIAS}},$alias;
812
                push @{$buildentry{USERALIAS}},$alias;
821
            }
813
            }
-
 
814
        } elsif ( m~^--Uses=(.+)~ ) {
-
 
815
            push @{$buildentry{USES}},split('[:,]',$1);
-
 
816
 
822
        } else {
817
        } else {
823
            push @{$buildentry{ARGS}}, $_;
818
            push @{$buildentry{ARGS}}, $_;
824
        }
819
        }
825
    }
820
    }
826
 
821
 
Line 1223... Line 1218...
1223
    shift @new_args if $new_args[0] eq '++';
1218
    shift @new_args if $new_args[0] eq '++';
1224
 
1219
 
1225
 
1220
 
1226
    my $platform  = "";                         # current platform
1221
    my $platform  = "";                         # current platform
1227
    my $notdefault  = 0;
1222
    my $notdefault  = 0;
1228
    my @uses = ();
-
 
1229
    my @pargs = ();
1223
    my @pargs = ();
1230
 
1224
 
1231
    foreach my $arg ( @new_args )
1225
    foreach my $arg ( @new_args )
1232
    {
1226
    {
1233
        #
1227
        #
Line 1236... Line 1230...
1236
        #
1230
        #
1237
        if ( $arg =~ /^--/ ) {
1231
        if ( $arg =~ /^--/ ) {
1238
            if ( $arg =~ /^--NotDefault$/ ) {
1232
            if ( $arg =~ /^--NotDefault$/ ) {
1239
                $notdefault = 1;
1233
                $notdefault = 1;
1240
 
1234
 
1241
            } elsif ( $arg =~/^--Uses=(.*)/ ) {
-
 
1242
                UniquePush (\@uses, $1);
-
 
1243
 
-
 
1244
            } elsif ( $arg =~/^--FunctionName=(.*)/ ) {
1235
            } elsif ( $arg =~/^--FunctionName=(.*)/ ) {
1245
                $fname = $1;
1236
                $fname = $1;
1246
                
1237
                
1247
            } else {
1238
            } else {
1248
                push @pargs, $arg;
1239
                push @pargs, $arg;
Line 1268... Line 1259...
1268
 
1259
 
1269
        #
1260
        #
1270
        #   Create new platform
1261
        #   Create new platform
1271
        #   Have collected name and arguments
1262
        #   Have collected name and arguments
1272
        #
1263
        #
1273
        CreateBuildPlatformEntry($fname, $notdefault, undef, $platform, \@uses, \@pargs  );
1264
        CreateBuildPlatformEntry($fname, $notdefault, undef, $platform, \@pargs  );
1274
 
1265
 
1275
        #
1266
        #
1276
        #   Reset collection variables for next platform
1267
        #   Reset collection variables for next platform
1277
        #
1268
        #
1278
        $platform = "";
1269
        $platform = "";
1279
        $notdefault  = 0;
1270
        $notdefault  = 0;
1280
        @uses = ();
-
 
1281
        @pargs = ();
1271
        @pargs = ();
1282
    }
1272
    }
1283
}
1273
}
1284
 
1274
 
1285
 
1275