automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] Refactoring: new module `Automake::Language'.


From: Stefano Lattarini
Subject: [PATCH 1/3] Refactoring: new module `Automake::Language'.
Date: Sun, 26 Sep 2010 22:04:37 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

* lib/Automake/Language.pm: New module, extracted from script
`automake.in'.
* lib/Automake/Makefile.am (dist_perllib_DATA): Updated.
* automake.in: Remove code moved into new `Automake::Language'
module, and related changes.
---
 ChangeLog                |    7 +++
 automake.in              |   89 +---------------------------------
 lib/Automake/Language.pm |  121 ++++++++++++++++++++++++++++++++++++++++++++++
 lib/Automake/Makefile.am |    1 +
 lib/Automake/Makefile.in |    1 +
 5 files changed, 132 insertions(+), 87 deletions(-)
 create mode 100644 lib/Automake/Language.pm

From 52ebe6ab0505caf1cd5ebfd76f60839ed87b8c27 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Sun, 26 Sep 2010 18:14:46 +0200
Subject: [PATCH 1/3] Refactoring: new module `Automake::Language'.

* lib/Automake/Language.pm: New module, extracted from script
`automake.in'.
* lib/Automake/Makefile.am (dist_perllib_DATA): Updated.
* automake.in: Remove code moved into new `Automake::Language'
module, and related changes.
---
 ChangeLog                |    7 +++
 automake.in              |   89 +---------------------------------
 lib/Automake/Language.pm |  121 ++++++++++++++++++++++++++++++++++++++++++++++
 lib/Automake/Makefile.am |    1 +
 lib/Automake/Makefile.in |    1 +
 5 files changed, 132 insertions(+), 87 deletions(-)
 create mode 100644 lib/Automake/Language.pm

diff --git a/ChangeLog b/ChangeLog
index b4d4890..9cc0c94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-09-26  Stefano Lattarini  <address@hidden>
 
+       Refactoring: new module `Automake::Language'.
+       * lib/Automake/Language.pm: New module, extracted from script
+       `automake.in'.
+       * lib/Automake/Makefile.am (dist_perllib_DATA): Updated.
+       * automake.in: Remove code moved into new `Automake::Language'
+       module, and related changes.
+
        Extend tests on `--help' and `--version' options.
        * tests/help.test: Create a new empty directory and chdir into
        it, rather than removing already present files.  Run the aclocal
diff --git a/automake.in b/automake.in
index 845ac7f..74227a9 100755
--- a/automake.in
+++ b/automake.in
@@ -27,8 +27,6 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S 
"$0" "$@";; esac'
 # Perl reimplementation by Tom Tromey <address@hidden>, and
 # Alexandre Duret-Lutz <address@hidden>.
 
-package Language;
-
 BEGIN
 {
   my $perllibdir = $ENV{'perllibdir'} || 
'@datadir@/@address@hidden@APIVERSION@';
@@ -44,90 +42,6 @@ BEGIN
   $ENV{'SHELL'} = '@SHELL@' if exists $ENV{'DJDIR'};
 }
 
-use Automake::Struct;
-struct (# Short name of the language (c, f77...).
-       'name' => "\$",
-       # Nice name of the language (C, Fortran 77...).
-       'Name' => "\$",
-
-       # List of configure variables which must be defined.
-       'config_vars' => '@',
-
-       'ansi'    => "\$",
-       # `pure' is `1' or `'.  A `pure' language is one where, if
-       # all the files in a directory are of that language, then we
-       # do not require the C compiler or any code to call it.
-       'pure'   => "\$",
-
-       'autodep' => "\$",
-
-       # Name of the compiling variable (COMPILE).
-       'compiler'  => "\$",
-       # Content of the compiling variable.
-       'compile'  => "\$",
-       # Flag to require compilation without linking (-c).
-       'compile_flag' => "\$",
-       'extensions' => '@',
-       # A subroutine to compute a list of possible extensions of
-       # the product given the input extensions.
-       # (defaults to a subroutine which returns ('.$(OBJEXT)', '.lo'))
-       'output_extensions' => "\$",
-       # A list of flag variables used in 'compile'.
-       # (defaults to [])
-       'flags' => "@",
-
-       # Any tag to pass to libtool while compiling.
-       'libtool_tag' => "\$",
-
-       # The file to use when generating rules for this language.
-       # The default is 'depend2'.
-       'rule_file' => "\$",
-
-       # Name of the linking variable (LINK).
-       'linker' => "\$",
-       # Content of the linking variable.
-       'link' => "\$",
-
-       # Name of the compiler variable (CC).
-       'ccer' => "\$",
-
-       # Name of the linker variable (LD).
-       'lder' => "\$",
-       # Content of the linker variable ($(CC)).
-       'ld' => "\$",
-
-       # Flag to specify the output file (-o).
-       'output_flag' => "\$",
-       '_finish' => "\$",
-
-       # This is a subroutine which is called whenever we finally
-       # determine the context in which a source file will be
-       # compiled.
-       '_target_hook' => "\$",
-
-       # If TRUE, nodist_ sources will be compiled using specific rules
-       # (i.e. not inference rules).  The default is FALSE.
-       'nodist_specific' => "\$");
-
-
-sub finish ($)
-{
-  my ($self) = @_;
-  if (defined $self->_finish)
-    {
-      &{$self->_finish} (@_);
-    }
-}
-
-sub target_hook ($$$$%)
-{
-    my ($self) = @_;
-    if (defined $self->_target_hook)
-    {
-       &{$self->_target_hook} (@_);
-    }
-}
-
 package Automake;
 
 use strict;
@@ -148,6 +62,7 @@ use Automake::Channels;
 use Automake::ChannelDefs;
 use Automake::Configure_ac;
 use Automake::FileUtils;
+use Automake::Language;
 use Automake::Location;
 use Automake::Condition qw/TRUE FALSE/;
 use Automake::DisjConditions;
@@ -6257,7 +6172,7 @@ sub register_language (%)
   $option{'nodist_specific'} = 0
     unless defined $option{'nodist_specific'};
 
-  my $lang = new Language (%option);
+  my $lang = new Automake::Language (%option);
 
   # Fill indexes.
   $extension_map{$_} = $lang->name foreach @{$lang->extensions};
diff --git a/lib/Automake/Language.pm b/lib/Automake/Language.pm
new file mode 100644
index 0000000..3566bee
--- /dev/null
+++ b/lib/Automake/Language.pm
@@ -0,0 +1,121 @@
+# Copyright (C) 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+package Automake::Language;
+
+use strict;
+use Automake::Struct;
+
+struct (# Short name of the language (c, f77...).
+       'name' => "\$",
+       # Nice name of the language (C, Fortran 77...).
+       'Name' => "\$",
+
+       # List of configure variables which must be defined.
+       'config_vars' => '@',
+
+       'ansi'    => "\$",
+       # `pure' is `1' or `'.  A `pure' language is one where, if
+       # all the files in a directory are of that language, then we
+       # do not require the C compiler or any code to call it.
+       'pure'   => "\$",
+
+       'autodep' => "\$",
+
+       # Name of the compiling variable (COMPILE).
+       'compiler'  => "\$",
+       # Content of the compiling variable.
+       'compile'  => "\$",
+       # Flag to require compilation without linking (-c).
+       'compile_flag' => "\$",
+       'extensions' => '@',
+       # A subroutine to compute a list of possible extensions of
+       # the product given the input extensions.
+       # (defaults to a subroutine which returns ('.$(OBJEXT)', '.lo'))
+       'output_extensions' => "\$",
+       # A list of flag variables used in 'compile'.
+       # (defaults to [])
+       'flags' => "@",
+
+       # Any tag to pass to libtool while compiling.
+       'libtool_tag' => "\$",
+
+       # The file to use when generating rules for this language.
+       # The default is 'depend2'.
+       'rule_file' => "\$",
+
+       # Name of the linking variable (LINK).
+       'linker' => "\$",
+       # Content of the linking variable.
+       'link' => "\$",
+
+       # Name of the compiler variable (CC).
+       'ccer' => "\$",
+
+       # Name of the linker variable (LD).
+       'lder' => "\$",
+       # Content of the linker variable ($(CC)).
+       'ld' => "\$",
+
+       # Flag to specify the output file (-o).
+       'output_flag' => "\$",
+       '_finish' => "\$",
+
+       # This is a subroutine which is called whenever we finally
+       # determine the context in which a source file will be
+       # compiled.
+       '_target_hook' => "\$",
+
+       # If TRUE, nodist_ sources will be compiled using specific rules
+       # (i.e. not inference rules).  The default is FALSE.
+       'nodist_specific' => "\$");
+
+
+sub finish ($)
+{
+  my ($self) = @_;
+  if (defined $self->_finish)
+    {
+      &{$self->_finish} (@_);
+    }
+}
+
+sub target_hook ($$$$%)
+{
+    my ($self) = @_;
+    if (defined $self->_target_hook)
+    {
+       &{$self->_target_hook} (@_);
+    }
+}
+
+1;
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
diff --git a/lib/Automake/Makefile.am b/lib/Automake/Makefile.am
index 0858b68..6218379 100644
--- a/lib/Automake/Makefile.am
+++ b/lib/Automake/Makefile.am
@@ -30,6 +30,7 @@ dist_perllib_DATA = \
   General.pm \
   Item.pm \
   ItemDef.pm \
+  Language.pm \
   Location.pm \
   Options.pm \
   Rule.pm \
diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in
index e068ab8..31df517 100644
--- a/lib/Automake/Makefile.in
+++ b/lib/Automake/Makefile.in
@@ -236,6 +236,7 @@ dist_perllib_DATA = \
   General.pm \
   Item.pm \
   ItemDef.pm \
+  Language.pm \
   Location.pm \
   Options.pm \
   Rule.pm \
-- 
1.7.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]