Subversion Repositories DevTools

Rev

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

Rev 283 Rev 285
Line 759... Line 759...
759
 
759
 
760
    $script = Exists( "PLATFORM", $script,      # locate image
760
    $script = Exists( "PLATFORM", $script,      # locate image
761
                "PlatformDefines", @ScmPlatformDirs );
761
                "PlatformDefines", @ScmPlatformDirs );
762
 
762
 
763
    push( @DEFINES, "# PlatformDefines from: $script" );
763
    push( @DEFINES, "# PlatformDefines from: $script" );
764
    open( SCRIPT, $script ) || Error( "Opening $script" );
764
    open( my $fh, '<', $script ) || Error( "Opening $script" );
765
    while (<SCRIPT>) {
765
    while (<$fh>) {
766
        $_ =~ s/\s*(\n|$)//;                    # kill trailing whitespace & nl
766
        $_ =~ s/\s*(\n|$)//;                    # kill trailing whitespace & nl
767
        push( @DEFINES, $_ );
767
        push( @DEFINES, $_ );
768
    }
768
    }
769
    push( @ScmDepends, "$script" );             # makefile dependencies
769
    push( @ScmDepends, "$script" );             # makefile dependencies
770
    close( SCRIPT );
770
    close( $fh );
771
}
771
}
772
 
772
 
773
 
773
 
774
sub PlatformEntry
774
sub PlatformEntry
775
{
775
{
776
    my( $prelim, $postlim, $prefix, $postfix, @elements ) = @_;
776
    my( $prelim, $postlim, $prefix, $postfix, @elements ) = @_;
777
    my( $str, $element );
-
 
778
 
777
 
779
    $str = "$prelim";
778
    my $str = "$prelim";
780
    foreach $element ( @elements )
779
    foreach my $element ( @elements )
781
    {
780
    {
782
        $str .= "${prefix}${element}${postfix}";
781
        $str .= "${prefix}${element}${postfix}";
783
    }
782
    }
784
    $str .= "$postlim";
783
    $str .= "$postlim";
785
    PlatformDefine( $str );
784
    PlatformDefine( $str );
Line 955... Line 954...
955
 
954
 
956
    Debug2( "ToolsetRules(@_)" );
955
    Debug2( "ToolsetRules(@_)" );
957
 
956
 
958
    $script = Exists( "$::GBE_CONFIG/TOOLSET", $script, "ToolsetRules" );
957
    $script = Exists( "$::GBE_CONFIG/TOOLSET", $script, "ToolsetRules" );
959
    push( @TOOLSETRULES, "# ToolsetRules from: $script" );
958
    push( @TOOLSETRULES, "# ToolsetRules from: $script" );
960
    open( SCRIPT, $script ) || Error( "Opening $script" );
959
    open( my $fh, '<', $script ) || Error( "Opening $script" );
961
    while (<SCRIPT>) {
960
    while (<$fh>) {
962
        $_ =~ s/\s*(\n|$)//;                    # kill trailing whitespace & newline
961
        $_ =~ s/\s*(\n|$)//;                    # kill trailing whitespace & newline
963
        push( @TOOLSETRULES, $_ );
962
        push( @TOOLSETRULES, $_ );
964
    }
963
    }
965
    push( @ScmDepends, "$script" );             # makefile dependencies
964
    push( @ScmDepends, "$script" );             # makefile dependencies
966
    close( SCRIPT );
965
    close( $fh );
967
}
966
}
968
 
967
 
969
 
968
 
970
###############################################################################
969
###############################################################################
971
# User interface:
970
# User interface:
Line 1628... Line 1627...
1628
 
1627
 
1629
 
1628
 
1630
sub AddProg
1629
sub AddProg
1631
{
1630
{
1632
    my( $platforms, @progs ) = @_;
1631
    my( $platforms, @progs ) = @_;
1633
    my( $prog, $temp );
-
 
1634
 
1632
 
1635
    Debug2( "AddProg($platforms, @progs)" );
1633
    Debug2( "AddProg($platforms, @progs)" );
1636
 
1634
 
1637
    return if ( ! ActivePlatform($platforms) );
1635
    return if ( ! ActivePlatform($platforms) );
1638
 
1636
 
1639
    foreach $prog (@progs)
1637
    foreach my $prog (@progs)
1640
    {
1638
    {
1641
        Warning( "Duplicate prog ignored '$prog'" )
1639
        Warning( "Duplicate prog ignored '$prog'" )
1642
            unless ( UniquePush(\@PROGS, $prog) );
1640
            unless ( UniquePush(\@PROGS, $prog) );
1643
        $PROGS{$prog} = 1;
1641
        $PROGS{$prog} = 1;
1644
    }
1642
    }
Line 1666... Line 1664...
1666
 
1664
 
1667
 
1665
 
1668
sub AddSourceFile
1666
sub AddSourceFile
1669
{
1667
{
1670
    my( $platforms, @elements ) = @_;
1668
    my( $platforms, @elements ) = @_;
1671
    my( $path );
-
 
1672
 
1669
 
1673
    Debug2( "AddSourceFile($platforms, @elements)" );
1670
    Debug2( "AddSourceFile($platforms, @elements)" );
1674
    return if ( ! ActivePlatform($platforms) );
1671
    return if ( ! ActivePlatform($platforms) );
1675
 
1672
 
1676
    foreach $path ( @elements )
1673
    foreach my $path ( @elements )
1677
    {
1674
    {
1678
        __AddSourceFile( 1, $path );
1675
        __AddSourceFile( 1, $path );
1679
    }
1676
    }
1680
}
1677
}
1681
 
1678
 
Line 2314... Line 2311...
2314
        #
2311
        #
2315
        #   If the file was a known source file, then it may need to be generated
2312
        #   If the file was a known source file, then it may need to be generated
2316
        #   very early in the build process.
2313
        #   very early in the build process.
2317
        #
2314
        #
2318
        my $src_file_type = __AddSourceFile( 1, $basename );
2315
        my $src_file_type = __AddSourceFile( 1, $basename );
2319
        if ($generated eq 1 || $src_file_type && $generated > 1)
2316
        if ($generated == 1 || ($src_file_type && $generated > 1) )
2320
        {
2317
        {
2321
            push(@GENERATED, $source);
2318
            push(@GENERATED, $source);
2322
        }
2319
        }
2323
        else
2320
        else
2324
        {
2321
        {
Line 2840... Line 2837...
2840
                                \((.*?)\)   |   # Stuff like (yyyyy)    $3
2837
                                \((.*?)\)   |   # Stuff like (yyyyy)    $3
2841
                                {(.*?)}     |   # or    like {yyyyy}    $4
2838
                                {(.*?)}     |   # or    like {yyyyy}    $4
2842
                                \[(.*?)\]       # or    like [yyyyy]    $5
2839
                                \[(.*?)\]       # or    like [yyyyy]    $5
2843
                                )/x )           # Allow comments and whitespace
2840
                                )/x )           # Allow comments and whitespace
