ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/ToolMapper.pm
Revision: 1.1.2.2
Committed: Mon Jun 5 12:11:34 2000 UTC (24 years, 11 months ago) by williamc
Content type: text/plain
Branch: V0_9branch
Changes since 1.1.2.1: +5 -5 lines
Log Message:
Correvet library rule names

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     # 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.1.2.2 @rv=$self->{classes}{$class}->defaulttypes();
64 williamc 1.1.2.1 }
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.1.2.2 $lib->types(qw(shared shared_debug archive archive_debug
86     archive_insure shared_insure));
87     $lib->defaulttypes("archive_debug");
88 williamc 1.1.2.1 $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.1.2.2 $bin->defaulttypes("debug");
95 williamc 1.1.2.1 $bin->rulesfile("\$(TOOL_HOME)/BuildSystem/binary.mk");
96    
97     $self->addclass($lib);
98     $self->addclass($bin);
99     }