Subversion Repositories DevTools

Rev

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

Rev 7320 Rev 7322
Line 127... Line 127...
127
our $ScmToolsetProgSource   = ();               # Toolset Program Source
127
our $ScmToolsetProgSource   = ();               # Toolset Program Source
128
our $ScmToolsetSoName       = 0;                # 1: Shared library supports SoName
128
our $ScmToolsetSoName       = 0;                # 1: Shared library supports SoName
129
our $ScmToolsetNillLibSrc   = 0;                # 1: Librarys created without source specified
129
our $ScmToolsetNillLibSrc   = 0;                # 1: Librarys created without source specified
130
our %ScmToolsetProperties   = ();               # Toolset specific features and limitations
130
our %ScmToolsetProperties   = ();               # Toolset specific features and limitations
131
                                                # Known values: UnitTests, AutoUnitTests
131
                                                # Known values: UnitTests, AutoUnitTests
132
our  %ScmGlobalOptions       = ();              # Hash of Global(platform) options. Access via functions
132
our %ScmGlobalOptions       = ();               # Hash of Global(platform) options. Access via functions
-
 
133
our %ScmRecipeTags          = ();               # Hash of exposed recipe names
133
 
134
 
134
our $ScmRoot                = "";
135
our $ScmRoot                = "";
135
our $ScmMakelib             = "";
136
our $ScmMakelib             = "";
136
our $ScmPlatform            = "";
137
our $ScmPlatform            = "";
137
our $ScmMachType            = "";
138
our $ScmMachType            = "";
Line 234... Line 235...
234
our $SHLIBS                 = ();
235
our $SHLIBS                 = ();
235
our @SHLIB_TARGETS          = ();
236
our @SHLIB_TARGETS          = ();
236
our %SHLIB_PKG              = ();
237
our %SHLIB_PKG              = ();
237
our %SHLIB_INS              = ();
238
our %SHLIB_INS              = ();
238
our %INSTALL_SHLIBS         = ();
239
our %INSTALL_SHLIBS         = ();
-
 
240
our @INSTALL_DIRS           = ();
239
 
241
 
240
our $TESTPROGS              = ();
242
our $TESTPROGS              = ();
241
our @TESTPROGS              = ();
243
our @TESTPROGS              = ();
242
 
244
 
243
our $PROGS                  = ();           # Simplify tracking of progs
245
our $PROGS                  = ();           # Simplify tracking of progs
Line 253... Line 255...
253
our %PACKAGE_LIBS           = ();
255
our %PACKAGE_LIBS           = ();
254
our %PACKAGE_CLSS           = ();
256
our %PACKAGE_CLSS           = ();
255
our %PACKAGE_SHLIBS         = ();
257
our %PACKAGE_SHLIBS         = ();
256
our %PACKAGE_PROGS          = ();
258
our %PACKAGE_PROGS          = ();
257
our %PACKAGE_FILES          = ();
259
our %PACKAGE_FILES          = ();
258
 
-
 
259
our @PACKAGE_VARS           = ( '%PACKAGE_CLSS',  '%PACKAGE_FILES', '%PACKAGE_HDRS',
260
our @PACKAGE_DIRS           = ();
260
                                '%PACKAGE_LIBS',  '%PACKAGE_PROGS', '%PACKAGE_SHLIBS' );
-
 
261
our @INSTALL_VARS           = ( '%INSTALL_CLSS',  '%INSTALL_HDRS',  '%INSTALL_LIBS',
-
 
262
                                '%INSTALL_PROGS', '%INSTALL_SHLIBS');
-
 
263
 
261
 
264
our @LINTLIBS               = ();
262
our @LINTLIBS               = ();
265
our @LINTSHLIBS             = ();
263
our @LINTSHLIBS             = ();
266
 
264
 
267
our @TESTS_TO_RUN           = ();                           # Info from 'RunTest' directives
265
our @TESTS_TO_RUN           = ();                           # Info from 'RunTest' directives
Line 717... Line 715...
717
 
715
 
718
    #
716
    #
719
    #   Include local toolset extensions
717
    #   Include local toolset extensions
720
    #   These are rooted in the build directory and are not to be confused with
718
    #   These are rooted in the build directory and are not to be confused with
721
    #   extensions that may be packaged
719
    #   extensions that may be packaged
-
 
720
    #   Simplify life - add the directory to the BUILDTOOLSPATH
722
    #
721
    #
723
    my $local_base_dir = "$ScmRoot/gbe/DIRECTIVES";
722
    my $local_base_dir = "$ScmRoot/gbe/DIRECTIVES";
724
    if ( -d $local_base_dir )
723
    if ( -d $local_base_dir )
