2 |
|
# |
3 |
|
# Interface |
4 |
|
# --------- |
5 |
< |
# new(toolbox) |
5 |
> |
# new(ConfigArea) |
6 |
|
# ParseBuildFile($base,$path,$file) |
7 |
|
# ParseBuildFileExport(filename) |
8 |
|
# BlockClassPath() : Return the class path |
9 |
|
# ignore() : return 1 if directory should be ignored 0 otherwise |
10 |
+ |
# CheckBuildFile(dir) : return the BuildFile if it exists |
11 |
|
|
12 |
|
package BuildSystem::BuildFile; |
13 |
|
use ActiveDoc::SimpleDoc; |
22 |
|
my $class=shift; |
23 |
|
my $self={}; |
24 |
|
bless $self, $class; |
25 |
< |
$self->{toolbox}=shift; |
25 |
> |
$self->{area}=shift; |
26 |
> |
$self->{toolbox}=$self->{area}->toolbox(); |
27 |
|
$self->{Arch}=1; |
28 |
|
push @{$self->{ARCHBLOCK}}, $self->{Arch}; |
29 |
|
return $self; |
109 |
|
return $switch; |
110 |
|
} |
111 |
|
|
112 |
+ |
sub GenerateMakefile { |
113 |
+ |
my $self=shift; |
114 |
+ |
my $infile=shift; |
115 |
+ |
my $outfile=shift; |
116 |
+ |
|
117 |
+ |
$self->{switch}=$self->_initswitcher(); |
118 |
+ |
$self->{switch}->filetoparse($infile); |
119 |
+ |
|
120 |
+ |
# open a temporary gnumakefile to store output. |
121 |
+ |
my $fh=FileHandle->new(); |
122 |
+ |
open ( $fh, ">$outfile") or die "Unable to open $outfile for output ". |
123 |
+ |
"$!\n"; |
124 |
+ |
@{$self->{filehandlestack}}=($fh); |
125 |
+ |
|
126 |
+ |
# -- make an alias |
127 |
+ |
*GNUmakefile=$fh; |
128 |
+ |
if ( -e $ENV{LatestBuildFile} ) { |
129 |
+ |
print GNUmakefile "include $ENV{LatestBuildFile}\n"; |
130 |
+ |
} |
131 |
+ |
$ENV{LatestBuildFile}=$outfile; |
132 |
+ |
$self->{switch}->parse("makebuild"); # sort out supported tags |
133 |
+ |
close GNUmakefile; |
134 |
+ |
} |
135 |
+ |
|
136 |
|
sub ParseBuildFile { |
137 |
|
my $self=shift; |
138 |
|
my $base=shift; |
152 |
|
$self->{envlevel}=0; |
153 |
|
$self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/". |
154 |
|
"BuildFile.mk"; |
155 |
< |
$self->{switch}=$self->_initswitcher(); |
130 |
< |
$self->{switch}->filetoparse($fullfilename); |
155 |
> |
$ENV{SCRAM_CURRENTENV}=$self->{currentenv}; |
156 |
|
|
157 |
< |
# $self->{switch}->{Strict_no_cr}='no'; |
133 |
< |
#open a temporary gnumakefile to store output. |
157 |
> |
# open a temporary gnumakefile to store output. |
158 |
|
use Utilities::AddDir; |
159 |
|
AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}"); |
160 |
< |
my $fh=FileHandle->new(); |
161 |
< |
open ( $fh, ">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk" |
138 |
< |
) or die 'Unable to open /$ENV{INTwork}/".$self->{path}."/BuildFile.mk $!\n'; |
139 |
< |
@{$self->{filehandlestack}}=($fh); |
140 |
< |
# make an alias |
141 |
< |
*GNUmakefile=$fh; |
142 |
< |
if ( -e $ENV{LatestBuildFile} ) { |
143 |
< |
print GNUmakefile "include $ENV{LatestBuildFile}\n"; |
144 |
< |
} |
145 |
< |
# print "writing to :\n". |
146 |
< |
# "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/BuildFile.mk\n"; |
147 |
< |
$ENV{LatestBuildFile}="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/BuildFile.mk"; |
148 |
< |
$self->{switch}->parse("makebuild"); # sort out supported tags |
149 |
< |
if ( $numbins > 0 ) { |
150 |
< |
print GNUmakefile <<ENDTEXT; |
151 |
< |
ifndef BINMODE |
152 |
< |
help:: |
153 |
< |
\t\@echo Generic Binary targets |
154 |
< |
\t\@echo ---------------------- |
155 |
< |
endif |
156 |
< |
ENDTEXT |
157 |
< |
foreach $target ( keys %$targettypes ) { |
158 |
< |
print GNUmakefile <<ENDTEXT; |
159 |
< |
ifndef BINMODE |
160 |
< |
help:: |
161 |
< |
\t\@echo $target |
162 |
< |
endif |
163 |
< |
ENDTEXT |
164 |
< |
} |
165 |
< |
} |
166 |
< |
close GNUmakefile; |
160 |
> |
$self->GenerateMakefile($fullfilename, |
161 |
> |
$ENV{LOCALTOP}."/".$ENV{INTwork}."/".$self->{path}."/BuildFile.mk"); |
162 |
|
} |
163 |
|
|
164 |
|
sub ParseBuildFile_Export { |
165 |
|
my $self=shift; |
166 |
|
my $filename=shift; |
167 |
< |
my $bf=BuildSystem::BuildFile->new($self->{toolbox}); |
167 |
> |
my $bf=BuildSystem::BuildFile->new($self->{area}); |
168 |
|
if ( defined $self->{remoteproject} ) { |
169 |
|
$bf->{remoteproject}=$self->{remoteproject}; |
170 |
|
} |
224 |
|
require BuildSystem::ToolMapper; |
225 |
|
$self->{mapper}=BuildSystem::ToolMapper->new(); |
226 |
|
} |
227 |
+ |
if ( @_ ) { #if a class is supplied then supply the map directly |
228 |
+ |
my $class=shift; |
229 |
+ |
return $self->{mapper}->getmap($class); |
230 |
+ |
} |
231 |
|
return $self->{mapper}; |
232 |
|
} |
233 |
|
|
234 |
|
|
235 |
|
# ---- Tag routines |
236 |
|
|
237 |
< |
#-- Override a class type with the <ConfigurationClass type=xxx> tag |
238 |
< |
# the type tag will pick up a pre-defined class type from project space. |
237 |
> |
# -- Override a class type with the <ConfigurationClass type=xxx> tag |
238 |
> |
# the type tag will pick up a pre-defined class type from project space. |
239 |
|
|
240 |
|
sub Class_StartTag { |
241 |
|
my $self=shift; |
269 |
|
my $name=shift; |
270 |
|
my $hashref=shift; |
271 |
|
|
272 |
+ |
|
273 |
|
$self->{switch}->checktag($name,$hashref,'class'); |
274 |
|
if ( $self->{Arch} ) { |
275 |
< |
|
276 |
< |
# -- determine the build products name |
277 |
< |
my $name; |
278 |
< |
if ( exists $$hashref{'name'} ) { |
279 |
< |
$name=$$hashref{'name'}; |
280 |
< |
} |
281 |
< |
else { |
282 |
< |
$self->{switch}->parseerror("No name specified for build product"); |
283 |
< |
#$name="\$(buildname)"; |
284 |
< |
} |
285 |
< |
|
286 |
< |
# -- check we have a lookup for the class type |
287 |
< |
my $mapper=$self->_toolmapper(); |
288 |
< |
if ( ! $mapper->exists($$hashref{'class'}) ) { |
275 |
> |
my $fh=$self->{filehandlestack}[0]; |
276 |
> |
# -- get the mapper object |
277 |
> |
my $mapper=$self->_toolmapper($$hashref{'class'}); |
278 |
> |
if ( ! defined $mapper ) { |
279 |
|
$self->{switch}->parseerror("Unknown class : ".$$hashref{'class'}); |
280 |
|
} |
281 |
|
else { |
282 |
< |
my @types=$self->_toolmapper()->types($$hashref{'class'}); |
283 |
< |
my @deftypes=$self->_toolmapper()->defaulttypes($$hashref{'class'}); |
282 |
> |
# -- get default types |
283 |
> |
my @deftypes; |
284 |
> |
if ( ! exists $$hashref{'default'} ) { |
285 |
> |
@deftypes=$mapper->defaulttypes(); |
286 |
> |
} |
287 |
> |
else { |
288 |
> |
@deftypes=split /,/, $$hashref{'default'}; |
289 |
> |
print $fh "# -- default override\n"; |
290 |
> |
print $fh "Sorigdefault_".$$hashref{'class'}.":=". |
291 |
> |
"\$(Sdefault_".$$hashref{'class'}.")\n"; |
292 |
> |
print $fh "Sdefault_".$$hashref{'class'}.":=\n\n"; |
293 |
> |
} |
294 |
> |
|
295 |
> |
# -- no src parameter so it must be a default setting tag |
296 |
> |
if ( ! exists $$hashref{src} ) { |
297 |
> |
# -- general default setting |
298 |
> |
$self->{switch}->checktag($name,$hashref,'default'); |
299 |
> |
$mapper->defaulttypes(@deftypes); |
300 |
> |
$self->_makegenerictargets($fh, $$hashref{'class'},@deftypes); |
301 |
> |
} |
302 |
> |
else { |
303 |
> |
$self->{switch}->checktag($name,$hashref,'src'); |
304 |
> |
$self->{switch}->checktag($name,$hashref,'name'); |
305 |
> |
my $name=$$hashref{'name'}; |
306 |
> |
my @types=$mapper->types(); |
307 |
> |
|
308 |
|
|
295 |
– |
my $fh=$self->{filehandlestack}[0]; |
309 |
|
my @targets=(); |
310 |
|
|
311 |
< |
# -- generate generic targets |
311 |
> |
# -- set some variables |
312 |
|
print $fh "ifndef _BuildLink_\n"; |
313 |
< |
print $fh "# -- Generic targets\n"; |
314 |
< |
push @targets, $$hashref{'class'}; |
315 |
< |
foreach $dtype ( @deftypes ) { |
316 |
< |
print $fh $$hashref{'class'}."::".$$hashref{'class'}."_". |
317 |
< |
$dtype."\n"; |
318 |
< |
} |
319 |
< |
print $fh "\n"; |
313 |
> |
print $fh $$hashref{'class'}."_buildsrcfiles+=".$$hashref{'src'}; |
314 |
> |
|
315 |
> |
# -- generate generic targets |
316 |
> |
push @targets, ($self->_makegenerictargets($fh,$$hashref{'class'}, |
317 |
> |
@deftypes)); |
318 |
> |
print $fh $$hashref{'class'}."::\$(Sdefault_".$$hashref{'class'} |
319 |
> |
.")\n"; |
320 |
> |
print $fh "Sdefault_".$$hashref{'class'}."_".$$hashref{'name'}. |
321 |
> |
"=\$(addsuffix _".$$hashref{'name'}.",\$(Sdefault_". |
322 |
> |
$$hashref{'class'}."))\n"; |
323 |
> |
print $fh $$hashref{'class'}."_".$$hashref{'name'}."::\$(". |
324 |
> |
"Sdefault_".$$hashref{'class'}."_".$$hashref{'name'}.")\n"; |
325 |
> |
push @targets, $$hashref{'class'}."_".$$hashref{'name'}; |
326 |
|
|
327 |
|
# -- generate targets for each type |
328 |
|
foreach $type ( @types ) { |
334 |
|
print $fh $$hashref{'class'}."_".$type."::".$$hashref{'class'}. |
335 |
|
"_".$type."_$name\n\n"; |
336 |
|
|
337 |
< |
# -- create a new directory for each type |
337 |
> |
# -- create a new directory rule for each type |
338 |
|
push @targets, $pattern; |
339 |
< |
my $dirname=$$hashref{'class'}."_".$type."_".$name; |
340 |
< |
my $here="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/".$dirname; |
339 |
> |
my $here="$ENV{LOCALTOP}/$ENV{INTwork}/\$(THISDIR)/".$dirname; |
340 |
> |
my $work=$ENV{INTwork}."/\$(THISDIR)/".$dirname; |
341 |
|
my $makefile=$here."/BuildFile.mk"; |
323 |
– |
# AddDir::adddir($here); |
342 |
|
|
343 |
|
# -- create link targets to the directory |
344 |
|
push @targets, $dirname; |
346 |
|
print $fh "$dirname: make_$dirname\n"; |
347 |
|
print $fh "\t\@cd $here; \\\n"; |
348 |
|
print $fh "\t\$(MAKE) LatestBuildFile=$makefile _BuildLink_=1". |
349 |
< |
" workdir=$here ". |
350 |
< |
" -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \n\n"; |
349 |
> |
" workdir=$work ". |
350 |
> |
" -f \$(TOOL_HOME)/basics.mk datestamp_config; \\\n". |
351 |
> |
print $fh "\t\$(MAKE) LatestBuildFile=$makefile _BuildLink_=1". |
352 |
> |
" workdir=$work ". |
353 |
> |
" -f \$(TOOL_HOME)/basics.mk datestamp; \\\n". |
354 |
> |
print $fh "\t\$(MAKE) LatestBuildFile=$makefile _BuildLink_=1". |
355 |
> |
" workdir=$work ". |
356 |
> |
" -f \$(TOOL_HOME)/basics.mk \$\@; \n\n"; |
357 |
|
|
358 |
|
# -- write target to make makefile for each directory |
359 |
|
print $fh "# -- Build target directories\n"; |
360 |
|
print $fh "make_$dirname:\n"; |
361 |
< |
print $fh "\tif [ ! -e \"$makefile\" ]; then \\\n"; |
361 |
> |
print $fh "\t\@if [ ! -f \"$makefile\" ]; then \\\n"; |
362 |
|
print $fh "\t if [ ! -d \"$here\" ]; then \\\n"; |
363 |
|
print $fh "\t mkdir $here; \\\n"; |
364 |
|
print $fh "\t fi;\\\n"; |
365 |
< |
print $fh "\t cd $dirname; \\\n"; |
366 |
< |
print $fh "\t echo include ".$self->{currentenv}." > ". |
365 |
> |
#print $fh "\t echo include ".$self->{currentenv}." > ". |
366 |
> |
print $fh "\t echo include \$(SCRAM_CURRENTENV) > ". |
367 |
|
"$makefile; \\\n"; |
368 |
< |
print $fh "\t echo VPATH+=$ENV{LOCALTOP}/".$self->{path}. |
368 |
> |
print $fh "\t echo VPATH+=$ENV{LOCALTOP}/".${THISPATH}. |
369 |
|
" >> $makefile; \\\n"; |
370 |
+ |
print $fh "\t echo buildsrcfiles:=".$$hashref{'src'}. |
371 |
+ |
" >> $makefile; \\\n"; |
372 |
|
print $fh "\t echo buildname=$name >> $makefile;\\\n"; |
373 |
|
print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n"; |
374 |
+ |
print $fh "\t echo ifdef DefaultBuildFile >> $makefile; \\\n"; |
375 |
+ |
print $fh "\t echo include \$(DefaultBuildFile) >> $makefile; \\\n"; |
376 |
+ |
print $fh "\t echo DefaultBuildFileIn=true >> $makefile; \\\n"; |
377 |
+ |
print $fh "\t echo endif >> $makefile; \\\n"; |
378 |
|
if ( defined (my @file=$mapper->rulesfile($$hashref{'class'})) ) { |
379 |
|
foreach $f ( @file ) { |
380 |
|
print $fh "\t echo -include $f >> $makefile; \\\n"; |
386 |
|
# print $typefile "\t\$(_quietbuild_)"; |
387 |
|
# print $typefile $mapper->template($$hashref{'class'},$type)."\n"; |
388 |
|
# print $typefile "\t\$(_quietstamp_)"; |
389 |
< |
# print $typefile "$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n"; |
389 |
> |
# print $typefile "$(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n"; |
390 |
> |
|
391 |
> |
# -- debug targets |
392 |
> |
print $fh "# -- debug targets\n"; |
393 |
> |
print $fh $dirname."_echo_% : make_$dirname\n"; |
394 |
> |
print $fh "\t\@cd $here; \n"; |
395 |
> |
print $fh "\t\@\$(MAKE) LatestBuildFile=$makefile _BuildLink_=1". |
396 |
> |
" workdir=$work ". |
397 |
> |
" -f \$(TOOL_HOME)/basics.mk ". |
398 |
> |
"echo_\$(subst ".$dirname."_echo_,,\$\@) ; \n\n"; |
399 |
> |
push @targets, $dirname."_echo_VAR"; |
400 |
|
|
401 |
|
# -- cleaning targets |
402 |
|
push @targets, "clean_$dirname"; |
403 |
|
print $fh "# -- cleaning targets\n"; |
404 |
|
print $fh "clean::clean_$dirname\n"; |
405 |
|
print $fh "clean_".$dirname."::\n"; |
366 |
– |
print $fh "\t\@echo cleaning $dirname\n"; |
406 |
|
print $fh "\t\@if [ -d $here ]; then \\\n"; |
407 |
+ |
print $fh "\techo cleaning $dirname; \\\n"; |
408 |
|
print $fh "\tcd $here; \\\n"; |
409 |
|
print $fh "\t\$(MAKE) LatestBuildFile=$makefile workdir=". |
410 |
< |
$here." _BuildLink_=1 -f ". |
410 |
> |
$work." _BuildLink_=1 -f ". |
411 |
|
"\$(TOOL_HOME)/basics.mk clean; \\\n"; |
412 |
|
print $fh "\tfi\n\n"; |
413 |
|
|
414 |
|
|
415 |
|
} |
416 |
+ |
# -- cleanup |
417 |
+ |
print $fh "Sdefault_".$$hashref{'class'}. |
418 |
+ |
":=\$(Sorigdefault_".$$hashref{'class'}.")\n"; |
419 |
|
# -- help targets |
420 |
|
print $fh "helpheader::\n"; |
421 |
|
print $fh "\t\@echo Targets available:\n"; |
428 |
|
print $fh "endif\n"; |
429 |
|
} # end else |
430 |
|
} |
431 |
+ |
} |
432 |
+ |
} |
433 |
+ |
|
434 |
+ |
sub _makegenerictargets { |
435 |
+ |
my $self=shift; |
436 |
+ |
my $fh=shift; |
437 |
+ |
my $class=shift; |
438 |
+ |
my @deftypes=@_; |
439 |
+ |
|
440 |
+ |
my @targets=(); |
441 |
+ |
# -- generate generic targets |
442 |
+ |
print $fh "# -- Generic targets\n"; |
443 |
+ |
push @targets, $class; |
444 |
+ |
foreach $dtype ( @deftypes ) { |
445 |
+ |
print $fh "Sdefault_".$class."+=".$class."_".$dtype."\n"; |
446 |
+ |
} |
447 |
+ |
#print $fh $class."::\$(Sdefault_".$class.")\n"; |
448 |
+ |
print $fh "\n\n"; |
449 |
+ |
return @targets; |
450 |
|
} |
451 |
|
|
452 |
|
sub Bin_start { |
462 |
|
|
463 |
|
$self->{switch}->checktag($name,$hashref,'file'); |
464 |
|
if ( $self->{Arch} ) { |
465 |
< |
if ( ! defined $$hashref{name} ) { |
465 |
> |
if ( ! defined $$hashref{name} ) { |
466 |
|
($$hashref{name}=$$hashref{file})=~s/\..*//; |
467 |
+ |
} |
468 |
+ |
($filename=$$hashref{file})=~s/^\///; # make sure full paths dont work |
469 |
+ |
my $arghash={ "class" => "bin", |
470 |
+ |
"src" => $filename, |
471 |
+ |
"name" => $$hashref{'name'}}; |
472 |
+ |
if ( exists $$hashref{'default'} ) { |
473 |
+ |
$arghash->{'default'}=$$hashref{'default'}; |
474 |
+ |
} |
475 |
+ |
$self->Build_start($name, $arghash); |
476 |
|
} |
406 |
– |
($filename=$$hashref{file})=~s/\..*//; |
407 |
– |
|
408 |
– |
# Create a new directory for each binary target |
409 |
– |
my $dirname="bin_".$$hashref{name}; |
410 |
– |
AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname"); |
411 |
– |
open (binGNUmakefile, |
412 |
– |
">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/". |
413 |
– |
"BuildFile.mk $!\n"; |
414 |
– |
|
415 |
– |
# Create the link targets |
416 |
– |
$numbins++; |
417 |
– |
my $fh=$self->{filehandlestack}[0]; |
418 |
– |
print $fh <<ENDTEXT; |
419 |
– |
|
420 |
– |
# Link Targets to binary directories |
421 |
– |
ifdef BINMODE |
422 |
– |
# We dont want to build a library here |
423 |
– |
override files:= |
424 |
– |
endif |
425 |
– |
ifndef BINMODE |
426 |
– |
|
427 |
– |
define stepdown_$$hashref{'name'} |
428 |
– |
if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
429 |
– |
cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
430 |
– |
\$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\ |
431 |
– |
fi |
432 |
– |
endef |
433 |
– |
|
434 |
– |
define stepdown2_$$hashref{'name'} |
435 |
– |
if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
436 |
– |
cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
437 |
– |
\$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\ |
438 |
– |
fi |
439 |
– |
|
440 |
– |
endef |
441 |
– |
|
442 |
– |
bin_$$hashref{'name'}_%:: dummy |
443 |
– |
\@\$(stepdown2_$$hashref{'name'}) |
444 |
– |
|
445 |
– |
$$hashref{'name'}_%:: dummy |
446 |
– |
\@\$(stepdown_$$hashref{'name'}) |
447 |
– |
|
448 |
– |
help bin bin_debug bin_debug_local bin_insure bin_Insure clean $$hashref{'name'}:: dummy |
449 |
– |
\@\$(stepdown_$$hashref{'name'}) |
450 |
– |
|
451 |
– |
binfiles+=$$hashref{'file'} |
452 |
– |
locbinfiles+=$dirname/$$hashref{'file'} |
453 |
– |
endif |
454 |
– |
|
455 |
– |
|
456 |
– |
ENDTEXT |
457 |
– |
|
458 |
– |
|
459 |
– |
# the binary specifics makefile |
460 |
– |
print binGNUmakefile "include ".$self->{currentenv}."\n"; |
461 |
– |
print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/$self{path}\n"; |
462 |
– |
|
463 |
– |
# alias for bin_Insure |
464 |
– |
print binGNUmakefile <<ENDTEXT; |
465 |
– |
|
466 |
– |
bin_insure:bin_Insure |
467 |
– |
ifdef MAKETARGET_bin_insure |
468 |
– |
MAKETARGET_$$hashref{name}_Insure=1 |
469 |
– |
endif |
470 |
– |
|
471 |
– |
# debuggging target |
472 |
– |
$$hashref{'name'}_echo_% :: echo_% |
473 |
– |
|
474 |
– |
# help targets |
475 |
– |
help:: |
476 |
– |
\t\@echo Targets For $$hashref{'name'} |
477 |
– |
\t\@echo ------------------------------------- |
478 |
– |
\t\@echo $$hashref{'name'} - default build |
479 |
– |
\t\@echo bin_$$hashref{'name'}_clean - executable specific cleaning |
480 |
– |
ENDTEXT |
481 |
– |
|
482 |
– |
# Make generic rules for each type |
483 |
– |
$targettypes={ |
484 |
– |
"bin" => 'o', |
485 |
– |
"bin_debug" => 'd', |
486 |
– |
"bin_debug_local" => 'l_d', |
487 |
– |
"bin_Insure" => 'Insure' |
488 |
– |
}; |
489 |
– |
# |
490 |
– |
foreach $target ( keys %$targettypes ) { |
491 |
– |
print binGNUmakefile <<ENDTEXT; |
492 |
– |
|
493 |
– |
# Type $target specifics |
494 |
– |
ifdef MAKETARGET_$target |
495 |
– |
MAKETARGET_$$hashref{name}_$$targettypes{$target}=1 |
496 |
– |
endif |
497 |
– |
$target ::$$hashref{name}_$$targettypes{$target} |
498 |
– |
|
499 |
– |
bintargets+=$$hashref{name}_$$targettypes{$target} |
500 |
– |
help:: |
501 |
– |
\t\@echo $$hashref{name}_$$targettypes{$target} |
502 |
– |
clean:: |
503 |
– |
\t\@if [ -f \$(binarystore)/$$hashref{name}_$$targettypes{$target} ]; then \\ |
504 |
– |
\techo Removing \$(binarystore)/$$hashref{name}; \\ |
505 |
– |
\trm \$(binarystore)/$$hashref{name}_$$targettypes{$target}; \\ |
506 |
– |
\tfi |
507 |
– |
|
508 |
– |
ENDTEXT |
509 |
– |
($objectname=$$hashref{file})=~s/\..*/_$$targettypes{$target}\.o/; |
510 |
– |
${"objectname_$$targettypes{$target}"}=$objectname; |
511 |
– |
print binGNUmakefile "$objectname:$$hashref{name}.dep\n"; |
512 |
– |
} # end loop |
513 |
– |
|
514 |
– |
print binGNUmakefile "$$hashref{name}_Insure.exe:.psrc\n"; |
515 |
– |
print binGNUmakefile "$$hashref{name}_d.exe:$objectname_d\n"; |
516 |
– |
print binGNUmakefile "\t\$(CClinkCmdDebug)\n"; |
517 |
– |
print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
518 |
– |
print binGNUmakefile "$$hashref{name}_l_d.exe:$objectname_d\n"; |
519 |
– |
print binGNUmakefile "\t\$(CClinkCmdDebugLocal)\n"; |
520 |
– |
print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
521 |
– |
print binGNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n"; |
522 |
– |
print binGNUmakefile "\t\$(CClinkCmdInsure)\n"; |
523 |
– |
print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
524 |
– |
print binGNUmakefile "$$hashref{name}_o.exe:$objectname_o\n"; |
525 |
– |
print binGNUmakefile "\t\$(CClinkCmd)\n"; |
526 |
– |
print binGNUmakefile "\t\@\$(SCRAMPERL) $(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
527 |
– |
print binGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n"; |
528 |
– |
print binGNUmakefile "-include $$hashref{name}.dep\n"; |
529 |
– |
print binGNUmakefile <<ENDTEXT; |
530 |
– |
clean:: |
531 |
– |
\t\@if [ -f \$(binarystore)/$$hashref{name} ]; then \\ |
532 |
– |
\techo Removing \$(binarystore)/$$hashref{name}; \\ |
533 |
– |
\trm \$(binarystore)/$$hashref{name}; \\ |
534 |
– |
\tfi |
535 |
– |
|
536 |
– |
$$hashref{name}_d.exe:\$(libslocal_d) |
537 |
– |
$$hashref{name}_o.exe:\$(libslocal) |
538 |
– |
ifdef MCCABE_DATA_DIR |
539 |
– |
$$hashref{name}_mccabe.exe: \$(libslocal_d) \$(MCCABE_DATA_DIR)/mccabeinstr/instplus.cpp |
540 |
– |
endif |
541 |
– |
$$hashref{name}_Insure.exe:\$(libslocal_I) |
542 |
– |
$$hashref{name}_d:$$hashref{name}_d.exe |
543 |
– |
\@cp $$hashref{name}_d.exe \$(binarystore)/$$hashref{name} |
544 |
– |
$$hashref{name}_l_d:$$hashref{name}_l_d.exe |
545 |
– |
\@cp $$hashref{name}_l_d.exe \$(binarystore)/$$hashref{name} |
546 |
– |
$$hashref{name}_Insure:$$hashref{name}_Insure.exe |
547 |
– |
\@cp $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure |
548 |
– |
$$hashref{name}:$$hashref{name}_d.exe |
549 |
– |
\@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name} |
550 |
– |
$$hashref{name}_o:$$hashref{name}_o.exe |
551 |
– |
\@mv $$hashref{name}_o.exe \$(binarystore)/$$hashref{name} |
552 |
– |
binfiles+=$$hashref{file} |
553 |
– |
ENDTEXT |
554 |
– |
} |
555 |
– |
close binGNUmakefile; |
477 |
|
} |
478 |
|
|
479 |
|
sub External_StartTag { |
528 |
|
} |
529 |
|
} |
530 |
|
|
531 |
+ |
sub Test_start { |
532 |
+ |
my $self=shift; |
533 |
+ |
my $name=shift; |
534 |
+ |
my $hashref=shift; |
535 |
+ |
|
536 |
+ |
# -- make sure we have the test binary |
537 |
+ |
$self->{switch}->checktag($name, $hashref, 'exe'); |
538 |
+ |
system($ENV{SCRAM_HOME}."/src/scram","build",$$hashref{'exe'}); |
539 |
+ |
|
540 |
+ |
# -- a name for the test |
541 |
+ |
$self->{switch}->checktag($name, $hashref, 'name'); |
542 |
+ |
|
543 |
+ |
# -- set up a tester object |
544 |
+ |
push @{$self->{testcontext}}, $$hashref{'name'}; |
545 |
+ |
my $tester=BuildSystem::Tester->new($self->{area}); |
546 |
+ |
if ( ! exists $self->{testers}{$$hashref{'name'}} ) { |
547 |
+ |
$self->{testers}{$$hashref{'name'}}=$tester; |
548 |
+ |
} |
549 |
+ |
else { |
550 |
+ |
$self->{switch}->parseerror("Second definition of $name " |
551 |
+ |
.$$hashref{'name'}); |
552 |
+ |
} |
553 |
+ |
} |
554 |
+ |
|
555 |
+ |
sub Test_end { |
556 |
+ |
my $self=shift; |
557 |
+ |
my $name=shift; |
558 |
+ |
my $hashref=shift; |
559 |
+ |
|
560 |
+ |
my $tester=$self->{testers}{pop @{$self->{testcontext}}}; |
561 |
+ |
$tester->run(); |
562 |
+ |
} |
563 |
+ |
|
564 |
|
sub Group_start { |
565 |
|
my $self=shift; |
566 |
|
my $name=shift; |
771 |
|
$self->{libtype_conext}=1; |
772 |
|
$self->{switch}->checktag($name, $hashref, 'type'); |
773 |
|
|
774 |
< |
print GNUmakefile "# Specify Library Type\n"; |
775 |
< |
print GNUmakefile "DefaultLibsOff=yes\n"; |
776 |
< |
if ( $$hashref{'type'}=~/^archive/i ) { |
777 |
< |
print GNUmakefile "LibArchive=true\n"; |
824 |
< |
} |
825 |
< |
elsif ($$hashref{'type'}=~/debug_archive/i ) { |
826 |
< |
print GNUmakefile "LibDebugArchive=true\n"; |
774 |
> |
my $string=$$hashref{'type'}; |
775 |
> |
# -- do some translation for backwards compatability |
776 |
> |
if ($$hashref{'type'}=~/debug_archive/i ) { |
777 |
> |
$string="archive_debug"; |
778 |
|
} |
779 |
|
elsif ($$hashref{'type'}=~/debug_shared/i ) { |
780 |
< |
print GNUmakefile "LibDebugShared=true\n"; |
830 |
< |
} |
831 |
< |
elsif ($$hashref{'type'}=~/shared/i ) { |
832 |
< |
print GNUmakefile 'LibShared=true'."\n"; |
780 |
> |
$string="shared_debug"; |
781 |
|
} |
782 |
< |
print GNUmakefile "\n"; |
782 |
> |
# -- call the Build defaults method |
783 |
> |
$self->Build_start($name, {"class" => "lib", "default" => $string }); |
784 |
|
} |
785 |
|
} |
786 |
|
} |
835 |
|
$self->{Envlevels}[$self->{envlevel}]=$self->{envnum}; |
836 |
|
$self->{currentenv}="$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk"; |
837 |
|
} |
838 |
+ |
$ENV{SCRAM_CURRENTENV}=$self->{currentenv}; |
839 |
|
} |
840 |
|
|
841 |
|
sub Environment_end { |
862 |
|
"$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/Env_". |
863 |
|
$self->{Envlevels}[$self->{envlevel}]; |
864 |
|
} |
865 |
+ |
$ENV{SCRAM_CURRENTENV}=$self->{currentenv}; |
866 |
|
} |
867 |
|
} |