Subversion Repositories DevTools

Rev

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

Rev 6403 Rev 6415
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 2684... Line 2685...
2684
#                                                 creation of files.
2685
#                                                 creation of files.
2685
#                       --Text=<text>           - Display text for command
2686
#                       --Text=<text>           - Display text for command
2686
#
2687
#
2687
#                       --Clean[=arg]           - Call script with arg[-clean] for cleaning.
2688
#                       --Clean[=arg]           - Call script with arg[-clean] for cleaning.
2688
#                       --PreDelete             - Delete generated files before running the command
2689
#                       --PreDelete             - Delete generated files before running the command
-
 
2690
#                       --RecipeTag=Name        - Name the recipe
-
 
2691
#                                                 Allows recipe to be called by Name and clean_Name
2689
#
2692
#
2690
#               Eg: GenerateFiles ( '*', "--Tool=mod_if.pl",
2693
#               Eg: GenerateFiles ( '*', "--Tool=mod_if.pl",
2691
#                                        "-src --Prerequisite(udh_module.cfg)",
2694
#                                        "-src --Prerequisite(udh_module.cfg)",
2692
#                                        "-direct -hdr --Generated(udp.h) -quiet" );
2695
#                                        "-direct -hdr --Generated(udp.h) -quiet" );
2693
#
2696
#
2694
my $NoGenIndex = 0;
2697
my $NoGenIndex = 0;
-
 
2698
my %recipeTags;
2695
sub GenerateFiles
2699
sub GenerateFiles
2696
{
2700
{
-
 
2701
    #
-
 
2702
    #   Remove undfined arguments
-
 
2703
    #   Simplifies programatic construction of argument lists
-
 
2704
    #
2697
    my ( $platforms, $tool, @args) = @_;
2705
    my ( $platforms, $tool, @args) = grep defined, @_;
2698
 
2706
 
2699
    return if ( ! ActivePlatform($platforms) );
2707
    return if ( ! ActivePlatform($platforms) );
2700
 
2708
 
2701
    Debug2( "GenerateFiles:($platforms, $tool, @args)" );
2709
    Debug2( "GenerateFiles:($platforms, $tool, @args)" );
2702
 
2710
 
Line 2712... Line 2720...
2712
    my $gtype = 1;
2720
    my $gtype = 1;
2713
    my @has_source;
2721
    my @has_source;
2714
    my @var_opts;
2722
    my @var_opts;
2715
    my @genreq_seen;
2723
    my @genreq_seen;
2716
    my $predelete;
2724
    my $predelete;
-
 
2725
    my $recipeTag;
2717
 
2726
 
2718
    #
2727
    #
2719
    #   Process the first argument - this describes the program that will be used
2728
    #   Process the first argument - this describes the program that will be used
2720
    #   to generate the files. It may be:
2729
    #   to generate the files. It may be:
2721
    #       --Tool          - A Jats Tool or Plugin
2730
    #       --Tool          - A Jats Tool or Plugin
Line 3073... Line 3082...
3073
            #   Display this text when executing commands
3082
            #   Display this text when executing commands
3074
            #
3083
            #
3075
            $text = $1;
3084
            $text = $1;
3076
            next;
3085
            next;
3077
        }
3086
        }
-
 
3087
 
-
 
3088
        if ( $arg =~ /^--RecipeTag=(.*)/ )
3078
        
3089
        {
-
 
3090
            #
-
 
3091
            #   Tag the generated Recipe
-
 
3092
            #   Only use the last tag - allow users to overwrite system tags
-
 
3093
            #
-
 
3094
            $recipeTag = $1;
-
 
3095
            Error ("Duplicate RecipeTag - $recipeTag") if ($recipeTags{$recipeTag}++ > 1);
-
 
3096
            next;
-
 
3097
        }
3079
 
3098
 
3080
        #   Not an option. Must be an argument to the tool/program
3099
        #   Not an option. Must be an argument to the tool/program
3081
        #   Process the tool arguments and extract file information
3100
        #   Process the tool arguments and extract file information
3082
        #   Extract all fields of the form:
3101
        #   Extract all fields of the form:
3083
        #           --xxxxx(yyyyyy[,zzzzz])
3102
        #           --xxxxx(yyyyyy[,zzzzz])
Line 3290... Line 3309...
3290
    #   Will be used to create makefile statements later
3309
    #   Will be used to create makefile statements later
3291
    #
3310
    #
3292
    my %gen_data;
3311
    my %gen_data;
3293
 
3312
 
3294
    $gen_data{'index'}      = $NoGenIndex++;
3313
    $gen_data{'index'}      = $NoGenIndex++;