725
    {
724
    {
-
 
725
        unshift @::BUILDTOOLSPATH, AbsPath($local_base_dir); 
726
        foreach my $file  ( glob ("$local_base_dir/*.pm") )
726
        foreach my $file  ( glob ("$local_base_dir/*.pm") )
727
        {
727
        {
728
            push( @ScmDepends, "$file" );
728
            push( @ScmDepends, "$file" );
729
            require $file;
729
            require $file;
730
        }
730
        }
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 2685... Line 2693...
2685
#                                                 creation of files.
2693
#                                                 creation of files.
2686
#                       --Text=<text>           - Display text for command
2694
#                       --Text=<text>           - Display text for command
2687
#
2695
#
2688
#                       --Clean[=arg]           - Call script with arg[-clean] for cleaning.
2696
#                       --Clean[=arg]           - Call script with arg[-clean] for cleaning.
2689
#                       --PreDelete             - Delete generated files before running the command
2697
#                       --PreDelete             - Delete generated files before running the command
-
 
2698
#                       --RecipeTag=Name        - Name the recipe
-
 
2699
#                                                 Allows recipe to be called by Name and clean_Name
2690
#
2700
#
2691
#               Eg: GenerateFiles ( '*', "--Tool=mod_if.pl",
2701
#               Eg: GenerateFiles ( '*', "--Tool=mod_if.pl",
2692
#                                        "-src --Prerequisite(udh_module.cfg)",
2702
#                                        "-src --Prerequisite(udh_module.cfg)",
2693
#                                        "-direct -hdr --Generated(udp.h) -quiet" );
2703
#                                        "-direct -hdr --Generated(udp.h) -quiet" );
2694
#
2704
#
2695
my $NoGenIndex = 0;
2705
my $NoGenIndex = 0;
-
 
2706
my %recipeTags;
2696
sub GenerateFiles
2707
sub GenerateFiles
2697
{
2708
{
-
 
2709
    #
-
 
2710
    #   Remove undfined arguments
-
 
2711
    #   Simplifies programatic construction of argument lists
-
 
2712
    #
2698
    my ( $platforms, $tool, @args) = @_;
2713
    my ( $platforms, $tool, @args) = grep defined, @_;
2699
 
2714
 
2700
    return if ( ! ActivePlatform($platforms) );
2715
    return if ( ! ActivePlatform($platforms) );
2701
 
2716
 
2702
    Debug2( "GenerateFiles:($platforms, $tool, @args)" );
2717
    Debug( "GenerateFiles:($platforms, $tool, @args)" );
2703
 
2718
 
2704
    my @preq_files;
2719
    my @preq_files;
2705
    my $preq_unknown;
2720
    my $preq_unknown;
2706
    my @gen_files;
2721
    my @gen_files;
2707
    my $shell_script;
2722
    my $shell_script;
Line 2713... Line 2728...
2713
    my $gtype = 1;
2728
    my $gtype = 1;
2714
    my @has_source;
2729
    my @has_source;
2715
    my @var_opts;
2730
    my @var_opts;
2716
    my @genreq_seen;
2731
    my @genreq_seen;
2717
    my $predelete;
2732
    my $predelete;
-
 
2733
    my $recipeTag;
2718
 
2734
 
2719
    #
2735
    #
2720
    #   Process the first argument - this describes the program that will be used
2736
    #   Process the first argument - this describes the program that will be used
2721
    #   to generate the files. It may be:
2737
    #   to generate the files. It may be:
2722
    #       --Tool          - A Jats Tool or Plugin
2738
    #       --Tool          - A Jats Tool or Plugin
Line 2932... Line 2948...
2932
        
2948
        
2933
        if ( $arg =~ /^--NoVarTag$/ )
2949
        if ( $arg =~ /^--NoVarTag$/ )
2934
        {
2950
        {
2935
            #
2951
            #
2936
            #   Modify the operation of --Var to supress the tags
2952
            #   Modify the operation of --Var to supress the tags
2937
            #   Should be usd early as will only affect following --Var usage
2953
            #   Should be used early as will only affect following --Var usage
2938
            #
2954
            #
2939
            push @var_opts, "--notag";
2955
            push @var_opts, "--notag";
2940
            next;
2956
            next;
2941
        }
2957
        }
2942
 
2958
 
Line 3074... Line 3090...
3074
            #   Display this text when executing commands
3090
            #   Display this text when executing commands
3075
            #
3091
            #
3076
            $text = $1;
3092
            $text = $1;
3077
            next;
3093
            next;
3078
        }
3094
        }
-
 
3095
 
-
 
3096
        if ( $arg =~ /^--RecipeTag=(.*)/ )
3079
        
3097
        {
-
 
3098
            #
-
 
3099
            #   Tag the generated Recipe
-
 
3100
            #   Only use the last tag - allow users to overwrite system tags
-
 
3101
            #
-
 
3102
            $recipeTag = $1;
-
 
3103
            Error ("Duplicate RecipeTag - $recipeTag") if ($recipeTags{$recipeTag}++ > 1);
-
 
3104
            next;
-
 
3105
        }
3080
 
3106
 
3081
        #   Not an option. Must be an argument to the tool/program
3107
        #   Not an option. Must be an argument to the tool/program
3082
        #   Process the tool arguments and extract file information
3108
        #   Process the tool arguments and extract file information
3083
        #   Extract all fields of the form:
3109
        #   Extract all fields of the form:
3084
        #           --xxxxx(yyyyyy[,zzzzz])
3110
        #           --xxxxx(yyyyyy[,zzzzz])
Line 3096... Line 3122...
3096
            my $ufn = $3 || $4 || $5;           # User filename + options
3122
            my $ufn = $3 || $4 || $5;           # User filename + options
3097
            my $mb = $-[0];                     # Match begin offset
3123
            my $mb = $-[0];                     # Match begin offset
3098
            my $me = $+[0];                     # Match end
3124
            my $me = $+[0];                     # Match end
3099
            my $flags = '';                     # Optional flags ( --dir or --file )
3125
            my $flags = '';                     # Optional flags ( --dir or --file )
3100
            my $raw_arg = $ufn;                 # Raw arguments
3126
            my $raw_arg = $ufn;                 # Raw arguments
3101
            my $all = substr( $arg, $mb, $me ); # All of match. Avoid use of $&
3127
            my $all = substr( $arg, $mb, $me - $mb ); # All of match. Avoid use of $&
3102
            my $is_path = 1;
3128
            my $is_path = 1;
3103
            
3129
            
3104
 
3130
 
3105
            Error ("GenerateFiles. Empty element not allowed: $all")
3131
            Error ("GenerateFiles. Empty element not allowed: $all")
3106
                unless ( defined($ufn) );
3132
                unless ( defined($ufn) );
Line 3222... Line 3248...
3222
            {
3248
            {
3223
                $fn = GetPackageInfo( "GenerateFiles", $raw_arg );
3249
                $fn = GetPackageInfo( "GenerateFiles", $raw_arg );
3224
            }
3250
            }
3225
            elsif ( $cmd =~ /^Var/ )
3251
            elsif ( $cmd =~ /^Var/ )
3226
            {
3252
            {
-
 
3253
                # --Var(...)
3227
                ($fnp, $fn, $is_path) = ExpandGenVar( "GenerateFiles", $raw_arg, @var_opts );
3254
                ($fnp, $fn, $is_path) = ExpandGenVar( "GenerateFiles", $raw_arg, @var_opts );
3228
                $flags = '';
3255
                $flags = '';
3229
                if ( $raw_arg eq 'ObjDir' ) {
3256
                if ( $raw_arg eq 'ObjDir' ) {
3230
                    UniquePush (\@preq_files, '$(GBE_OBJDIR)');
3257
                    UniquePush (\@preq_files, '$(GBE_OBJDIR)');
3231
                } elsif ( $raw_arg eq 'BinDir' ) {
3258
                } elsif ( $raw_arg eq 'BinDir' ) {
3232
                    UniquePush (\@preq_files, '$(GBE_BINDIR)');
3259
                    UniquePush (\@preq_files, '$(GBE_BINDIR)');
3233
                } elsif ( $raw_arg eq 'LibDir' ) {
3260
                } elsif ( $raw_arg eq 'LibDir' ) {
3234
                    UniquePush (\@preq_files, '$(GBE_LIBDIR)');
3261
                    UniquePush (\@preq_files, '$(GBE_LIBDIR)');
3235
                }
3262
                }
3236
            }
3263
            }
-
 
3264
            elsif ( $cmd =~ /^Tool/ ) {
-
 
3265
                # --Tool(toolName)
-
 
3266
                ($fn, $is_path) = ExpandTool( "GenerateFiles", $raw_arg );
-
 
3267
            }
3237
            else
3268
            else
3238
            {
3269
            {
3239
                Warning ("GenerateFiles: Unknown replacement command: $cmd");
3270
                Warning ("GenerateFiles: Unknown replacement command: $cmd");
3240
                $fn = $ufn;
3271
                $fn = $ufn;
3241
            }
3272
            }
Line 3283... Line 3314...
3283
    Warning( "GenerateFiles. --AutoGenerate option has no effect",
3314
    Warning( "GenerateFiles. --AutoGenerate option has no effect",
3284
             "The following files are 'source' files",  @has_source ) if ( @has_source );
3315
             "The following files are 'source' files",  @has_source ) if ( @has_source );
3285
    Warning( "No Prerequisite files found in $tool",@tool_args) unless ( $no_warn || $#preq_files >= 0 );
3316
    Warning( "No Prerequisite files found in $tool",@tool_args) unless ( $no_warn || $#preq_files >= 0 );
3286
    Error  ( "No generated files found in $tool",@tool_args) unless ($#gen_files >= 0);
3317
    Error  ( "No generated files found in $tool",@tool_args) unless ($#gen_files >= 0);
3287
 
3318
 
-
 
3319
    #
-
 
3320
    #   Determine the text to display while generating files
-
 
3321
    #   Will be either user-text or the first target file (default)
-
 
3322
    #   Suffix with RecipeTag, if provided
-
 
3323
    #   
-
 
3324
    my $txtSuffix = '';
-
 
3325
    $txtSuffix = "($recipeTag)" if defined $recipeTag;
-
 
3326
    $text = $gen_files[0] unless defined $text;
-
 
3327
    $text .= $txtSuffix;
3288
 
3328
 
3289
    #
3329
    #
3290
    #   Save information
3330
    #   Save information
3291
    #   Will be used to create makefile statements later
3331
    #   Will be used to create makefile statements later
3292
    #
3332
    #
3293
    my %gen_data;
3333
    my %gen_data;
3294
 
3334
 
3295
    $gen_data{'index'}      = $NoGenIndex++;
3335
    $gen_data{'index'}      = $NoGenIndex++;
-
 
3336
    $gen_data{'recipeTag'}  = $recipeTag if defined $recipeTag;
3296
    $gen_data{'shell'}      = $shell_cmds;
3337
    $gen_data{'shell'}      = $shell_cmds;
3297
    $gen_data{'gen'}        = \@gen_files;
3338
    $gen_data{'gen'}        = \@gen_files;
3298
    $gen_data{'preq'}       = \@preq_files;
3339
    $gen_data{'preq'}       = \@preq_files;
3299
    $gen_data{'tool'}       = $tool;
3340
    $gen_data{'tool'}       = $tool;
3300
    $gen_data{'toolargs'}   = \@tool_args;
3341
    $gen_data{'toolargs'}   = \@tool_args;
3301
    $gen_data{'clean'}      = $clean_tag;
3342
    $gen_data{'clean'}      = $clean_tag;
3302
    $gen_data{'text'}       = $text || $gen_files[0];
3343
    $gen_data{'text'}       = $text;
3303
    $gen_data{'preq_sus'}   = 1 if ( $preq_unknown );
3344
    $gen_data{'preq_sus'}   = 1 if ( $preq_unknown );
3304
    $gen_data{'predelete'}  = 1 if ( $predelete );
3345
    $gen_data{'predelete'}  = 1 if ( $predelete );
3305
 
3346
 
3306
    push(@GENERATE_FILES, \%gen_data);
3347
    push(@GENERATE_FILES, \%gen_data);
3307
 
-
 
-
 
3348
#DebugDumpData("GenerateFiles", \%gen_data);
3308
    Debug2( "GenerateFiles: cmd: $tool @tool_args" );
3349
    Debug2( "GenerateFiles: cmd: $tool @tool_args" );
3309
}
3350
}
3310
 
3351
 
3311
#-------------------------------------------------------------------------------
3352
#-------------------------------------------------------------------------------
3312
# Function        : MakePerlModule
3353
# Function        : MakePerlModule
Line 3782... Line 3823...
3782
    return $prefix , $expansion, $is_path ? 1 : 0, $is_abs;
3823
    return $prefix , $expansion, $is_path ? 1 : 0, $is_abs;
3783
 
3824
 
3784
}
3825
}
3785
 
3826
 
3786
#-------------------------------------------------------------------------------
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
#-------------------------------------------------------------------------------
3787
# Function        : isAnAlias 
3894
# Function        : isAnAlias 
3788
#
3895
#
3789
# Description     : Internal Helper
3896
# Description     : Internal Helper
3790
#                   Determine if this platform is an alias for ...
3897
#                   Determine if this platform is an alias for ...
3791
#
3898
#
Line 3947... Line 4054...
3947
#                   that also includes the toolset extension
4054
#                   that also includes the toolset extension
3948
#
4055
#
3949
# Inputs          : program             - Name of program
4056
# Inputs          : program             - Name of program
3950
#                   elist               - An array of possible program extensions
4057
#                   elist               - An array of possible program extensions
3951
#
4058
#
3952
# 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)
3953
#
4060
#
3954
sub ToolExtensionProgram
4061
sub ToolExtensionProgram
3955
{
4062
{
3956
    my ($program, @elist ) = @_;
4063
    my ($program, @elist ) = @_;
3957
 
4064
 
Line 4092... Line 4199...
4092
#                       --h, --headers
4199
#                       --h, --headers
4093
#                       --asm
4200
#                       --asm
4094
#                       --FromPackage       - Search packages for the file
4201
#                       --FromPackage       - Search packages for the file
4095
#                       --List=xxx          - Append file to a named list
4202
#                       --List=xxx          - Append file to a named list
4096
#                       --Depends=xxx       - Manually name a dependency
4203
#                       --Depends=xxx       - Manually name a dependency
-
 
4204
#                       --IgnoreDuplicates  - Ignore duplicates (mostly internal use)
4097
#
4205
#
4098
#                   Options are processed before file elements
4206
#                   Options are processed before file elements
4099
#                   Thus options apply to all files in the list
4207
#                   Thus options apply to all files in the list
4100
#
4208
#
4101
# Returns         : Nothing
4209
# Returns         : Nothing
4102
#
4210
#
4103
sub Src
4211
sub Src
4104
{
4212
{
4105
    my( $platforms, @elements ) = @_;
4213
    my( $platforms, @elements ) = @_;
4106
    my( $type, @args, $source, $basename, $from_package, @lists );
4214
    my( $type, @args, $source, $basename, $from_package, @lists, $ignoreDups );
4107
    my( @depends, @srcs );
4215
    my( @depends, @srcs );
4108
 
4216
 
4109
    $platforms = '' unless ( $platforms );
4217
    $platforms = '' unless ( $platforms );
4110
    Debug2( "Src($platforms, @elements)" );
4218
    Debug2( "Src($platforms, @elements)" );
4111
 
4219
 
Line 4151... Line 4259...
4151
        elsif ( /^--asm$/ )
4259
        elsif ( /^--asm$/ )
4152
        {
4260
        {
4153
            Debug( "Src: --asm" );
4261
            Debug( "Src: --asm" );
4154
            $type = ".asm";
4262
            $type = ".asm";
4155
        }
4263
        }
-
 
4264
        elsif ( /^--IgnoreDup/ )
-
 
4265
        {
-
 
4266
            $ignoreDups = 1;
-
 
4267
        }
4156
        elsif ( /^--FromPackage$/ )
4268
        elsif ( /^--FromPackage$/ )
4157
        {
4269
        {
4158
            $from_package = 1;
4270
            $from_package = 1;
4159
        }
4271
        }
4160
        elsif ( /^--List=(.*)/ )
4272
        elsif ( /^--List=(.*)/ )
Line 4192... Line 4304...
4192
            $source = MakeSrcResolveExtended( $from_package, $_ );
4304
            $source = MakeSrcResolveExtended( $from_package, $_ );
4193
            $basename = StripDir( $source );
4305
            $basename = StripDir( $source );
4194
            Debug( "Src: $_ -> $source=$basename (@args),(@depends)" );
4306
            Debug( "Src: $_ -> $source=$basename (@args),(@depends)" );
4195
 
4307
 
4196
            if ( $SRCS{ $basename } ) {
4308
            if ( $SRCS{ $basename } ) {
4197
                Warning( "Duplicate src ignored '$source'");
4309
                Warning( "Duplicate src ignored '$source'") unless $ignoreDups;
4198
                next;
4310
                next;
4199
            }
4311
            }
4200
            $SRCS{ $basename } = $source;
4312
            $SRCS{ $basename } = $source;
4201
 
4313
 
4202
            HashJoin( \%SRC_ARGS, $;, $basename, @args )
4314
            HashJoin( \%SRC_ARGS, $;, $basename, @args )
Line 4224... Line 4336...
4224
            __AddSourceFile( 1, $source, "", $type );
4336
            __AddSourceFile( 1, $source, "", $type );
4225
        }
4337
        }
4226
    }
4338
    }
4227
}
4339
}
4228
 
