ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/BuildFile.pm
(Generate patch)

Comparing COMP/SCRAM/src/BuildSystem/BuildFile.pm (file contents):
Revision 1.6 by williamc, Fri Sep 15 11:18:21 2000 UTC vs.
Revision 1.33 by muzaffar, Fri Jan 14 17:36:42 2011 UTC

# Line 1 | Line 1
1 < # BuildFile
1 > #____________________________________________________________________
2 > # File: BuildFile.pm
3 > #____________________________________________________________________
4 > #  
5 > # Author: Shaun Ashby <Shaun.Ashby@cern.ch>
6 > # Update: 2003-12-03 19:03:15+0100
7 > # Revision: $Id$
8   #
9 < # Interface
10 < # ---------
11 < # new(ConfigArea)
6 < # ParseBuildFile($base,$path,$file)
7 < # ParseBuildFileExport(filename)
8 < # BlockClassPath() : Return the class path
9 < # ignore()      : return 1 if directory should be ignored 0 otherwise
10 < # classname()   : get/set the associated class
11 < # buildfile()   : get/set BuildFile location
12 <
9 > # Copyright: 2003 (C) Shaun Ashby
10 > #
11 > #--------------------------------------------------------------------
12   package BuildSystem::BuildFile;
14 use ActiveDoc::SimpleDoc;
15 use BuildSystem::ToolBox;
13   require 5.004;
14 + use Exporter;
15 + use ActiveDoc::SimpleDoc;
16  
17 < BEGIN {
18 < $buildfile="BuildFile";
19 < }
20 <
21 < sub new {
22 <        my $class=shift;
23 <        my $self={};
24 <        bless $self, $class;
25 <        $self->{area}=shift;
26 <        $self->{toolbox}=$self->{area}->toolbox();
27 <        $self->{localtop}=$self->{area}->location();
28 <        $self->{Arch}=1;
29 <        push @{$self->{ARCHBLOCK}}, $self->{Arch};
30 <        return $self;
31 < }
32 <
33 < sub buildfile {
34 <        my $self=shift;
35 <        if ( @_ ) {
36 <          $self->{buildfile}=shift;
37 <        }
38 <        return $self->{buildfile};
39 < }
40 <
41 < sub ignore {
42 <        my $self=shift;
43 <        return (defined $self->{ignore})?$self->{ignore}:0;
44 < }
45 <
46 < sub _initswitcher {
47 <        my $self=shift;
48 <        my $switch=ActiveDoc::SimpleDoc->new();
49 <        my $parse="makebuild";
50 <        $switch->newparse($parse);
51 <        $switch->addignoretags($parse);
52 <        $self->_commontags($switch,$parse);
53 <        $switch->addtag($parse,"Build", \&Build_start, $self);
54 <        $switch->addtag($parse,"none",
55 <                                        \&OutToMakefile,$self,
56 <                                        \&OutToMakefile, $self,
57 <                                        "", $self);
58 <        $switch->addtag($parse,"Bin",
59 <                                        \&Bin_start,$self,
60 <                                        \&OutToScreen, $self,
61 <                                        "", $self);
62 <        $switch->addtag($parse,"LibType",
63 <                                        \&LibType_Start,$self,
64 <                                        \&LibType_text, $self,
65 <                                        \&LibType_end,$self);
66 <        $switch->addtag($parse,"ConfigurationClass",
67 <                                        \&Class_StartTag,$self,
68 <                                        \&OutToMakefile, $self,
69 <                                        "", $self);
70 <        $switch->addtag($parse,"ClassPath",
71 <                                        \&setBlockClassPath,$self,
72 <                                        \&OutToMakefile, $self,
73 <                                        "", $self);
74 <        $switch->addtag($parse,"AssociateGroup",
75 <                                        "",$self,
76 <                                        \&AssociateGroup,$self,
77 <                                        "", $self);
78 <        $switch->addtag($parse,"Environment",
79 <                                        \&Environment_start,$self,
80 <                                        \&OutToMakefile, $self,
81 <                                        \&Environment_end,$self);
82 <        $switch->addtag($parse,"Export",
83 <                                        \&export_start,$self,
84 <                                        \&OutToMakefile, $self,
85 <                                        \&export_end,$self);
86 <        return $switch;
87 < }
88 <
89 < sub _commontags {
90 <        my $self=shift;
91 <        my $switch=shift;
92 <        my $parse=shift;
93 <
94 <        $switch->grouptag("Export",$parse);
95 <        $switch->addtag($parse,"Use",\&Use_start,$self,
96 <                                               \&OutToMakefile, $self,
97 <                                                "", $self);
98 <        $switch->addtag($parse,"Group",\&Group_start,$self,
99 <                                               \&OutToMakefile, $self,
100 <                                                "", $self);
101 <        $switch->grouptag("Group",$parse);
102 <        $switch->addtag($parse,"External",
103 <                                        \&External_StartTag,$self,
104 <                                        \&OutToMakefile, $self,
105 <                                        "", $self);
106 <        $switch->addtag($parse,"lib",
107 <                                        \&lib_start,$self,
108 <                                        \&OutToMakefile, $self,
109 <                                        "", $self);
110 <        $switch->addtag($parse,"Architecture",
111 <                                        \&Arch_Start,$self,
112 <                                        \&OutToMakefile, $self,
113 <                                        \&Arch_End,$self);
114 <        $switch->addtag($parse,"INCLUDE_PATH",
115 <                                        \&IncludePath_Start,$self,
116 <                                        \&OutToMakefile, $self,
117 <                                        "",$self);
118 <        return $switch;
119 < }
120 <
121 < sub GenerateMakefile {
122 <        my $self=shift;
123 <        my $infile=shift;
124 <        my $outfile=shift;
125 <
126 <        $self->{switch}=$self->_initswitcher();
127 <        $self->{switch}->filetoparse($infile);
128 <
129 <        # open a temporary gnumakefile to store output.
130 <        my $fh=FileHandle->new();
131 <        open ( $fh, ">$outfile") or die "Unable to open $outfile for output ".
132 <                                                                "$!\n";
133 <        @{$self->{filehandlestack}}=($fh);
134 <
135 <        #  -- make an alias
136 <        *GNUmakefile=$fh;
137 <        if ( -e $ENV{LatestBuildFile} ) {
138 <          print GNUmakefile "include $ENV{LatestBuildFile}\n";
139 <        }
140 <        $ENV{LatestBuildFile}=$outfile;
141 <        $self->{switch}->parse("makebuild"); # sort out supported tags
142 <        close GNUmakefile;
143 < }
144 <
145 < sub ParseBuildFile {
146 <        my $self=shift;
147 <        my $base=shift;
148 <        my $path=shift;
149 <        my $filename=shift @_;
150 <        my $fullfilename;
151 <        if ( $filename!~/^\// ) {
152 <         $fullfilename="$base/$path/$filename";
153 <        }
154 <        else {
155 <         $fullfilename=$filename;
156 <        }
157 <        $self->{path}=$path;
158 <        #print "Processing $fullfilename\n";
159 <        $numbins=0;
160 <        $self->{envnum}=0;
161 <        $self->{envlevel}=0;
162 <        $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
163 <                                                                "BuildFile.mk";
164 <        $self->{switch}=$self->_initswitcher();
165 <        $self->{switch}->filetoparse($fullfilename);
166 <
167 < #       $self->{switch}->{Strict_no_cr}='no';
168 <        #open a temporary gnumakefile to store output.
169 <        use Utilities::AddDir;
170 <        AddDir::adddir("$self->{localtop}/$ENV{INTwork}/$self->{path}");
171 <        my $fh=FileHandle->new();
172 <        open ( $fh, ">$self->{localtop}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk"
173 <          ) or die 'Unable to open /$ENV{INTwork}/".$self->{path}."/BuildFile.mk $!\n';
174 <        @{$self->{filehandlestack}}=($fh);
175 <        # make an alias
176 <        *GNUmakefile=$fh;
177 <        if ( -e $ENV{LatestBuildFile} ) {
178 <          print GNUmakefile "include $ENV{LatestBuildFile}\n";
179 <        }
180 < #       print "writing to :\n".
181 < #               "$self->{localtop}/$ENV{INTwork}/$self->{path}/BuildFile.mk\n";
182 <        $ENV{LatestBuildFile}="$self->{localtop}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk";
183 <        $self->{switch}->parse("makebuild"); # sort out supported tags
184 <        if ( $numbins > 0 ) {
185 <         print GNUmakefile <<ENDTEXT;
186 < ifndef BINMODE
187 < help::
188 < \t\@echo Generic Binary targets
189 < \t\@echo ----------------------
190 < endif
191 < ENDTEXT
192 <         foreach $target ( keys %$targettypes ) {
193 <         print GNUmakefile <<ENDTEXT;
194 < ifndef BINMODE
195 < help::
196 < \t\@echo $target
197 < endif
198 < ENDTEXT
17 > @ISA=qw(Exporter);
18 > @EXPORT_OK=qw( );
19 > #
20 > sub new()
21 >   ###############################################################
22 >   # new                                                         #
23 >   ###############################################################
24 >   # modified : Wed Dec  3 19:03:22 2003 / SFA                   #
25 >   # params   :                                                  #
26 >   #          :                                                  #
27 >   # function :                                                  #
28 >   #          :                                                  #
29 >   ###############################################################
30 >   {
31 >   my $proto=shift;
32 >   my $class=ref($proto) || $proto;
33 >   $self={};
34 >   bless $self,$class;
35 >   $self->{DEPENDENCIES} = {};
36 >   $self->{content} = {};
37 >   $self->{scramdoc}=ActiveDoc::SimpleDoc->new();
38 >   $self->{scramdoc}->newparse("builder",__PACKAGE__,'Subs',shift);
39 >   return $self;
40 >   }
41 >
42 > sub parse()
43 >   {
44 >   my $self=shift;
45 >   my ($filename)=@_;
46 >   my $fhead='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><doc type="BuildSystem::BuildFile" version="1.0">';
47 >   my $ftail='</doc>';
48 >   $self->{scramdoc}->filetoparse($filename);
49 >   $self->{scramdoc}->parse("builder",$fhead,$ftail);
50 >   # We're done with the SimpleDoc object so delete it:
51 >   delete $self->{scramdoc};
52 >   }
53 >
54 > sub classpath()
55 >   {
56 >   my ($object,$name,%attributes)=@_;
57 >   # The getter part:
58 >   if (ref($object) eq __PACKAGE__)
59 >      {
60 >      return $self->{content}->{CLASSPATH};
61 >      }
62 >  
63 >   $self->{nested} == 1 ? push(@{$self->{tagcontent}->{CLASSPATH}}, $attributes{'path'})
64 >      : push(@{$self->{content}->{CLASSPATH}}, $attributes{'path'});
65 >   }
66 >
67 > sub productstore()
68 >   {
69 >   my ($object,$name,%attributes)=@_;
70 >   # The getter part:
71 >   if (ref($object) eq __PACKAGE__)
72 >      {
73 >      # Return an array of ProductStore hashes:
74 >      return $self->{content}->{PRODUCTSTORE};
75 >      }
76 >  
77 >   $self->{nested} == 1 ? push(@{$self->{tagcontent}->{PRODUCTSTORE}}, \%attributes)
78 >      : push(@{$self->{content}->{PRODUCTSTORE}}, \%attributes) ;
79 >   }
80 >
81 > sub include()
82 >   {
83 >   my $self=shift;
84 >   # Return an array of required includes:
85 >   return $self->{content}->{INCLUDE};
86 >   }
87 >
88 > sub include_path()
89 >   {
90 >   my ($object,$name,%attributes)=@_;
91 >   $self->{nested} == 1 ? push(@{$self->{tagcontent}->{INCLUDE}}, $attributes{'path'})
92 >      : push(@{$self->{content}->{INCLUDE}}, $attributes{'path'});
93 >   }
94 >
95 > sub use()
96 >   {
97 >   my $object=shift;
98 >   # The getter part:
99 >   if (ref($object) eq __PACKAGE__)
100 >      {
101 >      # Add or return uses (package deps):
102 >      @_ ? push(@{$self->{content}->{USE}},@_)
103 >         : @{$self->{content}->{USE}};
104 >      }
105 >   else
106 >      {
107 >      my ($name,%attributes)=@_;
108 >      $self->{DEPENDENCIES}->{$attributes{'name'}} = 1;
109 >      $self->{nested} == 1 ? push(@{$self->{tagcontent}->{USE}}, $attributes{'name'})
110 >         : push(@{$self->{content}->{USE}}, $attributes{'name'});
111 >      }
112 >   }
113 >
114 > sub architecture()
115 >   {
116 >   my ($object,$name,%attributes)=@_;
117 >   $self->pushlevel(\%attributes); # Set nested to 1;
118 >   }
119 >
120 > sub architecture_()
121 >   {
122 >   $self->{content}->{ARCH}->{$self->{id}->{'name'}}=$self->{tagcontent};
123 >   $self->poplevel();
124 >   }
125 >
126 > sub export()
127 >   {
128 >   $self->pushlevel(); # Set nested to 1;
129 >   }
130 >
131 > sub export_()
132 >   {
133 >   $self->{content}->{EXPORT} = $self->{tagcontent};
134 >   $self->poplevel();
135 >   }
136 >
137 > sub lib()
138 >   {
139 >   my ($object,$name,%attributes)=@_;
140 >   # The getter part:
141 >   if (ref($object) eq __PACKAGE__)
142 >      {
143 >      # Return an array of required libs:
144 >      return $self->{content}->{LIB};      
145 >      }
146 >  
147 >   my $libname;
148 >  
149 >   if (exists($attributes{'position'}))
150 >      {
151 >      if ($attributes{'position'} eq 'first')
152 >         {
153 >         $libname = "F:".$attributes{'name'};
154 >         }
155 >      else
156 >         {
157 >         # There was a position entry but it didn't make sense:
158 >         $libname = $attributes{'name'};
159 >         }
160 >      }
161 >   else
162 >      {
163 >      $libname = $attributes{'name'};
164 >      }
165 >   # We have a libname, add it to the list:
166 >   $self->{nested} == 1 ? push(@{$self->{tagcontent}->{LIB}}, $libname)
167 >      : push(@{$self->{content}->{LIB}}, $libname);
168 >   }
169 >
170 > sub libtype()
171 >   {
172 >   my ($object,$name,%attributes)=@_;
173 >   # The getter part:
174 >   if (ref($object) eq __PACKAGE__)
175 >      {
176 >      # Return an array of required libs:
177 >      return $self->{content}->{LIBTYPE};      
178 >      }
179 >
180 >   $self->{nested} == 1 ? push(@{$self->{tagcontent}->{LIBTYPE}}, $attributes{'type'})
181 >      : push(@{$self->{content}->{LIBTYPE}}, $attributes{'type'});
182 >   }
183 >
184 > sub skip()
185 >   {
186 >   my ($object,$name,%attributes)=@_;
187 >   $self->{nested} == 1 ? $self->{tagcontent}->{SKIPPEDDIRS} = [ 1 ]
188 >      : $self->{content}->{SKIPPEDDIRS} = [ 1 ];
189 >   }
190 >
191 > sub skip_message()
192 >   {
193 >   my ($object,$name,@message) = @_;
194 >   # Save any message text between <skip> tags:
195 >   if ($#message > -1)
196 >      {
197 >      $self->{nested} == 1 ? push(@{$self->{tagcontent}->{SKIPPEDDIRS}}, [ @message ])
198 >         : push(@{$self->{content}->{SKIPPEDDIRS}}, [ @message ]);
199 >      }
200 >   }
201 >
202 > sub skip_()
203 >   {
204 >   my ($object,$name)=@_;
205 >   }
206 >
207 > sub makefile()
208 >   {
209 >   my ($object,$name,%attributes)=@_;
210 >   # The getter part:
211 >   if (ref($object) eq __PACKAGE__)
212 >      {
213 >      return $self->{content}->{MAKEFILE};
214 >      }
215 >   }
216 >
217 > sub makefile_()
218 >   {
219 >   my ($object,$name,$cdata)=@_;
220 >   $self->{nested} == 1 ? push(@{$self->{tagcontent}->{MAKEFILE}}, join("\n",@$cdata))
221 >      : push(@{$self->{content}->{MAKEFILE}}, join("\n",@$cdata));
222 >   }
223 >
224 > sub flags()
225 >   {
226 >   my ($object,$name,%attributes)=@_;
227 >   # The getter part:
228 >   if (ref($object) eq __PACKAGE__)
229 >      {
230 >      # Return an array of ProductStore hashes:
231 >      return $self->{content}->{FLAGS};
232 >      }
233 >  
234 >   # Extract the flag name and its value:
235 >   my ($flagname,$flagvaluestring) = each %attributes;
236 >   $flagname =~ tr/[a-z]/[A-Z]/; # Keep flag name uppercase
237 >   chomp($flagvaluestring);
238 >   my @flagvalues = ( $flagvaluestring );
239 >   # Is current tag within another tag block?
240 >   if ($self->{nested} == 1)
241 >      {
242 >      # Check to see if the current flag name is already stored in the hash. If so,
243 >      # just add the new values to the array of flag values:
244 >      if (exists ($self->{tagcontent}->{FLAGS}->{$flagname}))
245 >         {
246 >         push(@{$self->{tagcontent}->{FLAGS}->{$flagname}},@flagvalues);
247 >         }
248 >      else
249 >         {
250 >         $self->{tagcontent}->{FLAGS}->{$flagname} = [ @flagvalues ];
251 >         }
252 >      }
253 >   else
254 >      {
255 >      if (exists ($self->{content}->{FLAGS}->{$flagname}))
256 >         {
257 >         push(@{$self->{content}->{FLAGS}->{$flagname}},@flagvalues);
258           }
259 <        }
260 <        close GNUmakefile;
261 < }
204 <
205 < sub classname {
206 <        my $self=shift;
207 <        if ( @_ ) {
208 <          $self->{classname}=shift;
209 <        }
210 <        return $self->{classname};
211 < }
212 <
213 < sub ParseBuildFile_Export {
214 <        my $self=shift;
215 <        my $filename=shift;
216 <        my $bf=BuildSystem::BuildFile->new($self->{area});
217 <        if ( defined $self->{remoteproject} ) {
218 <           $bf->{remoteproject}=$self->{remoteproject};
219 <        }
220 <        $bf->_parseexport($filename);
221 <        undef $bf;
222 < }
223 <
224 < sub _location {
225 <        my $self=shift;
226 <        use File::Basename;
227 <
228 <        return dirname($self->{switch}->filetoparse());
229 < }
230 <
231 < sub _parseexport {
232 <        my $self=shift;
233 <        my $filename=shift;
234 <
235 <        my $switchex=ActiveDoc::SimpleDoc->new();
236 <        $switchex->filetoparse($filename);
237 <        $switchex->newparse("export");
238 <        $switchex->addignoretags("export");
239 <        $switchex->addtag("export","Export",
240 <                                        \&export_start_export,$self,
241 <                                        \&OutToMakefile, $self,
242 <                                        \&export_end_export,$self);
243 <        $self->_commontags($switchex,"export");
244 <        $switchex->allowgroup("__export","export");
245 < #       $switchex->{Strict_no_cr}='no';
246 <        $self->{switch}=$switchex;
247 <        $switchex->parse("export"); # sort out supported tags
248 < }
249 <
250 < sub _pushremoteproject {
251 <        my $self=shift;
252 <        my $path=shift;
253 <        
254 <        if ( defined $self->{remoteproject} ) {
255 <          push @{$self->{rpstack}}, $self->{remoteproject};
256 <        }
257 <        $self->{remoteproject}=$path;
258 < }
259 <
260 < sub _popremoteproject {
261 <        my $self=shift;
262 <        if ( $#{$self->{rpstack}} >=0 ) {
263 <          $self->{remoteproject}=pop @{$self->{rpstack}};
264 <        }
265 <        else {
266 <          undef $self->{remoteproject};
267 <        }
268 < }
269 <
270 < sub _toolmapper {
271 <        my $self=shift;
272 <        if ( ! defined $self->{mapper} ) {
273 <           require BuildSystem::ToolMapper;
274 <           $self->{mapper}=BuildSystem::ToolMapper->new();
275 <        }
276 <        return $self->{mapper};
277 < }
278 <
279 <
280 < # ---- Tag routines
281 <
282 < #-- Override a class type with the <ConfigurationClass type=xxx> tag
283 < #   the type tag will pick up a pre-defined class type from project space.
284 <
285 < sub Class_StartTag {
286 <        my $self=shift;
287 <        my $name=shift;
288 <        my $hashref=shift;
289 <        
290 <        if ( $self->{Arch} ) {
291 <         if ( defined $$hashref{'type'} ) {
292 <                $self->classname($$hashref{'type'});
259 >      else
260 >         {
261 >         $self->{content}->{FLAGS}->{$flagname} = [ @flagvalues ];
262           }
263 <        }
264 < }
296 <
297 < sub IncludePath_Start {
298 <        my $self=shift;
299 <        my $name=shift;
300 <        my $hashref=shift;
301 <
302 <        $self->{switch}->checktag( $name, $hashref, 'path');
303 <        if ( $self->{Arch} ) {
304 <          print GNUmakefile "INCLUDE+=".$self->_location()."/".
305 <                                                $$hashref{'path'}."\n";
306 <        }
307 < }
263 >      }
264 >   }
265  
266 < #
267 < # generic build tag
268 < #
269 < sub Build_start {
270 <        my $self=shift;
271 <        my $name=shift;
272 <        my $hashref=shift;
273 <
274 <        $self->{switch}->checktag($name,$hashref,'class');
275 <        if ( $self->{Arch} ) {
276 <
277 <          # -- determine the build products name
278 <          my $name;
279 <          if ( exists $$hashref{'name'} ) {
280 <            $name=$$hashref{'name'};
281 <          }
282 <          else {
283 <            $self->{switch}->parseerror("No name specified for build product");
284 <            #$name="\$(buildname)";
328 <          }
329 <
330 <          # -- check we have a lookup for the class type
331 <          my $mapper=$self->_toolmapper();
332 <          if ( ! $mapper->exists($$hashref{'class'}) ) {
333 <            $self->{switch}->parseerror("Unknown class : ".$$hashref{'class'});
334 <          }
335 <          else {
336 <           my @types=$self->_toolmapper()->types($$hashref{'class'});
337 <           my @deftypes=$self->_toolmapper()->defaulttypes($$hashref{'class'});
338 <
339 <           my $fh=$self->{filehandlestack}[0];
340 <           my @targets=();
341 <
342 <           # -- generate generic targets
343 <           print $fh "ifndef _BuildLink_\n";
344 <           print $fh "# -- Generic targets\n";
345 <           push @targets, $$hashref{'class'};
346 <           foreach $dtype ( @deftypes ) {
347 <            print $fh $$hashref{'class'}."::".$$hashref{'class'}."_".
348 <                                                                $dtype."\n";
349 <           }
350 <           print $fh "\n";
351 <
352 <           # -- generate targets for each type
353 <           foreach $type ( @types ) {
354 <
355 <            # -- generic name for each type
356 <            my $pattern=$$hashref{'class'}."_".$type;
357 <            my $dirname=$$hashref{'class'}."_".$type."_".$name;
358 <            print $fh "# ------ $pattern rules ---------------\n";
359 <            print $fh $$hashref{'class'}."_".$type."::".$$hashref{'class'}.
360 <                                                        "_".$type."_$name\n\n";
361 <
362 <            # -- create a new directory for each type
363 <            push @targets, $pattern;
364 <            my $dirname=$$hashref{'class'}."_".$type."_".$name;
365 <            my $here="$self->{localtop}/$ENV{INTwork}/".$self->{path}."/".$dirname;
366 <            my $makefile=$here."/BuildFile.mk";
367 < #           AddDir::adddir($here);
368 <
369 <            # -- create link targets to the directory
370 <            push @targets, $dirname;
371 <            print $fh "# -- Link Targets to $type directories\n";
372 <            print $fh "$dirname: make_$dirname\n";
373 <            print $fh "\t\@cd $here; \\\n";
374 <            print $fh "\t\$(MAKE) LatestBuildFile=$makefile _BuildLink_=1".
375 <                        " workdir=$here ".
376 <                        " -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \n\n";
377 <
378 <            # -- write target to make makefile for each directory
379 <            print $fh "# -- Build target directories\n";
380 <            print $fh "make_$dirname:\n";
381 <            print $fh "\tif [ ! -e \"$makefile\" ]; then \\\n";
382 <            print $fh "\t if [ ! -d \"$here\" ]; then \\\n";
383 <            print $fh "\t  mkdir $here; \\\n";
384 <            print $fh "\t fi;\\\n";
385 <            print $fh "\t cd $dirname; \\\n";
386 <            print $fh "\t echo include ".$self->{currentenv}." > ".
387 <                                                        "$makefile; \\\n";
388 <            print $fh "\t echo VPATH+=$self->{localtop}/".$self->{path}.
389 <                                        " >> $makefile; \\\n";
390 <            print $fh "\t echo buildname=$name >> $makefile;\\\n";
391 <            print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n";
392 <            if ( defined (my @file=$mapper->rulesfile($$hashref{'class'})) ) {
393 <             foreach $f ( @file ) {
394 <              print $fh "\t echo -include $f >> $makefile; \\\n";
395 <             }
266 > sub allflags()
267 >   {
268 >   my $self=shift;
269 >   # Return hash data for flags:
270 >   return $self->{content}->{FLAGS};
271 >   }
272 >
273 > sub archspecific()
274 >   {
275 >   my $self=shift;
276 >  
277 >   # Check to see if there is arch-dependent data. If so, return it:
278 >   if ((my $nkeys=keys %{$self->{content}->{ARCH}}) > 0)
279 >      {
280 >      while (my ($k,$v) = each %{$self->{content}->{ARCH}})
281 >         {
282 >         if ( $ENV{SCRAM_ARCH} =~ /$k.*/ )
283 >            {
284 >            return $self->{content}->{ARCH}->{$k};
285              }
397            print $fh "\tfi\n";
398            print $fh "\n";
399 #           print $typefile "$name :\n";
400 #           print $typefile "\t\$(_quietbuild_)";
401 #           print $typefile $mapper->template($$hashref{'class'},$type)."\n";
402 #           print $typefile "\t\$(_quietstamp_)";
403 #           print $typefile "\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n";
404
405            # -- cleaning targets
406            push @targets, "clean_$dirname";
407            print $fh "# -- cleaning targets\n";
408            print $fh "clean::clean_$dirname\n";
409            print $fh "clean_".$dirname."::\n";
410            print $fh "\t\@echo cleaning $dirname\n";
411            print $fh "\t\@if [ -d $here ]; then \\\n";
412            print $fh "\tcd $here; \\\n";
413            print $fh "\t\$(MAKE) LatestBuildFile=$makefile workdir=".
414                        $here." _BuildLink_=1 -f ".
415                        "\$(TOOL_HOME)/basics.mk clean; \\\n";
416            print $fh "\tfi\n\n";
417
418
419          }
420          # -- help targets
421          print $fh "helpheader::\n";
422          print $fh "\t\@echo Targets available:\n";
423          print $fh "\t\@echo ------------------\n\n";
424          print $fh "help::helpheader\n";
425          foreach $target ( @targets ) {
426            print $fh "help::\n";
427            print $fh "\t\@echo $target\n"
428          }
429          print $fh "endif\n";
430         } # end else
431        }
432 }
433
434 sub Bin_start {
435        my $self=shift;
436        my $name=shift;
437        my $hashref=shift;
438
439        my $fileclass;
440        my @tools;
441        my $tool;
442        my $filename;
443        my $objectname;
444        
445        $self->{switch}->checktag($name,$hashref,'file');
446        if ( $self->{Arch} ) {
447        if ( ! defined $$hashref{name} ) {
448                ($$hashref{name}=$$hashref{file})=~s/\..*//;
449        }
450        ($filename=$$hashref{file})=~s/\..*//;
451
452        # Create a new directory for each binary target
453        my $dirname="bin_".$$hashref{name};
454        AddDir::adddir("$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname");
455        open (binGNUmakefile,
456           ">$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die           "Unable to make $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/".
457           "BuildFile.mk $!\n";
458
459        # Create the link targets
460        $numbins++;
461        my $fh=$self->{filehandlestack}[0];
462        print $fh <<ENDTEXT;
463
464 # Link Targets to binary directories
465 ifdef BINMODE
466 # We dont want to build a library here
467 override files:=
468 endif
469 ifndef BINMODE
470
471 define stepdown_$$hashref{'name'}
472 if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
473 cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\
474 \$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\
475 fi
476 endef
477
478 define stepdown2_$$hashref{'name'}
479 if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
480 cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\
481 \$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
482 fi
483
484 endef
485
486 bin_$$hashref{'name'}_%:: dummy
487        \@\$(stepdown2_$$hashref{'name'})
488
489 $$hashref{'name'}_%:: dummy
490        \@\$(stepdown_$$hashref{'name'})
491
492 help bin bin_debug bin_debug_local bin_insure bin_Insure clean $$hashref{'name'}:: dummy
493        \@\$(stepdown_$$hashref{'name'})
494
495 binfiles+=$$hashref{'file'}
496 locbinfiles+=$dirname/$$hashref{'file'}
497 endif
498
499
500 ENDTEXT
501
502
503 # the binary specifics makefile
504        print binGNUmakefile "include ".$self->{currentenv}."\n";
505        print binGNUmakefile "VPATH+=$self->{localtop}/$self{path}\n";
506
507 # alias for bin_Insure
508        print binGNUmakefile <<ENDTEXT;
509
510 bin_insure:bin_Insure
511 ifdef MAKETARGET_bin_insure
512 MAKETARGET_$$hashref{name}_Insure=1
513 endif
514
515 # debuggging target
516 $$hashref{'name'}_echo_% :: echo_%
517
518 # help targets
519 help::
520 \t\@echo Targets For $$hashref{'name'}
521 \t\@echo -------------------------------------
522 \t\@echo $$hashref{'name'}  - default build
523 \t\@echo bin_$$hashref{'name'}_clean - executable specific cleaning
524 ENDTEXT
525
526 # Make generic rules for each type
527        $targettypes={
528                "bin" => 'o',
529                "bin_debug" => 'd',
530                "bin_debug_local" => 'l_d',
531                "bin_Insure" => 'Insure'
532        };
533        #
534        foreach $target ( keys %$targettypes ) {
535          print binGNUmakefile <<ENDTEXT;
536
537 # Type $target specifics
538 ifdef MAKETARGET_$target
539 MAKETARGET_$$hashref{name}_$$targettypes{$target}=1
540 endif
541 $target ::$$hashref{name}_$$targettypes{$target}
542
543 bintargets+=$$hashref{name}_$$targettypes{$target}
544 help::
545 \t\@echo $$hashref{name}_$$targettypes{$target}
546 clean::
547 \t\@if [ -f \$(binarystore)/$$hashref{name}_$$targettypes{$target} ]; then \\
548 \techo Removing \$(binarystore)/$$hashref{name}; \\
549 \trm \$(binarystore)/$$hashref{name}_$$targettypes{$target}; \\
550 \tfi
551
552 ENDTEXT
553          ($objectname=$$hashref{file})=~s/\..*/_$$targettypes{$target}\.o/;
554          ${"objectname_$$targettypes{$target}"}=$objectname;
555          print binGNUmakefile "$objectname:$$hashref{name}.dep\n";
556        } # end loop
557
558        print binGNUmakefile "$$hashref{name}_Insure.exe:.psrc\n";
559        print binGNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
560        print binGNUmakefile "\t\$(CClinkCmdDebug)\n";
561        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
562        print binGNUmakefile "$$hashref{name}_l_d.exe:$objectname_d\n";
563        print binGNUmakefile "\t\$(CClinkCmdDebugLocal)\n";
564        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
565        print binGNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
566        print binGNUmakefile "\t\$(CClinkCmdInsure)\n";
567        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
568        print binGNUmakefile "$$hashref{name}_o.exe:$objectname_o\n";
569        print binGNUmakefile "\t\$(CClinkCmd)\n";
570        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
571        print binGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
572        print binGNUmakefile "-include $$hashref{name}.dep\n";
573 print binGNUmakefile <<ENDTEXT;
574 clean::
575 \t\@if [ -f \$(binarystore)/$$hashref{name} ]; then \\
576 \techo Removing \$(binarystore)/$$hashref{name}; \\
577 \trm \$(binarystore)/$$hashref{name}; \\
578 \tfi
579
580 $$hashref{name}_d.exe:\$(libslocal_d)
581 $$hashref{name}_o.exe:\$(libslocal)
582 ifdef MCCABE_DATA_DIR
583 $$hashref{name}_mccabe.exe: \$(libslocal_d) \$(MCCABE_DATA_DIR)/mccabeinstr/instplus.cpp
584 endif
585 $$hashref{name}_Insure.exe:\$(libslocal_I)
586 $$hashref{name}_d:$$hashref{name}_d.exe
587        \@cp $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
588 $$hashref{name}_l_d:$$hashref{name}_l_d.exe
589        \@cp $$hashref{name}_l_d.exe \$(binarystore)/$$hashref{name}
590 $$hashref{name}_Insure:$$hashref{name}_Insure.exe
591        \@cp $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure
592 $$hashref{name}:$$hashref{name}_d.exe
593        \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
594 $$hashref{name}_o:$$hashref{name}_o.exe
595        \@mv $$hashref{name}_o.exe \$(binarystore)/$$hashref{name}
596 binfiles+=$$hashref{file}
597 ENDTEXT
598        }
599        close binGNUmakefile;
600 }
601
602 sub External_StartTag {
603        my $self=shift;
604        my $name=shift;
605        my $hashref=shift;
606        
607        my $tool;
608        if ( $self->{Arch} ) {
609        $self->{switch}->checktag($name,$hashref,'ref');
610
611        # -- oo toolbox stuff
612        # - get the appropriate tool object
613        $$hashref{'ref'}=~tr[A-Z][a-z];
614        if ( ! exists $$hashref{'version'} ) {
615         $tool=$self->{toolbox}->gettool($$hashref{'ref'});
616        }
617        else {
618         $tool=$self->{toolbox}->gettool($$hashref{'ref'},$$hashref{'version'});
619        }
620        if ( ! defined $tool ) {
621          $self->{switch}->parseerror("Unknown Tool Specified ("
622                                                        .$$hashref{'ref'}.")");
623        }
624
625        # -- old fashioned GNUmakefile stuff
626        print GNUmakefile $$hashref{'ref'};
627        if ( defined $$hashref{'version'} ) {
628                print GNUmakefile "_V_".$$hashref{'version'};
629        }
630        print GNUmakefile "=true\n";
631        
632        # -- Sub system also specified?
633        if ( exists $$hashref{'use'} ) {
634           # -- look for a buildfile
635           my @paths=$tool->getfeature("INCLUDE");
636           my $file="";
637           my ($path,$testfile);
638           foreach $path ( @paths ) {
639             $testfile=$path."/".$$hashref{'use'}."/BuildFile" ;
640             if ( -f $testfile ) {
641                $file=$testfile;
642                $self->_pushremoteproject($path);
643             }
644           }
645           if ( $file eq "" ) {
646             $self->{switch}->parseerror("Unable to find SubSystem $testfile");
647           }
648           $self->ParseBuildFile_Export($file);
649           $self->_popremoteproject();
286           }
287 <        }
288 < }      
289 <
290 < sub Group_start {
291 <        my $self=shift;
292 <        my $name=shift;
293 <        my $hashref=shift;
294 <        
295 <        $self->{switch}->checktag($name, $hashref, 'name');
296 <        if ( $self->{Arch} ) {
297 <        print GNUmakefile "GROUP_".$$hashref{'name'};
298 <        if ( defined $$hashref{'version'} ) {
299 <                print GNUmakefile "_V_".$$hashref{'version'};
300 <        }
301 <        print GNUmakefile "=true\n";
302 <        }
303 < }      
304 <
305 < sub Use_start {
306 <        my $self=shift;
307 <        my $name=shift;
308 <        my $hashref=shift;
309 <        my $filename;
310 <        use Utilities::SCRAMUtils;
311 <        
312 <        $self->{switch}->checktag($name, $hashref, "name");
313 <        if ( $self->{Arch} ) {
314 <        if ( exists $$hashref{'group'} ) {
315 <          print GNUmakefile "GROUP_".$$hashref{'group'}."=true\n";
316 <        }
317 <        if ( ! defined $self->{remoteproject} ) {
318 <          $filename=SCRAMUtils::checkfile(
319 <                "/$ENV{INTsrc}/$$hashref{name}/BuildFile");
320 <        }
321 <        else {
322 <          $filename=$self->{remoteproject}."/$$hashref{name}/BuildFile";
323 <        print "trying $filename\n";
324 <          if ( ! -f $filename ) { $filename=""; };
325 <        }
326 <        if ( $filename ne "" ) {
327 <          $self->ParseBuildFile_Export( $filename );
328 <        }
329 <        else {
330 <           $self->{switch}->parseerror("Unable to detect Appropriate ".
331 <                "decription file for <$name name=".$$hashref{name}.">");
332 <        }
333 <        }
334 < }
335 <
336 < # List association groups between <AssociateGroup> tags
337 < # seperated by newlines or spaces
338 < sub AssociateGroup {
339 <        my $self=shift;
340 <        my $name=shift;
341 <        my $string=shift;
342 <        my $word;
343 <
344 <        if ( $self->{Arch} ) {
345 <        foreach $word ( (split /\s/, $string) ){
346 <                chomp $word;
347 <                next if /^#/;
348 <                if ( $word=~/none/ ) {
349 <                        $self->{ignore}=1;
350 <                }
351 <        }
352 <        }
353 < }
354 <
355 < sub Arch_Start {
356 <        my $self=shift;
357 <        my $name=shift;
358 <        my $hashref=shift;
359 <
360 <        $self->{switch}->checktag($name, $hashref,'name');
361 <        ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($self->{Arch}=1)
362 <                                                : ($self->{Arch}=0);
363 <        push @{$self->{ARCHBLOCK}}, $self->{Arch};
364 < }
365 <
366 < sub Arch_End {
367 <        my $self=shift;
368 <        my $name=shift;
369 <
370 <        pop @{$self->{ARCHBLOCK}};
371 <        $self->{Arch}=$self->{ARCHBLOCK}[$#{$self->{ARCHBLOCK}}];
372 < }
373 <
374 < # Split up the Class Block String into a useable array
375 < sub _CutBlock {
376 <    my $self=shift;
377 <    my $string= shift @_;
378 <    @BlockClassA = split /\//, $string;
379 < }
380 <
381 < sub OutToMakefile {
382 <        my $self=shift;
383 <        my $name=shift;
384 <        my @vars=@_;
385 <
386 <        if ( $self->{Arch} ) {
387 <          print GNUmakefile @vars;
388 <        }
389 < }
390 <
391 < sub OutToScreen {
392 <        my $name=shift;
393 <        my @vars=@_;
394 <
395 <        if ( $self->{Arch} ) {
396 <          print @vars;
397 <        }
398 < }
399 < sub setBlockClassPath {
400 <        my $self=shift;
401 <        my $name=shift;
402 <        my $hashref=shift;
403 <
404 <        $self->{switch}->checktag($name, $hashref, 'path');
405 <        $self->{BlockClassPath}=$self->{BlockClassPath}.":".$$hashref{path};
406 <        $self->_CutBlock($$hashref{path});
407 < }
408 <
409 < sub BlockClassPath {
410 <        my $self=shift;
411 <        return $self->{BlockClassPath};
412 < }
413 <
414 < sub export_start_export {
415 <        my $self=shift;
416 <        my $name=shift;
417 <        my $hashref=shift;
418 <
419 <        $self->{switch}->opengroup("__export");
420 < }
421 <
422 < sub export_start {
423 <        my $self=shift;
424 <        my $name=shift;
425 <        my $hashref=shift;
426 <
427 <        $self->{switch}->opengroup("__export");
428 <        if ( exists $$hashref{autoexport} ) {
429 <          print GNUmakefile "scram_autoexport=".$$hashref{autoexport}."\n";
430 <          if ( $$hashref{autoexport}=~/true/ ) {
431 <           $self->{switch}->allowgroup("__export","makebuild");
432 <          }
433 <          else {
434 <           $self->{switch}->disallowgroup("__export","makebuild");
435 <          }
436 <        }
437 <        # -- allow default setting from other makefiles
438 <        print GNUmakefile "ifeq (\$(scram_autoexport),true)\n";
439 < }
440 <
441 < sub export_end_export {
442 <        my $self=shift;
443 <        $self->{switch}->closegroup("__export");
444 < }
445 <
446 < sub export_end {
447 <        my $self=shift;
448 <        $self->{switch}->closegroup("__export");
449 <        print GNUmakefile "endif\n";
450 < }
451 <
452 < #
453 < # Standard lib tag
454 < #
455 < sub lib_start {
456 <        my $self=shift;
457 <        my $name=shift;
458 <        my $hashref=shift;
459 <
460 <        $self->{switch}->checktag($name, $hashref, 'name');
461 <        if ( $self->{Arch} ) {
462 <           print GNUmakefile "lib+=$$hashref{name}\n";
463 <        }
464 < }
287 >      }
288 >   return "";
289 >   }
290 >
291 > sub bin()
292 >   {
293 >   my ($object,$name,%attributes) = @_;
294 >   $self->pushlevel(\%attributes);# Set nested to 1;
295 >   }
296 >
297 > sub bin_()
298 >   {
299 >   # Need unique name for the binary (always use name of product). Either use "name"
300 >   # given, or use "file" value minus the ending:
301 >   if (exists ($self->{id}->{'name'}))
302 >      {
303 >      $name = $self->{id}->{'name'};
304 >      }
305 >   else
306 >      {
307 >      ($name) = ($self->{id}->{'file'} =~ /(.*)?\..*$/);
308 >      }
309 >
310 >   # Store the data:
311 >   $self->productcollector($name,'bin','BIN');
312 >   $self->poplevel();
313 >   }
314 >
315 > sub library()
316 >   {
317 >   my ($object,$name,%attributes) = @_;
318 >   $self->pushlevel(\%attributes);# Set nested to 1;
319 >   }
320 >
321 > sub library_()
322 >   {
323 >   # Need unique name for the library (always use name of product). Either use "name"
324 >   # given, or use "file" value minus the ending:
325 >   if (exists ($self->{id}->{'name'}))
326 >      {
327 >      $name = $self->{id}->{'name'};
328 >      }
329 >   else
330 >      {
331 >      ($name) = ($self->{id}->{'file'} =~ /(.*)?\..*$/);
332 >      }
333 >
334 >   # Store the data:
335 >   $self->productcollector($name,'lib','LIBRARY');
336 >   $self->poplevel();
337 >   }
338 >
339 > sub productcollector()
340 >   {
341 >   my $self=shift;
342 >   my ($name,$typeshort,$typefull)=@_;
343 >   # Create a new Product object for storage of data:
344 >   use BuildSystem::Product;
345 >   my $product = BuildSystem::Product->new();
346 >   # Store the name:
347 >   $product->name($name);
348 >   $product->type($typeshort);
349 >   # Store the files. Take the BuildFile path as the initial path for
350 >   # expanding source file globs:
351 >   $product->_files($self->{id}->{'file'},[ $self->{scramdoc}->filetoparse() ]);
352 >   # Store the data content:
353 >   $product->_data($self->{tagcontent});
354 >   # And store in a hash (all build products in same place):
355 >   $self->{content}->{BUILDPRODUCTS}->{$typefull}->{$name} = $product;
356 >   }
357 >
358 > sub pushlevel
359 >   {
360 >   my $self = shift;
361 >   my ($info)=@_;
362 >  
363 >   $self->{id} = $info if (defined $info);
364 >   $self->{nested} = 1;
365 >   $self->{tagcontent}={};
366 >   }
367 >
368 > sub poplevel
369 >   {
370 >   my $self = shift;
371 >   delete $self->{id};
372 >   delete $self->{nested};
373 >   delete $self->{tagcontent};
374 >   }
375 >
376 > sub dependencies()
377 >   {
378 >   my $self=shift;
379 >   # Make a copy of the variable so that
380 >   # we don't have a DEPENDENCIES entry in RAWDATA:
381 >   my %DEPS=%{$self->{DEPENDENCIES}};
382 >   delete $self->{DEPENDENCIES};
383 >   return \%DEPS;
384 >   }
385 >
386 > sub skippeddirs()
387 >   {
388 >   my $self=shift;
389 >   my ($here)=@_;
390 >   my $skipped;
391 >
392 >   if ($self->{content}->{SKIPPEDDIRS}->[0] == 1)
393 >      {
394 >      $skipped = [ @{$self->{content}->{SKIPPEDDIRS}} ];
395 >      delete $self->{content}->{SKIPPEDDIRS};
396 >      }
397 >  
398 >   delete $self->{content}->{SKIPPEDDIRS};
399 >   return $skipped;
400 >   }
401 >
402 > sub hasexport()
403 >   {
404 >   my $self=shift;
405 >   # Check to see if there is a valid export block:
406 >   my $nkeys = $self->exporteddatatypes();
407 >   $nkeys > 0 ? return 1 : return 0;
408 >   }
409 >
410 > sub has()
411 >   {
412 >   my $self=shift;
413 >   my ($datatype)=@_;  
414 >   (exists ($self->{content}->{$datatype})) ? return 1 : return 0;
415 >   }
416 >
417 > sub exported()
418 >   {
419 >   my $self=shift;
420 >   # Return a hash. Keys are type of data provided:
421 >   return ($self->{content}->{EXPORT});
422 >   }
423 >
424 > sub exporteddatatypes()
425 >   {
426 >   my $self=shift;
427 >   # Return exported data types:
428 >   return keys %{$self->{content}->{EXPORT}};
429 >   }
430 >
431 > sub buildproducts()
432 >   {
433 >   my $self=shift;
434 >   # Returns hash of build products and their data:
435 >   return $self->{content}->{BUILDPRODUCTS};
436 >   }
437 >
438 > sub values()
439 >   {
440 >   my $self=shift;
441 >   my ($type)=@_;
442 >   # Get a list of values from known types
443 >   return $self->{content}->{BUILDPRODUCTS}->{$type};
444 >   }
445 >
446 > sub basic_tags()
447 >   {
448 >   my $self=shift;
449 >   my $datatags=[];
450 >   my $buildtags=[ qw(BIN LIBRARY BUILDPRODUCTS) ];
451 >   my $skiptags=[ qw(ARCH EXPORT USE CLASSPATH) ];
452 >   my $otherskiptags=[ qw( SKIPPEDDIRS ) ];
453 >   my @all_skip_tags;
454 >  
455 >   push(@all_skip_tags,@$skiptags,@$buildtags,@$otherskiptags);
456 >
457 >   foreach my $t (keys %{$self->{content}})
458 >      {
459 >      push(@$datatags,$t),if (! grep($t eq $_, @all_skip_tags));
460 >      }
461 >   return @{$datatags};
462 >   }
463 >
464 > sub clean()
465 >   {
466 >   my $self=shift;
467 >   my (@tags) = @_;
468 >
469 >   # Delete some useless entries:
470 >   delete $self->{simpledoc};
471 >   delete $self->{id};
472 >   delete $self->{tagcontent};
473 >   delete $self->{nested};
474 >
475 >   delete $self->{DEPENDENCIES};
476 >  
477 >   map
478 >      {
479 >      delete $self->{content}->{$_} if (exists($self->{content}->{$_}));
480 >      } @tags;
481 >  
482 >   return $self;
483 >   }
484 >
485 > sub AUTOLOAD()
486 >   {
487 >   my ($xmlparser,$name,%attributes)=@_;
488 >   return if $AUTOLOAD =~ /::DESTROY$/;
489 >   my $name=$AUTOLOAD;
490 >   $name =~ s/.*://;
491 >   }
492  
493 < #
831 < # libtype specification
832 < #
833 < sub LibType_Start {
834 <        my $self=shift;
835 <        my $name=shift;
836 <        my $hashref=shift;
837 <
838 <        if ( $self->{Arch} ) {
839 <        if ( defined $self->{libtype_conext} ) {
840 <          $self->{switch}->parseerror("<$name> tag cannot be specified".
841 <                " without a </$name> tag to close previous context");
842 <        }
843 <        else {
844 <        $self->{libtype_conext}=1;
845 <        $self->{switch}->checktag($name, $hashref, 'type');
846 <        
847 <        print GNUmakefile "# Specify Library Type\n";
848 <        print GNUmakefile "DefaultLibsOff=yes\n";
849 <        if ( $$hashref{'type'}=~/^archive/i ) {
850 <          print GNUmakefile "LibArchive=true\n";
851 <        }
852 <        elsif ($$hashref{'type'}=~/debug_archive/i ) {
853 <          print GNUmakefile "LibDebugArchive=true\n";
854 <        }
855 <        elsif ($$hashref{'type'}=~/debug_shared/i ) {
856 <          print GNUmakefile "LibDebugShared=true\n";
857 <        }
858 <        elsif ($$hashref{'type'}=~/shared/i ) {
859 <          print GNUmakefile 'LibShared=true'."\n";
860 <        }
861 <        print GNUmakefile "\n";
862 <        }
863 <        }
864 < }
865 <
866 < sub LibType_text {
867 <        my $self=shift;
868 <        my $name=shift;
869 <        my $string=shift;
870 <
871 <        if ( $self->{Arch} ) {
872 <          $string=~s/\n/ /g;
873 <          print GNUmakefile "libmsg::\n\t\@echo Library info: ";
874 <          print GNUmakefile $string;
875 <          print GNUmakefile "\n";
876 <        }
877 < }
878 <
879 < sub LibType_end {
880 <        my $self=shift;
881 <        my $name=shift;
882 <
883 <        undef $self->{libtype_conext};
884 < }
885 <
886 < sub Environment_start {
887 <        my $self=shift;
888 <        my $name=shift;
889 <        my $hashref=shift;
890 <
891 <        if ( $self->{Arch} ) {
892 <          $self->{envnum}++;
893 <
894 <          # open a new Environment File
895 <          my $envfile="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_".
896 <                $self->{envnum}.".mk";
897 <          use FileHandle;
898 <          my $fh=FileHandle->new();
899 <          open ($fh,">$envfile") or die "Unable to open file $envfile \n$!\n";
900 <          push @{$self->{filehandlestack}}, $fh;
901 <          *GNUmakefile=$fh;
902 <
903 <          # include the approprate environment file
904 <          if ( $self->{envlevel} == 0 ) {
905 <             print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/".
906 <                $self->{path}."/BuildFile.mk\n";
907 <          }
908 <          else {
909 <             print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/".
910 <                $self->{path}."/Env_".$self->{Envlevels}[$self->{envlevel}].".mk\n";
911 <          }
912 <          $self->{envlevel}++;
913 <          $self->{Envlevels}[$self->{envlevel}]=$self->{envnum};
914 <          $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk";
915 <        }
916 < }
917 <
918 < sub Environment_end {
919 <        my $self=shift;
920 <        my $fd;
921 <
922 <        if ( $self->{Arch} ) {
923 <          $self->{envlevel}--;
924 <          if ( $self->{envlevel} < 0 ) {
925 <            print "Too many </Environent> Tags on $self->{switch}->line()\n";
926 <            exit 1;
927 <          }
928 <          close GNUmakefile;
929 <          # restore the last filehandle
930 <          $fd=pop @{$self->{filehandlestack}};
931 <          close $fd;
932 <          *GNUmakefile=$self->{filehandlestack}[$#{$self->{filehandlestack}}];
933 <          if ( $self->{envlevel} < 1 ) {
934 <            $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
935 <                        "BuildFile.mk";
936 <          }
937 <          else {
938 <            $self->{currentenv}=
939 <             $self->{localtop}."/$ENV{INTwork}/$self->{path}/Env_".
940 <                $self->{Envlevels}[$self->{envlevel}];
941 <          }
942 <        }
943 < }
493 > 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines