ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/MakeInterface.pm
Revision: 1.8
Committed: Tue Oct 18 14:59:26 2011 UTC (13 years, 7 months ago) by muzaffar
Content type: text/plain
Branch: MAIN
CVS Tags: V2_2_5_pre2, V2_2_5_pre1, V2_2_4, V2_2_4_pre9, V2_2_4_pre8, V2_2_4_pre7, V2_2_4_pre6, V2_2_4_pre5, V2_2_4_pre4, V2_2_4_pre3, V2_2_4_pre2, V2_2_4_pre1
Changes since 1.7: +0 -3 lines
Log Message:
removed cvs $id statement

File Contents

# User Rev Content
1 sashby 1.2 #____________________________________________________________________
2     # File: MakeInterface.pm
3     #____________________________________________________________________
4     #
5     # Author: Shaun Ashby <Shaun.Ashby@cern.ch>
6     # Copyright: 2004 (C) Shaun Ashby
7     #
8     #--------------------------------------------------------------------
9     package BuildSystem::MakeInterface;
10     require 5.004;
11    
12     use Exporter;
13     @ISA=qw(Exporter);
14     @EXPORT_OK=qw( );
15    
16     sub new()
17     ###############################################################
18     # new #
19     ###############################################################
20     # modified : Tue Jun 22 14:49:46 2004 / SFA #
21     # params : #
22     # : #
23     # function : #
24     # : #
25     ###############################################################
26     {
27     my $proto=shift;
28     my $class=ref($proto) || $proto;
29 muzaffar 1.7 my $self={ GMAKECMD => '${SCRAM_GMAKE_PATH}gmake', CMDOPTS => ' -r' };
30 sashby 1.2 bless $self,$class;
31     $|=1;
32    
33     # Useful help strings for the options we're supporting:
34     # %help = (
35     # "s" => " do not print any output",
36     # "j <n>" => " the number of processes to run simultaneously",
37     # "d" => " run gmake in debug mode",
38     # "k" => " continue for as long as possible after an error",
39     # "w" => " print the working directory before and after entering it",
40     # "n" => " print the commands that would be executed but do not run them",
41     # "p" => " print the data base of rules after scanning makefiles, then build as normal"
42     # );
43    
44     # The options. These are collected in CMDOPTS:
45     my %options =
46     (
47     "make" => sub { }, # dummy so we can use help opt just for MakeInterface
48     "s" => sub { $self->{CMDOPTS}.=" -s" },
49 muzaffar 1.6 "j=i" => sub { $self->{CMDOPTS}.=" -j ".$_[1] },
50 sashby 1.2 "d" => sub { $self->{CMDOPTS}.=" -d" },
51     "k" => sub { $self->{CMDOPTS}.=" -k" },
52     "printdir" => sub { $self->{CMDOPTS}.=" -w" },
53     "n" => sub { $self->{CMDOPTS}.=" -n" },
54     "printdb" => sub { $self->{CMDOPTS}.=" -p" }
55     );
56    
57 muzaffar 1.6 Getopt::Long::config qw(default no_ignore_case require_order bundling);
58 sashby 1.2
59     if (! Getopt::Long::GetOptions(\%opts, %options))
60     {
61     print "SCRAM Warning: Ignoring unknown option.","\n";
62 muzaffar 1.6 exit(1);
63 sashby 1.2 }
64    
65     return $self;
66     }
67    
68     sub exec()
69     {
70     my $self=shift;
71     my ($makefile)=@_;
72     my $PID;
73     my $makecmd=$self->{GMAKECMD}.$self->{CMDOPTS}." -f ".$makefile." ".join(" ",@ARGV);
74 muzaffar 1.7
75 sashby 1.2 # Try without forking:
76 muzaffar 1.7 exec("$makecmd") || die "SCRAM MakeInterface::exec(): Unable to run gmake ...$!","\n";
77 sashby 1.2 }
78    
79     1;
80