4340
 
-
 
4341
#-------------------------------------------------------------------------------
-
 
4342
# Function        : AddToSrc 
-
 
4343
#
-
 
4344
# Description     : Internal function
-
 
4345
#                   Used by plugins and tools
-
 
4346
#                   
-
 
4347
#                   Will test if specified file is known to JATS, before
-
 
4348
#                   adding to the the list of known (Src) files 
-
 
4349
#
-
 
4350
# Inputs          : $platform
-
 
4351
#                   $file           - Only one file
-
 
4352
#                   @srcOpts        - Same as Src
-
 
4353
#
-
 
4354
# Returns         : True if any file can be found
-
 
4355
#                   Returns full path to the file    
-
 
4356
#
-
 
4357
sub AddToSrc
-
 
4358
{
-
 
4359
    my( $platforms, $file, @args ) = @_;
-
 
4360
    Debug2( "AddToSrc($platforms, $file, @args)" );
-
 
4361
 
-
 
4362
    #
-
 
4363
    #   Process files
-
 
4364
    #
-
 
4365
    my $basename = StripDir( $file );
-
 
4366
    unless (exists $SRCS{$file} || exists  $SRCS{$basename} ) {
-
 
4367
        Src ('*', $file, @args);
-
 
4368
    }
-
 
4369
 
-
 
4370
    return $SRCS{$basename};
-
 
4371
}
-
 
4372
 
4229
 
4373
 
4230
###############################################################################
4374
###############################################################################
4231
#  sub LibNameSplit
4375
#  sub LibNameSplit
4232
#      Just a little help to deal with major/minor stuff for shared libs -
4376
#      Just a little help to deal with major/minor stuff for shared libs -
4233
#      given the name of the library as the argument, split out major and minor
4377
#      given the name of the library as the argument, split out major and minor
Line 5024... Line 5168...
5024
            my $ufn = $3 || $4 || $5;           # User filename + options
5168
            my $ufn = $3 || $4 || $5;           # User filename + options
5025
            my $mb = $-[0];                     # Match begin offset
5169
            my $mb = $-[0];                     # Match begin offset
5026
            my $me = $+[0];                     # Match end
5170
            my $me = $+[0];                     # Match end
5027
            my $flags = '';                     # Optional flags ( --dir or --file )
5171
            my $flags = '';                     # Optional flags ( --dir or --file )
5028
            my $raw_arg = $ufn;                 # Raw arguments
5172
            my $raw_arg = $ufn;                 # Raw arguments
5029
            my $all = substr( $arg, $mb, $me ); # All of match. Avoid use of $&
5173
            my $all = substr( $arg, $mb, $me - $mb ); # All of match. Avoid use of $&
5030
            my $is_abs;
5174
            my $is_abs;
5031
            my $is_path = 1;
5175
            my $is_path = 1;
5032
 
5176
 
5033
            Error ("RunTest. Empty element not allowed: $all")
5177
            Error ("RunTest. Empty element not allowed: $all")
5034
                unless ( defined($ufn) );
5178
                unless ( defined($ufn) );
Line 5075... Line 5219...
5075
            elsif ( $cmd =~ /^Var/ )
5219
            elsif ( $cmd =~ /^Var/ )
5076
            {
5220
            {
5077
                ($fnp, $fn, $is_path, $is_abs) = ExpandGenVar( "RunTest", $raw_arg );
5221
                ($fnp, $fn, $is_path, $is_abs) = ExpandGenVar( "RunTest", $raw_arg );
5078
                $flags = '';
5222
                $flags = '';
5079
            }
5223
            }
-
 
5224
            elsif ( $cmd =~ /^Tool/ )
-
 
5225
            {
-
 
5226
                ($fn, $is_path, $is_abs) = ExpandTool( "RunTest", $raw_arg );
-
 
5227
                $flags = '';
-
 
5228
            }
5080
            elsif ( $cmd =~ /^Local/ )
5229
            elsif ( $cmd =~ /^Local/ )
5081
            {
5230
            {
5082
                $fn = '$(LOCALDIR)/' . $ufn ;
5231
                $fn = '$(LOCALDIR)/' . $ufn ;
5083
                UniquePush (\@preq_files, $fn);
5232
                UniquePush (\@preq_files, $fn);
5084
            }
5233
            }
-
 
5234
            elsif ( $cmd =~ /^Dir/ )
-
 
5235
            {
-
 
5236
                # Item is a directory.
-
 
5237
                # Must be massaged so that it will be correct within the context
-
 
5238
                # Modified path is simply added to the command line
-
 
5239
                # 
-
 
5240
                $fn = $ufn;
-
 
5241
                unless (-d $fn) {
-
 
5242
                    if (-f $fn) {
-
 
5243
                        Warning ("Not a directory. Its a file: $arg") ;
-
 
5244
                    } else {
-
 
5245
                        Warning ("Directory not found: $arg");
-
 
5246
                    }
-
 
5247
                }
-
 
5248
            }
5085
            else
5249
            else
5086
            {
5250
            {
5087
                Warning ("RunTest: Unknown replacement command: $cmd");
5251
                Warning ("RunTest: Unknown replacement command: $cmd");
5088
                $fn = $ufn;
5252
                $fn = $ufn;
5089
            }
5253
            }
Line 5497... Line 5661...
5497
            push @tool_options, $_;
5661
            push @tool_options, $_;
5498
        }
5662
        }
5499
    }
5663
    }
5500
 
5664
 
5501
    #
5665
    #
-
 
5666
    #   Validate some of the arguments
-
 
5667
    #   Ensure has not specified both --Prod and --Debug
-
 
5668
    #
-
 
5669
    Error ("Makeproject. Conflicting options --Debug and --Prod" )
-
 
5670
        if ( $PROJECTS{$proj}{'Debug'}  && $PROJECTS{$proj}{'Prod'} );
-
 
5671
 
-
 
5672
    #   Ensure that global --OnlyProd/Debug don't prevent builds
-
 
5673
    $PROJECTS{$proj}{'Debug'} = 1 if ($ScmBuildType eq 'D');
-
 
5674
    $PROJECTS{$proj}{'Prod'} = 1 if ($ScmBuildType eq 'P');
-
 
5675
    Error ("Makeproject. Global and Local options --Debug and --Prod prevent project being built" )
-
 
5676
        if ( $PROJECTS{$proj}{'Debug'}  && $PROJECTS{$proj}{'Prod'} );
-
 
5677
 
-
 
5678
    #
5502
    #   Save the information
5679
    #   Save the information
5503
    #
5680
    #
5504
    $PROJECTS{$proj}{'options'} = \@tool_options;
5681
    $PROJECTS{$proj}{'options'} = \@tool_options;
5505
    $PROJECTS{$proj}{'name'} = $proj;
5682
    $PROJECTS{$proj}{'name'} = $proj;
5506
    $PROJECTS{$proj}{'project'} = $project;
5683
    $PROJECTS{$proj}{'project'} = $project;
5507
    $PROJECTS{$proj}{'basedir'} = $basedir;
5684
    $PROJECTS{$proj}{'basedir'} = $basedir;
5508
    $PROJECTS{$proj}{'unittest'} = $unit_tests if ( $unit_tests );
5685
    $PROJECTS{$proj}{'unittest'} = $unit_tests if ( $unit_tests );
5509
    $PROJECTS{$proj}{'autotest'} = $auto_tests if ( $auto_tests );
5686
    $PROJECTS{$proj}{'autotest'} = $auto_tests if ( $auto_tests );
5510
    UniquePush (\@PROJECTS_ORDER, $proj);
5687
    UniquePush (\@PROJECTS_ORDER, $proj);
5511
 
5688
 
5512
    #
-
 
5513
    #   Validate some of the arguments
-
 
5514
    #
-
 
5515
    Error ("Makeproject. Conflicting options --Debug and --Prod" )
-
 
5516
        if ( $PROJECTS{$proj}{'Debug'}  && $PROJECTS{$proj}{'Prod'} );
-
 
5517
}
5689
}
5518
 
5690
 
5519
#-------------------------------------------------------------------------------
5691
#-------------------------------------------------------------------------------
5520
# Function        : _PackageFromProject
5692
# Function        : _PackageFromProject
5521
#
5693
#
Line 5645... Line 5817...
5645
#                                          --UnitTest=<name>
5817
#                                          --UnitTest=<name>
5646
#                                               Supports unit test
5818
#                                               Supports unit test
5647
#                                               by calling build target <name>
5819
#                                               by calling build target <name>
5648
#                                          --PackageBase
5820
#                                          --PackageBase
5649
#                                               Provides path to base of all packages
5821
#                                               Provides path to base of all packages
-
 
5822
#                                          --AllPackages
-
 
5823
#                                               Provide paths to both LinkPkgArchive and BuildPkgArchive
5650
#
5824
#
5651
# Returns         :
5825
# Returns         :
5652
#
5826
#
5653
our %JAR_FILES;
5827
our %JAR_FILES;
5654
sub MakeAnt
5828
sub MakeAnt
Line 5681... Line 5855...
5681
    my @tool_options;
5855
    my @tool_options;
5682
    my @generated;
5856
    my @generated;
5683
    my $unit_tests;
5857
    my $unit_tests;
5684
    my $auto_tests;
5858
    my $auto_tests;
5685
    my $package_base;
5859
    my $package_base;
-
 
5860
    my $allPackages;
5686
 
5861
 
5687
    foreach ( @elements )
5862
    foreach ( @elements )
5688
    {
5863
    {
5689
        if ( m/^--Debug/ ) {
5864
        if ( m/^--Debug/ ) {
5690
            $PROJECTS{$proj}{'Debug'} = 1;
5865
            $PROJECTS{$proj}{'Debug'} = 1;
Line 5712... Line 5887...
5712
            $auto_tests = $1
5887
            $auto_tests = $1
5713
 
5888
 
5714
        } elsif ( m/^--PackageBase/ ) {
5889
        } elsif ( m/^--PackageBase/ ) {
5715
            $package_base = 1;
5890
            $package_base = 1;
5716
 
5891
 
-
 
5892
        } elsif ( m/^--AllPackages/i ) {
-
 
5893
            $allPackages = 1;
5717
            
5894
            
5718
        } elsif ( m/^--/ ) {
5895
        } elsif ( m/^--/ ) {
5719
            Error("MakeAnt. Unknown option ignored: $_");
5896
            Error("MakeAnt. Unknown option ignored: $_");
5720
 
5897
 
5721
        } else {
5898
        } else {
Line 5725... Line 5902...
5725
 
5902
 
5726
    #
5903
    #
5727
    #   Extend option arguments to include the base dir of packages
5904
    #   Extend option arguments to include the base dir of packages
5728
    #   Create definitions of the form PACKAGE_<name>
5905
    #   Create definitions of the form PACKAGE_<name>
5729
    #
5906
    #
5730
    for my $entry (@{$::ScmBuildPkgRules{$ScmPlatform} })
5907
    for my $entry (getPackageList())
5731
    {
5908
    {
-
 
5909
        my $pkgType = $entry->getType();
-
 
5910
        next if $pkgType eq 'interface'  ;
5732
        next unless ( $entry->{'TYPE'} eq 'link' );
5911
        next unless ( ( $pkgType eq 'link') || $allPackages);
5733
        my $dir = $entry->{'ROOT'};
5912
        my $dir = $entry->getBase(2);
5734
        my $name = $entry->{'NAME'};
5913
        my $name = $entry->getName();
5735
        unless ( $package_base )
5914
        unless ( $package_base )
5736
        {
5915
        {
5737
            $dir .= '/jar';
5916
            $dir .= '/jar';
5738
            next unless ( -d $dir );
5917
            next unless ( -d $dir );
5739
        }
5918
        }
5740
        push @tool_options, "-DPACKAGE_$name=$dir";
5919
        push @tool_options, "-DPACKAGE_$name=\$(call myabspath,$dir)";
5741
    }
5920
    }
5742
    #
5921
    #
5743
    #   Extend options to include the base dir of the created package
5922
    #   Extend options to include the base dir of the created package
5744
    #   Allows careful use for direct packaging of artifacts
5923
    #   Allows careful use for direct packaging of artifacts
5745
    #
5924
    #
5746
    push @tool_options, '-DPACKAGEDIR=$(PWD)/$(PKGDIR)';
5925
    push @tool_options, '-DPACKAGEDIR=$(call myabspath,$(PKGDIR))';
5747
 
5926
 
5748
    #
5927
    #
5749
    #   Save the information
5928
    #   Save the information
5750
    #
5929
    #
5751
    $PROJECTS{$proj}{'options'} = \@tool_options;
5930
    $PROJECTS{$proj}{'options'} = \@tool_options;
Line 5947... Line 6126...
5947
        }
6126
        }
5948
 
6127
 
5949
        if ($flags & $T_PKG) {
6128
        if ($flags & $T_PKG) {
5950
            $dir = __PkgDir( $udir );
6129
            $dir = __PkgDir( $udir );
5951
        } else {
6130
        } else {
5952
            $dir = "\$(LOCALDIR)/$udir";
6131
            $dir = $base . "/" . $udir;
5953
        }
6132
        }
5954
    }
6133
    }
5955
 
6134
 
5956
    return ($consumed) if ($dir eq "");
6135
    return ($consumed) if ($dir eq "");
5957
    $dir =~ s~//~/~g;
6136
    $dir =~ s~//~/~g;
Line 6411... Line 6590...
6411
    my( $name, $stripCount) = @_;
6590
    my( $name, $stripCount) = @_;
6412
 
6591
 
6413
    if ($stripCount)
6592
    if ($stripCount)
6414
    {
6593
    {
6415
        $name =~ s~\\~/~g;
6594
        $name =~ s~\\~/~g;
6416
        $name =~ s~//~~g;
6595
        $name =~ s~//~/~g;
6417
 
6596
 
6418
        my @items = split('/', $name);
6597
        my @items = split('/', $name);
6419
        if ($stripCount > 0)
6598
        if ($stripCount > 0)
6420
        {
6599
        {
6421
            my $len = scalar @items;
6600
            my $len = scalar @items;
Line 6457... Line 6636...
6457
            if ( ! exists $PACKAGE_SETS{ $_ }{'TAG'} );
6636
            if ( ! exists $PACKAGE_SETS{ $_ }{'TAG'} );
6458
    }
6637
    }
6459
}
6638
}
6460
 
6639
 
6461
#-------------------------------------------------------------------------------
6640
#-------------------------------------------------------------------------------
-
 
6641
# Function        : PackageDir 
-
 
6642
#                   InstallDir
-
 
6643
#
-
 
6644
# Description     : Directive to package an entire directory tree
-
 
6645
#                   Will package the contents of the directory without regard as to there content
-
 
6646
#                   
-
 
6647
#                   Differs from PackageFile (... --DirTree ) in that the process is dynamic
-
 
6648
#                   It will support the packaging of files that are generated
-
 
6649
#                   
-
 
6650
#                   NOT intended to support the JATS BIN and LIB structure
-
 
6651
#                   It knows nothing of these types of files
-
 
6652
#
-
 
6653
# Inputs          : platforms   - Active platform list
-
 
6654
#                   Options:    - Many from PackageFile
-
 
6655
#                       --DirTree=xxx   Source Tree [Mandatory]
-
 
6656
#                       --Subdir=yyy    Target [ Mandatory]
-
 
6657
#
-
 
6658
sub PackageDir { 
-
 
6659
    return if ( !$ScmPackage );                 # Packaging enabled ?
-
 
6660
    _PackageInstallDir('PackageDir', 'PBase', \@PACKAGE_DIRS, @_);
-
 
6661
    }
-
 
6662
 
-
 
6663
sub InstallDir { 
-
 
6664
    Warning ("InstallDir: Needs local directory specified in build.pl") unless ( $::ScmLocal );
-
 
6665
    _PackageInstallDir('InstallDir', 'IBase', \@INSTALL_DIRS, @_);
-
 
6666
    }
-
 
6667
 
-
 
6668
sub _PackageInstallDir
-
 
6669
{
-
 
6670
    my( $cmdName, $tbase, $dirRef, $platforms, @elements ) = @_;
-
 
6671
    my( $base, $dir, $path, $type );
-
 
6672
    my %data;
-
 
6673
 
-
 
6674
    Debug2( "$cmdName($platforms, @elements)" );
-
 
6675
 
-
 
6676
    return if ( ! ActivePlatform($platforms) );
-
 
6677
 
-
 
6678
#.. Arguments
-
 
6679
#
-
 
6680
    $base = $PackageInfo{'File'}{$tbase};           # Base of target
-
 
6681
    $dir = $base . $PackageInfo{'File'}{'Dir'};     # Installation path (default)
-
 
6682
 
-
 
6683
    foreach ( @elements )
-
 
6684
    {
-
 
6685
        my $rv = __TargetDir($T_MACH|$T_GBE|$T_FILE, $base, $_, \$dir, \$type);
-
 
6686
        next if ( $rv == 1 );
-
 
6687
        return if ( $rv == 2 );
-
 
6688
 
-
 
6689
        if (/^--Executable$/) {                  # Mark the file as executable
-
 
6690
            $data{exefile} = "X";
-
 
6691
 
-
 
6692
        } elsif (/^--PreserveSymlink/i) {        # Preserve symlink to local file
-
 
6693
            delete $data{noPreserveSymlink};
-
 
6694
 
-
 
6695
        } elsif (/^--NoPreserveSymlink/i) {      # Preserve symlink to local file
-
 
6696
            $data{noPreserveSymlink} = 1;
-
 
6697
 
-
 
6698
        } elsif ( /^--DirTree=(.*)/ ) {
-
 
6699
            Error("DirTree. Multiple directories not allowed.") if ( $data{dirTree} );
-
 
6700
            $data{dirTree} =  $1;
-
 
6701
 
-
 
6702
        } elsif ( /^--FilterOut=(.*)/ ) {
-
 
6703
            push @{$data{exclude}}, $1;
-
 
6704
 
-
 
6705
        } elsif ( /^--FilterIn=(.*)/ ) {
-
 
6706
            push @{$data{include}}, $1;
-
 
6707
 
-
 
6708
        } elsif ( /^--FilterOutRe=(.*)/ ) {
-
 
6709
            push @{$data{excludeRe}}, $1;
-
 
6710
 
-
 
6711
        } elsif ( /^--FilterInRe=(.*)/ ) {
-
 
6712
            push @{$data{includeRe}}, $1;
-
 
6713
 
-
 
6714
        } elsif ( /^--StripDir/ ) {
-
 
6715
            $data{strip_base} = 1;
-
 
6716
 
-
 
6717
        } elsif ( m/^--Recurse/ ) {
-
 
6718
            delete $data{noRecurse};
-
 
6719
 
-
 
6720
        } elsif ( m/^--NoRecurse/ ) {
-
 
6721
            $data{noRecurse} = 1;
-
 
6722
 
-
 
6723
        } elsif (/^--(.*)/) {
-
 
6724
            Message( "$cmdName: unknown option $_ -- ignored\n" );
-
 
6725
        }
-
 
6726
    }
-
 
6727
    Error("DirTree. No path specified") unless ( defined($data{dirTree}) && $data{dirTree} ne "" );
-
 
6728
    Debug2( "$cmdName. Raw DirTree: $data{dirTree}" );
-
 
6729
 
-
 
6730
    # Prevent the user from escaping from the current directory
-
 
6731
    Error("$cmdName. Absolute paths are not allowed",
-
 
6732
          "Directory: $data{dirTree}") if ( $data{dirTree} =~ m~^/~ || $data{dirTree} =~ m~^.\:~ );
-
 
6733
 
-
 
6734
    #
-
 
6735
    #   Convert the relative path to one that is truely relative to the current
-
 
6736
    #   directory. This may occur when the user uses $ProjectBase
-
 
6737
    #
-
 
6738
    my $abs_dir_tree = AbsPath($data{dirTree});
-
 
6739
    $data{dirTree} = RelPath($abs_dir_tree);
-
 
6740
 
-
 
6741
    #
-
 
6742
    #   Ensure that the user is not trying to escape the package
-
 
6743
    #   Don't allow the user to attempt to package the entire package either
-
 
6744
    #
-
 
6745
    #   Calculate the relative path from $ProjectBase to the target directory
-
 
6746
    #   It must not be above the $ProjectBase 
-
 
6747
    #
-
 
6748
    if ( $data{dirTree} =~ m~^\.\.~)
-
 
6749
    {
-
 
6750
        my $dirFromBase = RelPath($abs_dir_tree, AbsPath($ProjectBase));
-
 
6751
        Error("$cmdName. DirTree cannot extend outside current package.",
-
 
6752
              "Directory: $dirFromBase") if ( $dirFromBase =~ m~\.\.~ );
-
 
6753
        Error("$cmdName. DirTree cannot package entire package.",
-
 
6754
            "Directory: $dirFromBase") if ( $dirFromBase eq '.' );
-
 
6755
    }
-
 
6756
 
-
 
6757
    Debug( "$cmdName( $data{dirTree}");
-
 
6758
    $data{dir} = $dir;
-
 
6759
    $data{type} = $type if defined $type;
-
 
6760
    #DebugDumpData("$cmdName", \%data);
-
 
6761
    push @{$dirRef}, \%data;
-
 
6762
}
-
 
6763
 
-
 
6764
#-------------------------------------------------------------------------------
6462
# Function        : PackageFile
6765
# Function        : PackageFile
6463
#
6766
#
6464
# Description     : Directive to package files
6767
# Description     : Directive to package files
6465
#                   Not to be used to package libraries, executables, headers
6768
#                   Not to be used to package libraries, executables, headers
6466
#                   as this should be done by specialised directives
6769
#                   as this should be done by specialised directives
Line 6513... Line 6816...
6513
            $dist = "$1";
6816
            $dist = "$1";
6514
 
6817
 
6515
        } elsif (/^--Strip$/) {                 # Strip path from source files
6818
        } elsif (/^--Strip$/) {                 # Strip path from source files
6516
            $strip = -1;
6819
            $strip = -1;
6517
 
6820
 
6518
        } elsif (/^--Strip=(\d+)$/) {                 # Strip path from source files
6821
        } elsif (/^--Strip=(\d+)$/) {           # Strip path from source files
6519
            $strip = $1;
6822
            $strip = $1;
6520
 
6823
 
6521
        } elsif (/^--Executable$/) {            # Mark the file as executable
6824
        } elsif (/^--Executable$/) {            # Mark the file as executable
6522
            $exefile = "X";
6825
            $exefile = "X";
6523
 
6826
 
Line 6605... Line 6908...
6605
        if ($strip_base){
6908
        if ($strip_base){
6606
            $strip_base = length( $dir_tree ) if ( $strip_base );
6909
            $strip_base = length( $dir_tree ) if ( $strip_base );
6607
        } elsif ($strip_dots) {
6910
        } elsif ($strip_dots) {
6608
            $strip_base = $strip_dots;
6911
            $strip_base = $strip_dots;
6609
        }
6912
        }
-
 
6913
    } else {
-
 
6914
        $strip_base = 0;
6610
    }
6915
    }
6611
 
6916
 
6612
#.. Files
6917
#.. Files
6613
#
6918
#
6614
    foreach ( @elements )
6919
    foreach ( @elements )
Line 6666... Line 6971...
6666
 
6971
 
6667
            #
6972
            #
6668
            #   Sanity test the source filename
6973
            #   Sanity test the source filename
6669
            #   User may have misused an option
6974
            #   User may have misused an option
6670
            #
6975
            #
6671
            if ( ( $srcfile =~ m/=/ ) || ( $srcfile =~ m/^-/ ) || ( $srcfile =~ m~/-~ )  )
6976
            if ( !$dir_tree && ( ( $srcfile =~ m/=/ ) || ( $srcfile =~ m/^-/ ) || ( $srcfile =~ m~/-~ ))  )
6672
            {
6977
            {
6673
               Warning ("PackageFile: Suspect source filename: $srcfile");
6978
               Warning ("PackageFile: Suspect source filename: $srcfile");
6674
            }
6979
            }
