ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/ToolMapper.pm
Revision: 1.1.2.3
Committed: Thu Jun 8 10:54:07 2000 UTC (24 years, 11 months ago) by williamc
Content type: text/plain
Branch: V0_9branch
Changes since 1.1.2.2: +12 -0 lines
Log Message:
Add default qualifier to Build tag

File Contents

# User Rev Content
1 williamc 1.1.2.1 #
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 williamc 1.1.2.3 # getmap(class) : return the Map object for the given class (undef if ! exist)
17 williamc 1.1.2.1 # defaulttypes(Class) : return list of types to make the default
18     # rulesfile(class) : return the name of a makefile to include to describe
19     # suitable make rules
20    
21     package BuildSystem::ToolMapper;
22     use BuildSystem::ToolMap;
23     require 5.004;
24    
25     sub new {
26     my $class=shift;
27     $self={};
28     bless $self, $class;
29     $self->_init();
30     return $self;
31     }
32    
33     sub addclass {
34     my $self=shift;
35     my $map=shift;
36    
37     $self->{classes}{$map->name()}=$map;
38     }
39    
40     sub types {
41     my $self=shift;
42     my $class=shift;
43    
44     my @rv=();
45     if ( $self->exists($class) ) {
46     @rv=$self->{classes}{$class}->types;
47     }
48     return @rv;
49 williamc 1.1.2.3 }
50    
51     sub getmap {
52     my $self=shift;
53     my $class=shift;
54    
55     my $rv=undef;
56     if ( exists $self->{classes}{$class} ) {
57     return $self->{classes}{$class};
58     }
59     return $rv;
60 williamc 1.1.2.1 }
61    
62     sub exists {
63     my $self=shift;
64     my $class=shift;
65    
66     return ( exists $self->{classes}{$class} );
67     }
68    
69     sub defaulttypes {
70     my $self=shift;
71     my $class=shift;
72    
73     my @rv=();
74     if ( $self->exists($class) ) {
75 williamc 1.1.2.2 @rv=$self->{classes}{$class}->defaulttypes();
76 williamc 1.1.2.1 }
77     return @rv;
78     }
79    
80     sub rulesfile {
81     my $self=shift;
82     my $class=shift;
83     my @rv=();
84     if ( $self->exists($class) ) {
85     @rv=$self->{classes}{$class}->rulesfile;
86     }
87     return @rv;
88     }
89    
90     # -- Support routines
91     sub _init {
92     my $self=shift;
93    
94     # --- init library Toolmap
95     my $lib=BuildSystem::ToolMap->new();
96     $lib->name("lib");
97 williamc 1.1.2.2 $lib->types(qw(shared shared_debug archive archive_debug
98     archive_insure shared_insure));
99     $lib->defaulttypes("archive_debug");
100 williamc 1.1.2.1 $lib->rulesfile("\$(TOOL_HOME)/BuildSystem/library.mk");
101    
102     # --- init binary Toolmap
103     my $bin=BuildSystem::ToolMap->new();
104     $bin->name("bin");
105     $bin->types(qw(debug debug_local opt insure));
106 williamc 1.1.2.2 $bin->defaulttypes("debug");
107 williamc 1.1.2.1 $bin->rulesfile("\$(TOOL_HOME)/BuildSystem/binary.mk");
108    
109     $self->addclass($lib);
110     $self->addclass($bin);
111     }