ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSetup.pm
Revision: 1.1
Committed: Mon Mar 1 10:37:53 1999 UTC (26 years, 2 months ago) by williamc
Content type: text/plain
Branch: MAIN
Log Message:
Initial setup

File Contents

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