[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: s/$cygnus_mode/$options{'cygnus'}/
From: |
Akim Demaille |
Subject: |
FYI: s/$cygnus_mode/$options{'cygnus'}/ |
Date: |
Tue, 08 Jul 2003 10:10:16 +0200 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
This will help modularizing Automake.
Index: ChangeLog
from Akim Demaille <address@hidden>
* automake.in ($cygnus_mode): Replace with $options{'cygnus'}.
Adjust all dependencies.
(&depend): Move next to %dependencies.
(&initialize_per_input): Initialize the 'cygnus' field of
'%options' to spare the code from 'exists' or 'defined' when
testing it.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1479
diff -u -u -w -u -r1.1479 automake.in
--- automake.in 6 Jul 2003 23:48:09 -0000 1.1479
+++ automake.in 8 Jul 2003 08:09:12 -0000
@@ -375,9 +375,6 @@
# generation.
my %configure_vars = ();
-# TRUE if --cygnus seen.
-my $cygnus_mode = 0;
-
# Files included by @configure.
my @configure_deps = ();
@@ -516,6 +513,16 @@
# in Makefile: keeping related stuff altogether.
my %dependencies;
+# &depend ($CATEGORY, @DEPENDENDEES)
+# ----------------------------------
+# The target $CATEGORY depends on @DEPENDENDEES.
+sub depend ($@)
+{
+ my ($category, @dependendees) = @_;
+ push (@{$dependencies{$category}}, @dependendees);
+}
+
+
# Holds the factored actions. Tied to %DEPENDENCIES, i.e., filled
# only when keys exists in %DEPENDENCIES.
my %actions;
@@ -773,7 +780,11 @@
$strictness = $default_strictness;
$strictness_name = $default_strictness_name;
- %options = ();
+ %options =
+ (
+ # TRUE if --cygnus seen.
+ 'cygnus' => 0,
+ );
$use_dependencies = $cmdline_use_dependencies;
@@ -1180,10 +1191,6 @@
{
&set_strictness ($_);
}
- elsif ($_ eq 'cygnus')
- {
- $cygnus_mode = $where;
- }
elsif (/^(.*\/)?ansi2knr$/)
{
# An option like "../lib/ansi2knr" is allowed. With no
@@ -1199,7 +1206,8 @@
|| $_ eq 'readme-alpha' || $_ eq 'check-news'
|| $_ eq 'subdir-objects' || $_ eq 'nostdinc'
|| $_ eq 'no-exeext' || $_ eq 'no-define'
- || $_ eq 'std-options')
+ || $_ eq 'std-options'
+ || $_ eq 'cygnus')
{
# Explicitly recognize these.
}
@@ -3079,7 +3087,7 @@
# Handle location of texinfo.tex.
my $need_texi_file = 0;
my $texinfodir;
- if ($cygnus_mode)
+ if ($options{'cygnus'})
{
$texinfodir = '$(top_srcdir)/../texinfo';
define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL);
@@ -3354,7 +3362,7 @@
# `make dist' isn't used in a Cygnus-style tree.
# Omit the rules so that people don't try to use them.
- return if $cygnus_mode;
+ return if $options{'cygnus'};
# At least one of the archive formats must be enabled.
if ($relative_dir eq '.')
@@ -3653,9 +3661,12 @@
return @newinputs;
}
+
+# &handle_configure ($LOCAL, $INPUT, @SECONDARY_INPUTS)
+# -----------------------------------------------------
# Handle remaking and configure stuff.
# We need the name of the input file, to do proper remaking rules.
-sub handle_configure
+sub handle_configure ($$@)
{
my ($local, $input, @secondary_inputs) = @_;
@@ -3682,19 +3693,17 @@
define_pretty_variable ('am__configure_deps', TRUE, INTERNAL,
@configure_deps);
- $output_rules .=
- &file_contents ('configure',
+ $output_rules .= file_contents
+ ('configure',
new Automake::Location,
MAKEFILE => $local_base,
'MAKEFILE-DEPS' => "@rewritten",
- 'CONFIG-MAKEFILE'
- => ($relative_dir eq '.') ? '$@' : '$(subdir)/$@',
+ 'CONFIG-MAKEFILE' => ($relative_dir eq '.') ? '$@' : '$(subdir)/$@',
'MAKEFILE-IN' => $infile,
'MAKEFILE-IN-DEPS' => "@include_stack",
'MAKEFILE-AM' => $amfile,
- STRICTNESS => $cygnus_mode ? 'cygnus' : $strictness_name,
- 'USE-DEPS'
- => $cmdline_use_dependencies ? '' : ' --ignore-deps',
+ STRICTNESS => $options{'cygnus'} ? 'cygnus' : $strictness_name,
+ 'USE-DEPS' => $cmdline_use_dependencies ? '' : ' --ignore-deps',
'MAKEFILE-AM-SOURCES' => "$input$colon_infile",
'REGEN-ACLOCAL-M4' => $regen_aclocal_m4,
ACLOCAL_M4_DEPS => "@aclocal_m4_deps");
@@ -4086,21 +4095,23 @@
}
+# &do_check_merge_target ()
+# -------------------------
# Handle check merge target specially.
-sub do_check_merge_target
+sub do_check_merge_target ()
{
- if (&target_defined ('check-local'))
+ if (target_defined ('check-local'))
{
# User defined local form of target. So include it.
- push (@check_tests, 'check-local');
- &depend ('.PHONY', 'check-local');
+ push @check_tests, 'check-local';
+ depend '.PHONY', 'check-local';
}
# In --cygnus mode, check doesn't depend on all.
- if ($cygnus_mode)
+ if ($options{'cygnus'})
{
# Just run the local check rules.
- &pretty_print_rule ('check-am:', "\t\t", @check);
+ pretty_print_rule ('check-am:', "\t\t", @check);
}
else
{
@@ -4108,15 +4119,15 @@
# `all', to ensure all the primary targets are built. Then it
# must build the local check rules.
$output_rules .= "check-am: all-am\n";
- &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ",
+ pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ",
@check)
if @check;
}
- &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ",
+ pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ",
@check_tests)
if @check_tests;
- &depend ('.PHONY', 'check', 'check-am');
+ depend '.PHONY', 'check', 'check-am';
# Handle recursion. We have to honor BUILT_SOURCES like for `all:'.
$output_rules .= ("check: "
. (var ('BUILT_SOURCES')
@@ -4173,18 +4184,6 @@
}
-# &depend ($CATEGORY, @DEPENDENDEES)
-# ----------------------------------
-# The target $CATEGORY depends on @DEPENDENDEES.
-sub depend
-{
- my ($category, @dependendees) = @_;
- {
- push (@{$dependencies{$category}}, @dependendees);
- }
-}
-
-
# &target_cmp ($A, $B)
# --------------------
# Subroutine for &handle_factored_dependencies to let `.PHONY' be last.
@@ -4707,11 +4706,11 @@
# Set up for Cygnus mode.
sub check_cygnus
{
- return unless $cygnus_mode;
+ return unless $options{'cygnus'};
&set_strictness ('foreign');
- $options{'no-installinfo'} = $cygnus_mode;
- $options{'no-dependencies'} = $cygnus_mode;
+ $options{'no-installinfo'} = $options{'cygnus'};
+ $options{'no-dependencies'} = $options{'cygnus'};
$use_dependencies = 0;
err_ac "`AM_MAINTAINER_MODE' required when --cygnus specified"
@@ -6134,7 +6133,7 @@
"s/$IGNORE_PATTERN//gm;"
. transform (%transform,
- 'CYGNUS' => $cygnus_mode,
+ 'CYGNUS' => $options{'cygnus'},
'MAINTAINER-MODE'
=> $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '',
@@ -7406,12 +7405,12 @@
# Start off as gnu.
&set_strictness ('gnu');
- my %options =
+ my %cli_options =
(
'libdir:s' => \$libdir,
'gnu' => sub { &set_strictness ('gnu'); },
'gnits' => sub { &set_strictness ('gnits'); },
- 'cygnus' => \$cygnus_mode,
+ 'cygnus' => \$options{'cygnus'},
'foreign' => sub { &set_strictness ('foreign'); },
'include-deps' => sub { $cmdline_use_dependencies = 1; },
'i|ignore-deps' => sub { $cmdline_use_dependencies = 0; },
@@ -7436,21 +7435,21 @@
# 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 =
+ my %cli_options_1st_pass =
(
'version' => \&version,
'help' => \&usage,
# Recognize all other options (and their arguments) but do nothing.
- map { $_ => sub {} } (keys %options)
+ map { $_ => sub {} } (keys %cli_options)
);
my @ARGV_backup = @ARGV;
- Getopt::Long::GetOptions %options_1st_pass
+ Getopt::Long::GetOptions %cli_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
+ Getopt::Long::GetOptions %cli_options
or exit 1;
if (defined $output_directory)
- FYI: s/$cygnus_mode/$options{'cygnus'}/,
Akim Demaille <=