53 |
|
\&Bin_start,$self, |
54 |
|
\&OutToScreen, $self, |
55 |
|
"", $self); |
56 |
< |
$switch->addtag($parse,"ProductStore", |
56 |
> |
$switch->addtag($parse,"Module", |
57 |
> |
\&Module_start,$self, |
58 |
> |
\&OutToScreen, $self, |
59 |
> |
"", $self); |
60 |
> |
|
61 |
> |
$switch->addtag($parse,"ProductStore", |
62 |
|
\&Store_start,$self, |
63 |
|
"", $self, |
64 |
|
"", $self); |
277 |
|
} |
278 |
|
} |
279 |
|
|
280 |
< |
sub IncludePath_Start { |
281 |
< |
my $self=shift; |
282 |
< |
my $name=shift; |
283 |
< |
my $hashref=shift; |
284 |
< |
|
285 |
< |
$self->verbose(">> IncludePath_Start: NM ".$name." <<"); |
286 |
< |
|
287 |
< |
$self->{switch}->checktag( $name, $hashref, 'path'); |
288 |
< |
if ( $self->{Arch} ) { |
289 |
< |
print GNUmakefile "INCLUDE+=".$self->_location()."/". |
290 |
< |
$$hashref{'path'}."\n"; |
291 |
< |
} |
292 |
< |
} |
280 |
> |
sub IncludePath_Start |
281 |
> |
{ |
282 |
> |
my $self=shift; |
283 |
> |
my $name=shift; |
284 |
> |
my $hashref=shift; |
285 |
> |
|
286 |
> |
$self->verbose(">> IncludePath_Start: NM ".$name." <<"); |
287 |
> |
|
288 |
> |
$self->{switch}->checktag( $name, $hashref, 'path'); |
289 |
> |
if ( $self->{Arch} ) |
290 |
> |
{ |
291 |
> |
print GNUmakefile "INCLUDE:=\$(filter-out ".$self->_location()."/".$$hashref{'path'}.",\$(INCLUDE))","\n"; |
292 |
> |
print GNUmakefile "INCLUDE+=".$self->_location()."/".$$hashref{'path'}."\n"; |
293 |
> |
} |
294 |
> |
} |
295 |
|
|
296 |
|
# |
297 |
|
# generic build tag |
583 |
|
close binGNUmakefile; |
584 |
|
} |
585 |
|
|
586 |
+ |
sub Module_start { |
587 |
+ |
my $self=shift; |
588 |
+ |
my $name=shift; |
589 |
+ |
my $hashref=shift; |
590 |
+ |
|
591 |
+ |
my $fileclass; |
592 |
+ |
my @tools; |
593 |
+ |
my $tool; |
594 |
+ |
my $filename; |
595 |
+ |
my $objectname; |
596 |
+ |
|
597 |
+ |
$self->verbose(">> In module_start: ".$name." <<"); |
598 |
+ |
|
599 |
+ |
$self->{switch}->checktag($name,$hashref,'file'); |
600 |
+ |
if ( $self->{Arch} ) { |
601 |
+ |
if ( ! defined $$hashref{name} ) { |
602 |
+ |
($$hashref{name}=$$hashref{file})=~s/\..*//; |
603 |
+ |
} |
604 |
+ |
($filename=$$hashref{file})=~s/\..*//; |
605 |
+ |
|
606 |
+ |
# Create a new directory for each module target |
607 |
+ |
my $dirname="module_".$$hashref{name}; |
608 |
+ |
AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname"); |
609 |
+ |
open (moduleGNUmakefile, |
610 |
+ |
">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/". |
611 |
+ |
"BuildFile.mk $!\n"; |
612 |
+ |
|
613 |
+ |
# Create the link targets |
614 |
+ |
$numbins++; |
615 |
+ |
my $fh=$self->{filehandlestack}[0]; |
616 |
+ |
print $fh <<ENDTEXT; |
617 |
+ |
|
618 |
+ |
# Link Targets to module directories |
619 |
+ |
ifdef MODULEMODE |
620 |
+ |
# We dont want to build a library here |
621 |
+ |
override files:= |
622 |
+ |
endif |
623 |
+ |
ifndef MODULEMODE |
624 |
+ |
|
625 |
+ |
BINMODE=true |
626 |
+ |
|
627 |
+ |
define stepdown_$$hashref{'name'} |
628 |
+ |
if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
629 |
+ |
cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
630 |
+ |
\$(MAKE) MODULEMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\ |
631 |
+ |
fi |
632 |
+ |
endef |
633 |
+ |
|
634 |
+ |
define stepdown2_$$hashref{'name'} |
635 |
+ |
if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
636 |
+ |
cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
637 |
+ |
\$(MAKE) MODULEMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\ |
638 |
+ |
fi |
639 |
+ |
|
640 |
+ |
endef |
641 |
+ |
|
642 |
+ |
module_$$hashref{'name'}_%:: dummy |
643 |
+ |
\@\$(stepdown2_$$hashref{'name'}) |
644 |
+ |
|
645 |
+ |
$$hashref{'name'}_%:: dummy |
646 |
+ |
\@\$(stepdown_$$hashref{'name'}) |
647 |
+ |
|
648 |
+ |
help module module_debug module_debug_local module_insure module_Insure clean $$hashref{'name'}:: dummy |
649 |
+ |
\@\$(stepdown_$$hashref{'name'}) |
650 |
+ |
|
651 |
+ |
modulefiles+=$$hashref{'file'} |
652 |
+ |
locmodulefiles+=$dirname/$$hashref{'file'} |
653 |
+ |
endif |
654 |
+ |
|
655 |
+ |
|
656 |
+ |
ENDTEXT |
657 |
+ |
|
658 |
+ |
|
659 |
+ |
# the module specifics makefile |
660 |
+ |
print moduleGNUmakefile "include ".$self->{currentenv}."\n"; |
661 |
+ |
print moduleGNUmakefile "VPATH+=$ENV{LOCALTOP}/$self{path}\n"; |
662 |
+ |
|
663 |
+ |
# alias for bin_Insure |
664 |
+ |
print moduleGNUmakefile <<ENDTEXT; |
665 |
+ |
|
666 |
+ |
module_insure:module_Insure |
667 |
+ |
ifdef MAKETARGET_module_insure |
668 |
+ |
MAKETARGET_$$hashref{name}_Insure=1 |
669 |
+ |
endif |
670 |
+ |
|
671 |
+ |
# debuggging target |
672 |
+ |
$$hashref{'name'}_echo_% :: echo_% |
673 |
+ |
|
674 |
+ |
# help targets |
675 |
+ |
help:: |
676 |
+ |
\t\@echo |
677 |
+ |
\t\@echo Targets For $$hashref{'name'} |
678 |
+ |
\t\@echo ------------------------------------- |
679 |
+ |
\t\@echo $$hashref{'name'} - default build |
680 |
+ |
\t\@echo module_$$hashref{'name'}_clean - executable specific cleaning |
681 |
+ |
ENDTEXT |
682 |
+ |
|
683 |
+ |
# Make generic rules for each type |
684 |
+ |
$targettypes={ |
685 |
+ |
"module" => 'o', |
686 |
+ |
"module_debug" => 'd', |
687 |
+ |
"module_debug_local" => 'l_d', |
688 |
+ |
"module_Insure" => 'Insure' |
689 |
+ |
}; |
690 |
+ |
# |
691 |
+ |
foreach $target ( keys %$targettypes ) { |
692 |
+ |
print moduleGNUmakefile <<ENDTEXT; |
693 |
+ |
|
694 |
+ |
# Type $target specifics |
695 |
+ |
ifdef MAKETARGET_$target |
696 |
+ |
MAKETARGET_$$hashref{name}_$$targettypes{$target}=1 |
697 |
+ |
endif |
698 |
+ |
$target ::$$hashref{name}_$$targettypes{$target} |
699 |
+ |
|
700 |
+ |
moduletargets+=$$hashref{name}_$$targettypes{$target} |
701 |
+ |
help:: |
702 |
+ |
\t\@echo $$hashref{name}_$$targettypes{$target} |
703 |
+ |
clean:: |
704 |
+ |
\t\@if [ -f \$(modulestore)/$$hashref{name}_$$targettypes{$target} ]; then \\ |
705 |
+ |
\techo Removing \$(modulestore)/$$hashref{name}; \\ |
706 |
+ |
\trm \$(modulestore)/$$hashref{name}_$$targettypes{$target}; \\ |
707 |
+ |
\tfi |
708 |
+ |
|
709 |
+ |
ENDTEXT |
710 |
+ |
($objectname=$$hashref{file})=~s/\..*/_$$targettypes{$target}\.o/; |
711 |
+ |
${"objectname_$$targettypes{$target}"}=$objectname; |
712 |
+ |
print moduleGNUmakefile "$objectname:$$hashref{name}.dep\n"; |
713 |
+ |
} # end loop |
714 |
+ |
print moduleGNUmakefile "MDFLAGS= -shared -Wl,-soname,\$\@","\n"; |
715 |
+ |
print moduleGNUmakefile "$$hashref{name}_Insure.so:.psrc\n"; |
716 |
+ |
print moduleGNUmakefile "$$hashref{name}_d.so:$objectname_d\n"; |
717 |
+ |
print moduleGNUmakefile "\t\$(CClinkCmdDebug) \$(MDFLAGS)\n"; |
718 |
+ |
print moduleGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
719 |
+ |
print moduleGNUmakefile "$$hashref{name}_l_d.so:$objectname_d\n"; |
720 |
+ |
print moduleGNUmakefile "\t\$(CClinkCmdDebugLocal) \$(MDFLAGS)\n"; |
721 |
+ |
print moduleGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
722 |
+ |
print moduleGNUmakefile "$$hashref{name}_Insure.so:$objectname_Insure\n"; |
723 |
+ |
print moduleGNUmakefile "\t\$(CClinkCmdInsure) \$(MDFLAGS)\n"; |
724 |
+ |
print moduleGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
725 |
+ |
print moduleGNUmakefile "$$hashref{name}_o.so:$objectname_o\n"; |
726 |
+ |
print moduleGNUmakefile "\t\$(CClinkCmd) \$(MDFLAGS)\n"; |
727 |
+ |
print moduleGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
728 |
+ |
print moduleGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n"; |
729 |
+ |
print moduleGNUmakefile "-include $$hashref{name}.dep\n"; |
730 |
+ |
print moduleGNUmakefile <<ENDTEXT; |
731 |
+ |
clean:: |
732 |
+ |
\t\@if [ -f \$(modulestore)/lib$$hashref{name} ]; then \\ |
733 |
+ |
\techo Removing \$(modulestore)/lib$$hashref{name}; \\ |
734 |
+ |
\trm \$(modulestore)/lib$$hashref{name}; \\ |
735 |
+ |
\tfi |
736 |
+ |
|
737 |
+ |
|
738 |
+ |
$$hashref{name}_d.so:\$(libslocal_d) |
739 |
+ |
$$hashref{name}_o.so:\$(libslocal) |
740 |
+ |
ifdef MCCABE_DATA_DIR |
741 |
+ |
$$hashref{name}_mccabe.so: \$(libslocal_d) \$(MCCABE_DATA_DIR)/mccabeinstr/instplus.cpp |
742 |
+ |
endif |
743 |
+ |
$$hashref{name}_Insure.so:\$(libslocal_I) |
744 |
+ |
$$hashref{name}_d:$$hashref{name}_d.so |
745 |
+ |
\@cp $$hashref{name}_d.so \$(modulestore)/lib$$hashref{name} |
746 |
+ |
$$hashref{name}_l_d:$$hashref{name}_l_d.so |
747 |
+ |
\@cp $$hashref{name}_l_d.so \$(modulestore)/lib$$hashref{name} |
748 |
+ |
$$hashref{name}_Insure:$$hashref{name}_Insure.so |
749 |
+ |
\@cp $$hashref{name}_Insure.so \$(modulestore)/lib$$hashref{name}_Insure |
750 |
+ |
$$hashref{name}:$$hashref{name}_d.so |
751 |
+ |
\@mv $$hashref{name}_d.so \$(modulestore)/lib$$hashref{name} |
752 |
+ |
$$hashref{name}_o:$$hashref{name}_o.so |
753 |
+ |
\@mv $$hashref{name}_o.so \$(modulestore)/lib$$hashref{name}.so |
754 |
+ |
modulefiles+=$$hashref{file} |
755 |
+ |
ENDTEXT |
756 |
+ |
} |
757 |
+ |
close moduleGNUmakefile; |
758 |
+ |
} |
759 |
+ |
|
760 |
+ |
|
761 |
|
sub External_StartTag { |
762 |
|
my $self=shift; |
763 |
|
my $name=shift; |
1028 |
|
# |
1029 |
|
# Standard lib tag |
1030 |
|
# |
1031 |
< |
sub lib_start { |
1032 |
< |
my $self=shift; |
1033 |
< |
my $name=shift; |
1034 |
< |
my $hashref=shift; |
1035 |
< |
|
1036 |
< |
$self->verbose(">> lib_start: NM ".$name." <<"); |
1037 |
< |
|
1038 |
< |
$self->{switch}->checktag($name, $hashref, 'name'); |
1031 |
> |
sub lib_start |
1032 |
> |
{ |
1033 |
> |
my $self=shift; |
1034 |
> |
my $name=shift; |
1035 |
> |
my $hashref=shift; |
1036 |
> |
|
1037 |
> |
$self->verbose(">> lib_start: NM ".$name." <<"); |
1038 |
> |
|
1039 |
> |
$self->{switch}->checktag($name, $hashref, 'name'); |
1040 |
|
|
1041 |
< |
if ( $self->{Arch} ) { |
1042 |
< |
print GNUmakefile "lib+=$$hashref{name}\n"; |
1043 |
< |
} |
1044 |
< |
} |
1041 |
> |
if ( $self->{Arch} ) |
1042 |
> |
{ |
1043 |
> |
print GNUmakefile "lib+=$$hashref{name}\n"; |
1044 |
> |
} |
1045 |
> |
} |
1046 |
|
|
1047 |
|
# |
1048 |
|
# libtype specification |