-
 
3314
    $gen_data{'recipeTag'}  = $recipeTag if defined $recipeTag;
3295
    $gen_data{'shell'}      = $shell_cmds;
3315
    $gen_data{'shell'}      = $shell_cmds;
3296
    $gen_data{'gen'}        = \@gen_files;
3316
    $gen_data{'gen'}        = \@gen_files;
3297
    $gen_data{'preq'}       = \@preq_files;
3317
    $gen_data{'preq'}       = \@preq_files;
3298
    $gen_data{'tool'}       = $tool;
3318
    $gen_data{'tool'}       = $tool;
3299
    $gen_data{'toolargs'}   = \@tool_args;
3319
    $gen_data{'toolargs'}   = \@tool_args;
Line 9918... Line 9938...
9918
    MakePrint ("\n.PHONY: phony_generate\n\n" );
9938
    MakePrint ("\n.PHONY: phony_generate\n\n" );
9919
    
9939
    
9920
    foreach my $i ( @GENERATE_FILES )
9940
    foreach my $i ( @GENERATE_FILES )
9921
    {
9941
    {
9922
        my $gen_tag = $i->{'index'};
9942
        my $gen_tag = $i->{'index'};
-
 
9943
        #
-
 
9944
        #   Generate user-provided recipe names to allow the rule to be called by name.
-
 
9945
        #
-
 
9946
        my $recipeTag = $i->{'recipeTag'} || '';
-
 
9947
        my $recipeName = '';
-
 
9948
        my $recipeCleanName = '';
-
 
9949
 
-
 
9950
        if ($recipeTag) {
-
 
9951
            $recipeName = $recipeTag;
-
 
9952
            $recipeCleanName = 'clean_' . $recipeTag;
-
 
9953
 
-
 
9954
            # for 'jats make help'
-
 
9955
            $ScmRecipeTags{$recipeTag} = defined $i->{'clean'} ? 1 : 0;
-
 
9956
 
-
 
9957
            MakePrint( ".PHONY: $recipeName $recipeCleanName\n"); 
-
 
9958
        }
9923
 
9959
 
9924
        #
9960
        #
9925
        #   If predelete is enabled, then create a list of files to delete
9961
        #   If predelete is enabled, then create a list of files to delete
9926
        #
9962
        #
9927
        if ( $i->{'predelete'}  )
9963
        if ( $i->{'predelete'}  )
Line 9933... Line 9969...
9933
 
9969
 
9934
        #
9970
        #
9935
        #   Generate the basic generate rule and recipe
9971
        #   Generate the basic generate rule and recipe
9936
        #   together with the prerequisites
9972
        #   together with the prerequisites
9937
        #
9973
        #
9938
        MakeEntry ( "", ":", "", " ", @{$i->{'gen'}} );
9974
        MakeEntry ( "", ":", "", " ", @{$i->{'gen'}}, $recipeName );
9939
 
9975
 
9940
        unless ( $i->{'clean'} && $i->{'shell'} )
9976
        unless ( $i->{'clean'} && $i->{'shell'} )
9941
        {
9977
        {
9942
            MakeEntry ( "", "", " \\\n\t\t", "", @{$i->{'preq'}} );
9978
            MakeEntry ( "", "", " \\\n\t\t", "", @{$i->{'preq'}} );
9943
            MakeEntry ( "", "", " \\\n\t\t", "", "phony_generate" ) if $i->{'preq_sus'};
9979
            MakeEntry ( "", "", " \\\n\t\t", "", "phony_generate" ) if $i->{'preq_sus'};
Line 9955... Line 9991...
9955
        #   Generate 'clean' rules and recipes
9991
        #   Generate 'clean' rules and recipes
9956
        #
9992
        #
9957
        if ( $i->{'clean'} )
9993
        if ( $i->{'clean'} )
9958
        {
9994
        {
9959
            MakePrint ("\n\nPHONY: clean_generate_$gen_tag" );
9995
            MakePrint ("\n\nPHONY: clean_generate_$gen_tag" );
9960
            MakePrint ("\nclean_generate_$gen_tag:" );
9996
            MakePrint ("\nclean_generate_$gen_tag $recipeCleanName:" );
9961
            MakePrint ("\n\t" . "\$(XX_PRE)-\$(call generate_$gen_tag,$i->{'clean'})" );
9997
            MakePrint ("\n\t" . "\$(XX_PRE)-\$(call generate_$gen_tag,$i->{'clean'})" );
9962
        }
9998
        }
9963
 
9999
 
9964
        #
10000
        #
9965
        #   Define a function to contain the body of the generation call
10001
        #   Define a function to contain the body of the generation call