Merge branch 'msvc'
[platform/upstream/automake.git] / lib / Automake / RuleDef.pm
1 # Copyright (C) 2003, 2009  Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2, or (at your option)
6 # any later version.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16 package Automake::RuleDef;
17 use strict;
18 use Carp;
19 use Automake::ChannelDefs;
20 use Automake::ItemDef;
21
22 require Exporter;
23 use vars '@ISA', '@EXPORT';
24 @ISA = qw/Automake::ItemDef Exporter/;
25 @EXPORT = qw (&RULE_AUTOMAKE &RULE_USER);
26
27 =head1 NAME
28
29 Automake::RuleDef - a class for rule definitions
30
31 =head1 SYNOPSIS
32
33   use Automake::RuleDef;
34   use Automake::Location;
35
36 =head1 DESCRIPTION
37
38 This class gathers data related to one Makefile-rule definition.
39 It shouldn't be needed outside of F<Rule.pm>.
40
41 =head2 Constants
42
43 =over 4
44
45 =item C<RULE_AUTOMAKE>, C<RULE_USER>
46
47 Possible owners for rules.
48
49 =cut
50
51 use constant RULE_AUTOMAKE => 0; # Rule defined by Automake.
52 use constant RULE_USER => 1;     # Rule defined in the user's Makefile.am.
53
54 =back
55
56 =head2 Methods
57
58 =over 4
59
60 =item C<new Automake::RuleDef ($name, $comment, $location, $owner, $source)>
61
62 Create a new rule definition with target C<$name>, with associated comment
63 C<$comment>, Location C<$location> and owner C<$owner>, defined in file
64 C<$source>.
65
66 =cut
67
68 sub new ($$$$$)
69 {
70   my ($class, $name, $comment, $location, $owner, $source) = @_;
71
72   my $self = Automake::ItemDef::new ($class, $comment, $location, $owner);
73   $self->{'source'} = $source;
74   $self->{'name'} = $name;
75   return $self;
76 }
77
78 =item C<$source = $rule-E<gt>source>
79
80 Return the source of the rule.
81
82 =cut
83
84 sub source ($)
85 {
86   my ($self) = @_;
87   return $self->{'source'};
88 }
89
90 =item C<$name = $rule-E<gt>name>
91
92 Return the name of the rule.
93
94 =cut
95
96 sub name ($)
97 {
98   my ($self) = @_;
99   return $self->{'name'};
100 }
101
102 =back
103
104 =head1 SEE ALSO
105
106 L<Automake::Rule>, L<Automake::ItemDef>.
107
108 =cut
109
110 1;
111
112 ### Setup "GNU" style for perl-mode and cperl-mode.
113 ## Local Variables:
114 ## perl-indent-level: 2
115 ## perl-continued-statement-offset: 2
116 ## perl-continued-brace-offset: 0
117 ## perl-brace-offset: 0
118 ## perl-brace-imaginary-offset: 0
119 ## perl-label-offset: -2
120 ## cperl-indent-level: 2
121 ## cperl-brace-offset: 0
122 ## cperl-continued-brace-offset: 0
123 ## cperl-label-offset: -2
124 ## cperl-extra-newline-before-brace: t
125 ## cperl-merge-trailing-else: nil
126 ## cperl-continued-statement-offset: 2
127 ## End: