Subversion Repositories DevTools

Rev

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

Rev 6469 Rev 6504
Line 2656... Line 2656...
2656
#                                                 Refer to ExpandGenVar function for details
2656
#                                                 Refer to ExpandGenVar function for details
2657
#                                                 of Name and available options
2657
#                                                 of Name and available options
2658
#                                                 The expanded text will be replaced with an
2658
#                                                 The expanded text will be replaced with an
2659
#                                                 suitable makefile variables that will be
2659
#                                                 suitable makefile variables that will be
2660
#                                                 replaced at run-time.
2660
#                                                 replaced at run-time.
-
 
2661
#                                                 
-
 
2662
#                       --Tool(Name,opt)        - Name is the name of a 'tool' found withnin a package
-
 
2663
#                                                 The argument is replaced with the full path of the
-
 
2664
#                                                 tool. opt may be
-
 
2665
#                                                   --dir
-
 
2666
#                                                   --file
-
 
2667
#                                                   --abspath
-
 
2668
#                                                   --absdrive
2661
#
2669
#
2662
#                   The keyword will be replaced with the resolved name. This may be a file,
2670
#                   The keyword will be replaced with the resolved name. This may be a file,
2663
#                   a directory or other text.
2671
#                   a directory or other text.
2664
#
2672
#
2665
#                   Options do not alter command line text. They do affect the way the command is
2673
#                   Options do not alter command line text. They do affect the way the command is
Line 2704... Line 2712...
2704
    #
2712
    #
2705
    my ( $platforms, $tool, @args) = grep defined, @_;
2713
    my ( $platforms, $tool, @args) = grep defined, @_;
2706
 
2714
 
2707
    return if ( ! ActivePlatform($platforms) );
2715
    return if ( ! ActivePlatform($platforms) );
2708
 
2716
 
2709
    Debug2( "GenerateFiles:($platforms, $tool, @args)" );
2717
    Debug( "GenerateFiles:($platforms, $tool, @args)" );
2710
 
2718
 
2711
    my @preq_files;
2719
    my @preq_files;
2712
    my $preq_unknown;
2720
    my $preq_unknown;
2713
    my @gen_files;
2721
    my @gen_files;
2714
    my $shell_script;
2722
    my $shell_script;
Line 3240... Line 3248...
3240
            {
3248
            {
3241
                $fn = GetPackageInfo( "GenerateFiles", $raw_arg );
3249
                $fn = GetPackageInfo( "GenerateFiles", $raw_arg );
3242
            }
3250
            }
3243
            elsif ( $cmd =~ /^Var/ )
3251
            elsif ( $cmd =~ /^Var/ )
3244
            {
3252
            {
-
 
3253
                # --Var(...)
3245
                ($fnp, $fn, $is_path) = ExpandGenVar( "GenerateFiles", $raw_arg, @var_opts );
3254
                ($fnp, $fn, $is_path) = ExpandGenVar( "GenerateFiles", $raw_arg, @var_opts );
3246
                $flags = '';
3255
                $flags = '';
3247
                if ( $raw_arg eq 'ObjDir' ) {
3256
                if ( $raw_arg eq 'ObjDir' ) {
3248
                    UniquePush (\@preq_files, '$(GBE_OBJDIR)');
3257
                    UniquePush (\@preq_files, '$(GBE_OBJDIR)');
3249
                } elsif ( $raw_arg eq 'BinDir' ) {
3258
                } elsif ( $raw_arg eq 'BinDir' ) {
3250
                    UniquePush (\@preq_files, '$(GBE_BINDIR)');
3259
                    UniquePush (\@preq_files, '$(GBE_BINDIR)');
3251
                } elsif ( $raw_arg eq 'LibDir' ) {
3260
                } elsif ( $raw_arg eq 'LibDir' ) {
3252
                    UniquePush (\@preq_files, '$(GBE_LIBDIR)');
3261
                    UniquePush (\@preq_files, '$(GBE_LIBDIR)');
3253
                }
3262
                }
3254
            }
3263
            }
-
 
3264
            elsif ( $cmd =~ /^Tool/ ) {
-
 
3265
                # --Tool(toolName)
-
 
3266
                ($fn, $is_path) = ExpandTool( "GenerateFiles", $raw_arg );
-
 
3267
            }
3255
            else
3268
            else
3256
            {
3269
            {
3257
                Warning ("GenerateFiles: Unknown replacement command: $cmd");
3270
                Warning ("GenerateFiles: Unknown replacement command: $cmd");
3258
                $fn = $ufn;
3271
                $fn = $ufn;
3259
            }
3272
            }
Line 3810... Line 3823...
3810
    return $prefix , $expansion, $is_path ? 1 : 0, $is_abs;
3823
    return $prefix , $expansion, $is_path ? 1 : 0, $is_abs;
3811
 
3824
 
3812
}
3825
}
3813
 
3826
 
3814
#-------------------------------------------------------------------------------
3827
#-------------------------------------------------------------------------------
-
 
3828
# Function        : ExpandTool
-
 
3829
#
-
 
3830
# Description     : Locate a 'tool' and provide the complete path
-
 
3831
#
-
 
3832
# Inputs          : $dname         - Directive name     (Reporting)
-
 
3833
#                   $arg           - Name of the tool to locate (no extension) with 
-
 
3834
#                                    embedded options. Options are:
-
 
3835
#                                       --dir
-
 
3836
#                                       --file
-
 
3837
#                                       --abspath
-
 
3838
#                                       --absdrive
-
 
3839
#
-
 
3840
#                                    
-
 
3841
# Returns         : Path/Value      - Path/Value of the component
-
 
3842
#                   is_path         - Above is a path
-
 
3843
#                   is_abs          - Path is absolute
-
 
3844
#
-
 
3845
 
-
 
3846
sub ExpandTool
-
 
3847
{
-
 
3848
    my ($dname, $args) = @_;
-
 
3849
    my ($toolName, @opts) = split('\s*,\s*', $args);
-
 
3850
    my $is_abs = 1;
-
 
3851
    my $is_path = 1;
-
 
3852
 
-
 
3853
    #
-
 
3854
    #   Locate the tool in one of the dependent packages
-
 
3855
    #
-
 
3856
    my @extension_list; 
-
 
3857
    push @extension_list, '.exe' if ( $::ScmHost ne "Unix" );
-
 
3858
    my $toolFullPath =  ToolExtensionProgram( $toolName, @extension_list );
-
 
3859
    if ($toolFullPath) {
-
 
3860
        $toolName = $toolFullPath;
-
 
3861
    } else {
-
 
3862
            Warning("$dname. Tool not found: $toolName", "Searched:", ToolExtensionPaths());
-
 
3863
    }
-
 
3864
 
-
 
3865
    #
-
 
3866
    #   Process options
-
 
3867
    #
-
 
3868
    foreach my $opt ( @opts )
-
 
3869
    {
-
 
3870
        if ( $opt =~ m/^--dir/i ) {
-
 
3871
            $toolName = StripFileExt($toolName);
-
 
3872
 
-
 
3873
        } elsif ( $opt =~ m/^--file/i ) {
-
 
3874
            $toolName = StripDir($toolName);
-
 
3875
            $is_abs = 0;
-
 
3876
            $is_path = 0;
-
 
3877
 
-
 
3878
        } elsif ( $opt =~ m/^--abspath/i ) {
-
 
3879
            $toolName = AbsPath($toolName);
-
 
3880
 
-
 
3881
        } elsif ( $opt =~ m/^--absdrive/i ) {
-
 
3882
            $toolName = FullPath($toolName);
-
 
3883
 
-
 
3884
        } else {
-
 
3885
            Error ("$dname: Unsupported option($opt) for --Tool(@_)");
-
 
3886
        }
-
 
3887
    }
-
 
3888
 
-
 
3889
    Debug ("ExpandTool: $args --> $toolName");
-
 
3890
    return $toolName, $is_path ? 1 : 0, $is_abs;
-
 
3891
}
-
 
3892
 
-
 
