ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/ToolMapper.pm
Revision: 1.5
Committed: Fri Dec 10 14:05:52 2004 UTC (20 years, 5 months ago) by sashby
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +0 -0 lines
State: FILE REMOVED
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 williamc 1.2 #
2     # ToolMapper.pm
3     #
4     # Originally Written by Christopher Williams
5     #
6     # Description
7     # -----------
8     # A toolmap container
9     #
10     # Interface
11     # ---------
12     # new() : A new ToolMapper object
13     # addclass(ToolMap) : add a new class
14     # types(class) : Return the types for a given Class
15     # exists(class) : Return 1,0 if class exist or not
16     # defaulttypes(Class) : return list of types to make the default
17     # rulesfile(class) : return the name of a makefile to include to describe
18     # suitable make rules
19    
20     package BuildSystem::ToolMapper;
21     use BuildSystem::ToolMap;
22     require 5.004;
23    
24     sub new {
25     my $class=shift;
26     $self={};
27     bless $self, $class;
28     $self->_init();
29     return $self;
30     }
31    
32     sub addclass {
33     my $self=shift;
34     my $map=shift;
35    
36     $self->{classes}{$map->name()}=$map;
37     }
38    
39     sub types {
40     my $self=shift;
41     my $class=shift;
42    
43     my @rv=();
44     if ( $self->exists($class) ) {
45     @rv=$self->{classes}{$class}->types;
46     }
47     return @rv;
48     }
49    
50     sub exists {
51     my $self=shift;
52     my $class=shift;
53    
54     return ( exists $self->{classes}{$class} );
55     }
56    
57     sub defaulttypes {
58     my $self=shift;
59     my $class=shift;
60    
61     my @rv=();
62     if ( $self->exists($class) ) {
63 williamc 1.4 @rv=$self->{classes}{$class}->defaulttypes;
64 williamc 1.2 }
65     return @rv;
66     }
67    
68     sub rulesfile {
69     my $self=shift;
70     my $class=shift;
71     my @rv=();
72     if ( $self->exists($class) ) {
73     @rv=$self->{classes}{$class}->rulesfile;
74     }
75     return @rv;
76     }
77    
78     # -- Support routines
79     sub _init {
80     my $self=shift;
81    
82     # --- init library Toolmap
83     my $lib=BuildSystem::ToolMap->new();
84     $lib->name("lib");
85 williamc 1.4 $lib->types(qw(shared debug_shared archive debug_archive
86     insure_archive insure_shared));
87     $lib->defaulttypes("debug_archive");
88 williamc 1.2 $lib->rulesfile("\$(TOOL_HOME)/BuildSystem/library.mk");
89    
90     # --- init binary Toolmap
91     my $bin=BuildSystem::ToolMap->new();
92     $bin->name("bin");
93     $bin->types(qw(debug debug_local opt insure));
94 williamc 1.4 $bin->defaulttypes("debug_archive");
95 williamc 1.2 $bin->rulesfile("\$(TOOL_HOME)/BuildSystem/binary.mk");
96    
97 williamc 1.4 $self->addclass($lib);
98 williamc 1.2 $self->addclass($bin);
99     }