2844
        {
2841
        {
2845
            my $all = $&;
-
 
2846
            my $cmd = $1;                       # The command
2842
            my $cmd = $1;                       # The command
2847
            my $ufn = $3 || $4 || $5;           # User filename + options
2843
            my $ufn = $3 || $4 || $5;           # User filename + options
2848
            my $mb = $-[0];                     # Match begin offset
2844
            my $mb = $-[0];                     # Match begin offset
2849
            my $me = $+[0];                     # Match end
2845
            my $me = $+[0];                     # Match end
2850
            my $flags = '';                     # Optional flags ( --dir or --file )
2846
            my $flags = '';                     # Optional flags ( --dir or --file )
2851
            my $raw_arg = $ufn;                 # Raw arguments
2847
            my $raw_arg = $ufn;                 # Raw arguments
-
 
2848
            my $all = substr( $arg, $mb, $me ); # All of match. Avoid use of $&
-
 
2849
            
2852
 
2850
 
2853
            Error ("GenerateFiles. Empty element not allowed: $all")
2851
            Error ("GenerateFiles. Empty element not allowed: $all")
2854
                unless ( defined($ufn) );
2852
                unless ( defined($ufn) );
2855
 
2853
 
2856
            $ufn =~ s/\s+$//;
2854
            $ufn =~ s/\s+$//;
Line 3113... Line 3111...
3113
{
3111
{
3114
    my ( $platforms, $driver_name, @args) = @_;
3112
    my ( $platforms, $driver_name, @args) = @_;
3115
 
3113
 
3116
    return if ( ! ActivePlatform($platforms) );
3114
    return if ( ! ActivePlatform($platforms) );
3117
 
3115
 
3118
    Error ("No driver name specified"), unless ( $driver_name );
3116
    Error ("No driver name specified") unless ( $driver_name );
3119
    Debug2( "MakeLinuxDriver:($platforms, $driver_name ,@args)" );
3117
    Debug2( "MakeLinuxDriver:($platforms, $driver_name ,@args)" );
3120
    my @srcs;
3118
    my @srcs;
3121
    my @opts;
3119
    my @opts;
3122
 
3120
 
3123
    #
3121
    #
Line 3285... Line 3283...
3285
    {
3283
    {
3286
        next unless ( $entry->{'NAME'} eq $name );
3284
        next unless ( $entry->{'NAME'} eq $name );
3287
        next if ( $ext && $entry->{'DPROJ'} ne $ext );
3285
        next if ( $ext && $entry->{'DPROJ'} ne $ext );
3288
        return $entry;
3286
        return $entry;
3289
    }
3287
    }
3290
    return undef;
3288
    return;
3291
}
3289
}
3292
 
3290
 
3293
#-------------------------------------------------------------------------------
3291
#-------------------------------------------------------------------------------
3294
# Function        : ExpandGenVar
3292
# Function        : ExpandGenVar
3295
#
3293
#
Line 3305... Line 3303...
3305
#                                       --tag
3303
#                                       --tag
3306
#                                       --notag
3304
#                                       --notag
3307
#                                       --tag=<SomeTag>
3305
#                                       --tag=<SomeTag>
3308
#                                       --absdrive
3306
#                                       --absdrive
3309
#                                       --abspath
3307
#                                       --abspath
-
 
3308
#                                       --default=text
3310
#                                   Not all options are avalaible on all variables
3309
#                                   Not all options are avalaible on all variables
3311
#                   @opts           - Options
3310
#                   @opts           - Options
3312
#                                       --notag     - Default is --notag
3311
#                                       --notag     - Default is --notag
3313
#
3312
#
3314
# Returns         : String
3313
# Returns         : String
Line 3370... Line 3369...
3370
    my ($dname, $args, @uopts) = @_;
3369
    my ($dname, $args, @uopts) = @_;
3371
    my $expansion;
3370
    my $expansion;
3372
    my $prefix='';
3371
    my $prefix='';
3373
    my ($tag, @opts) = split('\s*,\s*', $args);
3372
    my ($tag, @opts) = split('\s*,\s*', $args);
3374
    my $no_prefix;
3373
    my $no_prefix;
-
 
3374
    my $default_value;
-
 
3375
    my $allow_none;
3375
 
3376
 
-
 
3377
    #
-
 
3378
    #   Parse options lists
-
 
3379
    #       Options provided by the caller
-
 
3380
    #       Options embedded in the argument
3376
    foreach ( @uopts )
3381
    foreach ( @uopts )
3377
    {
3382
    {
3378
        if ( m/^--notag$/ ) {
3383
        if ( m/^--notag$/ ) {
3379
            $no_prefix = 1;
3384
            $no_prefix = 1;
3380
        } else{
3385
        } else{
3381
            Error ("$dname: Unknown option: $_")
3386
            Error ("$dname: Unknown option: $_")
3382
        }
3387
        }
3383
    }
3388
    }
3384
 
3389
 
-
 
3390
    foreach ( @opts )
-
 
3391
    {
-
 
3392
        if ( m/^--default=(.+)/i ) {
-
 
3393
            $default_value = $1;
-
 
3394
        } elsif ( m/^--allownone$/i ) {
-
 
3395
            $allow_none = 1;
-
 
3396
        }
-
 
3397
    }
3385
 
3398
    
3386
    #
3399
    #
3387
    #   Perform run-time update on the %ExpandGenVarConvert
3400
    #   Perform run-time update on the %ExpandGenVarConvert
3388
    #   Most of it can be initialised at startup - but not all of it.
3401
    #   Most of it can be initialised at startup - but not all of it.
3389
    #
3402
    #
3390
    $ExpandGenVarConvert{CompilerPath} = undef unless $::ScmToolsetCompilerPath;
3403
    $ExpandGenVarConvert{CompilerPath} = undef unless $::ScmToolsetCompilerPath;
Line 3395... Line 3408...
3395
    #   Could allow for a code ref, but not needed yet
3408
    #   Could allow for a code ref, but not needed yet
3396
    #
3409
    #
3397
    Error ("$dname: Unknown expansion --Var($tag)")
3410
    Error ("$dname: Unknown expansion --Var($tag)")
3398
        unless ( exists $ExpandGenVarConvert{$tag} );
3411
        unless ( exists $ExpandGenVarConvert{$tag} );
3399
 
3412
 
-
 
3413
    #
-
 
3414
    #   Handle undefined expansions
-
 
3415
    #   Only 'CompilerPath', but it can be a pain in user land
-
 
3416
    #
-
 
3417
    $expansion = $ExpandGenVarConvert{$tag};
-
 
3418
    unless ( defined $expansion  )
-
 
3419
    {
-
 
3420
        return '' if ( $allow_none );
-
 
3421
        $expansion = $default_value;
3400
    Error ("$dname: Expansion --Var($tag) not be supported by toolset: $ScmToolset")
3422
        Error ("$dname: Expansion --Var($tag) not be supported by toolset: $ScmToolset")
3401
        unless ($expansion = $ExpandGenVarConvert{$tag});
3423
            unless ( $expansion );
-
 
3424
    }
-
 
3425
 
3402
 
3426
 
3403
    ($expansion,my $is_path) = split (',', $expansion );
3427
    ($expansion,my $is_path) = split (',', $expansion );
3404
 
3428
 
3405
    #
3429
    #
3406
    #   Process options
3430
    #   Process options
Line 3419... Line 3443...
3419
            $prefix = '';
3443
            $prefix = '';
3420
 
3444
 
3421
        } elsif ( $is_path && $opt =~ /--abspath|--absdrive/i ) {
3445
        } elsif ( $is_path && $opt =~ /--abspath|--absdrive/i ) {
3422
            $expansion = '$(CURDIR)/' . $expansion;
3446
            $expansion = '$(CURDIR)/' . $expansion;
3423
 
3447
 
-
 
3448
        } elsif ( $opt =~ m/^--default=(.+)/i ) {
-
 
3449
            # Already processed
-
 
3450
        } elsif ( $opt =~ m/^--allownone$/i ) {
-
 
3451
            # Already processed
3424
        } else {
3452
        } else {
3425
            Error ("$dname: Unsupported option($opt) for --Var(@_)");
3453
            Error ("$dname: Unsupported option($opt) for --Var(@_)");
3426
        }
3454
        }