3893
#-------------------------------------------------------------------------------
3815
# Function        : isAnAlias 
3894
# Function        : isAnAlias 
3816
#
3895
#
3817
# Description     : Internal Helper
3896
# Description     : Internal Helper
3818
#                   Determine if this platform is an alias for ...
3897
#                   Determine if this platform is an alias for ...
3819
#
3898
#
Line 3975... Line 4054...
3975
#                   that also includes the toolset extension
4054
#                   that also includes the toolset extension
3976
#
4055
#
3977
# Inputs          : program             - Name of program
4056
# Inputs          : program             - Name of program
3978
#                   elist               - An array of possible program extensions
4057
#                   elist               - An array of possible program extensions
3979
#
4058
#
3980
# Returns         : Full path the to program or an empty elelent (not undef)
4059
# Returns         : Full path the to program or an empty element (not undef)
3981
#
4060
#
3982
sub ToolExtensionProgram
4061
sub ToolExtensionProgram
3983
{
4062
{
3984
    my ($program, @elist ) = @_;
4063
    my ($program, @elist ) = @_;
3985
 
4064
 
Line 5140... Line 5219...
5140
            elsif ( $cmd =~ /^Var/ )
5219
            elsif ( $cmd =~ /^Var/ )
5141
            {
5220
            {
5142
                ($fnp, $fn, $is_path, $is_abs) = ExpandGenVar( "RunTest", $raw_arg );
5221
                ($fnp, $fn, $is_path, $is_abs) = ExpandGenVar( "RunTest", $raw_arg );
5143
                $flags = '';
5222
                $flags = '';
5144
            }
5223
            }
-
 
5224
            elsif ( $cmd =~ /^Tool/ )
-
 
5225
            {
-
 
5226
                ($fn, $is_path, $is_abs) = ExpandTool( "RunTest", $raw_arg );
-
 
5227
                $flags = '';
-
 
5228
            }
5145
            elsif ( $cmd =~ /^Local/ )
5229
            elsif ( $cmd =~ /^Local/ )
5146
            {
5230
            {
5147
                $fn = '$(LOCALDIR)/' . $ufn ;
5231
                $fn = '$(LOCALDIR)/' . $ufn ;
5148
                UniquePush (\@preq_files, $fn);
5232
                UniquePush (\@preq_files, $fn);
5149
            }
5233
            }
Line 8343... Line 8427...
8343
    if (scalar @found > 1)
8427
    if (scalar @found > 1)
8344
    {
8428
    {
8345
        Warning("Duplicates for '$source'. Using the first", @found);
8429
        Warning("Duplicates for '$source'. Using the first", @found);
8346
    }
8430
    }
8347
 
8431
 
8348
    return $found[0] || "";
8432
    return $found[0] || $source;
8349
}
8433
}
8350
 
8434
 
8351
#-------------------------------------------------------------------------------
8435
#-------------------------------------------------------------------------------
8352
# Function        : MakeSrcResolve
8436
# Function        : MakeSrcResolve
8353
#
8437
#
Line 9165... Line 9249...
9165
    MakeHeader ("Tool Search Path",
9249
    MakeHeader ("Tool Search Path",
9166
                "Extend the PATH seen by all the tools to include",
9250
                "Extend the PATH seen by all the tools to include",
9167
                "The tools/bin directories discovered in Packages" );
9251
                "The tools/bin directories discovered in Packages" );
9168
    my $put_PATH;
9252
    my $put_PATH;
9169
    my $put_LD_LIBRARY_PATH;
9253
    my $put_LD_LIBRARY_PATH;
-
 
9254
 
-
 
9255
    MakePrint( "PATH := \$(BINDIR_LOCAL_PATH)$::ScmPathSep\$(PATH)\n" );
-
 
9256
    $put_PATH = 1;
-
 
9257
 
9170
    for my $path ( ToolExtensionPaths() )
9258
    for my $path ( ToolExtensionPaths() )
9171
    {
9259
    {
9172
        MakePrint( "PATH := $path$::ScmPathSep\$(PATH)\n" );
9260
        MakePrint( "PATH := $path$::ScmPathSep\$(PATH)\n" );
9173
        $put_PATH = 1;
9261
        $put_PATH = 1;
9174
 
9262