maint: Configure Emacs automatically with ".dir-locals.el"
[automake.git] / lib / Automake / RuleDef.pm
blob3a19e08ef07567283c54365087675158a05cf0c4
1 # Copyright (C) 2003-2017 Free Software Foundation, Inc.
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.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 package Automake::RuleDef;
18 use 5.006;
19 use strict;
20 use Carp;
21 use Automake::ChannelDefs;
22 use Automake::ItemDef;
24 require Exporter;
25 use vars '@ISA', '@EXPORT';
26 @ISA = qw/Automake::ItemDef Exporter/;
27 @EXPORT = qw (&RULE_AUTOMAKE &RULE_USER);
29 =head1 NAME
31 Automake::RuleDef - a class for rule definitions
33 =head1 SYNOPSIS
35 use Automake::RuleDef;
36 use Automake::Location;
38 =head1 DESCRIPTION
40 This class gathers data related to one Makefile-rule definition.
41 It shouldn't be needed outside of F<Rule.pm>.
43 =head2 Constants
45 =over 4
47 =item C<RULE_AUTOMAKE>, C<RULE_USER>
49 Possible owners for rules.
51 =cut
53 use constant RULE_AUTOMAKE => 0; # Rule defined by Automake.
54 use constant RULE_USER => 1; # Rule defined in the user's Makefile.am.
56 =back
58 =head2 Methods
60 =over 4
62 =item C<new Automake::RuleDef ($name, $comment, $location, $owner, $source)>
64 Create a new rule definition with target C<$name>, with associated comment
65 C<$comment>, Location C<$location> and owner C<$owner>, defined in file
66 C<$source>.
68 =cut
70 sub new ($$$$$)
72 my ($class, $name, $comment, $location, $owner, $source) = @_;
74 my $self = Automake::ItemDef::new ($class, $comment, $location, $owner);
75 $self->{'source'} = $source;
76 $self->{'name'} = $name;
77 return $self;
80 =item C<$source = $rule-E<gt>source>
82 Return the source of the rule.
84 =cut
86 sub source ($)
88 my ($self) = @_;
89 return $self->{'source'};
92 =item C<$name = $rule-E<gt>name>
94 Return the name of the rule.
96 =cut
98 sub name ($)
100 my ($self) = @_;
101 return $self->{'name'};
104 =back
106 =head1 SEE ALSO
108 L<Automake::Rule>, L<Automake::ItemDef>.
110 =cut