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.9 by williamc, Fri Sep 29 10:32:18 2000 UTC vs.
Revision 1.29 by sashby, Fri Aug 5 16:44:40 2005 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 < # blockparse(Block) : perform a parse to modify the block
9 < # BlockClassPath() : Return the class path
10 < # ignore()      : return 1 if directory should be ignored 0 otherwise
11 < # classname()   : get/set the associated class
12 < # buildfile()   : get/set BuildFile location
13 < # makefile()    : get the generated makefile
14 <
9 > # Copyright: 2003 (C) Shaun Ashby
10 > #
11 > #--------------------------------------------------------------------
12   package BuildSystem::BuildFile;
16 use ActiveDoc::SimpleDoc;
17 use BuildSystem::ToolBox;
13   require 5.004;
14 + use Exporter;
15 + use BuildSystem::TagUtils;
16 + use BuildSystem::BuildDataUtils;
17 + use ActiveDoc::SimpleDoc;
18  
19 < BEGIN {
20 < $buildfile="BuildFile";
22 < }
23 <
24 < sub new {
25 <        my $class=shift;
26 <        my $self={};
27 <        bless $self, $class;
28 <        $self->{area}=shift;
29 <        $self->{toolbox}=$self->{area}->toolbox();
30 <        $self->{localtop}=$self->{area}->location();
31 <        # -- set RELEASTOP
32 <        my $rarea=$self->{area}->linkarea();
33 <        if ( ! defined $rarea ) {
34 <          $self->{releasetop}=$self->{localtop};
35 <        }
36 <        else {
37 <          $self->{releasetop}=$rarea->location();
38 <        }
39 <        $self->{releasetop}=$self->{area}->location();
40 <        $self->{Arch}=1;
41 <        push @{$self->{ARCHBLOCK}}, $self->{Arch};
42 <        return $self;
43 < }
44 <
45 < sub buildfile {
46 <        my $self=shift;
47 <        if ( @_ ) {
48 <          $self->{buildfile}=shift;
49 <        }
50 <        return $self->{buildfile};
51 < }
52 <
53 < sub makefile {
54 <        my $self=shift;
55 <        if ( @_ ) {
56 <          $self->{makefile}=shift;
57 <        }
58 <        return $self->{makefile};
59 < }
60 <
61 < sub blockparse {
62 <        my $self=shift;
63 <        $self->{block}=shift;
64 <
65 <        $self->{switch}=$self->_initswitcher();
66 <        $self->_initblockparse($self->{switch});
67 < }
68 <
69 < sub ignore {
70 <        my $self=shift;
71 <        return (defined $self->{ignore})?$self->{ignore}:0;
72 < }
73 <
74 < sub _initswitcher {
75 <        my $self=shift;
76 <        my $switch=ActiveDoc::SimpleDoc->new();
77 <        my $parse="makebuild";
78 <        $switch->newparse($parse);
79 <        $switch->addignoretags($parse);
80 <        $self->_commontags($switch,$parse);
81 <        #$switch->addtag($parse,"Build", \&Build_start, $self);
82 <        $switch->addtag($parse,"none",
83 <                                        \&OutToMakefile,$self,
84 <                                        \&OutToMakefile, $self,
85 <                                        "", $self);
86 <        $switch->addtag($parse,"Bin",
87 <                                        \&Bin_start,$self,
88 <                                        \&OutToScreen, $self,
89 <                                        "", $self);
90 <        $switch->addtag($parse,"ProductStore",
91 <                                        \&Store_start,$self,
92 <                                        "", $self,
93 <                                        "", $self);
94 <        $switch->addtag($parse,"LibType",
95 <                                        \&LibType_Start,$self,
96 <                                        \&LibType_text, $self,
97 <                                        \&LibType_end,$self);
98 <        $switch->addtag($parse,"ConfigurationClass",
99 <                                        \&Class_StartTag,$self,
100 <                                        \&OutToMakefile, $self,
101 <                                        "", $self);
102 <        $switch->addtag($parse,"ClassPath",
103 <                                        \&setBlockClassPath,$self,
104 <                                        \&OutToMakefile, $self,
105 <                                        "", $self);
106 <        $switch->addtag($parse,"AssociateGroup",
107 <                                        "",$self,
108 <                                        \&AssociateGroup,$self,
109 <                                        "", $self);
110 <        $switch->addtag($parse,"Environment",
111 <                                        \&Environment_start,$self,
112 <                                        \&OutToMakefile, $self,
113 <                                        \&Environment_end,$self);
114 <        $switch->addtag($parse,"Export",
115 <                                        \&export_start,$self,
116 <                                        \&OutToMakefile, $self,
117 <                                        \&export_end,$self);
118 <        return $switch;
119 < }
120 <
121 < sub _initblockparse {
122 <        my $self=shift;
123 <        my $switch=shift;
124 <
125 <        my $parse="block";
126 <        $switch->newparse($parse);
127 <        $switch->addignoretags($parse);
128 <        $switch->addtag($parse,"DropDown",
129 <                                        \&DropDown_start,$self,
130 <                                        "", $self,
131 <                                        "", $self);
132 <        $switch->addtag($parse,"Build", \&Build_start, $self);
133 < }
134 <
135 < sub _commontags {
136 <        my $self=shift;
137 <        my $switch=shift;
138 <        my $parse=shift;
139 <
140 <        $switch->grouptag("Export",$parse);
141 <        $switch->addtag($parse,"Use",\&Use_start,$self,
142 <                                               \&OutToMakefile, $self,
143 <                                                "", $self);
144 <        $switch->addtag($parse,"Group",\&Group_start,$self,
145 <                                               \&OutToMakefile, $self,
146 <                                                "", $self);
147 <        $switch->grouptag("Group",$parse);
148 <        $switch->addtag($parse,"External",
149 <                                        \&External_StartTag,$self,
150 <                                        \&OutToMakefile, $self,
151 <                                        "", $self);
152 <        $switch->addtag($parse,"lib",
153 <                                        \&lib_start,$self,
154 <                                        \&OutToMakefile, $self,
155 <                                        "", $self);
156 <        $switch->addtag($parse,"Architecture",
157 <                                        \&Arch_Start,$self,
158 <                                        \&OutToMakefile, $self,
159 <                                        \&Arch_End,$self);
160 <        $switch->addtag($parse,"INCLUDE_PATH",
161 <                                        \&IncludePath_Start,$self,
162 <                                        \&OutToMakefile, $self,
163 <                                        "",$self);
164 <        return $switch;
165 < }
166 <
167 < sub GenerateMakefile {
168 <        my $self=shift;
169 <        my $infile=shift;
170 <        my $outfile=shift;
171 <
172 <        $self->{switch}=$self->_initswitcher();
173 <        $self->{switch}->filetoparse($infile);
174 <
175 <        # open a temporary gnumakefile to store output.
176 <        my $fh=FileHandle->new();
177 <        open ( $fh, ">$outfile") or die "Unable to open $outfile for output ".
178 <                                                                "$!\n";
179 <        @{$self->{filehandlestack}}=($fh);
180 <
181 <        #  -- make an alias
182 <        *GNUmakefile=$fh;
183 <        if ( -e $ENV{LatestBuildFile} ) {
184 <          print GNUmakefile "include $ENV{LatestBuildFile}\n";
185 <        }
186 <        $self->{switch}->parse("makebuild"); # sort out supported tags
187 <        close GNUmakefile;
188 <        return $outfile;
189 < }
190 <
191 < sub ParseBuildFile {
192 <        my $self=shift;
193 <        my $base=shift;
194 <        my $path=shift;
195 <        my $filename=shift @_;
196 <        my $fullfilename;
197 <        if ( $filename!~/^\// ) {
198 <         $fullfilename="$base/$path/$filename";
199 <        }
200 <        else {
201 <         $fullfilename=$filename;
202 <        }
203 <        $self->{path}=$path;
204 <        #print "Processing $fullfilename\n";
205 <        $numbins=0;
206 <        $self->{envnum}=0;
207 <        $self->{envlevel}=0;
208 <        $self->{makefile}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
209 <                                                                "BuildFile.mk";
210 <        $self->{currentenv}=$self->{makefile};
211 <        $self->{switch}=$self->_initswitcher();
212 <        $self->{switch}->filetoparse($fullfilename);
213 <
214 < #       $self->{switch}->{Strict_no_cr}='no';
215 <        #open a temporary gnumakefile to store output.
216 <        use Utilities::AddDir;
217 <        AddDir::adddir("$self->{localtop}/$ENV{INTwork}/$self->{path}");
218 <        $ENV{LatestBuildFile}=$self->GenerateMakefile($fullfilename,
219 <          $self->{localtop}."/".$ENV{INTwork}."/".$self->{path}."/BuildFile.mk");
220 < }
221 <
222 < sub classname {
223 <        my $self=shift;
224 <        if ( @_ ) {
225 <          $self->{classname}=shift;
226 <        }
227 <        return $self->{classname};
228 < }
229 <
230 < sub ParseBuildFile_Export {
231 <        my $self=shift;
232 <        my $filename=shift;
233 <        my $bf=BuildSystem::BuildFile->new($self->{area});
234 <        if ( defined $self->{remoteproject} ) {
235 <           $bf->{remoteproject}=$self->{remoteproject};
236 <        }
237 <        $bf->_parseexport($filename);
238 <        undef $bf;
239 < }
240 <
241 < sub _location {
242 <        my $self=shift;
243 <        use File::Basename;
244 <
245 <        return dirname($self->{switch}->filetoparse());
246 < }
247 <
248 < sub _parseexport {
249 <        my $self=shift;
250 <        my $filename=shift;
251 <
252 <        my $switchex=ActiveDoc::SimpleDoc->new();
253 <        $switchex->filetoparse($filename);
254 <        $switchex->newparse("export");
255 <        $switchex->addignoretags("export");
256 <        $switchex->addtag("export","Export",
257 <                                        \&export_start_export,$self,
258 <                                        \&OutToMakefile, $self,
259 <                                        \&export_end_export,$self);
260 <        $self->_commontags($switchex,"export");
261 <        $switchex->allowgroup("__export","export");
262 < #       $switchex->{Strict_no_cr}='no';
263 <        $self->{switch}=$switchex;
264 <        $switchex->parse("export"); # sort out supported tags
265 < }
266 <
267 < sub _pushremoteproject {
268 <        my $self=shift;
269 <        my $path=shift;
270 <        
271 <        if ( defined $self->{remoteproject} ) {
272 <          push @{$self->{rpstack}}, $self->{remoteproject};
273 <        }
274 <        $self->{remoteproject}=$path;
275 < }
276 <
277 < sub _popremoteproject {
278 <        my $self=shift;
279 <        if ( $#{$self->{rpstack}} >=0 ) {
280 <          $self->{remoteproject}=pop @{$self->{rpstack}};
281 <        }
282 <        else {
283 <          undef $self->{remoteproject};
284 <        }
285 < }
286 <
287 < sub _toolmapper {
288 <        my $self=shift;
289 <        if ( ! defined $self->{mapper} ) {
290 <           require BuildSystem::ToolMapper;
291 <           $self->{mapper}=BuildSystem::ToolMapper->new();
292 <        }
293 <        return $self->{mapper};
294 < }
295 <
296 <
297 < # ---- Tag routines
298 <
299 < #-- Override a class type with the <ConfigurationClass type=xxx> tag
300 < #   the type tag will pick up a pre-defined class type from project space.
301 <
302 < sub Class_StartTag {
303 <        my $self=shift;
304 <        my $name=shift;
305 <        my $hashref=shift;
306 <        
307 <        if ( $self->{Arch} ) {
308 <         if ( defined $$hashref{'type'} ) {
309 <                $self->classname($$hashref{'type'});
310 <         }
311 <        }
312 < }
313 <
314 < sub IncludePath_Start {
315 <        my $self=shift;
316 <        my $name=shift;
317 <        my $hashref=shift;
318 <
319 <        $self->{switch}->checktag( $name, $hashref, 'path');
320 <        if ( $self->{Arch} ) {
321 <          print GNUmakefile "INCLUDE+=".$self->_location()."/".
322 <                                                $$hashref{'path'}."\n";
323 <        }
324 < }
19 > @ISA=qw(Exporter BuildSystem::BuildDataUtils);
20 > @EXPORT_OK=qw( );
21  
22   #
23 < # generic build tag
24 < #
25 < sub Build_start {
26 <        my $self=shift;
27 <        my $name=shift;
28 <        my $hashref=shift;
29 <
30 <        $self->{switch}->checktag($name,$hashref,'class');
31 <        $self->{switch}->checktag($name,$hashref,'id');
32 <        if ( $self->{Arch} ) {
33 <
34 <          # -- determine the build products name
35 <          my $name;
36 <          if ( exists $$hashref{'name'} ) {
37 <            $name=$$hashref{'name'};
38 <          }
39 <          else {
40 <            $self->{switch}->parseerror("No name specified for build product");
41 <            #$name="\$(buildname)";
42 <          }
43 <
44 <          # -- check we have a lookup for the class type
45 <          my $mapper=$self->_toolmapper();
46 <          if ( ! $mapper->exists($$hashref{'class'}) ) {
47 <            $self->{switch}->parseerror("Unknown class : ".$$hashref{'class'});
48 <          }
49 <          else {
50 <           my @types=$self->_toolmapper()->types($$hashref{'class'});
51 <           my @deftypes=$self->_toolmapper()->defaulttypes($$hashref{'class'});
52 <
53 <           my $fh=$self->{filehandlestack}[0];
54 <           my @targets=();
55 <
56 <           # -- generate generic targets
57 <           print $fh "ifndef _BuildLink_\n";
58 <           print $fh "# -- Generic targets\n";
59 <           push @targets, $$hashref{'class'};
60 <           foreach $dtype ( @deftypes ) {
61 <            print $fh $$hashref{'class'}."::".$$hashref{'class'}."_".
62 <                                                                $dtype."\n";
63 <           }
64 <           print $fh "\n";
65 <
66 <           # -- generate targets for each type
67 <           foreach $type ( @types ) {
68 <
69 <            # -- generic name for each type
70 <            my $pattern=$$hashref{'class'}."_".$type;
71 <            my $dirname=$$hashref{'class'}."_".$type."_".$name;
72 <            print $fh "# ------ $pattern rules ---------------\n";
73 <            print $fh $$hashref{'class'}."_".$type."::".$$hashref{'class'}.
74 <                                                        "_".$type."_$name\n\n";
75 <
76 <            # -- create a new directory for each type
77 <            push @targets, $pattern;
78 <            my $dirname=$$hashref{'class'}."_".$type."_".$name;
79 <            my $here="$self->{localtop}/$ENV{INTwork}/".$self->{path}."/".$dirname;
80 <            my $makefile=$here."/BuildFile.mk";
81 < #           AddDir::adddir($here);
82 <
83 <            # -- create link targets to the directory
84 <            push @targets, $dirname;
85 <            print $fh "# -- Link Targets to $type directories\n";
86 <            print $fh "$dirname: make_$dirname\n";
87 <            print $fh "\t\@cd $here; \\\n";
88 <            print $fh "\t\$(MAKE) LatestBuildFile=$makefile _BuildLink_=1".
89 <                        " workdir=$here ".
90 <                        " -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \n\n";
91 <
92 <            # -- write target to make makefile for each directory
93 <            print $fh "# -- Build target directories\n";
94 <            print $fh "make_$dirname:\n";
95 <            print $fh "\tif [ ! -e \"$makefile\" ]; then \\\n";
96 <            print $fh "\t if [ ! -d \"$here\" ]; then \\\n";
97 <            print $fh "\t  mkdir $here; \\\n";
98 <            print $fh "\t fi;\\\n";
99 <            print $fh "\t cd $dirname; \\\n";
100 <            print $fh "\t echo include ".$self->{currentenv}." > ".
101 <                                                        "$makefile; \\\n";
102 <            print $fh "\t echo VPATH+=$self->{localtop}/".$self->{path}.
103 <                                        " >> $makefile; \\\n";
104 <            print $fh "\t echo buildname=$name >> $makefile;\\\n";
105 <            print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n";
106 <            if ( defined (my @file=$mapper->rulesfile($$hashref{'class'})) ) {
107 <             foreach $f ( @file ) {
108 <              print $fh "\t echo -include $f >> $makefile; \\\n";
109 <             }
110 <            }
111 <            print $fh "\tfi\n";
112 <            print $fh "\n";
113 < #           print $typefile "$name :\n";
114 < #           print $typefile "\t\$(_quietbuild_)";
115 < #           print $typefile $mapper->template($$hashref{'class'},$type)."\n";
116 < #           print $typefile "\t\$(_quietstamp_)";
117 < #           print $typefile "\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n";
118 <
119 <            # -- cleaning targets
120 <            push @targets, "clean_$dirname";
121 <            print $fh "# -- cleaning targets\n";
122 <            print $fh "clean::clean_$dirname\n";
123 <            print $fh "clean_".$dirname."::\n";
124 <            print $fh "\t\@echo cleaning $dirname\n";
125 <            print $fh "\t\@if [ -d $here ]; then \\\n";
126 <            print $fh "\tcd $here; \\\n";
127 <            print $fh "\t\$(MAKE) LatestBuildFile=$makefile workdir=".
128 <                        $here." _BuildLink_=1 -f ".
129 <                        "\$(TOOL_HOME)/basics.mk clean; \\\n";
130 <            print $fh "\tfi\n\n";
131 <
132 <
133 <          }
134 <          # -- help targets
135 <          print $fh "helpheader::\n";
136 <          print $fh "\t\@echo Targets available:\n";
137 <          print $fh "\t\@echo ------------------\n\n";
138 <          print $fh "help::helpheader\n";
139 <          foreach $target ( @targets ) {
140 <            print $fh "help::\n";
141 <            print $fh "\t\@echo $target\n"
142 <          }
143 <          print $fh "endif\n";
144 <         } # end else
145 <        }
146 < }
147 <
148 < sub Bin_start {
149 <        my $self=shift;
150 <        my $name=shift;
151 <        my $hashref=shift;
456 <
457 <        my $fileclass;
458 <        my @tools;
459 <        my $tool;
460 <        my $filename;
461 <        my $objectname;
462 <        
463 <        $self->{switch}->checktag($name,$hashref,'file');
464 <        if ( $self->{Arch} ) {
465 <        if ( ! defined $$hashref{name} ) {
466 <                ($$hashref{name}=$$hashref{file})=~s/\..*//;
467 <        }
468 <        ($filename=$$hashref{file})=~s/\..*//;
469 <
470 <        # Create a new directory for each binary target
471 <        my $dirname="bin_".$$hashref{name};
472 <        AddDir::adddir("$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname");
473 <        open (binGNUmakefile,
474 <           ">$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die           "Unable to make $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/".
475 <           "BuildFile.mk $!\n";
476 <
477 <        # Create the link targets
478 <        $numbins++;
479 <        my $fh=$self->{filehandlestack}[0];
480 <        print $fh <<ENDTEXT;
481 <
482 < # Link Targets to binary directories
483 < ifdef BINMODE
484 < # We dont want to build a library here
485 < override files:=
486 < endif
487 < ifndef BINMODE
488 <
489 < define stepdown_$$hashref{'name'}
490 < if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
491 < cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\
492 < \$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\
493 < fi
494 < endef
495 <
496 < define stepdown2_$$hashref{'name'}
497 < if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\
498 < cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\
499 < \$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\
500 < fi
501 <
502 < endef
503 <
504 < bin_$$hashref{'name'}_%:: dummy
505 <        \@\$(stepdown2_$$hashref{'name'})
506 <
507 < $$hashref{'name'}_%:: dummy
508 <        \@\$(stepdown_$$hashref{'name'})
509 <
510 < help bin bin_debug bin_debug_local bin_insure bin_Insure clean $$hashref{'name'}:: dummy
511 <        \@\$(stepdown_$$hashref{'name'})
512 <
513 < binfiles+=$$hashref{'file'}
514 < locbinfiles+=$dirname/$$hashref{'file'}
515 < endif
516 <
517 <
518 < ENDTEXT
519 <
520 <
521 < # the binary specifics makefile
522 <        print binGNUmakefile "include ".$self->{currentenv}."\n";
523 <        print binGNUmakefile "VPATH+=".$self->{localtop}."/$self{path}\n";
524 <
525 < # alias for bin_Insure
526 <        print binGNUmakefile <<ENDTEXT;
527 <
528 < bin_insure:bin_Insure
529 < ifdef MAKETARGET_bin_insure
530 < MAKETARGET_$$hashref{name}_Insure=1
531 < endif
532 <
533 < # debuggging target
534 < $$hashref{'name'}_echo_% :: echo_%
535 <
536 < # help targets
537 < help::
538 < \t\@echo Targets For $$hashref{'name'}
539 < \t\@echo -------------------------------------
540 < \t\@echo $$hashref{'name'}  - default build
541 < \t\@echo bin_$$hashref{'name'}_clean - executable specific cleaning
542 < ENDTEXT
543 <
544 < # Make generic rules for each type
545 <        $targettypes={
546 <                "bin" => 'o',
547 <                "bin_debug" => 'd',
548 <                "bin_debug_local" => 'l_d',
549 <                "bin_Insure" => 'Insure'
550 <        };
551 <        #
552 <        foreach $target ( keys %$targettypes ) {
553 <          print binGNUmakefile <<ENDTEXT;
554 <
555 < # Type $target specifics
556 < ifdef MAKETARGET_$target
557 < MAKETARGET_$$hashref{name}_$$targettypes{$target}=1
558 < endif
559 < $target ::$$hashref{name}_$$targettypes{$target}
560 <
561 < bintargets+=$$hashref{name}_$$targettypes{$target}
562 < help::
563 < \t\@echo $$hashref{name}_$$targettypes{$target}
564 < clean::
565 < \t\@if [ -f \$(binarystore)/$$hashref{name}_$$targettypes{$target} ]; then \\
566 < \techo Removing \$(binarystore)/$$hashref{name}; \\
567 < \trm \$(binarystore)/$$hashref{name}_$$targettypes{$target}; \\
568 < \tfi
569 <
570 < ENDTEXT
571 <          ($objectname=$$hashref{file})=~s/\..*/_$$targettypes{$target}\.o/;
572 <          ${"objectname_$$targettypes{$target}"}=$objectname;
573 <          print binGNUmakefile "$objectname:$$hashref{name}.dep\n";
574 <        } # end loop
575 <
576 <        print binGNUmakefile "$$hashref{name}_Insure.exe:.psrc\n";
577 <        print binGNUmakefile "$$hashref{name}_d.exe:$objectname_d\n";
578 <        print binGNUmakefile "\t\$(CClinkCmdDebug)\n";
579 <        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
580 <        print binGNUmakefile "$$hashref{name}_l_d.exe:$objectname_d\n";
581 <        print binGNUmakefile "\t\$(CClinkCmdDebugLocal)\n";
582 <        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
583 <        print binGNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n";
584 <        print binGNUmakefile "\t\$(CClinkCmdInsure)\n";
585 <        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
586 <        print binGNUmakefile "$$hashref{name}_o.exe:$objectname_o\n";
587 <        print binGNUmakefile "\t\$(CClinkCmd)\n";
588 <        print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n";
589 <        print binGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n";
590 <        print binGNUmakefile "-include $$hashref{name}.dep\n";
591 < print binGNUmakefile <<ENDTEXT;
592 < clean::
593 < \t\@if [ -f \$(binarystore)/$$hashref{name} ]; then \\
594 < \techo Removing \$(binarystore)/$$hashref{name}; \\
595 < \trm \$(binarystore)/$$hashref{name}; \\
596 < \tfi
597 <
598 < $$hashref{name}_d.exe:\$(libslocal_d)
599 < $$hashref{name}_o.exe:\$(libslocal)
600 < ifdef MCCABE_DATA_DIR
601 < $$hashref{name}_mccabe.exe: \$(libslocal_d) \$(MCCABE_DATA_DIR)/mccabeinstr/instplus.cpp
602 < endif
603 < $$hashref{name}_Insure.exe:\$(libslocal_I)
604 < $$hashref{name}_d:$$hashref{name}_d.exe
605 <        \@cp $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
606 < $$hashref{name}_l_d:$$hashref{name}_l_d.exe
607 <        \@cp $$hashref{name}_l_d.exe \$(binarystore)/$$hashref{name}
608 < $$hashref{name}_Insure:$$hashref{name}_Insure.exe
609 <        \@cp $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure
610 < $$hashref{name}:$$hashref{name}_d.exe
611 <        \@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name}
612 < $$hashref{name}_o:$$hashref{name}_o.exe
613 <        \@mv $$hashref{name}_o.exe \$(binarystore)/$$hashref{name}
614 < binfiles+=$$hashref{file}
615 < ENDTEXT
616 <        }
617 <        close binGNUmakefile;
618 < }
619 <
620 < sub External_StartTag {
621 <        my $self=shift;
622 <        my $name=shift;
623 <        my $hashref=shift;
624 <        
625 <        my $tool;
626 <        if ( $self->{Arch} ) {
627 <        $self->{switch}->checktag($name,$hashref,'ref');
628 <
629 <        # -- oo toolbox stuff
630 <        # - get the appropriate tool object
631 <        $$hashref{'ref'}=~tr[A-Z][a-z];
632 <        if ( ! exists $$hashref{'version'} ) {
633 <         $tool=$self->{toolbox}->gettool($$hashref{'ref'});
634 <        }
635 <        else {
636 <         $tool=$self->{toolbox}->gettool($$hashref{'ref'},$$hashref{'version'});
637 <        }
638 <        if ( ! defined $tool ) {
639 <          $self->{switch}->parseerror("Unknown Tool Specified ("
640 <                                                        .$$hashref{'ref'}.")");
641 <        }
642 <
643 <        # -- old fashioned GNUmakefile stuff
644 <        print GNUmakefile $$hashref{'ref'};
645 <        if ( defined $$hashref{'version'} ) {
646 <                print GNUmakefile "_V_".$$hashref{'version'};
647 <        }
648 <        print GNUmakefile "=true\n";
649 <        
650 <        # -- Sub system also specified?
651 <        if ( exists $$hashref{'use'} ) {
652 <           # -- look for a buildfile
653 <           my @paths=$tool->getfeature("INCLUDE");
654 <           my $file="";
655 <           my ($path,$testfile);
656 <           foreach $path ( @paths ) {
657 <             $testfile=$path."/".$$hashref{'use'}."/BuildFile" ;
658 <             if ( -f $testfile ) {
659 <                $file=$testfile;
660 <                $self->_pushremoteproject($path);
661 <             }
662 <           }
663 <           if ( $file eq "" ) {
664 <             $self->{switch}->parseerror("Unable to find SubSystem $testfile");
665 <           }
666 <           $self->ParseBuildFile_Export($file);
667 <           $self->_popremoteproject();
668 <         }
669 <        }
670 < }      
671 <
672 < sub Group_start {
673 <        my $self=shift;
674 <        my $name=shift;
675 <        my $hashref=shift;
676 <        
677 <        $self->{switch}->checktag($name, $hashref, 'name');
678 <        if ( $self->{Arch} ) {
679 <        print GNUmakefile "GROUP_".$$hashref{'name'};
680 <        if ( defined $$hashref{'version'} ) {
681 <                print GNUmakefile "_V_".$$hashref{'version'};
682 <        }
683 <        print GNUmakefile "=true\n";
684 <        }
685 < }      
686 <
687 < sub Use_start {
688 <        my $self=shift;
689 <        my $name=shift;
690 <        my $hashref=shift;
691 <        my $filename;
692 <        use Utilities::SCRAMUtils;
693 <        
694 <        $self->{switch}->checktag($name, $hashref, "name");
695 <        if ( $self->{Arch} ) {
696 <        if ( exists $$hashref{'group'} ) {
697 <          print GNUmakefile "GROUP_".$$hashref{'group'}."=true\n";
698 <        }
699 <        if ( ! defined $self->{remoteproject} ) {
700 <          $filename=SCRAMUtils::checkfile(
701 <                "/$ENV{INTsrc}/$$hashref{name}/BuildFile");
702 <        }
703 <        else {
704 <          $filename=$self->{remoteproject}."/$$hashref{name}/BuildFile";
705 <        print "trying $filename\n";
706 <          if ( ! -f $filename ) { $filename=""; };
707 <        }
708 <        if ( $filename ne "" ) {
709 <          $self->ParseBuildFile_Export( $filename );
710 <        }
711 <        else {
712 <           $self->{switch}->parseerror("Unable to detect Appropriate ".
713 <                "decription file for <$name name=".$$hashref{name}.">");
714 <        }
715 <        }
716 < }
717 <
718 < # List association groups between <AssociateGroup> tags
719 < # seperated by newlines or spaces
720 < sub AssociateGroup {
721 <        my $self=shift;
722 <        my $name=shift;
723 <        my $string=shift;
724 <        my $word;
725 <
726 <        if ( $self->{Arch} ) {
727 <        foreach $word ( (split /\s/, $string) ){
728 <                chomp $word;
729 <                next if /^#/;
730 <                if ( $word=~/none/ ) {
731 <                        $self->{ignore}=1;
732 <                }
733 <        }
734 <        }
735 < }
736 <
737 < sub Arch_Start {
738 <        my $self=shift;
739 <        my $name=shift;
740 <        my $hashref=shift;
741 <
742 <        $self->{switch}->checktag($name, $hashref,'name');
743 <        ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($self->{Arch}=1)
744 <                                                : ($self->{Arch}=0);
745 <        push @{$self->{ARCHBLOCK}}, $self->{Arch};
746 < }
747 <
748 < sub Arch_End {
749 <        my $self=shift;
750 <        my $name=shift;
751 <
752 <        pop @{$self->{ARCHBLOCK}};
753 <        $self->{Arch}=$self->{ARCHBLOCK}[$#{$self->{ARCHBLOCK}}];
754 < }
755 <
756 < # Split up the Class Block String into a useable array
757 < sub _CutBlock {
758 <    my $self=shift;
759 <    my $string= shift @_;
760 <    @BlockClassA = split /\//, $string;
761 < }
762 <
763 < sub OutToMakefile {
764 <        my $self=shift;
765 <        my $name=shift;
766 <        my @vars=@_;
767 <
768 <        if ( $self->{Arch} ) {
769 <          print GNUmakefile @vars;
770 <        }
771 < }
772 <
773 < sub OutToScreen {
774 <        my $name=shift;
775 <        my @vars=@_;
776 <
777 <        if ( $self->{Arch} ) {
778 <          print @vars;
779 <        }
780 < }
781 < sub setBlockClassPath {
782 <        my $self=shift;
783 <        my $name=shift;
784 <        my $hashref=shift;
785 <
786 <        $self->{switch}->checktag($name, $hashref, 'path');
787 <        $self->{BlockClassPath}=$self->{BlockClassPath}.":".$$hashref{path};
788 <        $self->_CutBlock($$hashref{path});
789 < }
790 <
791 < sub BlockClassPath {
792 <        my $self=shift;
793 <        return $self->{BlockClassPath};
794 < }
795 <
796 < sub export_start_export {
797 <        my $self=shift;
798 <        my $name=shift;
799 <        my $hashref=shift;
800 <
801 <        $self->{switch}->opengroup("__export");
802 < }
803 <
804 < sub export_start {
805 <        my $self=shift;
806 <        my $name=shift;
807 <        my $hashref=shift;
808 <
809 <        $self->{switch}->opengroup("__export");
810 <        if ( exists $$hashref{autoexport} ) {
811 <          print GNUmakefile "scram_autoexport=".$$hashref{autoexport}."\n";
812 <          if ( $$hashref{autoexport}=~/true/ ) {
813 <           $self->{switch}->allowgroup("__export","makebuild");
814 <          }
815 <          else {
816 <           $self->{switch}->disallowgroup("__export","makebuild");
817 <          }
818 <        }
819 <        # -- allow default setting from other makefiles
820 <        print GNUmakefile "ifeq (\$(scram_autoexport),true)\n";
821 < }
822 <
823 < sub export_end_export {
824 <        my $self=shift;
825 <        $self->{switch}->closegroup("__export");
826 < }
827 <
828 < sub export_end {
829 <        my $self=shift;
830 <        $self->{switch}->closegroup("__export");
831 <        print GNUmakefile "endif\n";
832 < }
23 > sub new()
24 >   ###############################################################
25 >   # new                                                         #
26 >   ###############################################################
27 >   # modified : Wed Dec  3 19:03:22 2003 / SFA                   #
28 >   # params   :                                                  #
29 >   #          :                                                  #
30 >   # function :                                                  #
31 >   #          :                                                  #
32 >   ###############################################################
33 >   {
34 >   my $proto=shift;
35 >   my $class=ref($proto) || $proto;
36 >   my $self={};
37 >  
38 >   bless $self,$class;
39 >
40 >   $self->{DEPENDENCIES} = {};
41 >   $self->{content} = {};
42 >   return $self;
43 >   }
44 >
45 > sub _initparser()
46 >   {
47 >   my $self=shift;
48 >
49 >   $self->{simpledoc}=ActiveDoc::SimpleDoc->new();
50 >   $self->{simpledoc}->newparse("builder");
51 >   $self->{simpledoc}->addignoretags("builder");
52 >
53 >   # For blank lines do nothing:
54 >   $self->{simpledoc}->addtag("builder","none",
55 >                              "", $self,
56 >                              "", $self,
57 >                              "", $self);
58 >  
59 >   # Define the tags to be used in this class:
60 >   $self->{simpledoc}->addtag("builder","classpath",
61 >                              \&BuildSystem::TagUtils::classpathtagOpen, $self,
62 >                              "", $self,
63 >                              "", $self);
64 >
65 >   $self->{simpledoc}->addtag("builder","productstore",
66 >                              \&BuildSystem::TagUtils::productstoretagOpen, $self,
67 >                              "", $self,
68 >                              "", $self);
69 >
70 >   $self->{simpledoc}->addtag("builder","architecture",
71 >                              \&BuildSystem::TagUtils::archtagOpen, $self,
72 >                              "", $self,
73 >                              \&BuildSystem::TagUtils::archtagClose, $self);
74 >
75 >   $self->{simpledoc}->addtag("builder","include_path",
76 >                              \&BuildSystem::TagUtils::includetagOpen, $self,
77 >                              "", $self,
78 >                              "", $self);
79 >  
80 >   $self->{simpledoc}->addtag("builder","define_group",
81 >                              \&BuildSystem::TagUtils::groupdeftagOpen, $self,
82 >                              "", $self,
83 >                              \&BuildSystem::TagUtils::groupdeftagClose, $self);
84 >  
85 >   $self->{simpledoc}->addtag("builder","group",
86 >                              \&BuildSystem::TagUtils::grouptagOpen, $self,
87 >                              "", $self,
88 >                              "", $self);
89 >  
90 >   $self->{simpledoc}->addtag("builder","lib",
91 >                              \&BuildSystem::TagUtils::libtagOpen, $self,
92 >                              "", $self,
93 >                              "", $self);
94 >
95 >   $self->{simpledoc}->addtag("builder","export",
96 >                              \&BuildSystem::TagUtils::exporttagOpen, $self,
97 >                              "", $self,
98 >                              \&BuildSystem::TagUtils::exporttagClose, $self);
99 >
100 >   $self->{simpledoc}->addtag("builder","use",
101 >                              \&BuildSystem::TagUtils::usetagOpen, $self,
102 >                              "", $self,
103 >                              "", $self);
104 >  
105 >   $self->{simpledoc}->addtag("builder","libtype",
106 >                              \&BuildSystem::TagUtils::libtypetagOpen, $self,
107 >                              "", $self,
108 >                              "", $self);
109 >
110 >   $self->{simpledoc}->addtag("builder","skip",
111 >                              \&BuildSystem::TagUtils::skiptagOpen, $self,
112 >                              \&BuildSystem::TagUtils::skiptagMessage, $self,
113 >                              \&BuildSystem::TagUtils::skiptagClose, $self);
114 >
115 >   $self->{simpledoc}->addtag("builder","makefile",
116 >                              \&BuildSystem::TagUtils::makefiletagOpen, $self,
117 >                              \&BuildSystem::TagUtils::makefiletagContent, $self,
118 >                              \&BuildSystem::TagUtils::makefiletagClose, $self);
119 >
120 >   $self->{simpledoc}->addtag("builder","flags",
121 >                              \&BuildSystem::TagUtils::flagstagOpen, $self,
122 >                              "", $self,
123 >                              "", $self);
124 >  
125 >   $self->{simpledoc}->addtag("builder","bin",
126 >                              \&BuildSystem::TagUtils::binarytagOpen, $self,
127 >                              "", $self,
128 >                              \&BuildSystem::TagUtils::binarytagClose, $self);
129 >  
130 >   $self->{simpledoc}->addtag("builder","module",
131 >                              \&BuildSystem::TagUtils::moduletagOpen, $self,
132 >                              "", $self,
133 >                              \&BuildSystem::TagUtils::moduletagClose, $self);
134 >  
135 >   $self->{simpledoc}->addtag("builder","application",
136 >                              \&BuildSystem::TagUtils::applicationtagOpen, $self,
137 >                              "", $self,
138 >                              \&BuildSystem::TagUtils::applicationtagClose, $self);
139 >
140 >   $self->{simpledoc}->addtag("builder","library",
141 >                              \&BuildSystem::TagUtils::librarytagOpen, $self,
142 >                              "", $self,
143 >                              \&BuildSystem::TagUtils::librarytagClose, $self);
144 >
145 > #    $self->{simpledoc}->addtag("builder"," ",
146 > #                             \&BuildSystem::TagUtils::  ,$self,
147 > #                             \&BuildSystem::TagUtils::  ,$self,
148 > #                             \&BuildSystem::TagUtils::  ,$self);
149 >
150 >   return $self->{simpledoc};
151 >   }
152  
153 < #
154 < # Standard lib tag
155 < #
156 < sub lib_start {
157 <        my $self=shift;
158 <        my $name=shift;
159 <        my $hashref=shift;
160 <
161 <        $self->{switch}->checktag($name, $hashref, 'name');
162 <        if ( $self->{Arch} ) {
163 <           print GNUmakefile "lib+=$$hashref{name}\n";
164 <        }
165 < }
153 > sub parse()
154 >   {
155 >   my $self=shift;
156 >   my ($filename)=@_;
157 >
158 >   $self->{simpledoc}=$self->_initparser();
159 >   $self->{simpledoc}->filetoparse($filename);
160 >   $self->{simpledoc}->parse("builder");
161 >   # We're done with the SimpleDoc object so delete it:
162 >   delete $self->{simpledoc};
163 >   }
164 >
165 > sub _initbranchparser()
166 >   {
167 >   my $self=shift;
168 >
169 >   $self->{simpledoc}=ActiveDoc::SimpleDoc->new();
170 >   $self->{simpledoc}->newparse("branchbuilder");
171 >   $self->{simpledoc}->addignoretags("branchbuilder");
172 >
173 >   # For blank lines do nothing:
174 >   $self->{simpledoc}->addtag("branchbuilder","none",
175 >                              "", $self,
176 >                              "", $self,
177 >                              "", $self);
178 >  
179 >   # Define the tags to be used in this class:
180 >   $self->{simpledoc}->addtag("branchbuilder","productstore",
181 >                              \&BuildSystem::TagUtils::productstoretagOpen, $self,
182 >                              "", $self,
183 >                              "", $self);
184 >  
185 >   $self->{simpledoc}->addtag("branchbuilder","architecture",
186 >                              \&BuildSystem::TagUtils::archtagOpen, $self,
187 >                              "", $self,
188 >                              \&BuildSystem::TagUtils::archtagClose, $self);
189 >
190 >   $self->{simpledoc}->addtag("branchbuilder","include_path",
191 >                              \&BuildSystem::TagUtils::includetagOpen, $self,
192 >                              "", $self,
193 >                              "", $self);
194 >  
195 >   $self->{simpledoc}->addtag("branchbuilder","export",
196 >                              \&BuildSystem::TagUtils::exporttagOpen, $self,
197 >                              "", $self,
198 >                              \&BuildSystem::TagUtils::exporttagClose, $self);
199 >
200 >   $self->{simpledoc}->addtag("branchbuilder","define_group",
201 >                              \&BuildSystem::TagUtils::groupdeftagOpen, $self,
202 >                              "", $self,
203 >                              \&BuildSystem::TagUtils::groupdeftagClose, $self);
204 >  
205 >   $self->{simpledoc}->addtag("branchbuilder","group",
206 >                              \&BuildSystem::TagUtils::grouptagOpen, $self,
207 >                              "", $self,
208 >                              "", $self);
209 >  
210 >   $self->{simpledoc}->addtag("branchbuilder","lib",
211 >                              \&BuildSystem::TagUtils::libtagOpen, $self,
212 >                              "", $self,
213 >                              "", $self);
214 >
215 >   $self->{simpledoc}->addtag("branchbuilder","use",
216 >                              \&BuildSystem::TagUtils::usetagOpen, $self,
217 >                              "", $self,
218 >                              "", $self);
219 >  
220 >   $self->{simpledoc}->addtag("branchbuilder","libtype",
221 >                              \&BuildSystem::TagUtils::libtypetagOpen, $self,
222 >                              "", $self,
223 >                              "", $self);
224 >  
225 >   $self->{simpledoc}->addtag("branchbuilder","makefile",
226 >                              \&BuildSystem::TagUtils::makefiletagOpen, $self,
227 >                              \&BuildSystem::TagUtils::makefiletagContent, $self,
228 >                              \&BuildSystem::TagUtils::makefiletagClose, $self);
229 >
230 >   $self->{simpledoc}->addtag("branchbuilder","flags",
231 >                              \&BuildSystem::TagUtils::flagstagOpen, $self,
232 >                              "", $self,
233 >                              "", $self);
234 >  
235 >   $self->{simpledoc}->addtag("branchbuilder","bin",
236 >                              \&BuildSystem::TagUtils::binarytagOpen, $self,
237 >                              "", $self,
238 >                              \&BuildSystem::TagUtils::binarytagClose, $self);
239 >  
240 >   $self->{simpledoc}->addtag("branchbuilder","module",
241 >                              \&BuildSystem::TagUtils::moduletagOpen, $self,
242 >                              "", $self,
243 >                              \&BuildSystem::TagUtils::moduletagClose, $self);
244 >  
245 >   $self->{simpledoc}->addtag("branchbuilder","application",
246 >                              \&BuildSystem::TagUtils::applicationtagOpen, $self,
247 >                              "", $self,
248 >                              \&BuildSystem::TagUtils::applicationtagClose, $self);
249 >
250 >   $self->{simpledoc}->addtag("branchbuilder","library",
251 >                              \&BuildSystem::TagUtils::librarytagOpen, $self,
252 >                              "", $self,
253 >                              \&BuildSystem::TagUtils::librarytagClose, $self);
254 >  
255 >   return $self->{simpledoc};
256 >   }
257 >
258 > sub parsebranchfiles()
259 >   {
260 >   my $self=shift;
261 >   my ($filenames)=@_; # array ref
262 >   # List of buildfiles:
263 >   $self->{localpaths}=$filenames;
264 >   $self->{simpledoc}=$self->_initbranchparser();
265 >   # We iterate over an array of files to be read in turn: all
266 >   # build data will be stored in the same BuildFile object:
267 >   $self->{simpledoc}->parsefilelist("branchbuilder",$filenames);
268 >   # We're done with the SimpleDoc object so delete it:
269 >   delete $self->{simpledoc};
270 >   }
271 >
272 > sub productcollector()
273 >   {
274 >   my $self=shift;
275 >   my ($name,$typeshort,$typefull)=@_;
276 >   # Create a new Product object for storage of data:
277 >   use BuildSystem::Product;
278 >   my $product = BuildSystem::Product->new();
279 >   # Store the name:
280 >   $product->name($name);
281 >   $product->type($typeshort);
282 >   # Store the files:
283 >   $product->_files($self->{id}->{'file'},$self->{localpaths});
284 >   # Store the data content:
285 >   $product->_data($self->{tagcontent});
286 >   # And store in a hash (all build products in same place):
287 >   $self->{content}->{BUILDPRODUCTS}->{$typefull}->{$name} = $product;
288 >   }
289 >
290 > sub pushlevel
291 >   {
292 >   my $self = shift;
293 >   my ($info)=@_;
294 >  
295 >   $self->{id} = $info if (defined $info);
296 >   $self->{nested} = 1;
297 >   $self->{tagcontent}={};
298 >   }
299 >
300 > sub poplevel
301 >   {
302 >   my $self = shift;
303 >   delete $self->{id};
304 >   delete $self->{nested};
305 >   delete $self->{tagcontent};
306 >   }
307 >
308 > sub dependencies()
309 >   {
310 >   my $self=shift;
311 >   # Make a copy of the variable so that
312 >   # we don't have a DEPENDENCIES entry in RAWDATA:
313 >   my %DEPS=%{$self->{DEPENDENCIES}};
314 >   delete $self->{DEPENDENCIES};
315 >   return \%DEPS;
316 >   }
317 >
318 > sub skippeddirs()
319 >   {
320 >   my $self=shift;
321 >   my ($here)=@_;
322 >   my $skipped;
323 >
324 >   if ($self->{content}->{SKIPPEDDIRS}->[0] == 1)
325 >      {
326 >      $skipped = [ @{$self->{content}->{SKIPPEDDIRS}} ];
327 >      delete $self->{content}->{SKIPPEDDIRS};
328 >      }
329 >  
330 >   delete $self->{content}->{SKIPPEDDIRS};
331 >   return $skipped;
332 >   }
333  
334   #
335 < # libtype specification
335 > # All data access methods are inherited from BuildDataUtils.
336   #
337 < sub LibType_Start {
852 <        my $self=shift;
853 <        my $name=shift;
854 <        my $hashref=shift;
855 <
856 <        if ( $self->{Arch} ) {
857 <        if ( defined $self->{libtype_conext} ) {
858 <          $self->{switch}->parseerror("<$name> tag cannot be specified".
859 <                " without a </$name> tag to close previous context");
860 <        }
861 <        else {
862 <        $self->{libtype_conext}=1;
863 <        $self->{switch}->checktag($name, $hashref, 'type');
864 <        
865 <        print GNUmakefile "# Specify Library Type\n";
866 <        print GNUmakefile "DefaultLibsOff=yes\n";
867 <        if ( $$hashref{'type'}=~/^archive/i ) {
868 <          print GNUmakefile "LibArchive=true\n";
869 <        }
870 <        elsif ($$hashref{'type'}=~/debug_archive/i ) {
871 <          print GNUmakefile "LibDebugArchive=true\n";
872 <        }
873 <        elsif ($$hashref{'type'}=~/debug_shared/i ) {
874 <          print GNUmakefile "LibDebugShared=true\n";
875 <        }
876 <        elsif ($$hashref{'type'}=~/shared/i ) {
877 <          print GNUmakefile 'LibShared=true'."\n";
878 <        }
879 <        print GNUmakefile "\n";
880 <        }
881 <        }
882 < }
883 <
884 < sub LibType_text {
885 <        my $self=shift;
886 <        my $name=shift;
887 <        my $string=shift;
888 <
889 <        if ( $self->{Arch} ) {
890 <          $string=~s/\n/ /g;
891 <          print GNUmakefile "libmsg::\n\t\@echo Library info: ";
892 <          print GNUmakefile $string;
893 <          print GNUmakefile "\n";
894 <        }
895 < }
896 <
897 < sub LibType_end {
898 <        my $self=shift;
899 <        my $name=shift;
900 <
901 <        undef $self->{libtype_conext};
902 < }
903 <
904 < sub Environment_start {
905 <        my $self=shift;
906 <        my $name=shift;
907 <        my $hashref=shift;
908 <
909 <        if ( $self->{Arch} ) {
910 <          $self->{envnum}++;
911 <
912 <          # open a new Environment File
913 <          my $envfile="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_".
914 <                $self->{envnum}.".mk";
915 <          use FileHandle;
916 <          my $fh=FileHandle->new();
917 <          open ($fh,">$envfile") or die "Unable to open file $envfile \n$!\n";
918 <          push @{$self->{filehandlestack}}, $fh;
919 <          *GNUmakefile=$fh;
920 <
921 <          # include the approprate environment file
922 <          if ( $self->{envlevel} == 0 ) {
923 <             print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/".
924 <                $self->{path}."/BuildFile.mk\n";
925 <          }
926 <          else {
927 <             print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/".
928 <                $self->{path}."/Env_".$self->{Envlevels}[$self->{envlevel}].".mk\n";
929 <          }
930 <          $self->{envlevel}++;
931 <          $self->{Envlevels}[$self->{envlevel}]=$self->{envnum};
932 <          $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk";
933 <        }
934 < }
935 <
936 < sub Environment_end {
937 <        my $self=shift;
938 <        my $fd;
939 <
940 <        if ( $self->{Arch} ) {
941 <          $self->{envlevel}--;
942 <          if ( $self->{envlevel} < 0 ) {
943 <            print "Too many </Environent> Tags on $self->{switch}->line()\n";
944 <            exit 1;
945 <          }
946 <          close GNUmakefile;
947 <          # restore the last filehandle
948 <          $fd=pop @{$self->{filehandlestack}};
949 <          close $fd;
950 <          *GNUmakefile=$self->{filehandlestack}[$#{$self->{filehandlestack}}];
951 <          if ( $self->{envlevel} < 1 ) {
952 <            $self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/".
953 <                        "BuildFile.mk";
954 <          }
955 <          else {
956 <            $self->{currentenv}=
957 <             $self->{localtop}."/$ENV{INTwork}/$self->{path}/Env_".
958 <                $self->{Envlevels}[$self->{envlevel}];
959 <          }
960 <        }
961 < }
962 <
963 < sub Store_start {
964 <        my $self=shift;
965 <        my $name=shift;
966 <        my $hashref=shift;
967 <
968 <        if ( $self->{Arch} ) {
969 <          $self->{switch}->checktag( $name, $hashref, 'name' );
970 <
971 <          # -- store creation
972 <          my $dir=$$hashref{'name'};
973 <          AddDir::adddir($self->{area}->location()."/".$dir);
974 <          if ( exists $$hashref{'type'} ) {
975 <            # -- architecture specific store
976 <            if ( $$hashref{'type'}=~/^arch/i ) {
977 <                $dir=$dir."/".$ENV{SCRAM_ARCH};
978 <                AddDir::adddir($self->{area}->location()."/".$dir);
979 <            }
980 <            else {
981 <                $self->parseerror("Unknown type in <$name> tag");
982 <            }
983 <          }
984 <        
985 <          # -- set make variables for the store
986 <          print GNUmakefile "SCRAMSTORENAME_".$$hashref{'name'}.":=".$dir."\n";
987 <          print GNUmakefile "SCRAMSTORE_".$$hashref{'name'}.":=".
988 <                                        $self->{localtop}."/".$dir."\n";
989 <          print GNUmakefile "VPATH+=".$self->{localtop}
990 <                        ."/".$dir.":".$self->{releasetop}."/".$dir."\n";
991 <        }
992 < }
993 <
994 < sub DropDown {
995 <        my $self=shift;
996 <        my $name=shift;
997 <        my $hashref=shift;
998 <
999 <        if ( $self->{Arch} ) {
1000 <          # - default values must always be specified
1001 <          $self->{switch}->checktag( $name, $hashref, 'defaults' );
1002 <          my @blockdirs=split /,/ , $$hashref{'defaults'};
1003 <          $self->{block}->defaultblocks(@blockdirs);
1004 <        }
1005 < }
337 > 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines