ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/MakeInterface.pm
Revision: 1.6.4.3
Committed: Thu Dec 11 09:38:09 2008 UTC (16 years, 4 months ago) by muzaffar
Content type: text/plain
Branch: SCRAM_V2_0
CVS Tags: V2_2_2, V2_2_2_pre4, V2_2_2_pre3, V2_2_2_pre2, V2_2_2_pre1, V2_2_2-pre1, V2_2_1, forV2_2_1, V2_2_0, sm100112, V2_1_4, V2_1_3, V2_1_2, V2_1_1, V2_1_0
Changes since 1.6.4.2: +2 -2 lines
Log Message:
print error message when gmake command not found

File Contents

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