ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/ToolMapper.pm
Revision: 1.3
Committed: Tue Sep 5 15:49:57 2000 UTC (24 years, 8 months ago) by williamc
Content type: text/plain
Branch: MAIN
Changes since 1.2: +28 -6 lines
Log Message:
import from V0_13_3

File Contents

# Content
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 # getmap(class) : return the Map object for the given class (undef if ! exist)
17 # 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 }
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 }
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 @rv=$self->{classes}{$class}->defaulttypes();
76 }
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 $lib->types(qw(shared shared_debug archive archive_debug
98 archive_insure shared_insure));
99 $lib->defaulttypes("archive_debug");
100 $lib->rulesfile("\$(TOOL_HOME)/BuildSystem/library.mk");
101
102 $self->addclass($lib);
103
104 # --- init binary Toolmap
105 my $bin=BuildSystem::ToolMap->new();
106 $bin->name("bin");
107 $bin->types(qw(debug debug_local opt insure));
108 $bin->defaulttypes("opt");
109 $bin->rulesfile("\$(TOOL_HOME)/BuildSystem/binary.mk");
110
111 $self->addclass($bin);
112
113 # --- init header test
114 my $headertest=BuildSystem::ToolMap->new();
115 $headertest->name("CXXheadertest");
116 $headertest->types(qw(debug opt pic debug_pic));
117 $headertest->defaulttypes("opt");
118 $headertest->rulesfile("\$(TOOL_HOME)/BuildSystem/testcompileheader.mk");
119
120 $self->addclass($headertest);
121 }