3427
    }
3455
    }
3428
 
3456
 
Line 3607... Line 3635...
3607
 
3635
 
3608
    Debug2( "Defines($path, $script)" );
3636
    Debug2( "Defines($path, $script)" );
3609
 
3637
 
3610
    $script = Exists( $path, $script, "Defines" );
3638
    $script = Exists( $path, $script, "Defines" );
3611
    push( @DEFINES, "# Defines from: $script" );
3639
    push( @DEFINES, "# Defines from: $script" );
3612
    open( SCRIPT, $script ) || Error( "Opening $script" );
3640
    open( my $fh, '<', $script ) || Error( "Opening $script" );
3613
    while (<SCRIPT>) {
3641
    while (<$fh>) {
3614
        $_ =~ s/\s*(\n|$)//;                    # kill trailing whitespace & nl
3642
        $_ =~ s/\s*(\n|$)//;                    # kill trailing whitespace & nl
3615
        push( @DEFINES, $_ );
3643
        push( @DEFINES, $_ );
3616
    }
3644
    }
3617
    push( @ScmDepends, "$script" );             # makefile dependencies
3645
    push( @ScmDepends, "$script" );             # makefile dependencies
3618
    close( SCRIPT );
3646
    close( $fh );
3619
}
3647
}
3620
#-------------------------------------------------------------------------------
3648
#-------------------------------------------------------------------------------
3621
# Function        : Rule
3649
# Function        : Rule
3622
#
3650
#
3623
# Description     : Add a Rule and Recipe to the generated makefile
3651
# Description     : Add a Rule and Recipe to the generated makefile
Line 3659... Line 3687...
3659
    my( $path, $script ) = @_;
