diff options
author | Matthias Paulmier <matthias.paulmier@etu.u-bordeaux.fr> | 2018-06-20 16:54:00 +0200 |
---|---|---|
committer | Matthias Paulmier <matthias.paulmier@etu.u-bordeaux.fr> | 2018-06-22 14:20:30 +0200 |
commit | dc79cd192751c0022a21c1d8b4fc57afa845ee3e (patch) | |
tree | b4afda890b75864a43acdfe68842c0b7c5836d22 | |
parent | a619e178bb25dc4868d3e688675b6b3c12a9d350 (diff) | |
download | automake-dc79cd192751c0022a21c1d8b4fc57afa845ee3e.tar.gz |
Utils: Add yet more methods to this module
Move ̀is_make_dir', ̀push_dist_common' and `canonicalize' to this module.
-rwxr-xr-x | bin/automake.in | 49 | ||||
-rw-r--r-- | lib/Automake/Utils.pm | 50 |
2 files changed, 49 insertions, 50 deletions
diff --git a/bin/automake.in b/bin/automake.in index dfcab7a98..4b5eee448 100755 --- a/bin/automake.in +++ b/bin/automake.in @@ -1868,14 +1868,6 @@ sub handle_ALLOCA saw_extension ('.c'); } -# Canonicalize the input parameter. -sub canonicalize -{ - my ($string) = @_; - $string =~ tr/A-Za-z0-9_\@/_/c; - return $string; -} - # Canonicalize a name, and check to make sure the non-canonical name # is never used. Returns canonical name. Arguments are name and a # list of suffixes to check for. @@ -6248,37 +6240,6 @@ sub am_install_var ################################################################ -# Each key in this hash is the name of a directory holding a -# Makefile.in. These variables are local to 'is_make_dir'. -my %make_dirs = (); -my $make_dirs_set = 0; - -# is_make_dir ($DIRECTORY) -# ------------------------ -sub is_make_dir -{ - my ($dir) = @_; - if (! $make_dirs_set) - { - foreach my $iter (@configure_input_files) - { - $make_dirs{dirname ($iter)} = 1; - } - # We also want to notice Makefile.in's. - foreach my $iter (@other_input_files) - { - if ($iter =~ /Makefile\.in$/) - { - $make_dirs{dirname ($iter)} = 1; - } - } - $make_dirs_set = 1; - } - return defined $make_dirs{$dir}; -} - -################################################################ - # push_required_file ($DIR, $FILE, $FULLFILE) # ------------------------------------------- # Push the given file onto DIST_COMMON. @@ -6674,16 +6635,6 @@ sub require_build_directory_maybe } } -################################################################ - -# Push a list of files onto '@dist_common'. -sub push_dist_common -{ - prog_error "push_dist_common run after handle_dist" - if $handle_dist_run; - push @dist_common, @_; -} - ################################################################ diff --git a/lib/Automake/Utils.pm b/lib/Automake/Utils.pm index c273d943e..61ff25563 100644 --- a/lib/Automake/Utils.pm +++ b/lib/Automake/Utils.pm @@ -26,6 +26,7 @@ use Automake::ChannelDefs; use Automake::Variable 'var'; use Automake::Rule; use Exporter; +use File::Basename; use vars qw (@ISA @EXPORT); @@ -34,7 +35,8 @@ use vars qw (@ISA @EXPORT); @EXPORT = qw ($config_aux_dir $am_config_aux_dir $config_aux_dir_set_in_configure_ac $seen_maint_mode $relative_dir $seen_canonical $am_file_cache &var_SUFFIXES_trigger &locate_aux_dir - &subst &make_paragraphs &flatten); + &subst &make_paragraphs &flatten &canonicalize &push_dist_common + &is_make_dir); # Directory to search for configure-required files. This # will be computed by locate_aux_dir() and can be set using @@ -297,4 +299,50 @@ sub flatten } +# Canonicalize the input parameter. +sub canonicalize +{ + my ($string) = @_; + $string =~ tr/A-Za-z0-9_\@/_/c; + return $string; +} + + +# Push a list of files onto '@dist_common'. +sub push_dist_common +{ + prog_error "push_dist_common run after handle_dist" + if $handle_dist_run; + push @dist_common, @_; +} + +# Each key in this hash is the name of a directory holding a +# Makefile.in. These variables are local to 'is_make_dir'. +my %make_dirs = (); +my $make_dirs_set = 0; + +# is_make_dir ($DIRECTORY) +# ------------------------ +sub is_make_dir +{ + my ($dir) = @_; + if (! $make_dirs_set) + { + foreach my $iter (@configure_input_files) + { + $make_dirs{dirname ($iter)} = 1; + } + # We also want to notice Makefile.in's. + foreach my $iter (@other_input_files) + { + if ($iter =~ /Makefile\.in$/) + { + $make_dirs{dirname ($iter)} = 1; + } + } + $make_dirs_set = 1; + } + return defined $make_dirs{$dir}; +} + 1; |