am-ft: make the environment available earlier
[platform/upstream/automake.git] / lib / Automake / ItemDef.pm
1 # Copyright (C) 2003-2013 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::ItemDef;
17
18 use 5.006;
19 use strict;
20 use Carp;
21
22 =head1 NAME
23
24 Automake::ItemDef - base class for Automake::VarDef and Automake::RuleDef
25
26 =head1 DESCRIPTION
27
28 =head2 Methods
29
30 =over 4
31
32 =item C<my $def = Automake::new ($comment, $location, $owner)>
33
34 Create a new Makefile-item definition.
35
36 C<$comment> is any comment preceding the definition.  (Because
37 Automake reorders items in the output, it also tries to carry comments
38 around.)
39
40 C<$location> is the place where the definition occurred, it should be
41 an instance of L<Automake::Location>.
42
43 C<$owner> specifies who owns the rule.
44
45 =cut
46
47 sub new ($$$$)
48 {
49   my ($class, $comment, $location, $owner) = @_;
50
51   my $self = {
52     comment => $comment,
53     location => $location,
54     owner => $owner,
55   };
56   bless $self, $class;
57
58   return $self;
59 }
60
61 =item C<$def-E<gt>comment>
62
63 =item C<$def-E<gt>location>
64
65 =item C<$def-E<gt>owner>
66
67 Accessors to the various constituents of an C<ItemDef>.  See the
68 documentation of C<new>'s arguments for a description of these.
69
70 =cut
71
72 sub comment ($)
73 {
74   my ($self) = @_;
75   return $self->{'comment'};
76 }
77
78 sub location ($)
79 {
80   my ($self) = @_;
81   return $self->{'location'};
82 }
83
84 sub owner ($)
85 {
86   my ($self) = @_;
87   return $self->{'owner'};
88 }
89
90 =head1 SEE ALSO
91
92 L<Automake::VarDef>, and L<Automake::RuleDef>.
93
94 =cut
95
96 1;
97
98 ### Setup "GNU" style for perl-mode and cperl-mode.
99 ## Local Variables:
100 ## perl-indent-level: 2
101 ## perl-continued-statement-offset: 2
102 ## perl-continued-brace-offset: 0
103 ## perl-brace-offset: 0
104 ## perl-brace-imaginary-offset: 0
105 ## perl-label-offset: -2
106 ## cperl-indent-level: 2
107 ## cperl-brace-offset: 0
108 ## cperl-continued-brace-offset: 0
109 ## cperl-label-offset: -2
110 ## cperl-extra-newline-before-brace: t
111 ## cperl-merge-trailing-else: nil
112 ## cperl-continued-statement-offset: 2
113 ## End: