RuleDef.pm 2.7 KB

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