ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSetup.pm
Revision: 1.3
Committed: Tue Mar 2 10:58:07 1999 UTC (26 years, 2 months ago) by williamc
Content type: text/plain
Branch: MAIN
Changes since 1.2: +1 -1 lines
Log Message:
restructure calls etc to refelect new structure

File Contents

# User Rev Content
1 williamc 1.1 package BuildSetup;
2 williamc 1.2 require 5.001;
3 williamc 1.1 require Exporter;
4     @ISA=qw(Exporter);
5     @EXPORT=qw(BuildSetup);
6     use Interface;
7     use BuildFile;
8 williamc 1.2 use Utilities::AddDir;
9 williamc 1.1
10     sub BuildSetup {
11     my $THISDIR=shift;
12     my @Targets=@_;
13     my $DefaultBuildFile="";
14     $Class="";
15    
16     # Create working directory
17     chdir $ENV{LOCALTOP};
18 williamc 1.3 AddDir::adddir($ENV{INTwork}."/".$THISDIR);
19 williamc 1.1
20     GetClass($THISDIR);
21     print "Class = $Class\n";
22     if ( grep /none/i , @BuildFile::groups) {
23     print "Nothing to be done - empty group\n";
24     exit
25     }
26     shift;
27    
28     # set up the workdir variable
29     $ENV{workdir}=$ENV{INTwork}."/".$ClassDir;
30     $fullworkdir=$ENV{LOCALTOP}."/".$ENV{workdir};
31    
32    
33     # set up projdeps variable
34     $projectfile=$ENV{projconfigdir}."/External_Dependencies";
35     if ( -e $ENV{LOCALTOP}."/".$projectfile ) {
36     $ENV{projdeps}=$ENV{LOCALTOP}."/".$projectfile;
37     }
38     elsif ( -e $ENV{RELEASETOP}."/".$projectfile ) {
39     $ENV{projectfile}=$ENV{RELEASETOP}."/".$projectfile;
40     }
41     else {
42     print "Warning : Unable to find $projectfile\n";
43     }
44     # Assume always overrides for now : TODO add merge
45     if ( $DefaultBuildFile eq "" ) {
46     # Map Relevant makefile classmakefile directory
47     $classmakefile=$ENV{projconfigdir}."/".$Class."_makefile.mk";
48     if ( -e $ENV{LOCALTOP}."/".$classmakefile ) {
49     $ENV{classmakefile}=$ENV{LOCALTOP}."/".$classmakefile;
50     }
51     elsif ( -e $ENV{RELEASETOP}."/".$classmakefile ) {
52     $ENV{classmakefile}=$ENV{RELEASETOP}."/".$classmakefile;
53     }
54     else {
55     print "\nUnable to locate $classmakefile\n";
56     print " Not in $ENV{LOCALTOP}\n";
57     print " Not in $ENV{RELEASETOP}\n";
58     exit 1;
59     }
60     $DefaultBuildFile=$ENV{classmakefile}; # TODO - only for override
61     }
62    
63     $ENV{ClassDir}=$ClassDir;
64     $ENV{DefaultBuildFile}=$DefaultBuildFile;
65    
66     chdir $fullworkdir || die "Unable to enter working directory $!";
67    
68     # If not specified default to the class name target
69     if ( $#Targets == -1 ) {
70     $Targets[0]=$Class
71     }
72     $ENV{DefaultMakefile}="$ENV{TOOL_HOME}/basics.mk";
73     system("gmake","-j 1","-f","$ENV{DefaultMakefile}","-I$ENV{TOOL_HOME}",@Targets);
74     }