6675
 
6980
 
6676
            Debug( "PackageFile( $dir/$name, " .
6981
            Debug( "PackageFile( $dir/$name, " .
Line 8122... Line 8427...
8122
    if (scalar @found > 1)
8427
    if (scalar @found > 1)
8123
    {
8428
    {
8124
        Warning("Duplicates for '$source'. Using the first", @found);
8429
        Warning("Duplicates for '$source'. Using the first", @found);
8125
    }
8430
    }
8126
 
8431
 
8127
    return $found[0] || "";
8432
    return $found[0] || $source;
8128
}
8433
}
8129
 
8434
 
8130
#-------------------------------------------------------------------------------
8435
#-------------------------------------------------------------------------------
8131
# Function        : MakeSrcResolve
8436
# Function        : MakeSrcResolve
8132
#
8437
#
Line 8157... Line 8462...
8157
 
8462
 
8158
    } elsif ( exists $SRCS{$name} ) {
8463
    } elsif ( exists $SRCS{$name} ) {
8159
        $file = $SRCS{$name};
8464
        $file = $SRCS{$name};
8160
 
8465
 
8161
    } else {
8466
    } else {
8162
        $file = MakeResolve( \@SRCDIRS, @_ )
8467
        $file = MakeResolve( \@SRCDIRS, @_ );
8163
    }
8468
    }
8164
    return $file;
8469
    return $file;
8165
}
8470
}
8166
 
8471
 
8167
 
8472
 
Line 8725... Line 9030...
8725
    #   Auto package the 'descpkg' file
9030
    #   Auto package the 'descpkg' file
8726
    #   If this makefile packages any files, then it can also package the descpkg file
9031
    #   If this makefile packages any files, then it can also package the descpkg file
8727
    #   The descpkg will be piggybacked into all makefiles that do a package
9032
    #   The descpkg will be piggybacked into all makefiles that do a package
8728
    #
9033
    #
8729
    if ( %PACKAGE_FILES || %PACKAGE_HDRS || %PACKAGE_CLSS || %PACKAGE_LIBS
9034
    if ( %PACKAGE_FILES || %PACKAGE_HDRS || %PACKAGE_CLSS || %PACKAGE_LIBS
8730
                        || %PACKAGE_SHLIBS || %PACKAGE_PROGS )
9035
                        || %PACKAGE_SHLIBS || %PACKAGE_PROGS || @PACKAGE_DIRS )
8731
    {
9036
    {
8732
        Src ('*', 'descpkg') unless ($SRCS{ descpkg });
9037
        Src ('*', 'descpkg') unless ($SRCS{ descpkg });
8733
        PackageFile ('*', 'descpkg');
9038
        PackageFile ('*', 'descpkg');
8734
    }
9039
    }
8735
 
9040
 
Line 8867... Line 9172...
8867
		clean unbuild clobber deploy
9172
		clean unbuild clobber deploy
8868
 
9173
 
8869
default:
9174
default:
8870
all:		install package deploy
9175
all:		install package deploy
8871
build:		make_init generate install_hdr depend make_lib \\
9176
build:		make_init generate install_hdr depend make_lib \\
8872
		install_lib make_install_shlib make_prog install_class
9177
		install_lib make_install_shlib make_prog install_class install_dirs
8873
install:	build install_prog
9178
install:	build install_prog
8874
package:	package_files package_hdr package_lib package_shlib package_prog \\
9179
package:	package_dirs package_files package_hdr package_lib package_shlib \\
8875
		package_class
9180
		package_prog package_class
8876
unpackage:	unpackage_class unpackage_prog unpackage_shlib \\
9181
unpackage:	unpackage_class unpackage_prog unpackage_shlib \\
8877
		unpackage_lib unpackage_hdr unpackage_files
9182
		unpackage_lib unpackage_hdr unpackage_files unpackage_dirs 
8878
uninstall:	uninstall_class uninstall_prog uninstall_shlib \\
9183
uninstall:	uninstall_dirs uninstall_class uninstall_prog uninstall_shlib \\
8879
		uninstall_lib uninstall_hdr
9184
		uninstall_lib uninstall_hdr
8880
clean:		make_clean unmake_prog unmake_test unmake_lib unobj \\
9185
clean:		make_clean unmake_prog unmake_test unmake_lib unobj \\
8881
		undepend ungenerate rmlitter unmake_dir
9186
		undepend ungenerate rmlitter unmake_dir
8882
unbuild:	clean uninstall
9187
unbuild:	clean uninstall
8883
clobber:	unpackage unbuild
9188
clobber:	unpackage unbuild
Line 8944... Line 9249...
8944
    MakeHeader ("Tool Search Path",
9249
    MakeHeader ("Tool Search Path",
8945
                "Extend the PATH seen by all the tools to include",
9250
                "Extend the PATH seen by all the tools to include",
8946
                "The tools/bin directories discovered in Packages" );
9251
                "The tools/bin directories discovered in Packages" );
8947
    my $put_PATH;
9252
    my $put_PATH;
8948
    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
 
8949
    for my $path ( ToolExtensionPaths() )
9258
    for my $path ( ToolExtensionPaths() )
8950
    {
9259
    {
8951
        MakePrint( "PATH := $path$::ScmPathSep\$(PATH)\n" );
9260
        MakePrint( "PATH := $path$::ScmPathSep\$(PATH)\n" );
8952
        $put_PATH = 1;
9261
        $put_PATH = 1;
8953
 
9262
 
Line 9554... Line 9863...
9554
        #   Export GBE_UTF... for the duration of the test
9863
        #   Export GBE_UTF... for the duration of the test
9555
        #
9864
        #
9556
        $me->AddDefn('export GBE_UTFNAME', $pEntry->{'utfname'});
9865
        $me->AddDefn('export GBE_UTFNAME', $pEntry->{'utfname'});
9557
        $me->AddDefn('export GBE_UTFUID', '$(MAKEFILEUID)' . '_' . $pEntry->{'index'});
9866
        $me->AddDefn('export GBE_UTFUID', '$(MAKEFILEUID)' . '_' . $pEntry->{'index'});
9558
        $me->AddDefn('export GBE_UTFFILE','$(UTFDIR_PKG)/$(GBE_PLATFORM)-$(GBE_TYPE)-$(GBE_UTFUID)' . '.xml');
9867
        $me->AddDefn('export GBE_UTFFILE','$(UTFDIR_PKG)/$(GBE_PLATFORM)-$(GBE_TYPE)-$(GBE_UTFUID)' . '.xml');
-
 
9868
        $me->AddDefn('export GBE_UTFTEST','TEST-$(GBE_UTFNAME)-$(GBE_TYPE)-$(GBE_UTFUID)' );
-
 
9869
 
-
 
9870
        #
-
 
9871
        #   A bit of a kludge for 'googletest'
-
 
9872
        #       If we have another kludge like then then consider placing this work into a module based on the filter name
-
 
9873
        #       with some sort of interface to allow the ENVvars and format and command line args to be massaged
-
 
9874
        #       
-
 
9875
        #   For googletest
-
 
9876
        #       Set EnvVar and then prost process with junit
-
 
9877
        #
-
 
9878
        if ($pEntry->{'utfformat'})
-
 
9879
        {
-
 
9880
            if ($pEntry->{'utfformat'} eq 'gtest') {
-
 
9881
                $pEntry->{'utfformat'} = 'junit';
-
 
9882
                $me->AddDefn('export GTEST_OUTPUT ', 'xml:${GBE_UTFTEST}.xml');
-
 
9883
            }
-
 
9884
        }
9559
 
9885
 
9560
        # Workaround for dirsep under windows when being wrapped in a timeout
9886
        # Workaround for dirsep under windows when being wrapped in a timeout
9561
        $me->AddDefn('dirsep', '$(dirsep)$(dirsep)') if ($timeout && ($::ScmHost ne "Unix"));
9887
        $me->AddDefn('dirsep', '$(dirsep)$(dirsep)') if ($timeout && ($::ScmHost ne "Unix"));
9562
 
9888
 
9563
        $me->AddDependancy( "\$(GBE_$tdir_alias)" );
9889
        $me->AddDependancy( "\$(GBE_$tdir_alias)" );
Line 9726... Line 10052...
9726
    MakePrint ("\n.PHONY: phony_generate\n\n" );
10052
    MakePrint ("\n.PHONY: phony_generate\n\n" );
9727
    
10053
    
9728
    foreach my $i ( @GENERATE_FILES )
10054
    foreach my $i ( @GENERATE_FILES )
9729
    {
10055
    {
9730
        my $gen_tag = $i->{'index'};
10056
        my $gen_tag = $i->{'index'};
-
 
10057
        #
-
 
10058
        #   Generate user-provided recipe names to allow the rule to be called by name.
-
 
10059
        #
-
 
10060
        my $recipeTag = $i->{'recipeTag'} || '';
-
 
10061
        my $recipeName = '';
-
 
10062
        my $recipeCleanName = '';
-
 
10063
 
-
 
10064
        if ($recipeTag) {
-
 
10065
            $recipeName = $recipeTag;
-
 
10066
            $recipeCleanName = 'clean_' . $recipeTag;
-
 
10067
 
-
 
10068
            # for 'jats make help'
-
 
10069
            $ScmRecipeTags{$recipeTag} = defined $i->{'clean'} ? 1 : 0;
-
 
10070
 
-
 
10071
            MakePrint( ".PHONY: $recipeName $recipeCleanName\n"); 
-
 
10072
        }
9731
 
10073
 
9732
        #
10074
        #
9733
        #   If predelete is enabled, then create a list of files to delete
10075
        #   If predelete is enabled, then create a list of files to delete
9734
        #
10076
        #
9735
        if ( $i->{'predelete'}  )
10077
        if ( $i->{'predelete'}  )
Line 9741... Line 10083...
9741
 
10083
 
9742
        #
10084
        #
9743
        #   Generate the basic generate rule and recipe
10085
        #   Generate the basic generate rule and recipe
9744
        #   together with the prerequisites
10086
        #   together with the prerequisites
9745
        #
10087
        #
9746
        MakeEntry ( "", ":", "", " ", @{$i->{'gen'}} );
10088
        MakeEntry ( "", ":", "", " ", @{$i->{'gen'}}, $recipeName );
9747
 
10089
 
9748
        unless ( $i->{'clean'} && $i->{'shell'} )
10090
        unless ( $i->{'clean'} && $i->{'shell'} )
9749
        {
10091
        {
9750
            MakeEntry ( "", "", " \\\n\t\t", "", @{$i->{'preq'}} );
10092
            MakeEntry ( "", "", " \\\n\t\t", "", @{$i->{'preq'}} );
9751
            MakeEntry ( "", "", " \\\n\t\t", "", "phony_generate" ) if $i->{'preq_sus'};
10093
            MakeEntry ( "", "", " \\\n\t\t", "", "phony_generate" ) if $i->{'preq_sus'};
Line 9763... Line 10105...
9763
        #   Generate 'clean' rules and recipes
10105
        #   Generate 'clean' rules and recipes
9764
        #
10106
        #
9765
        if ( $i->{'clean'} )
10107
        if ( $i->{'clean'} )
9766
        {
10108
        {
9767
            MakePrint ("\n\nPHONY: clean_generate_$gen_tag" );
10109
            MakePrint ("\n\nPHONY: clean_generate_$gen_tag" );
9768
            MakePrint ("\nclean_generate_$gen_tag:" );
10110
            MakePrint ("\nclean_generate_$gen_tag $recipeCleanName:" );
9769
            MakePrint ("\n\t" . "\$(XX_PRE)-\$(call generate_$gen_tag,$i->{'clean'})" );
10111
            MakePrint ("\n\t" . "\$(XX_PRE)-\$(call generate_$gen_tag,$i->{'clean'})" );
9770
        }
10112
        }
9771
 
10113
 
9772
        #
10114
        #
9773
        #   Define a function to contain the body of the generation call
10115
        #   Define a function to contain the body of the generation call
Line 10264... Line 10606...
10264
 
10606
 
10265
#-------------------------------------------------------------------------------
10607
#-------------------------------------------------------------------------------
10266
#   Installations
10608
#   Installations
10267
 
10609
 
10268
MakeHeader ("Installations");
10610
MakeHeader ("Installations");
10269
PackageRule ( \&InstallCmd, \%INSTALL_HDRS  );
10611
PackageRule    ( \&InstallCmd, \%INSTALL_HDRS  );
10270
PackageRule ( \&InstallCmd, \%INSTALL_CLSS  );
10612
PackageRule    ( \&InstallCmd, \%INSTALL_CLSS  );
10271
PackageRule ( \&InstallCmd, \%INSTALL_LIBS  );
10613
PackageRule    ( \&InstallCmd, \%INSTALL_LIBS  );
10272
PackageRule ( \&InstallCmd, \%INSTALL_SHLIBS  );
10614
PackageRule    ( \&InstallCmd, \%INSTALL_SHLIBS  );
10273
PackageRule ( \&InstallCmd, \%INSTALL_PROGS  );
10615
PackageRule    ( \&InstallCmd, \%INSTALL_PROGS  );
10274
 
-
 
-
 
10616
PackageDirRule ('install_dirs',    \@INSTALL_DIRS);
10275
 
10617
 
10276
#-------------------------------------------------------------------------------
10618
#-------------------------------------------------------------------------------
10277
#   Packaging
10619
#   Packaging
10278
#
10620
#
10279
MakeHeader ("Packaging");
10621
MakeHeader ("Packaging");
10280
PackageRule ( \&PackageCmd, \%PACKAGE_FILES );
10622
PackageRule    ( \&PackageCmd, \%PACKAGE_FILES );
10281
PackageRule ( \&PackageCmd, \%PACKAGE_HDRS );
10623
PackageRule    ( \&PackageCmd, \%PACKAGE_HDRS );
10282
PackageRule ( \&PackageCmd, \%PACKAGE_CLSS );
10624
PackageRule    ( \&PackageCmd, \%PACKAGE_CLSS );
10283
PackageRule ( \&PackageCmd, \%PACKAGE_LIBS );
10625
PackageRule    ( \&PackageCmd, \%PACKAGE_LIBS );
10284
PackageRule ( \&PackageCmd, \%PACKAGE_SHLIBS );
10626
PackageRule    ( \&PackageCmd, \%PACKAGE_SHLIBS );
10285
PackageRule ( \&PackageCmd, \%PACKAGE_PROGS );
10627
PackageRule    ( \&PackageCmd, \%PACKAGE_PROGS );
-
 
10628
PackageDirRule ('package_dirs', \@PACKAGE_DIRS);
10286
 
10629
 
10287
#-------------------------------------------------------------------------------
10630
#-------------------------------------------------------------------------------
10288
#   Uninstall/unpackaging
10631
#   Uninstall/unpackaging
10289
#
10632
#
10290
MakeHeader ("Uninstall/unpackaging");
10633
MakeHeader ("Uninstall/unpackaging");
10291
 
10634
 
10292
UnpackageRule( "uninstall_hdr",         \&UninstallCmd, \%INSTALL_HDRS );
10635
UnpackageRule  ( 'uninstall_hdr',         \&UninstallCmd, \%INSTALL_HDRS );
10293
UnpackageRule( "uninstall_lib",         \&UninstallCmd, \%INSTALL_LIBS );
10636
UnpackageRule  ( 'uninstall_lib',         \&UninstallCmd, \%INSTALL_LIBS );
10294
UnpackageRule( "uninstall_shlib",       \&UninstallCmd, \%INSTALL_SHLIBS );
10637
UnpackageRule  ( 'uninstall_shlib',       \&UninstallCmd, \%INSTALL_SHLIBS );
10295
UnpackageRule( "uninstall_prog",        \&UninstallCmd, \%INSTALL_PROGS );
10638
UnpackageRule  ( 'uninstall_prog',        \&UninstallCmd, \%INSTALL_PROGS );
10296
UnpackageRule( "uninstall_class",       \&UninstallCmd, \%INSTALL_CLSS );
10639
UnpackageRule  ( 'uninstall_class',       \&UninstallCmd, \%INSTALL_CLSS );
-
 
10640
PackageDirRule ( 'uninstall_dirs',        \@INSTALL_DIRS);
10297
 
10641
 
10298
UnpackageRule( "unpackage_files",       \&UnpackageCmd, \%PACKAGE_FILES );
10642
UnpackageRule  ( 'unpackage_files',       \&UnpackageCmd, \%PACKAGE_FILES );
10299
UnpackageRule( "unpackage_hdr",         \&UnpackageCmd, \%PACKAGE_HDRS );
10643
UnpackageRule  ( 'unpackage_hdr',         \&UnpackageCmd, \%PACKAGE_HDRS );
10300
UnpackageRule( "unpackage_lib",         \&UnpackageCmd, \%PACKAGE_LIBS );
10644
UnpackageRule  ( 'unpackage_lib',         \&UnpackageCmd, \%PACKAGE_LIBS );
10301
UnpackageRule( "unpackage_shlib",       \&UnpackageCmd, \%PACKAGE_SHLIBS );
10645
UnpackageRule  ( 'unpackage_shlib',       \&UnpackageCmd, \%PACKAGE_SHLIBS );
10302
UnpackageRule( "unpackage_prog",        \&UnpackageCmd, \%PACKAGE_PROGS );
10646
UnpackageRule  ( 'unpackage_prog',        \&UnpackageCmd, \%PACKAGE_PROGS );
10303
UnpackageRule( "unpackage_class",       \&UnpackageCmd, \%PACKAGE_CLSS );
10647
UnpackageRule  ( 'unpackage_class',       \&UnpackageCmd, \%PACKAGE_CLSS );
-
 
10648
PackageDirRule ( 'unpackage_dirs',        \@PACKAGE_DIRS);
10304
 
10649
 
10305
#-------------------------------------------------------------------------------
10650
#-------------------------------------------------------------------------------
10306
#   Distribution Sets
10651
#   Distribution Sets
10307
#
10652
#
10308
MakeHeader ("Distribution Sets");
10653
MakeHeader ("Distribution Sets");
Line 10354... Line 10699...
10354
    Maketag( "process_tests",       @TOOLSET_UTF_PRE || @TOOLSET_UTF_POST || @TOOLSET_UTF_COLLATE);
10699
    Maketag( "process_tests",       @TOOLSET_UTF_PRE || @TOOLSET_UTF_POST || @TOOLSET_UTF_COLLATE);
10355
    Maketag( "install_hdr",         %INSTALL_HDRS );
10700
    Maketag( "install_hdr",         %INSTALL_HDRS );
10356
    Maketag( "install_class",       %INSTALL_CLSS );
10701
    Maketag( "install_class",       %INSTALL_CLSS );
10357
    Maketag( "install_lib",         %INSTALL_LIBS );
10702
    Maketag( "install_lib",         %INSTALL_LIBS );
10358
    Maketag( "install_prog",        %INSTALL_PROGS );
10703
    Maketag( "install_prog",        %INSTALL_PROGS );
-
 
10704
    Maketag( "install_dirs",        @INSTALL_DIRS );
10359
    Maketag( "deploy",              %DEPLOYPACKAGE );
10705
    Maketag( "deploy",              %DEPLOYPACKAGE );
10360
    Maketag( "package",             %PACKAGE_FILES || %PACKAGE_HDRS || %PACKAGE_CLSS ||
10706
    Maketag( "package",             %PACKAGE_FILES || %PACKAGE_HDRS || %PACKAGE_CLSS ||
10361
                                    %PACKAGE_LIBS || %PACKAGE_SHLIBS || %PACKAGE_PROGS );
10707
                                    %PACKAGE_LIBS || %PACKAGE_SHLIBS || %PACKAGE_PROGS );
10362
 
10708
 
10363
    #
10709
    #
Line 10396... Line 10742...
10396
# Description     : Escape/Quote a pathname for make
10742
# Description     : Escape/Quote a pathname for make
10397
#                       Allow files with a $ in the name
10743
#                       Allow files with a $ in the name
10398
#                       Allow files with a space in the name
10744
#                       Allow files with a space in the name
10399
#                       Allow files with a comma in the name
10745
#                       Allow files with a comma in the name
10400
#                       Allow for paths that have make-varible prefixes
10746
#                       Allow for paths that have make-varible prefixes
10401
#                           $(GBE_...) or ${GBE_...} or $(OBJDIR)
10747
#                           $(GBE_...) or ${GBE_...} or $(OBJDIR) or $(BUILDVERNUM)
10402
#                           as these may be generated internally
10748
#                           as these may be generated internally
10403
#                       Allow for files with a colon in the name
10749
#                       Allow for files with a colon in the name
10404
#                           Mode dependent
10750
#                           Mode dependent
10405
#                               0 - No effect
10751
#                               0 - No effect
10406
#                               T - \\\:
10752
#                               T - \\\:
Line 10429... Line 10775...
10429
    #
10775
    #
10430
    $uarg =~ m~^((\$\(.*?\)/)*)(.*)~;
10776
    $uarg =~ m~^((\$\(.*?\)/)*)(.*)~;
10431
    my $prefix = defined $1 ? $1 : '';
10777
    my $prefix = defined $1 ? $1 : '';
10432
    my $arg    = defined $3 ? $3 : '';
10778
    my $arg    = defined $3 ? $3 : '';
10433
 
10779
 
10434
    $arg =~ s~\$(?!\(GBE_[A-Z]+\)|{GBE_[A-Z]+}|\(OBJDIR\))~\$\$~g;       # $, not followed by (GBE_ or ${GBE_ or (OBJDIR)- is not $(GBE_ AND not $(OBJDIR)
10780
    $arg =~ s~\$(?!\(GBE_[A-Z]+\)|{GBE_[A-Z]+}|\(OBJDIR\)|\(BUILDVERNUM\))~\$\$~g;       # $, not followed by (GBE_ or ${GBE_ or (OBJDIR)- is not $(GBE_ AND not $(OBJDIR)
10435
    $arg =~ s~ ~\\ ~g;
10781
    $arg =~ s~ ~\\ ~g;
10436
    $arg =~ s~,~\$(comma)~g;
10782
    $arg =~ s~,~\$(comma)~g;
10437
    $arg =~ s~%~\\%~g;
10783
    $arg =~ s~%~\\%~g;
10438
    $arg =~ s~:~\\\\\\:~g if ($mode eq 'T' &&  $::ScmHost eq "Unix");
10784
    $arg =~ s~:~\\\\\\:~g if ($mode eq 'T' &&  $::ScmHost eq "Unix");
10439
    $arg =~ s~:~\\:~g     if ($mode eq 'S' &&  $::ScmHost eq "Unix");
10785
    $arg =~ s~:~\\:~g     if ($mode eq 'S' &&  $::ScmHost eq "Unix");
Line 10767... Line 11113...
10767
        }
11113
        }
10768
    }
11114
    }
10769
}
11115
}
10770
 
