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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines