Subversion Repositories DevTools

Rev

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

Rev 2074 Rev 2312
Line 7291... Line 7291...
7291
sub MakePrintList
7291
sub MakePrintList
7292
{
7292
{
7293
    print MAKEFILE $_ . "\n" foreach (@{$_[0]});
7293
    print MAKEFILE $_ . "\n" foreach (@{$_[0]});
7294
}
7294
}
7295
 
7295
 
-
 
7296
sub QuoteArray
-
 
7297
{
-
 
7298
    my $quote = "'";
-
 
7299
    if ( @_ ) {
-
 
7300
        return ($quote . join("$quote $quote", @_) . $quote);
-
 
7301
    }
-
 
7302
    return '';
-
 
7303
}
7296
 
7304
 
7297
#-------------------------------------------------------------------------------
7305
#-------------------------------------------------------------------------------
7298
# Function        : MakeEntry
7306
# Function        : MakeEntry
7299
#
7307
#
7300
# Description     : Build a entry based on the element list
7308
# Description     : Build a entry based on the element list
Line 8728... Line 8736...
8728
#   Deletion is done AFTER the toolset functions have been invoked to create the
8736
#   Deletion is done AFTER the toolset functions have been invoked to create the
8729
#   build artifacts so that the toolsets can create directories too
8737
#   build artifacts so that the toolsets can create directories too
8730
 
8738
 
8731
    MakeHeader ("Subdir creation");
8739
    MakeHeader ("Subdir creation");
8732
    CreateMkdirRules();
8740
    CreateMkdirRules();
8733
    MkdirRule( '$(OBJDIR)', 'OBJDIR' );                # Object build directory
8741
    MkdirRule( '$(OBJDIR)', 'OBJDIR', '--Extra=depend,depend.err' );  # Object build directory
8734
    MkdirRule( '$(OBJDIR)/'.$_ ) foreach (@SHLIBS);    # Shared library build directory
8742
    MkdirRule( '$(OBJDIR)/'.$_ ) foreach (@SHLIBS);                     # Shared library build directory
8735
    MkdirRule( '$(LIBDIR)', 'LIBDIR' );                # Library directory
8743
    MkdirRule( '$(LIBDIR)', 'LIBDIR' );                                 # Library directory
8736
    MkdirRule( '$(BINDIR)', 'BINDIR' );                # Binary directory
8744
    MkdirRule( '$(BINDIR)', 'BINDIR' );                                 # Binary directory
8737
 
8745
 
8738
    #
8746
    #
8739
    #   Create a directory for library merge tool to work within
8747
    #   Create a directory for library merge tool to work within
8740
    #
8748
    #
8741
    MkdirRule( "\$(MLIBDIR)", 'MLIBDIR', '--Path=$(GBE_PLATFORM).MRG', '--RemoveAll' ) if (@MLIBS);
8749
    MkdirRule( "\$(MLIBDIR)", 'MLIBDIR', '--Path=$(GBE_PLATFORM).MRG', '--RemoveAll' ) if (@MLIBS);
Line 9461... Line 9469...
9461
EOF
9469
EOF
9462
}
9470
}
9463
 
9471
 
9464
#
9472
#
9465
#   Rule to unmake the depend file
9473
#   Rule to unmake the depend file
-
 
9474
#       No longer neeed.
-
 
9475
#       The file is deleted as a part of the OBJDIR cleanup
9466
#
9476
#
9467
    print MAKEFILE <<EOF;
9477
    print MAKEFILE <<EOF;
9468
 
9478
 
9469
undepend:
9479
undepend:
9470
	-\$(XX_PRE)\$(rm) -f \$(OBJDIR)/depend
-
 
9471
EOF
9480
EOF
9472
 
9481
 
9473
#--------- IFLAG Documentation -------------------------------------------------
9482
#--------- IFLAG Documentation -------------------------------------------------
9474
#
9483
#
9475
#   IFLAG - iteration flag. This is setting by the calling process
9484
#   IFLAG - iteration flag. This is setting by the calling process
Line 9504... Line 9513...
9504
 
9513
 
9505
.PHONY:		make_clean
9514
.PHONY:		make_clean
9506
make_clean:
9515
make_clean:
9507
	-\@echo "Removing generated files (objects, libraries, binaries etc)";
9516
	-\@echo "Removing generated files (objects, libraries, binaries etc)";
9508
 
9517
 
9509
#
-
 
9510
#   Under windows/cygwin, there is a problem with the rm being used
-
 
9511
#   The expansion of wildcards will terminate the command if:
-
 
9512
#       1) No files exist to expand  : Solution : touch a file of that type
-
 
9513
#       2) A directory is involved   : Solution : cd to directory
-
 
9514
#
-
 
9515
#   Cannot use make's wildcard function as this only operates in the current directory
-
 
9516
#
-
 