11116
 
10771
#-------------------------------------------------------------------------------
11117
#-------------------------------------------------------------------------------
-
 
11118
# Function        : PackageDirRule 
-
 
11119
#
-
 
11120
# Description     : Generate special rules for dynamic packaging/installation of directories 
-
 
11121
#
-
 
11122
# Inputs          : $mode        - package_dirs/unpackage_dirs/install_dirs/uninstall_dirs
-
 
11123
#                   $dataRef     - Ref to package/install list
-
 
11124
#                       
-
 
11125
#
-
 
11126
# Returns         : 
-
 
11127
#
-
 
11128
sub PackageDirRule
-
 
11129
{
-
 
11130
    my ($mode, $dataRef) = @_;
-
 
11131
    my $me = MakeEntry::New( *MAKEFILE, $mode , '--Phony' );
-
 
11132
 
-
 
11133
    my $modeText = 'packaging';
-
 
11134
    my $cmdText = 'PackageDir';
-
 
11135
    if ($mode =~ m~install~) {
-
 
11136
        $modeText = 'installing';
-
 
11137
        $cmdText = 'InstallDir';
-
 
11138
    }
-
 
11139
    my $cmd = 'copyDir'; 
-
 
11140
    if ($mode =~ m~^un~) {
-
 
11141
        $cmd = 'unCopyDir';
-
 
11142
        $modeText = 'un' . $modeText;
-
 
11143
        $cmdText = 'Un' . $cmdText;
-
 
11144
    }
-
 
11145
 
-
 
11146
 
-
 
11147
    foreach my $entry ( @{$dataRef}) {
-
 
11148
        $me->NewSection();
-
 
11149
 
-
 
11150
        #
-
 
11151
        #   Conditional installation for DEBUG/PRODUCTION
-
 
11152
        #
-
 
11153
        my $type = $entry->{'type'};
-
 
11154
        if ( $type )
-
 
11155
        {
-
 
11156
           if ( $type eq "D" ) {
-
 
11157
               $me->SectionIfNeq('$(DEBUG)','0');
-
 
11158
           } elsif ( $type eq "P" ) {
-
 
11159
               $me->SectionIfEq('$(DEBUG)','0');
-
 
11160
           } else {
-
 
11161
               Error("INTERNAL: Unexpected packaging type: $type");
-
 
11162
           }
-
 
11163
        }
-
 
11164
 
-
 
11165
        #
-
 
11166
        #   Quote the REs so that they can be passed to a command line
-
 
11167
        #       Replace $ with $$
-
 
11168
        #
-
 
11169
        my $QuoteRe = sub {
-
 
11170
            my ($arg) = @_;
-
 
11171
            $arg=~ s~\$~\$\$~g;
-
 
11172
            return $arg;
-
 
11173
            };
-
 
11174
 
-
 
11175
        #
-
 
11176
        #   The body of the copy
-
 
11177
        #   Create a command line for run-time command
-
 
11178
        #   
-
 
11179
        my @cmd;
-
 
11180
        push @cmd, '$(JatsRunTime)', $cmd, '--', '-$(VERBOSE_OPT)', '--Name='. $cmdText, '--';
-
 
11181
        push @cmd, '-mode=' . $modeText;
-
 
11182
        push @cmd, "'" . '-src=' . $entry->{dirTree} . "'";
-
 
11183
        push @cmd, "'" . '-dst=' . $entry->{dir} . "'";
-
 
11184
        push (@cmd, '-execute' ) if $entry->{exefile};
-
 
11185
        push (@cmd, '-noSymlink' ) if $entry->{noPreserveSymlink};
-
 
11186
        push (@cmd, '-noRecurse' ) if $entry->{noRecurse};
-
 
11187
        push (@cmd, '-stripBase' ) if $entry->{strip_base};
-
 
11188
        push (@cmd, "'" . '-exclude+=' . $QuoteRe->($_) . "'" ) foreach @{$entry->{exclude}};
-
 
11189
        push (@cmd, "'" . '-include+=' . $QuoteRe->($_) . "'" ) foreach @{$entry->{include}};
-
 
11190
        push (@cmd, "'" . '-excludeRe+=' . $QuoteRe->($_) . "'" ) foreach @{$entry->{excludeRe}};
-
 
11191
        push (@cmd, "'" . '-includeRe+=' . $QuoteRe->($_) . "'" ) foreach @{$entry->{includeRe}};
-
 
11192
 
-
 
11193
        $me->AddRecipe(join(' ', @cmd ) );
-
 
11194
    }
-
 
11195
    $me->Print();
-
 
11196
}
-
 
11197
 
-
 
11198
#-------------------------------------------------------------------------------
10772
# Function        : PackageSetRules
11199
# Function        : PackageSetRules
10773
#
11200
#
10774
# Description     : Generate the packageset rules
11201
# Description     : Generate the packageset rules
10775
#                   These appear to be a now-defuct feature
11202
#                   These appear to be a now-defuct feature
10776
#
11203
#