Subversion Repositories DevTools

Rev

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

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