7 |
|
# ParseBuildFileExport(filename) |
8 |
|
# BlockClassPath() : Return the class path |
9 |
|
# ignore() : return 1 if directory should be ignored 0 otherwise |
10 |
+ |
# classname() : get/set the associated class |
11 |
+ |
# buildfile() : get/set BuildFile location |
12 |
|
|
13 |
|
package BuildSystem::BuildFile; |
14 |
|
use ActiveDoc::SimpleDoc; |
25 |
|
bless $self, $class; |
26 |
|
$self->{area}=shift; |
27 |
|
$self->{toolbox}=$self->{area}->toolbox(); |
28 |
+ |
$self->{localtop}=$self->{area}->location(); |
29 |
|
$self->{Arch}=1; |
30 |
|
push @{$self->{ARCHBLOCK}}, $self->{Arch}; |
31 |
|
return $self; |
32 |
|
} |
33 |
|
|
34 |
+ |
sub buildfile { |
35 |
+ |
my $self=shift; |
36 |
+ |
if ( @_ ) { |
37 |
+ |
$self->{buildfile}=shift; |
38 |
+ |
} |
39 |
+ |
return $self->{buildfile}; |
40 |
+ |
} |
41 |
+ |
|
42 |
|
sub ignore { |
43 |
|
my $self=shift; |
44 |
|
return (defined $self->{ignore})?$self->{ignore}:0; |
160 |
|
$numbins=0; |
161 |
|
$self->{envnum}=0; |
162 |
|
$self->{envlevel}=0; |
163 |
< |
$self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/". |
163 |
> |
$self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/". |
164 |
|
"BuildFile.mk"; |
165 |
|
$self->{switch}=$self->_initswitcher(); |
166 |
|
$self->{switch}->filetoparse($fullfilename); |
168 |
|
# $self->{switch}->{Strict_no_cr}='no'; |
169 |
|
#open a temporary gnumakefile to store output. |
170 |
|
use Utilities::AddDir; |
171 |
< |
AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}"); |
171 |
> |
AddDir::adddir("$self->{localtop}/$ENV{INTwork}/$self->{path}"); |
172 |
|
my $fh=FileHandle->new(); |
173 |
< |
open ( $fh, ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk" |
173 |
> |
open ( $fh, ">$self->{localtop}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk" |
174 |
|
) or die 'Unable to open /$ENV{INTwork}/".$self->{path}."/BuildFile.mk $!\n'; |
175 |
|
@{$self->{filehandlestack}}=($fh); |
176 |
|
# make an alias |
179 |
|
print GNUmakefile "include $ENV{LatestBuildFile}\n"; |
180 |
|
} |
181 |
|
# print "writing to :\n". |
182 |
< |
# "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/BuildFile.mk\n"; |
183 |
< |
$ENV{LatestBuildFile}="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk"; |
182 |
> |
# "$self->{localtop}/$ENV{INTwork}/$self->{path}/BuildFile.mk\n"; |
183 |
> |
$ENV{LatestBuildFile}="$self->{localtop}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk"; |
184 |
|
$self->{switch}->parse("makebuild"); # sort out supported tags |
185 |
|
if ( $numbins > 0 ) { |
186 |
|
print GNUmakefile <<ENDTEXT; |
202 |
|
close GNUmakefile; |
203 |
|
} |
204 |
|
|
205 |
+ |
sub classname { |
206 |
+ |
my $self=shift; |
207 |
+ |
if ( @_ ) { |
208 |
+ |
$self->{classname}=shift; |
209 |
+ |
} |
210 |
+ |
return $self->{classname}; |
211 |
+ |
} |
212 |
+ |
|
213 |
|
sub ParseBuildFile_Export { |
214 |
|
my $self=shift; |
215 |
|
my $filename=shift; |
289 |
|
|
290 |
|
if ( $self->{Arch} ) { |
291 |
|
if ( defined $$hashref{'type'} ) { |
292 |
< |
$ClassName=$$hashref{'type'}; |
292 |
> |
$self->classname($$hashref{'type'}); |
293 |
|
} |
294 |
|
} |
295 |
|
} |
362 |
|
# -- create a new directory for each type |
363 |
|
push @targets, $pattern; |
364 |
|
my $dirname=$$hashref{'class'}."_".$type."_".$name; |
365 |
< |
my $here="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/".$dirname; |
365 |
> |
my $here="$self->{localtop}/$ENV{INTwork}/".$self->{path}."/".$dirname; |
366 |
|
my $makefile=$here."/BuildFile.mk"; |
367 |
|
# AddDir::adddir($here); |
368 |
|
|
385 |
|
print $fh "\t cd $dirname; \\\n"; |
386 |
|
print $fh "\t echo include ".$self->{currentenv}." > ". |
387 |
|
"$makefile; \\\n"; |
388 |
< |
print $fh "\t echo VPATH+=$ENV{LOCALTOP}/".$self->{path}. |
388 |
> |
print $fh "\t echo VPATH+=$self->{localtop}/".$self->{path}. |
389 |
|
" >> $makefile; \\\n"; |
390 |
|
print $fh "\t echo buildname=$name >> $makefile;\\\n"; |
391 |
|
print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n"; |
400 |
|
# print $typefile "\t\$(_quietbuild_)"; |
401 |
|
# print $typefile $mapper->template($$hashref{'class'},$type)."\n"; |
402 |
|
# print $typefile "\t\$(_quietstamp_)"; |
403 |
< |
# print $typefile "$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n"; |
403 |
> |
# print $typefile "\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n"; |
404 |
|
|
405 |
|
# -- cleaning targets |
406 |
|
push @targets, "clean_$dirname"; |
451 |
|
|
452 |
|
# Create a new directory for each binary target |
453 |
|
my $dirname="bin_".$$hashref{name}; |
454 |
< |
AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname"); |
454 |
> |
AddDir::adddir("$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname"); |
455 |
|
open (binGNUmakefile, |
456 |
< |
">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/". |
456 |
> |
">$self->{localtop}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die "Unable to make $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/". |
457 |
|
"BuildFile.mk $!\n"; |
458 |
|
|
459 |
|
# Create the link targets |
469 |
|
ifndef BINMODE |
470 |
|
|
471 |
|
define stepdown_$$hashref{'name'} |
472 |
< |
if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
473 |
< |
cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
474 |
< |
\$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\ |
472 |
> |
if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
473 |
> |
cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
474 |
> |
\$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\ |
475 |
|
fi |
476 |
|
endef |
477 |
|
|
478 |
|
define stepdown2_$$hashref{'name'} |
479 |
< |
if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
480 |
< |
cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
481 |
< |
\$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\ |
479 |
> |
if [ -d "$self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
480 |
> |
cd $self->{localtop}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
481 |
> |
\$(MAKE) BINMODE=true LatestBuildFile=$self->{localtop}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\ |
482 |
|
fi |
483 |
|
|
484 |
|
endef |
502 |
|
|
503 |
|
# the binary specifics makefile |
504 |
|
print binGNUmakefile "include ".$self->{currentenv}."\n"; |
505 |
< |
print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/$self{path}\n"; |
505 |
> |
print binGNUmakefile "VPATH+=$self->{localtop}/$self{path}\n"; |
506 |
|
|
507 |
|
# alias for bin_Insure |
508 |
|
print binGNUmakefile <<ENDTEXT; |
558 |
|
print binGNUmakefile "$$hashref{name}_Insure.exe:.psrc\n"; |
559 |
|
print binGNUmakefile "$$hashref{name}_d.exe:$objectname_d\n"; |
560 |
|
print binGNUmakefile "\t\$(CClinkCmdDebug)\n"; |
561 |
< |
print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
561 |
> |
print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
562 |
|
print binGNUmakefile "$$hashref{name}_l_d.exe:$objectname_d\n"; |
563 |
|
print binGNUmakefile "\t\$(CClinkCmdDebugLocal)\n"; |
564 |
< |
print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
564 |
> |
print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
565 |
|
print binGNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n"; |
566 |
|
print binGNUmakefile "\t\$(CClinkCmdInsure)\n"; |
567 |
< |
print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
567 |
> |
print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
568 |
|
print binGNUmakefile "$$hashref{name}_o.exe:$objectname_o\n"; |
569 |
|
print binGNUmakefile "\t\$(CClinkCmd)\n"; |
570 |
< |
print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
570 |
> |
print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
571 |
|
print binGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n"; |
572 |
|
print binGNUmakefile "-include $$hashref{name}.dep\n"; |
573 |
|
print binGNUmakefile <<ENDTEXT; |
697 |
|
} |
698 |
|
} |
699 |
|
|
681 |
– |
sub CheckBuildFile { |
682 |
– |
my $self=shift; |
683 |
– |
my $classdir=shift; |
684 |
– |
my $ClassName=""; |
685 |
– |
my $thisfile="$classdir/$buildfile"; |
686 |
– |
|
687 |
– |
if ( -e $ENV{LOCALTOP}."/".$thisfile ) { |
688 |
– |
$DefaultBuildfile="$ENV{LOCALTOP}/$thisfile"; |
689 |
– |
$self->ParseBuildFile($ENV{LOCALTOP}, $classdir, $buildfile); |
690 |
– |
} |
691 |
– |
elsif ( -e $ENV{RELEASETOP}."/".$thisfile ) { |
692 |
– |
$DefaultBuildfile="$ENV{RELEASETOP}/$thisfile"; |
693 |
– |
$self->ParseBuildFile($ENV{RELEASETOP}, $classdir, $buildfile); |
694 |
– |
} |
695 |
– |
return $ClassName; |
696 |
– |
} |
697 |
– |
|
700 |
|
# List association groups between <AssociateGroup> tags |
701 |
|
# seperated by newlines or spaces |
702 |
|
sub AssociateGroup { |
892 |
|
$self->{envnum}++; |
893 |
|
|
894 |
|
# open a new Environment File |
895 |
< |
my $envfile="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_". |
895 |
> |
my $envfile="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_". |
896 |
|
$self->{envnum}.".mk"; |
897 |
|
use FileHandle; |
898 |
|
my $fh=FileHandle->new(); |
902 |
|
|
903 |
|
# include the approprate environment file |
904 |
|
if ( $self->{envlevel} == 0 ) { |
905 |
< |
print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/". |
905 |
> |
print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/". |
906 |
|
$self->{path}."/BuildFile.mk\n"; |
907 |
|
} |
908 |
|
else { |
909 |
< |
print GNUmakefile "include $ENV{LOCALTOP}/$ENV{INTwork}/". |
909 |
> |
print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/". |
910 |
|
$self->{path}."/Env_".$self->{Envlevels}[$self->{envlevel}].".mk\n"; |
911 |
|
} |
912 |
|
$self->{envlevel}++; |
913 |
|
$self->{Envlevels}[$self->{envlevel}]=$self->{envnum}; |
914 |
< |
$self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk"; |
914 |
> |
$self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk"; |
915 |
|
} |
916 |
|
} |
917 |
|
|
931 |
|
close $fd; |
932 |
|
*GNUmakefile=$self->{filehandlestack}[$#{$self->{filehandlestack}}]; |
933 |
|
if ( $self->{envlevel} < 1 ) { |
934 |
< |
$self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/". |
934 |
> |
$self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/". |
935 |
|
"BuildFile.mk"; |
936 |
|
} |
937 |
|
else { |
938 |
|
$self->{currentenv}= |
939 |
< |
"$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_". |
939 |
> |
$self->{localtop}."/$ENV{INTwork}/$self->{path}/Env_". |
940 |
|
$self->{Envlevels}[$self->{envlevel}]; |
941 |
|
} |
942 |
|
} |