summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Paulmier <matthias.paulmier@etu.u-bordeaux.fr>2018-06-04 11:49:36 +0200
committerMatthias Paulmier <matthias.paulmier@etu.u-bordeaux.fr>2018-06-22 14:17:42 +0200
commitb26d06e0ffdb6e50c5e59f89b15a2b7c26cea003 (patch)
treee2a5150fcd188659d5340b661a0be0680c6df457
parentbe2458dd8998b75b64429303ff099ec06e524af9 (diff)
downloadautomake-b26d06e0ffdb6e50c5e59f89b15a2b7c26cea003.tar.gz
lib: Add Automake::Utils module
This module contains utility methods to be used in bin/automake. * lib/Automake/Utils.pm: New utility module. * var_SUFFIXES_trigger: Moved to the Automake::Utils module. * locate_aux_dir: Moved to the Automake::Utils module.
-rwxr-xr-xbin/automake.in42
-rw-r--r--lib/Automake/Utils.pm69
2 files changed, 70 insertions, 41 deletions
diff --git a/bin/automake.in b/bin/automake.in
index ce2bc8919..480e69f02 100755
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -67,6 +67,7 @@ use Automake::Rule;
use Automake::RuleDef;
use Automake::Wrap 'makefile_wrap';
use Automake::Language;
+use Automake::Utils;
use File::Basename;
use File::Spec;
use Carp;
@@ -120,7 +121,6 @@ sub lang_lex_finish ();
sub lang_sub_obj ();
sub lang_vala_finish ();
sub lang_yacc_finish ();
-sub locate_aux_dir ();
sub parse_arguments ();
sub scan_aclocal_m4 ();
sub scan_autoconf_files ();
@@ -150,19 +150,6 @@ my $gen_copyright = "\
################################################################
-# var_SUFFIXES_trigger ($TYPE, $VALUE)
-# ------------------------------------
-# This is called by Automake::Variable::define() when SUFFIXES
-# is defined ($TYPE eq '') or appended ($TYPE eq '+').
-# The work here needs to be performed as a side-effect of the
-# macro_define() call because SUFFIXES definitions impact
-# on $KNOWN_EXTENSIONS_PATTERN which is used used when parsing
-# the input am file.
-sub var_SUFFIXES_trigger
-{
- my ($type, $value) = @_;
- accept_extensions (split (' ', $value));
-}
Automake::Variable::hook ('SUFFIXES', \&var_SUFFIXES_trigger);
################################################################
@@ -6981,33 +6968,6 @@ sub is_make_dir
################################################################
-# Find the aux dir. This should match the algorithm used by
-# ./configure. (See the Autoconf documentation for for
-# AC_CONFIG_AUX_DIR.)
-sub locate_aux_dir ()
-{
- if (! $config_aux_dir_set_in_configure_ac)
- {
- # The default auxiliary directory is the first
- # of ., .., or ../.. that contains install-sh.
- # Assume . if install-sh doesn't exist yet.
- for my $dir (qw (. .. ../..))
- {
- if (-f "$dir/install-sh")
- {
- $config_aux_dir = $dir;
- last;
- }
- }
- $config_aux_dir = '.' unless $config_aux_dir;
- }
- # Avoid unsightly '/.'s.
- $am_config_aux_dir =
- '$(top_srcdir)' . ($config_aux_dir eq '.' ? "" : "/$config_aux_dir");
- $am_config_aux_dir =~ s,/*$,,;
-}
-
-
# push_required_file ($DIR, $FILE, $FULLFILE)
# -------------------------------------------
# Push the given file onto DIST_COMMON.
diff --git a/lib/Automake/Utils.pm b/lib/Automake/Utils.pm
new file mode 100644
index 000000000..e1cd46337
--- /dev/null
+++ b/lib/Automake/Utils.pm
@@ -0,0 +1,69 @@
+# Copyright (C) 2018 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 3 of the License, 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::Utils;
+
+use 5.006;
+use strict;
+use Exporter;
+use Automake::Rule;
+use Automake::Global;
+
+use vars qw (@ISA @EXPORT);
+
+@ISA = qw (Exporter);
+@EXPORT = qw (&var_SUFFIXES_trigger &locate_aux_dir);
+
+# var_SUFFIXES_trigger ($TYPE, $VALUE)
+# ------------------------------------
+# This is called by Automake::Variable::define() when SUFFIXES
+# is defined ($TYPE eq '') or appended ($TYPE eq '+').
+# The work here needs to be performed as a side-effect of the
+# macro_define() call because SUFFIXES definitions impact
+# on $KNOWN_EXTENSIONS_PATTERN which is used used when parsing
+# the input am file.
+sub var_SUFFIXES_trigger
+{
+ my ($type, $value) = @_;
+ accept_extensions (split (' ', $value));
+}
+
+# Find the aux dir. This should match the algorithm used by
+# ./configure. (See the Autoconf documentation for for
+# AC_CONFIG_AUX_DIR.)
+sub locate_aux_dir
+{
+ if (! $config_aux_dir_set_in_configure_ac)
+ {
+ # The default auxiliary directory is the first
+ # of ., .., or ../.. that contains install-sh.
+ # Assume . if install-sh doesn't exist yet.
+ for my $dir (qw (. .. ../..))
+ {
+ if (-f "$dir/install-sh")
+ {
+ $config_aux_dir = $dir;
+ last;
+ }
+ }
+ $config_aux_dir = '.' unless $config_aux_dir;
+ }
+ # Avoid unsightly '/.'s.
+ $am_config_aux_dir =
+ '$(top_srcdir)' . ($config_aux_dir eq '.' ? "" : "/$config_aux_dir");
+ $am_config_aux_dir =~ s,/*$,,;
+}
+
+1;