{
&set_strictness ('foreign');
}
- elsif ($arglist[0] eq '--strictness')
+ elsif ($arglist[0] eq '--strictness' || $arglist[0] eq '-s')
{
&require_argument (@arglist);
shift (@arglist);
&set_strictness ($arglist[0]);
}
- elsif ($arglist[0] eq '--include-deps')
+ elsif ($arglist[0] eq '--include-deps' || $arglist[0] eq '-i')
{
$cmdline_use_dependencies = 0;
}
# Set output directory.
$output_directory = $1;
}
- elsif ($arglist[0] eq '--output-dir')
+ elsif ($arglist[0] eq '--output-dir' || $arglist[0] eq '-o')
{
&require_argument (@arglist);
shift (@arglist);
$output_directory = $arglist[0];
}
- elsif ($arglist[0] eq '--add-missing')
+ elsif ($arglist[0] eq '--add-missing' || $arglist[0] eq '-a')
{
$add_missing = 1;
}
- elsif ($arglist[0] eq '--verbose')
+ elsif ($arglist[0] eq '--verbose' || $arglist[0] eq '-v')
{
$verbose = 1;
}
# We still need Makefile.in here, because sometimes the `dist'
# target doesn't re-run automake.
&push_dist_common ($in_file_name, $am_file_name);
- push (@sources, '$(SOURCES)') if defined $contents{'SOURCES'};
- push (@objects, '$(OBJECTS)') if defined $contents{'OBJECTS'};
+ push (@sources, '$(SOURCES)')
+ if &variable_defined ('SOURCES');
+ push (@objects, '$(OBJECTS)')
+ if &variable_defined ('OBJECTS');
# This is always the default target. This gives us freedom to do
# things in whatever order is convenient.
# Handle AUTOMAKE_OPTIONS variable.
sub handle_options
{
- return if ! defined $contents{'AUTOMAKE_OPTIONS'};
+ return if ! &variable_defined ('AUTOMAKE_OPTIONS');
foreach (split (/\s+/, $contents{'AUTOMAKE_OPTIONS'}))
{
{
# Boilerplate.
local ($xform) = '';
- if (defined $contents{'CONFIG_HEADER'})
+ if (&variable_defined ('CONFIG_HEADER'))
{
($xform = &dirname ($contents{'CONFIG_HEADER'}))
=~ s/(\W)/\\$1/g;
local ($objpat) = $obj;
$objpat =~ s/(\W)/\\$1/g;
- if (defined $contents{$one_file . "_OBJECTS"})
+ if (&variable_defined ($one_file . "_OBJECTS"))
{
&am_line_error ($one_file . '_OBJECTS',
$one_file . '_OBJECTS', 'should not be defined');
foreach $prefix ('', 'EXTRA_')
{
$source_list = '';
- if (defined $contents{$prefix . $one_file . "_SOURCES"})
+ if (&variable_defined ($prefix . $one_file . "_SOURCES"))
{
push (@sources, '$(' . $prefix . $one_file . "_SOURCES)");
push (@objects, '$(' . $prefix . $one_file . "_OBJECTS)")
}
}
- if (defined $contents{'CONFIG_HEADER'})
+ if (&variable_defined ('CONFIG_HEADER'))
{
$output_rules .= ('$(' . $one_file . "_OBJECTS): "
. $contents{'CONFIG_HEADER'} . "\n");
local ($var) = @_;
die "programming error in handle_lib_objects"
- if ! defined $contents{$var};
+ if ! &variable_defined ($var);
# We recognize certain things that are commonly put in LIBADD or
# LDADD.
&am_line_error ($one_file . $xt,
"invalid variable \`" . $one_file . $xt
. "'; should be \`" . $xname . $xt . "'")
- if defined $contents{$one_file . $xt};
+ if &variable_defined ($one_file . $xt);
}
}
&handle_source_transform ($xname, $obj);
- if (defined $contents{$xname . "_LDADD"})
+ if (&variable_defined ($xname . "_LDADD"))
{
&handle_lib_objects ($xname . '_LDADD');
}
}
&handle_lib_objects ('LDADD')
- if defined $contents{'LDADD'};
+ if &variable_defined ('LDADD');
}
# Handle libraries.
local (@outlist);
foreach $onedir ('lib', 'pkglib', 'noinst')
{
- if (defined $contents{$onedir . '_LIBRARIES'})
+ if (&variable_defined ($onedir . '_LIBRARIES'))
{
@outlist = ();
foreach $onelib (split (/\s+/, $contents{$onedir . '_LIBRARIES'}))
local ($munge);
foreach $onelib (@liblist)
{
- if (defined $contents{$onelib . '_LIBADD'})
+ if (&variable_defined ($onelib . '_LIBADD'))
{
&handle_lib_objects ($onelib . '_LIBADD');
}
# Turn "foo" into "libfoo.a" and include macro definition.
grep (($_ = 'lib' . $_ . '.a') && 0, @liblist);
- if (! defined $contents{'LIBFILES'})
+ if (! &variable_defined ('LIBFILES'))
{
&pretty_print ('LIBFILES = ', "", @liblist);
}
{
&am_line_error ('TEXINFOS',
"\`TEXINFOS' is an anachronism; use \`info_TEXINFOS'")
- if defined $contents{'TEXINFOS'};
- return if (! defined $contents{'info_TEXINFOS'}
- && ! defined $contents{'html_TEXINFOS'});
+ if &variable_defined ('TEXINFOS');
+ return if (! &variable_defined ('info_TEXINFOS')
+ && ! &variable_defined ('html_TEXINFOS'));
local (@texis) = split (/\s+/, $contents{'info_TEXINFOS'});
# Canonicalize name first.
($canonical = $infobase) =~ tr/A-Za-z0-9_/_/c;
- if (defined $contents{$canonical . "_TEXINFOS"})
+ if (&variable_defined ($canonical . "_TEXINFOS"))
{
push (@texi_deps, '$(' . $canonical . '_TEXINFOS)');
&push_dist_common ('$(' . $canonical . '_TEXINFOS)');
sub handle_man_pages
{
&am_line_error ('MANS', "\`MANS' is an anachronism; use \`man_MANS'")
- if defined $contents{'MANS'};
- return if ! defined $contents{'man_MANS'};
+ if &variable_defined ('MANS');
+ return if ! &variable_defined ('man_MANS');
# We generate the manpage install code by hand to avoid the use of
# basename in the generated Makefile.
local ($tagging) = 0;
push (@phony, 'tags');
- if (defined $contents{'SUBDIRS'})
+ if (&variable_defined ('SUBDIRS'))
{
$output_rules .= &file_contents ('tags');
$tagging = 1;
}
- elsif ($dir_holds_sources || defined $contents{'ETAGS_ARGS'})
+ elsif ($dir_holds_sources || &variable_defined ('ETAGS_ARGS'))
{
$output_rules .= &file_contents ('tags-subd');
$tagging = 1;
# If we have SUBDIRS, create all dist subdirectories and do
# recursive build.
- if (defined $contents{'SUBDIRS'})
+ if (&variable_defined ('SUBDIRS'))
{
# Test for directory existence here because previous automake
# invocation might have created some directories.
{
# Set up maint_charset.
$local_maint_charset = $contents{'MAINT_CHARSET'}
- if defined $contents{'MAINT_CHARSET'};
+ if &variable_defined ('MAINT_CHARSET');
$maint_charset = $local_maint_charset
if $relative_dir eq '.';
- if (defined $contents{'DIST_CHARSET'})
+ if (&variable_defined ('DIST_CHARSET'))
{
&am_line_error ('DIST_CHARSET',
"DIST_CHARSET defined but no MAINT_CHARSET defined")
# Handle subdirectories.
sub handle_subdirs
{
- if (! defined $contents{'SUBDIRS'})
+ if (! &variable_defined ('SUBDIRS'))
{
&am_conf_error
("ud_GNU_GETTEXT in configure.in but SUBDIRS not defined")
&require_file_with_conf_line ($ac_gettext_line, $FOREIGN, 'ABOUT-NLS')
if $seen_gettext;
- return if ! defined $contents{'SUBDIRS'};
+ return if ! &variable_defined ('SUBDIRS');
# Make sure each directory mentioned in SUBDIRS actually exists.
local ($dir);
{
# If SUBDIRS defined, require AC_PROG_MAKE_SET.
&am_line_error ('SUBDIRS', "AC_PROG_MAKE_SET must be used in configure.in")
- if defined $contents{'SUBDIRS'} && ! $seen_make_set;
+ if &variable_defined ('SUBDIRS') && ! $seen_make_set;
local ($top_reldir);
if ($relative_dir ne '.')
&am_line_error ('CONFIG_HEADER',
"\`CONFIG_HEADER' is an anachronism; now determined from \`configure.in'")
- if defined $contents{'CONFIG_HEADER'};
+ if &variable_defined ('CONFIG_HEADER');
# Generate CONFIG_HEADER define, and define interally.
$output_vars .= "CONFIG_HEADER = ${top_builddir}/${config_name}\n"
# As of 0.10.6, gettext still wants @INTLSUB@ and @POSUB@ in
# SUBDIRS. This is going to change in a future version. So for
# now we simply do no checking.
- if (0 && defined $contents{'SUBDIRS'})
+ if (0 && &variable_defined ('SUBDIRS'))
{
&am_line_error
('SUBDIRS',
&do_one_merge_target ('info', @info);
&do_one_merge_target ('dvi', @dvi);
- if (! defined $contents{'SUBDIRS'} || $relative_dir ne '.')
+ if (! &variable_defined ('SUBDIRS') || $relative_dir ne '.')
{
# 'check' must depend on 'all', but not at top level.
# Ditto install.
# Handle TESTS variable.
sub handle_tests
{
- return if ! defined $contents{'TESTS'};
+ return if ! &variable_defined ('TESTS');
&push_dist_common (split (/\s+/, $contents{'TESTS'}));
push (@check, 'check-TESTS');
################################################################
+# See if a variable exists.
+sub variable_defined
+{
+ local ($var) = @_;
+ if (defined $targets{$var})
+ {
+ &am_line_error ($var, "\`$var' is target; expected variable");
+ }
+ return (defined $contents{$var} && ! defined $targets{$var});
+}
+
# Read Makefile.am and set up %contents. Simultaneously copy lines
# from Makefile.am into $output_trailer or $output_vars as
# appropriate. NOTE we put rules in the trailer section. We want
local ($spacing) = '';
local ($comment) = '';
local ($last_var_name) = '';
+ local ($blank) = 0;
while (<AM_FILE>)
{
{
# Stick a single white line before the incoming macro or rule.
$spacing = "\n";
+ $blank = 1;
}
elsif (/$COMMENT_PATTERN/o)
{
- # Stick comments before the incoming macro or rule.
+ # Stick comments before the incoming macro or rule. Make
+ # sure a blank line preceeds comments.
+ $spacing = "\n" unless $blank;
$comment .= $spacing . $_;
$spacing = '';
}
# Value here doesn't matter; for targets we only note
# existence.
$contents{$1} = 1;
+ $targets{$1} = 1;
$content_lines{$1} = $.;
$output_trailer .= $comment . $spacing . $_;
$comment = $spacing = '';
--gnits same as --strictness=gnits
--gnu same as --strictness=gnu
--help print this help, then exit
- --include-deps include generated dependencies in Makefile.in
- --add-missing add missing standard files to package
- --output-dir=DIR put generated Makefile.in's into DIR
- --strictness=LEVEL set strictness level. LEVEL is foreign, gnu, gnits
- --verbose verbosely list files processed
+ -i, --include-deps include generated dependencies in Makefile.in
+ -a, --add-missing add missing standard files to package
+ -o DIR, --output-dir=DIR
+ put generated Makefile.in's into DIR
+ -s LEVEL, --strictness=LEVEL
+ set strictness level. LEVEL is foreign, gnu, gnits
+ -v, --verbose verbosely list files processed
--version print version number, then exit\n";
# Copyright on generated Makefile.ins.
# read_am_file.
%contents = ();
+ # This holds the names which are targets. These also appear in
+ # %contents.
+ %targets = ();
+
# This holds the line numbers at which various elements of
# %contents are defined.
%content_lines = ();
# Now that configure substitutions are allowed in where_HOW
# variables, it is an error to actually define the primary.
&am_line_error ($primary, "\`$primary' is an anachronism")
- if defined $contents{$primary};
+ if &variable_defined ($primary);
# Look for misspellings. It is an error to have a variable ending
{
if ($varname =~ /^(.*)_$primary$/)
{
- if (! defined $valid{$1} && ! defined $contents{$1 . 'dir'})
+ if (! defined $valid{$1} && ! &variable_defined ($1 . 'dir'))
{
&am_line_error ($varname, "invalid variable \"$varname\"");
}
foreach $X (keys %valid)
{
$one_name = $X . '_' . $primary;
- if (defined $contents{$one_name})
+ if (&variable_defined ($one_name))
{
# Append actual contents of where_PRIMARY variable to
# result.