Subversion Repositories DevTools

Rev

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

Rev 369 Rev 3967
Line -... Line 1...
-
 
1
########################################################################
1
# -*- mode: perl; tabs: 8; indent-width: 4; -*-
2
# Copyright (C) 1998-2013 Vix Technology, All rights reserved
2
#
3
#
3
# Module name   : common.pl
4
# Module name   : common.pl
4
# Module type   : Makefile system
5
# Module type   : Makefile system
-
 
6
# Compiler(s)   : Perl
-
 
7
# Environment(s): jats
5
#
8
#
6
# Description   : Some function common to build and makefile processing tools.
9
# Description   : Some function common to build and makefile processing tools.
7
#
10
#
8
#.........................................................................#
11
#......................................................................#
9
 
12
 
10
use strict;
13
use strict;
11
use warnings;
14
use warnings;
12
use JatsError;
15
use JatsError;
13
use JatsSystem;
16
use JatsSystem;
Line 440... Line 443...
440
    (@_ == 1) ? $_[0] :
443
    (@_ == 1) ? $_[0] :
441
    (@_ == 2) ? join(" and ", @_)  :
444
    (@_ == 2) ? join(" and ", @_)  :
442
                    join("$sepchar ", @_[0 .. ($#_-1)], "and $_[-1]");
445
                    join("$sepchar ", @_[0 .. ($#_-1)], "and $_[-1]");
443
}
446
}
444
 
447
 
-
 
448
#-------------------------------------------------------------------------------
-
 
449
# Function        : ToolsetFile
-
 
450
#
-
 
451
# Description     : Maintain a datastructure of files that are created
-
 
452
#                   by the makefile creation process.
-
 
453
#
-
 
454
#                   Used to simplify the clobber process
-
 
455
#
-
 
456
#                   Maintains a in-memory datastructure
-
 
457
#
-
 
458
# Inputs          : fileList        - Files to add to the list
-
 
459
#
-
 
460
# Returns         : Nothing
-
 
461
#
-
 
462
our %GBE_TOOLSETFiles;
-
 
463
sub ToolsetFile
-
 
464
{
-
 
465
    my (@fileList) = @_;
-
 
466
    Verbose2 ("ToolsetFile:", @fileList);
-
 
467
    Error ("Internal: ToolsetFile. ScmRoot or ScmInterface not defined")
-
 
468
        unless ( defined $::ScmRoot && defined $::ScmInterface );
-
 
469
 
-
 
470
    my $dataFile = "$::ScmRoot/$::ScmInterface/GbeFiles.cfg";
-
 
471
 
-
 
472
    Error ("Internal: ToolsetFile. Cwd not defined")
-
 
473
        unless ( defined $::Cwd );
-
 
474
 
-
 
475
 
-
 
476
    #
-
 
477
    #   Initial read of data structure
-
 
478
    #   Only read on first call
-
 
479
    #
-
 
480
    unless ( %GBE_TOOLSETFiles )
-
 
481
    {
-
 
482
        if ( -f  $dataFile )
-
 
483
        {
-
 
484
            require ( $dataFile );
-
 
485
        }
-
 
486
 
-
 
487
        # Capture the package root directory
-
 
488
        $GBE_TOOLSETFiles{Root} = AbsPath($::ScmRoot)
-
 
489
            unless defined $GBE_TOOLSETFiles{Root};
-
 
490
    }
-
 
491
 
-
 
492
    #
-
 
493
    #   Add files
-
 
494
    #       Need to be full paths
-
 
495
    #
-
 
496
    $GBE_TOOLSETFiles{Files}{RelPath(AbsPath($_), $GBE_TOOLSETFiles{Root} )} = 1 foreach ( @fileList );
-
 
497
 
-
 
498
    #
-
 
499
    #   Save file
-
 
500
    #   Simply rewrite the file
-
 
501
    #
-
 
502
    my $fh = ConfigurationFile::New( $dataFile );
-
 
503
    $fh->Header( "ToolsetFile",
-
 
504
                              "Toolset Files" );
-
 
505
    $fh->Dump( [\%GBE_TOOLSETFiles], [qw(*GBE_TOOLSETFiles)] );
-
 
506
    $fh->Close();
-
 
507
    
-
 
508
}
445
 
509
 
446
1;  #success
510
1;  #success
447
 
511