3687
    my( $path, $script ) = @_;
3660
    my( $line );
3688
    my( $line );
3661
 
3689
 
3662
    $script = Exists( $path, $script, "Rules" );
3690
    $script = Exists( $path, $script, "Rules" );
3663
    push( @RULES, "# Rules from: $script" );
3691
    push( @RULES, "# Rules from: $script" );
3664
    open( SCRIPT, $script ) || Error( "Opening $script" );
3692
    open( my $fh, '<', $script ) || Error( "Opening $script" );
3665
    while (<SCRIPT>) {
3693
    while (<$fh>) {
3666
        $_ =~ s/\s*(\n|$)//;                    # kill trailing whitespace & nl
3694
        $_ =~ s/\s*(\n|$)//;                    # kill trailing whitespace & nl
3667
        push( @RULES, $_ );
3695
        push( @RULES, $_ );
3668
    }
3696
    }
3669
    push( @ScmDepends, "$script" );             # makefile dependencies
3697
    push( @ScmDepends, "$script" );             # makefile dependencies
3670
    close( SCRIPT );
3698
    close( $fh );
3671
}
3699
}
3672
 
3700
 
3673
#-------------------------------------------------------------------------------
3701
#-------------------------------------------------------------------------------
3674
# Function        : AddRule
3702
# Function        : AddRule
3675
#
3703
#
Line 4538... Line 4566...
4538
                                \((.*?)\)   |   # Stuff like (yyyyy)    $3
4566
                                \((.*?)\)   |   # Stuff like (yyyyy)    $3
4539
                                {(.*?)}     |   # or    like {yyyyy}    $4
4567
                                {(.*?)}     |   # or    like {yyyyy}    $4
4540
                                \[(.*?)\]       # or    like [yyyyy]    $5
4568
                                \[(.*?)\]       # or    like [yyyyy]    $5
4541
                                )/x )           # Allow comments and whitespace
4569
                                )/x )           # Allow comments and whitespace