9517
.PHONY:		rmlitter
9518
.PHONY:		rmlitter
9518
rmlitter:
9519
rmlitter:
9519
	-\$(AA_PRE)( echo "Removing litter";\\
9520
	-\$(AA_PRE)JatsFileUtil 'D0' 'Removing litter' '.' 'core' '*.bak' '*.tmp' '*.err'
9520
		\$(touch) _delete.bak _delete.tmp _delete.err ;\\
-
 
9521
		\$(rm) -f core *.bak *.tmp *.err ;\\
-
 
9522
		for subdir in \$(SHDIRS) '' ; do \\
-
 
9523
			if [ -d "\$\$subdir" ] ; then \\
-
 
9524
				( cd \$\$subdir ;\\
-
 
9525
				\$(touch) _delete.err _delete.cmd ;\\
-
 
9526
				\$(rm) -r * ; );\\
-
 
9527
			fi ;\\
-
 
9528
		done;\\
-
 
9529
		for subdir in \$(OBJDIR) '' ; do \\
-
 
9530
			if [ -d "\$\$subdir" ] ; then \\
-
 
9531
				( cd \$\$subdir ;\\
-
 
9532
				\$(touch) _delete.err _delete.cmd ;\\
-
 
9533
				\$(rm) -r *.err *.cmd ; );\\
-
 
9534
			fi ;\\
-
 
9535
		done;\\
-
 
9536
	)
-
 
9537
 
9521
 
9538
.PHONY:		lint_init
9522
.PHONY:		lint_init
9539
lint_init:
9523
lint_init:
9540
 
9524
 
9541
EOF
9525
EOF
Line 9852... Line 9836...
9852
#   build artifacts so that the toolsets can create directories too
9836
#   build artifacts so that the toolsets can create directories too
9853
#
9837
#
9854
#   Note: Toolset directories are deleted first
9838
#   Note: Toolset directories are deleted first
9855
#   Note: User Directories are deleted in the reverse order of creation
9839
#   Note: User Directories are deleted in the reverse order of creation
9856
#
9840
#
-
 
9841
#   Add them into the directory data structure
-
 
9842
#
-
 
9843
    foreach my $path ( @TOOLSETDIRS )
-
 
9844
    {
-
 
9845
        MkdirRule( $path, '', '--NoCreate' );
-
 
9846
    }
-
 
9847
 
-
 
9848
    foreach my $path ( @TOOLSETDIRTREES )
-
 
9849
    {
-
 
9850
        MkdirRule( $path, '', '--NoCreate' , '--RemoveAll');
-
 
9851
    }
-
 
9852
    
9857
    MakeHeader ("Subdir deletion");
9853
    MakeHeader ("Subdir deletion");
9858
    MakePrint( ".PHONY:\t\tunmake_dir\n" );
-
 
9859
    MakePrint( "unmake_dir:\n" );
-
 
9860
    MakePrint( "\t-\$(AA_PRE)echo Removing directories;" );
-
 
9861
    MakePrint( " \\\n\t\$(rmdir) \$(TOOLSETDIRS);" )            if ( @TOOLSETDIRS );
-
 
9862
    MakePrint( " \\\n\t\$(rm) -rf \$(TOOLSETDIRTREES);" )       if ( @TOOLSETDIRTREES );
-
 
9863
    RmdirRules();
9854
    RmdirRules();
9864
    MakeNewLine();
9855
    MakeNewLine();
9865
 
9856
 
9866
#--------- Toolset Rules -------------------------------------------------------
9857
#--------- Toolset Rules -------------------------------------------------------
9867
    MakeHeader ("Toolset Rules");
9858
    MakeHeader ("Toolset Rules");
Line 10000... Line 9991...
10000
#                   Such entries will be retained and dumped at a known time
9991
#                   Such entries will be retained and dumped at a known time
10001
#
9992
#
10002
# Inputs          : $subdir     - Symbolic name of the subdir $(OBJDIR)
9993
# Inputs          : $subdir     - Symbolic name of the subdir $(OBJDIR)
10003
#                   $alias      - Optional script alias for the dir 'OBJDIR' --> GBE_OBJDIR
9994
#                   $alias      - Optional script alias for the dir 'OBJDIR' --> GBE_OBJDIR
10004
#                   Options:
9995
#                   Options:
10005
#                       --Path=path     Optional value of $subdir '$(GBE_PLATFORM)$(GBE_TYPE).OBJ'
9996
#                       --Path=path             Optional value of $subdir '$(GBE_PLATFORM)$(GBE_TYPE).OBJ'
10006
#                       --RemoveAll     Remove all files on clean
9997
#                       --RemoveAll             Remove all files on clean
-
 
9998
#                       --Extra=file[,file]     Additiona files to remove
-
 
9999
#                       --NoCreate              Do not Create the Directory, just delete it
10007
#
10000
#
10008
# Returns         : Nothing
10001
# Returns         : Nothing
10009
#
10002
#
10010
 
10003
 
