# been checked for. This variable is local to the "require file"
# functions.
my %require_file_found = ();
+
+# The name of the Makefile currently being processed.
+my $am_file = 'BUG';
\f
################################################################
# the named of the helper variable used to append to VAR in CONDITIONS.
my %appendvar = ();
+################################################################
+
+# Pattern that matches all know input extensions (i.e. extensions used
+# by the languages supported by Automake). Using this pattern
+# (instead of `\..*$') to match extensions allows Automake to support
+# dot-less extensions.
+my $KNOWN_EXTENSIONS_PATTERN = "";
+my @known_extensions_list = ();
+
+# accept_extensions (@EXTS)
+# -------------------------
+# Update $KNOWN_EXTENSIONS_PATTERN to recognize the extensions
+# listed @EXTS. Extensions should contain a dot if needed.
+sub accept_extensions (@)
+{
+ push @known_extensions_list, @_;
+ $KNOWN_EXTENSIONS_PATTERN =
+ '(?:' . join ('|', map (quotemeta, @known_extensions_list)) . ')';
+}
+
+# var_SUFFIXES_trigger ($TYPE, $VALUE)
+# ------------------------------------
+# This is called automagically by macro_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, and $KNOWN_EXTENSIONS_PATTERN
+# are used when parsing the input am file.
+sub var_SUFFIXES_trigger ($$)
+{
+ my ($type, $value) = @_;
+ accept_extensions (split (' ', $value));
+}
+
+################################################################
## --------------------------------- ##
## Forward subroutine declarations. ##
################################################################
-# Parse the WARNINGS environment variable.
-&parse_WARNINGS;
-
-# Parse command line.
-&parse_arguments;
-
-# Do configure.ac scan only once.
-&scan_autoconf_files;
-
-&fatal ("no `Makefile.am' found or specified\n")
- if ! @input_files;
-
-my $automake_has_run = 0;
-
-do
-{
- if ($automake_has_run)
- {
- &verb ('processing Makefiles another time to fix them up.');
- &prog_error ('running more than two times should never be needed.')
- if $automake_has_run >= 2;
- }
- $automake_needs_to_reprocess_all_files = 0;
-
- # Now do all the work on each file.
- # This guy must be local otherwise it's private to the loop.
- use vars '$am_file';
- local $am_file;
- foreach $am_file (@input_files)
- {
- if (! -f ($am_file . '.am'))
- {
- &error ("`$am_file.am' does not exist");
- }
- else
- {
- &generate_makefile ($output_files{$am_file}, $am_file);
- }
- }
- ++$automake_has_run;
-}
-while ($automake_needs_to_reprocess_all_files);
-
-exit $exit_code;
-
-################################################################
-
# Error reporting functions.
# err_var ($VARNAME, $MESSAGE, [%OPTIONS])
################################################################
-# Pattern that matches all know input extensions (i.e. extensions used
-# by the languages supported by Automake). Using this pattern
-# (instead of `\..*$') to match extensions allows Automake to support
-# dot-less extensions.
-my $KNOWN_EXTENSIONS_PATTERN = "";
-my @known_extensions_list = ();
-
-# accept_extensions (@EXTS)
-# -------------------------
-# Update $KNOWN_EXTENSIONS_PATTERN to recognize the extensions
-# listed @EXTS. Extensions should contain a dot if needed.
-sub accept_extensions (@)
-{
- push @known_extensions_list, @_;
- $KNOWN_EXTENSIONS_PATTERN =
- '(?:' . join ('|', map (quotemeta, @known_extensions_list)) . ')';
-}
-
-# var_SUFFIXES_trigger ($TYPE, $VALUE)
-# ------------------------------------
-# This is called automagically by macro_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, and $KNOWN_EXTENSIONS_PATTERN
-# are used when parsing the input am file.
-sub var_SUFFIXES_trigger ($$)
-{
- my ($type, $value) = @_;
- accept_extensions (split (' ', $value));
-}
-
-################################################################
-
-
-# Parse command line.
-sub parse_arguments ()
-{
- # Start off as gnu.
- &set_strictness ('gnu');
-
- my %options =
- (
- 'libdir:s' => \$libdir,
- 'gnu' => sub { &set_strictness ('gnu'); },
- 'gnits' => sub { &set_strictness ('gnits'); },
- 'cygnus' => \$cygnus_mode,
- 'foreign' => sub { &set_strictness ('foreign'); },
- 'include-deps' => sub { $cmdline_use_dependencies = 1; },
- 'i|ignore-deps' => sub { $cmdline_use_dependencies = 0; },
- 'no-force' => sub { $force_generation = 0; },
- 'f|force-missing' => \$force_missing,
- 'o|output-dir:s' => \$output_directory,
- 'a|add-missing' => \$add_missing,
- 'c|copy' => \$copy_missing,
- 'v|verbose' => sub { setup_channel 'verb', silent => 0; },
- 'W|warnings:s' => \&parse_warnings,
- # These long options (--Werror and --Wno-error) for backward
- # compatibility. Use -Werror and -Wno-error today.
- 'Werror' => sub { parse_warnings 'W', 'error'; },
- 'Wno-error' => sub { parse_warnings 'W', 'no-error'; },
- );
-
- use Getopt::Long;
- Getopt::Long::config ("bundling", "pass_through");
-
- # See if --version or --help is used. We want to process these before
- # anything else because the GNU Coding Standards require us to
- # `exit 0' after processing these options, and we can't garanty this
- # if we treat other options first. (Handling other options first
- # could produce error diagnostics, and in this condition it is
- # confusing if Automake `exit 0'.)
- my %options_1st_pass =
- (
- 'version' => \&version,
- 'help' => \&usage,
- # Recognize all other options (and their arguments) but do nothing.
- map { $_ => sub {} } (keys %options)
- );
- my @ARGV_backup = @ARGV;
- Getopt::Long::GetOptions %options_1st_pass
- or exit 1;
- @ARGV = @ARGV_backup;
-
- # Now *really* process the options. This time we know
- # that --help and --version are not present.
- Getopt::Long::GetOptions %options
- or exit 1;
-
- if (defined $output_directory)
- {
- msg 'obsolete', "`--output-dir' is deprecated\n";
- }
- else
- {
- # In the next release we'll remove this entirely.
- $output_directory = '.';
- }
-
- foreach my $arg (@ARGV)
- {
- if ($arg =~ /^-./)
- {
- fatal ("unrecognized option `$arg'\n"
- . "Try `$0 --help' for more information.");
- }
-
- # Handle $local:$input syntax. Note that we only examine the
- # first ":" file to see if it is automake input; the rest are
- # just taken verbatim. We still keep all the files around for
- # dependency checking, however.
- my ($local, $input, @rest) = split (/:/, $arg);
- if (! $input)
- {
- $input = $local;
- }
- else
- {
- # Strip .in; later on .am is tacked on. That is how the
- # automake input file is found. Maybe not the best way, but
- # it is easy to explain.
- $input =~ s/\.in$//
- or fatal "invalid input file name `$arg'\n.";
- }
- push (@input_files, $input);
- $output_files{$input} = join (':', ($local, @rest));
- }
-
- # Take global strictness from whatever we currently have set.
- $default_strictness = $strictness;
- $default_strictness_name = $strictness_name;
-}
-
-################################################################
-
# Generate a Makefile.in given the name of the corresponding Makefile and
# the name of the file output by config.status.
sub generate_makefile
exit 0;
}
+################################################################
+
+# Parse command line.
+sub parse_arguments ()
+{
+ # Start off as gnu.
+ &set_strictness ('gnu');
+
+ my %options =
+ (
+ 'libdir:s' => \$libdir,
+ 'gnu' => sub { &set_strictness ('gnu'); },
+ 'gnits' => sub { &set_strictness ('gnits'); },
+ 'cygnus' => \$cygnus_mode,
+ 'foreign' => sub { &set_strictness ('foreign'); },
+ 'include-deps' => sub { $cmdline_use_dependencies = 1; },
+ 'i|ignore-deps' => sub { $cmdline_use_dependencies = 0; },
+ 'no-force' => sub { $force_generation = 0; },
+ 'f|force-missing' => \$force_missing,
+ 'o|output-dir:s' => \$output_directory,
+ 'a|add-missing' => \$add_missing,
+ 'c|copy' => \$copy_missing,
+ 'v|verbose' => sub { setup_channel 'verb', silent => 0; },
+ 'W|warnings:s' => \&parse_warnings,
+ # These long options (--Werror and --Wno-error) for backward
+ # compatibility. Use -Werror and -Wno-error today.
+ 'Werror' => sub { parse_warnings 'W', 'error'; },
+ 'Wno-error' => sub { parse_warnings 'W', 'no-error'; },
+ );
+ use Getopt::Long;
+ Getopt::Long::config ("bundling", "pass_through");
+
+ # See if --version or --help is used. We want to process these before
+ # anything else because the GNU Coding Standards require us to
+ # `exit 0' after processing these options, and we can't garanty this
+ # if we treat other options first. (Handling other options first
+ # could produce error diagnostics, and in this condition it is
+ # confusing if Automake `exit 0'.)
+ my %options_1st_pass =
+ (
+ 'version' => \&version,
+ 'help' => \&usage,
+ # Recognize all other options (and their arguments) but do nothing.
+ map { $_ => sub {} } (keys %options)
+ );
+ my @ARGV_backup = @ARGV;
+ Getopt::Long::GetOptions %options_1st_pass
+ or exit 1;
+ @ARGV = @ARGV_backup;
+
+ # Now *really* process the options. This time we know
+ # that --help and --version are not present.
+ Getopt::Long::GetOptions %options
+ or exit 1;
+
+ if (defined $output_directory)
+ {
+ msg 'obsolete', "`--output-dir' is deprecated\n";
+ }
+ else
+ {
+ # In the next release we'll remove this entirely.
+ $output_directory = '.';
+ }
+
+ foreach my $arg (@ARGV)
+ {
+ if ($arg =~ /^-./)
+ {
+ fatal ("unrecognized option `$arg'\n"
+ . "Try `$0 --help' for more information.");
+ }
+
+ # Handle $local:$input syntax. Note that we only examine the
+ # first ":" file to see if it is automake input; the rest are
+ # just taken verbatim. We still keep all the files around for
+ # dependency checking, however.
+ my ($local, $input, @rest) = split (/:/, $arg);
+ if (! $input)
+ {
+ $input = $local;
+ }
+ else
+ {
+ # Strip .in; later on .am is tacked on. That is how the
+ # automake input file is found. Maybe not the best way, but
+ # it is easy to explain.
+ $input =~ s/\.in$//
+ or fatal "invalid input file name `$arg'\n.";
+ }
+ push (@input_files, $input);
+ $output_files{$input} = join (':', ($local, @rest));
+ }
+
+ # Take global strictness from whatever we currently have set.
+ $default_strictness = $strictness;
+ $default_strictness_name = $strictness_name;
+}
+
+################################################################
+
+# Parse the WARNINGS environment variable.
+parse_WARNINGS;
+
+# Parse command line.
+parse_arguments;
+
+# Do configure.ac scan only once.
+scan_autoconf_files;
+
+fatal "no `Makefile.am' found or specified\n"
+ if ! @input_files;
+
+my $automake_has_run = 0;
+
+do
+{
+ if ($automake_has_run)
+ {
+ verb 'processing Makefiles another time to fix them up.';
+ prog_error 'running more than two times should never be needed.'
+ if $automake_has_run >= 2;
+ }
+ $automake_needs_to_reprocess_all_files = 0;
+
+ # Now do all the work on each file.
+ foreach my $file (@input_files)
+ {
+ $am_file = $file;
+ if (! -f ($am_file . '.am'))
+ {
+ error "`$am_file.am' does not exist";
+ }
+ else
+ {
+ generate_makefile ($output_files{$am_file}, $am_file);
+ }
+ }
+ ++$automake_has_run;
+}
+while ($automake_needs_to_reprocess_all_files);
+
+exit $exit_code;
+
+
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2