4542
        {
4570
        {
4543
            my $all = $&;
-
 
4544
            my $cmd = $1;                       # The command
4571
            my $cmd = $1;                       # The command
4545
            my $ufn = $3 || $4 || $5;           # User filename + options
4572
            my $ufn = $3 || $4 || $5;           # User filename + options
4546
            my $mb = $-[0];                     # Match begin offset
4573
            my $mb = $-[0];                     # Match begin offset
4547
            my $me = $+[0];                     # Match end
4574
            my $me = $+[0];                     # Match end
4548
            my $flags = '';                     # Optional flags ( --dir or --file )
4575
            my $flags = '';                     # Optional flags ( --dir or --file )
4549
            my $raw_arg = $ufn;                 # Raw arguments
4576
            my $raw_arg = $ufn;                 # Raw arguments
-
 
4577
            my $all = substr( $arg, $mb, $me ); # All of match. Avoid use of $&
4550
 
4578
 
4551
            Error ("RunTest. Empty element not allowed: $all")
4579
            Error ("RunTest. Empty element not allowed: $all")
4552
                unless ( defined($ufn) );
4580
                unless ( defined($ufn) );
4553
 
4581
 
4554
            $ufn =~ s/\s+$//;
4582
            $ufn =~ s/\s+$//;
Line 5449... Line 5477...
5449
#       given the name of the library as the argument, split out major and
5477
#       given the name of the library as the argument, split out major and
5450
#       minor parts and return the basename, i.e name without major and minor
5478
#       minor parts and return the basename, i.e name without major and minor
5451
#       and the pair of major and minor.
5479
#       and the pair of major and minor.
5452
#..
5480
#..
5453
 
5481
 
5454
sub getMajorMinor ($)
5482
sub getMajorMinor
5455
{
5483
{
5456
    my @bits = split ('\.', $_[0]);
5484
    my @bits = split ('\.', $_[0]);
5457
    my $stop;
5485
    my $stop;
5458
    my $major;
5486
    my $major;
5459
    my $minor;
5487
    my $minor;
Line 5503... Line 5531...
5503
#
5531
#
5504
    $base = $PackageInfo{'Hdr'}{'IBase'};       # Base of target
5532
    $base = $PackageInfo{'Hdr'}{'IBase'};       # Base of target
5505
    $dir = $base . $PackageInfo{'Hdr'}{'Dir'};  # Installation path (default)
5533
    $dir = $base . $PackageInfo{'Hdr'}{'Dir'};  # Installation path (default)
5506
    $full = $abs = $strip = 0;
5534
    $full = $abs = $strip = 0;
5507
 
5535
 
5508
    foreach $_ ( @elements )
5536
    foreach ( @elements )
5509
    {
5537
    {
5510
                                                # Standard targets
5538
                                                # Standard targets
5511
        my $rv = __TargetDir(0, $base, $_, \$dir);
5539
        my $rv = __TargetDir(0, $base, $_, \$dir);
5512
        next if ( $rv == 1 );
5540
        next if ( $rv == 1 );
5513
        return if ( $rv == 2 );
5541
        return if ( $rv == 2 );
Line 5530... Line 5558...
5530
        }
5558
        }
5531
    }
5559
    }
5532
 
5560
 
5533
#.. Files
5561
#.. Files
5534
#
5562
#
5535
    foreach $_ ( @elements )
5563
    foreach ( @elements )
5536
    {
5564
    {
5537
        my %package_entry;
5565
        my %package_entry;
5538
        if ( ! /^--(.*)/ )
5566
        if ( ! /^--(.*)/ )
5539
        {
5567
        {
5540
            $name = $_;
5568
            $name = $_;
Line 5596... Line 5624...
5596
#.. Arguments
5624
#.. Arguments
5597
#
5625
#
5598
    $base = $PackageInfo{'Lib'}{'IBase'};       # Base of target
5626
    $base = $PackageInfo{'Lib'}{'IBase'};       # Base of target
5599
    $dir = $base . $PackageInfo{'Lib'}{'Dir'};  # Installation path (default)
5627
    $dir = $base . $PackageInfo{'Lib'}{'Dir'};  # Installation path (default)
5600
 
5628
 
5601
    foreach $_ ( @elements )
5629
    foreach ( @elements )
5602
    {
5630
    {
5603
                                                # Standard targets
5631
                                                # Standard targets
5604
        my $rv = __TargetDir(0, $base, $_, \$dir);
5632
        my $rv = __TargetDir(0, $base, $_, \$dir);
5605
        next if ( $rv == 1 );
5633
        next if ( $rv == 1 );
5606
        return if ( $rv == 2 );
5634
        return if ( $rv == 2 );
Line 5616... Line 5644...
5616
        }
5644
        }
5617
    }
5645
    }
5618
 
5646
 
5619
#.. Files
5647
#.. Files
5620
#
5648
#
5621
    foreach $_ ( @elements )
5649
    foreach ( @elements )
5622
    {
5650
    {
5623
        my %package_entry;
5651
        my %package_entry;
5624
        if ( ! /^--(.*)/ )
5652
        if ( ! /^--(.*)/ )
5625
        {
5653
        {
5626
            $_ = basename ($_)
5654
            $_ = basename ($_)
Line 5709... Line 5737...
5709
#.. Arguments
5737
#.. Arguments
5710
#
5738
#
5711
    $base = $PackageInfo{'Jar'}{'IBase'};       # Base of target
5739
    $base = $PackageInfo{'Jar'}{'IBase'};       # Base of target
5712
    $dir = $base . $PackageInfo{'Jar'}{'Dir'};  # Installation path (default)
5740
    $dir = $base . $PackageInfo{'Jar'}{'Dir'};  # Installation path (default)
5713
 
5741
 
5714
    foreach $_ ( @elements )
5742
    foreach ( @elements )
5715
    {
5743
    {
5716
                                                # Standard targets
5744
                                                # Standard targets
5717
        my $rv = __TargetDir(0, $base, $_, \$dir);
5745
        my $rv = __TargetDir(0, $base, $_, \$dir);
5718
        next if ( $rv == 1 );
5746
        next if ( $rv == 1 );
5719
        return if ( $rv == 2 );
5747
        return if ( $rv == 2 );
Line 5727... Line 5755...
5727
    }
5755
    }
5728
 
5756
 
5729
 
5757
 
5730
#.. Files
5758
#.. Files
5731
#
5759
#
5732
    foreach $_ ( @elements )
5760
    foreach ( @elements )
5733
    {
5761
    {
5734
        my %package_entry;
5762
        my %package_entry;
5735
        if ( ! /^--(.*)/ )
5763
        if ( ! /^--(.*)/ )
5736
        {
5764
        {
5737
            $jar = $_;
5765
            $jar = $_;
Line 5781... Line 5809...
5781
#.. Arguments
5809
#.. Arguments
5782
#
5810
#
5783
    $base = $PackageInfo{'Prog'}{'IBase'};       # Base of target
5811
    $base = $PackageInfo{'Prog'}{'IBase'};       # Base of target
5784
    $dir = $base . $PackageInfo{'Prog'}{'Dir'};  # Installation path (default)
5812
    $dir = $base . $PackageInfo{'Prog'}{'Dir'};  # Installation path (default)
5785
 
5813
 
5786
    foreach $_ ( @elements )
5814
    foreach ( @elements )
5787
    {
5815
    {
5788
                                                # Standard targets
5816
                                                # Standard targets
5789
        my $rv = __TargetDir($T_TYPE, $base, $_, \$dir);
5817
        my $rv = __TargetDir($T_TYPE, $base, $_, \$dir);
5790
        next if ( $rv == 1 );
5818
        next if ( $rv == 1 );
5791
        return if ( $rv == 2 );
5819
        return if ( $rv == 2 );
Line 5798... Line 5826...
5798
        }
5826
        }
5799
    }
5827
    }
5800
 
5828
 
5801
#.. Files
5829
#.. Files
5802
#
5830
#
5803
    foreach $_ ( @elements )
5831
    foreach ( @elements )
5804
    {
5832
    {
5805
        my %package_entry;
5833
        my %package_entry;
5806
        if ( ! /^--(.*)/ )
5834
        if ( ! /^--(.*)/ )
5807
        {
5835
        {
5808
            my $ext = "";
5836
            my $ext = "";
Line 5887... Line 5915...
5887
    $full = $abs = 0;
5915
    $full = $abs = 0;
5888
    $strip = 0;
5916
    $strip = 0;
5889
    $strip_base = 0;
5917
    $strip_base = 0;
5890
    $exefile = 0;
5918
    $exefile = 0;
5891
 
5919
 
5892
    foreach $_ ( @elements )
5920
    foreach ( @elements )
5893
    {
5921
    {
5894
        my $rv = __TargetDir($T_PKG|$T_MACH|$T_GBE|$T_FILE, $base, $_, \$dir, \$type);
5922
        my $rv = __TargetDir($T_PKG|$T_MACH|$T_GBE|$T_FILE, $base, $_, \$dir, \$type);
5895
        next if ( $rv == 1 );
5923
        next if ( $rv == 1 );
5896
        return if ( $rv == 2 );
5924
        return if ( $rv == 2 );
5897
 
5925
 
Line 5952... Line 5980...
5952
        $strip_base = length( $dir_tree ) if ( $strip_base );
5980
        $strip_base = length( $dir_tree ) if ( $strip_base );
5953
    }
5981
    }
5954
 
5982
 
5955
#.. Files
5983
#.. Files
5956
#
5984
#
5957
    foreach $_ ( @elements )
5985
    foreach ( @elements )
5958
    {
5986
    {
5959
        my %package_entry;
5987
        my %package_entry;
5960
        #
5988
        #
5961
        #   Special cases: Provide make-style $ escape processing.
5989
        #   Special cases: Provide make-style $ escape processing.
5962
        #       Allow files with a $ in the name
5990
        #       Allow files with a $ in the name
Line 6066... Line 6094...
6066
    $base = $PackageInfo{'Hdr'}{'PBase'};           # Base of target
6094
    $base = $PackageInfo{'Hdr'}{'PBase'};           # Base of target
6067
    $dir = $base . $PackageInfo{'Hdr'}{'Dir'};      # Installation path (default)
6095
    $dir = $base . $PackageInfo{'Hdr'}{'Dir'};      # Installation path (default)
6068
    $full = $abs = 0;
6096
    $full = $abs = 0;
6069
    $strip = 0;
6097
    $strip = 0;
6070
 
6098
 
6071
    foreach $_ ( @elements )
6099
    foreach ( @elements )
6072
    {
6100
    {
6073
        my $rv = __TargetDir($T_PKG, $base, $_, \$dir);
6101
        my $rv = __TargetDir($T_PKG, $base, $_, \$dir);
6074
        next if ( $rv == 1 );
6102
        next if ( $rv == 1 );
6075
        return if ( $rv == 2 );
6103
        return if ( $rv == 2 );
6076
 
6104
 
Line 6095... Line 6123...
6095
        }
6123
        }
6096
    }
6124
    }
6097
 
6125
 
6098
#.. Files
6126
#.. Files
6099
#
6127
#
6100
    foreach $_ ( @elements )
6128
    foreach ( @elements )
6101
    {
6129
    {
6102
        my %package_entry;
6130
        my %package_entry;
6103
        if ( ! /^--(.*)/ )
6131
        if ( ! /^--(.*)/ )
6104
        {
6132
        {
6105
            $name = $_;
6133
            $name = $_;
Line 6164... Line 6192...
6164
    $dist = "ALL";                              # Default set (ALL)
6192
    $dist = "ALL";                              # Default set (ALL)
6165
    $base = $PackageInfo{'Lib'}{'PBase'};       # Base of target
6193
    $base = $PackageInfo{'Lib'}{'PBase'};       # Base of target
6166
    $dir = $base . $PackageInfo{'Lib'}{'Dir'};  # Installation path (default)
6194
    $dir = $base . $PackageInfo{'Lib'}{'Dir'};  # Installation path (default)
6167
    $type = "";
6195
    $type = "";
6168
 
6196
 
6169
    foreach $_ ( @elements )
6197
    foreach ( @elements )
6170
    {
6198
    {
6171
                                                # Standard targets
6199
                                                # Standard targets
6172
        my $rv = __TargetDir($T_PKG, $base, $_, \$dir, \$type);
6200
        my $rv = __TargetDir($T_PKG, $base, $_, \$dir, \$type);
6173
        next if ( $rv == 1 );
6201
        next if ( $rv == 1 );
6174
        return if ( $rv == 2 );
6202
        return if ( $rv == 2 );
Line 6197... Line 6225...
6197
        }
6225
        }
6198
    }
6226
    }
6199
 
6227
 
6200
#.. Files
6228
#.. Files
6201
#
6229
#
6202
    foreach $_ ( @elements )
6230
    foreach ( @elements )
6203
    {
6231
    {
6204
        my %package_entry;
6232
        my %package_entry;
6205
        if ( ! /^--(.*)/ )
6233
        if ( ! /^--(.*)/ )
6206
        {
6234
        {
6207
            $_ = StripDir( $_ )
6235
            $_ = StripDir( $_ )
Line 6298... Line 6326...
6298
    $dist = "ALL";                              # Default set (ALL)
6326
    $dist = "ALL";                              # Default set (ALL)
6299
    $base = $PackageInfo{'Prog'}{'PBase'};       # Base of target
6327
    $base = $PackageInfo{'Prog'}{'PBase'};       # Base of target
6300
    $dir = $base . $PackageInfo{'Prog'}{'Dir'};  # Installation path (default)
6328
    $dir = $base . $PackageInfo{'Prog'}{'Dir'};  # Installation path (default)
6301
    $type = "";
6329
    $type = "";
6302
 
6330
 
6303
    foreach $_ ( @elements )
6331
    foreach ( @elements )
6304
    {
6332
    {
6305
                                                # Standard targets
6333
                                                # Standard targets
6306
        my $rv = __TargetDir($T_PKG|$T_TYPE, $base, $_, \$dir, \$type);
6334
        my $rv = __TargetDir($T_PKG|$T_TYPE, $base, $_, \$dir, \$type);
6307
        next if ( $rv == 1 );
6335
        next if ( $rv == 1 );
6308
        return if ( $rv == 2 );
6336
        return if ( $rv == 2 );
Line 6335... Line 6363...
6335
        }
6363
        }
6336
    }
6364
    }
6337
 
6365
 
6338
#.. Files
6366
#.. Files
6339
#
6367
#
6340
    foreach $_ ( @elements )
6368
    foreach ( @elements )
6341
    {
6369
    {
6342
        my %package_entry;
6370
        my %package_entry;
6343
        if ( m~descpkg~ ) {
6371
        if ( m~descpkg~ ) {
6344
            PackageFile($platforms, @elements);
6372
            PackageFile($platforms, @elements);
6345
 
6373
 
Line 6402... Line 6430...
6402
    $dist = "ALL";                              # Default set (ALL)
6430
    $dist = "ALL";                              # Default set (ALL)
6403
    $base = $PackageInfo{'Jar'}{'PBase'};       # Base of target
6431
    $base = $PackageInfo{'Jar'}{'PBase'};       # Base of target
6404
    $dir = $base . $PackageInfo{'Jar'}{'Dir'};  # Installation path (default)
6432
    $dir = $base . $PackageInfo{'Jar'}{'Dir'};  # Installation path (default)
6405
    $type = "";
6433
    $type = "";
6406
 
6434
 
6407
    foreach $_ ( @elements )
6435
    foreach ( @elements )
6408
    {
6436
    {
6409
                                                # Standard targets
6437
                                                # Standard targets
6410
        my $rv = __TargetDir($T_PKG, $base, $_, \$dir, \$type);
6438
        my $rv = __TargetDir($T_PKG, $base, $_, \$dir, \$type);
6411
        next if ( $rv == 1 );
6439
        next if ( $rv == 1 );
6412
        return if ( $rv == 2 );
6440
        return if ( $rv == 2 );
Line 6423... Line 6451...
6423
        }
6451
        }
6424
    }
6452
    }
6425
 
6453
 
6426
#.. Files
6454
#.. Files
6427
#
6455
#
6428
    foreach $_ ( @elements )
6456
    foreach ( @elements )
6429
    {
6457
    {
6430
        my %package_entry;
6458
        my %package_entry;
6431
        if ( ! /^--(.*)/ )
6459
        if ( ! /^--(.*)/ )
6432
        {
6460
        {
6433
            $jar = $_;
6461
            $jar = $_;
Line 7387... Line 7415...
7387
#                   Will warn if multiple instances of the file are found
7415
#                   Will warn if multiple instances of the file are found
7388
#
7416
#
7389
sub MakeResolve
7417
sub MakeResolve
7390
{
7418
{
7391
    my( $dirs, $source ) = @_;
7419
    my( $dirs, $source ) = @_;
7392
    my( $first, $dir, $count, $temp );
7420
    my( $first, $count );
7393
 
7421
 
7394
    #
7422
    #
7395
    #   If the path contains a '$' then its assumed to be
7423
    #   If the path contains a '$' then its assumed to be
7396
    #   a variable name in the path. Just assume that it exists
7424
    #   a variable name in the path. Just assume that it exists
7397
    #
7425
    #
Line 7415... Line 7443...
7415
    $first = "$source"                          # was ./$source
7443
    $first = "$source"                          # was ./$source
7416
        if (-r "$source");
7444
        if (-r "$source");
7417
 
7445
 
7418
#.. search directory paths
7446
#.. search directory paths
7419
#
7447
#
7420
    foreach $dir (@$dirs)
7448
    foreach my $dir (@$dirs)
7421
    {
7449
    {
7422
        $temp = "$dir/$source";                 # was ./$dir/$source
7450
        my $temp = "$dir/$source";                 # was ./$dir/$source
7423
        Debug2( "MakeResolve: Looking in: $temp" );
7451
        Debug2( "MakeResolve: Looking in: $temp" );
7424
        if (-r "$temp")
7452
        if (-r "$temp")
7425
        {
7453
        {
7426
            if ($first eq "") {
7454
            if ($first eq "") {
7427
                $first = $temp;
7455
                $first = $temp;
Line 7951... Line 7979...
7951
    }
7979
    }
7952
    
7980
    
7953
    #
7981
    #
7954
    #   Now start to create the makefile
7982
    #   Now start to create the makefile
7955
    #
7983
    #
7956
    open( MAKEFILE, ">$Makefile" ) || Error( "Cannot create $Makefile" );
7984
    open( MAKEFILE, '>', $Makefile ) || Error( "Cannot create $Makefile" );
7957
    ::MakefileHeader( *MAKEFILE,
7985
    ::MakefileHeader( *MAKEFILE,
7958
                      'Auto-generated Platform Dependent Makefile',
7986
                      'Auto-generated Platform Dependent Makefile',
7959
                      "$ScmMakelib (version $ScmVersion)",
7987
                      "$ScmMakelib (version $ScmVersion)",
7960
                      "# Copyright (C) 1995-$::CurrentYear ERG Transit Systems, All rights reserved",
7988
                      "# Copyright (C) 1995-$::CurrentYear ERG Transit Systems, All rights reserved",
7961
                      '#',
7989
                      '#',
Line 8001... Line 8029...
8001
else
8029
else
8002
GBE_TYPE	:= D
8030
GBE_TYPE	:= D
8003
endif
8031
endif
8004
EOF
8032
EOF
8005
 
8033
 
8006
MakePrint( "GBE_ARGS	:= @ScmPlatformArgs\n" )
8034
MakePrint( "GBE_ARGS\t:= @ScmPlatformArgs\n" )
8007
    if ( scalar @ScmPlatformArgs );
8035
    if ( scalar @ScmPlatformArgs );
8008
 
8036
 
8009
MakePrint( "GBE_PRODUCT	:= $ScmProduct\n" )
8037
MakePrint( "GBE_PRODUCT\t:= $ScmProduct\n" )
8010
    if ( $ScmProduct ne "" );
8038
    if ( $ScmProduct ne "" );
8011
 
8039
 
8012
MakePrint( "GBE_OS_COMMON	:= $::BUILDINFO{$ScmPlatform}{OS_COMMON}\n" )
8040
MakePrint( "GBE_OS_COMMON\t:= $::BUILDINFO{$ScmPlatform}{OS_COMMON}\n" )
8013
    if ( exists($::BUILDINFO{$ScmPlatform}{OS_COMMON}) );
8041
    if ( exists($::BUILDINFO{$ScmPlatform}{OS_COMMON}) );
8014
 
8042
 
8015
 
8043
 
8016
    print MAKEFILE <<EOF;
8044
    print MAKEFILE <<EOF;
8017
 
8045
 
Line 8041... Line 8069...
8041
#                 Mostly done in jmake.pl
8069
#                 Mostly done in jmake.pl
8042
#   EXPERT      - Used to suppress dependency on this makefile
8070
#   EXPERT      - Used to suppress dependency on this makefile
8043
#
8071
#
8044
EOF
8072
EOF
8045
 
8073
 
8046
MakePrint( "NOSCMDEPEND	?= " . ($ScmExpert ? '1' : '0' ) . "\n" );
8074
MakePrint( "NOSCMDEPEND\t?= " . ($ScmExpert ? '1' : '0' ) . "\n" );
8047
MakePrint( "EXPERT		?= " . ($ScmExpert ? '1' : '0' ) . "\n" );
8075
MakePrint( "EXPERT\t\t?= " . ($ScmExpert ? '1' : '0' ) . "\n" );
8048
MakePrint( "NODEPEND	?= 0\n" );
8076
MakePrint( "NODEPEND\t?= 0\n" );
8049
 
8077
 
8050
print MAKEFILE <<EOF;
8078
print MAKEFILE <<EOF;
8051
 
8079
 
8052
#
8080
#
8053
#   SCM_MAKEFILE - The name of the file to depend upon
8081
#   SCM_MAKEFILE - The name of the file to depend upon
Line 9389... Line 9417...
9389
    MakePadded( 2,"$target:", $prereq, "\n");
9417
    MakePadded( 2,"$target:", $prereq, "\n");
9390
    MakePrint ("\t\t" . $_ . "\n") foreach ( @{$recipe} );
9418
    MakePrint ("\t\t" . $_ . "\n") foreach ( @{$recipe} );
9391
    MakePrint ("\n");
9419
    MakePrint ("\n");
9392
}
9420
}
9393
 
9421
 
9394
my %MakeTargets;
-
 
9395
 
-
 
9396
#   make_init - Test toolset presence and sanity
9422
#   make_init - Test toolset presence and sanity
9397
#   Will only be called ONCE for each platform in a recursive build
9423
#   Will only be called ONCE for each platform in a recursive build
9398
#   Should be used to ensure that the required toolset is present
9424
#   Should be used to ensure that the required toolset is present
9399
#
9425
#
9400
PrintPhonyRule ('make_init',       "@initdep" );
9426
PrintPhonyRule ('make_init',       "@initdep" );
Line 9526... Line 9552...
9526
#
9552
#
9527
#   Note: Toolset directories are deleted first
9553
#   Note: Toolset directories are deleted first
9528
#   Note: User Directories are deleted in the reverse order of creation
9554
#   Note: User Directories are deleted in the reverse order of creation
9529
#
9555
#
9530
    MakeHeader ("Subdir deletion");
9556
    MakeHeader ("Subdir deletion");
9531
    MakePrint( ".PHONY:		unmake_dir\n" );
9557
    MakePrint( ".PHONY:\t\tunmake_dir\n" );
9532
    MakePrint( "unmake_dir:\n" );
9558
    MakePrint( "unmake_dir:\n" );
9533
    MakePrint( "\t-\$(AA_PRE)echo Removing directories;" );
9559
    MakePrint( "\t-\$(AA_PRE)echo Removing directories;" );
9534
    MakePrint( " \\\n\t\$(rmdir) \$(TOOLSETDIRS);" )            if ( @TOOLSETDIRS );
9560
    MakePrint( " \\\n\t\$(rmdir) \$(TOOLSETDIRS);" )            if ( @TOOLSETDIRS );
9535
    MakePrint( " \\\n\t\$(rm) -rf \$(TOOLSETDIRTREES);" )       if ( @TOOLSETDIRTREES );
9561
    MakePrint( " \\\n\t\$(rm) -rf \$(TOOLSETDIRTREES);" )       if ( @TOOLSETDIRTREES );
9536
    RmdirRules();
9562
    RmdirRules();