10011
sub MkdirRule
10004
sub MkdirRule
Line 10027... Line 10020...
10027
        {
10020
        {
10028
            if ( /^--Path=(.+)/ ) {
10021
            if ( /^--Path=(.+)/ ) {
10029
                $data{path} = $1;
10022
                $data{path} = $1;
10030
            } elsif ( /^--RemoveAll/ ) {
10023
            } elsif ( /^--RemoveAll/ ) {
10031
                $data{remove_all} = 1;
10024
                $data{remove_all} = 1;
-
 
10025
            } elsif ( /^--NoCreate/ ) {
-
 
10026
                $data{noCreate} = 1;
-
 
10027
            } elsif ( /^--Extra=(.+)/ ) {
-
 
10028
                @{$data{extraFiles}} = split(/,/, $1);
10032
            } else {
10029
            } else {
10033
                Error ("MkdirRule: Unknown option: $_");
10030
                Error ("MkdirRule: Unknown option: $_");
10034
            }
10031
            }
10035
        }
10032
        }
10036
        $data{alias} = $alias if ( $alias );
10033
        $data{alias} = $alias if ( $alias );
Line 10041... Line 10038...
10041
 
10038
 
10042
    #
10039
    #
10043
    #   Save or print
10040
    #   Save or print
10044
    #
10041
    #
10045
    return unless ( $MkdirRulePrinting );
10042
    return unless ( $MkdirRulePrinting );
-
 
10043
    return if ( $MkdirRuleData{$subdir}{noCreate} );
10046
 
10044
 
10047
    #
10045
    #
10048
    #   Create a definition of the physical directory
10046
    #   Create a definition of the physical directory
10049
    #
10047
    #
10050
    my $path = $MkdirRuleData{$subdir}{path};
10048
    my $path = $MkdirRuleData{$subdir}{path};
Line 10071... Line 10069...
10071
}
10069
}
10072
 
10070
 
10073
#-------------------------------------------------------------------------------
10071
#-------------------------------------------------------------------------------
10074
# Function        : RmdirRules
10072
# Function        : RmdirRules
10075
#
10073
#
10076
# Description     : Create the body of a recipe to delete the directoeis that
10074
# Description     : Create the body of a recipe to delete the directories that
10077
#                   have been created.
10075
#                   have been created.
10078
#
10076
#
10079
#                   The rule header will have been written to the makefile
10077
#                   Use JatsFileUtil rather than shell script
-
 
10078
#                       Faster under windows (and others)
-
 
10079
#                       Solved long pathname issues
-
 
10080
#                       Simpler to use and control
10080
#
10081
#
10081
# Inputs          : Uses $MkdirRuleData
10082
# Inputs          : Uses $MkdirRuleData
10082
#
10083
#
10083
# Returns         : Nothing.
10084
# Returns         : Nothing.
10084
#                   Prints to the makefile
10085
#                   Prints to the makefile
10085
#
10086
#
10086
sub RmdirRules
10087
sub RmdirRules
10087
{
10088
{
-
 
10089
    MakePrint( ".PHONY:\tunmake_dir\n" );
-
 
10090
    MakePrint( "unmake_dir:\n" );
-
 
10091
 
10088
    #
10092
    #
10089
    #   Determine the list of directories to delete
10093
    #   Determine the list of directories to delete
10090
    #   Sort such that subdirs are deleted files
10094
    #   Sort such that subdirs are deleted first
10091
    #
10095
    #
-
 
10096
    my $txt = 'Removing directories';
10092
    foreach my $subdir ( reverse sort keys %MkdirRuleData )
10097
    foreach my $subdir ( reverse sort keys %MkdirRuleData )
10093
    {
10098
    {
10094
        MakePrint "\\\n";                       # join to previous line
10099
        my @args = $subdir;
-
 
10100
 
10095
        MakePrint "\tif [ -d $subdir ]; then \\\n";
10101
        push (@args, $MkdirRuleGbeFile, 'core', '*.bak', '*.tmp', '*.err')
10096
        unless ( $MkdirRuleData{$subdir}{remove_all} )
10102
            unless $MkdirRuleData{$subdir}{remove_all};
10097
        {
10103
 
10098
            MakePrint "\t\t\$(rm) -f $subdir/$MkdirRuleGbeFile; \\\n";
10104
        push (@args, @{$MkdirRuleData{$subdir}{extraFiles}})
10099
            MakePrint "\t\t\$(rmdir) $subdir; \\\n";
10105
            if ( $MkdirRuleData{$subdir}{extraFiles} );
10100
        }
10106
 
10101
        else
10107
        my $mode = $MkdirRuleData{$subdir}{remove_all} ? 'T0' : 'D0';
10102
        {
10108
 
10103
            MakePrint "\t\t\$(rm) -rf $subdir; \\\n";
10109
        MakePrint ("\t-\$(AA_PRE)JatsFileUtil ", QuoteArray( $mode, $txt, @args ), "\n");
10104
        }
-
 
10105
        MakePrint "\tfi;";
10110
        $txt = '';
10106
    }
10111
    }
10107
}
10112
}
10108
 
10113
 
10109
#-------------------------------------------------------------------------------
10114
#-------------------------------------------------------------------------------
10110
# Function        : CreateMkdirRules
10115
# Function        : CreateMkdirRules