+Tue Nov 19 19:03:30 1996 Tom Tromey <tromey@cygnus.com>
+
+ * automake.in (initialize_per_input): Initialize output_header.
+ (generate_makefile): Set up output_header; print it before
+ output_rules.
+ (handle_footer): Put .SUFFIXES into output_header, for AIX.
+
Mon Nov 18 13:29:55 1996 Tom Tromey <tromey@cygnus.com>
+ * automake.in (handle_lib_objects): Push @LIBOBJS@ and @ALLOCA@
+ onto dependency list.
+
* aclocal.in (obsolete_macros): Include AM_SANITY_CHECK_CC; now
part of autoconf proper.
* m4/ccsanity.m4: Removed.
* error messages should print ``[info blah blah]'' command when a
certain part of the standards apply. saw idea in message from
- Craig Burley.
+ Craig Burley. wouldn't it be really cool if compile-mode in Emacs
+ understood this convention, and you could click on such text to
+ go to the appropriate info page?
!! should write autoconf-style doc entries for each m4 macro
if &variable_defined ('OBJECTS');
# This is always the default target. This gives us freedom to do
- # things in whatever order is convenient.
- $output_rules .= "default: all\n\n";
+ # things in whatever order is convenient. Note that we set up
+ # $output_header here so that we can insert some text just after
+ # the "default" target, but before any other targets. In
+ # particular we want to support the .SUFFIX hack here; this is
+ # documented elsewhere.
+ $output_header = "default: all\n\n";
push (@phony, 'default');
&read_am_file ($makefile . '.am');
print "automake: creating ", $makefile, ".in\n" if $verbose;
print GM_FILE $output_vars;
+ print GM_FILE $output_header;
print GM_FILE $output_rules;
print GM_FILE $output_trailer;
# dependency list. Autoconf substitutions are not pushed;
# rarely is a new dependency substituted into (eg) foo_LDADD
# -- but "bad things (eg -lX11) are routinely substituted.
+ # Note that LIBOBJS and ALLOCA are exceptions to this rule,
+ # and handled specially below.
push (@dep_list, $lsearch)
unless $lsearch =~ /^\@.*\@$/;
# means adding entries to dep_files.
if ($lsearch eq '@LIBOBJS@')
{
+ push (@dep_list, $lsearch);
$seen_libobjs = 1;
if (! keys %libsources)
{
}
elsif ($lsearch eq '@ALLOCA@')
{
+ push (@dep_files, $lsearch);
&am_line_error ($var,
"\@ALLOCA\@ seen but \`AC_FUNC_ALLOCA' not in \`configure.in'")
if ! defined $libsources{'alloca.c'};
$output_vars .= "\n";
}
- if (defined $contents{'SUFFIXES'})
+ if (&variable_defined ('SUFFIXES'))
{
# Push actual suffixes, and not $(SUFFIXES). Some versions of
# make do not like variable substitutions on the .SUFFIXES
# line.
- push (@suffixes, split (' ', $contents{'SUFFIXES'}));
+ push (@suffixes, &variable_value_as_list ('SUFFIXES'));
}
- $output_trailer .= ".SUFFIXES:\n";
+ # Note: AIX 4.1 /bin/make will fail if any suffix rule appears
+ # before .SUFFIXES. So we make sure that .SUFFIXES appears before
+ # anything else, by sticking it right after the default: target.
+ $output_header .= ".SUFFIXES:\n";
if (@suffixes)
{
- $output_trailer .= ".SUFFIXES: " . join (' ', @suffixes) . "\n";
+ $output_header .= ".SUFFIXES: " . join (' ', @suffixes) . "\n";
}
$output_trailer .= &file_contents ('footer');
}
$output_rules = '';
$output_vars = '';
$output_trailer = '';
+ $output_header = '';
# Suffixes found during a run.
@suffixes = ();
@item AC_PROG_YACC
If a Yacc source file is seen, then you must either use this macro or
-declare the variable @samp{YACC} in @file{configure.in}. The former is
+define the variable @samp{YACC} in @file{configure.in}. The former is
preferred.
@cvindex AC_PROG_YACC
@cvindex YACC
Header files listed in a @samp{_SOURCES} definition will be included in
the distribution but otherwise ignored. In case it isn't obvious, you
should not include the header file generated by @file{configure} in an
-@samp{_SOURCES} variable; this file should not be distributed.
-Lex (@samp{.l}) and yacc (@samp{.y}) files can also be listed; support
-for these should work but is still preliminary.
-@c lex & yacc should have a separate section
+@samp{_SOURCES} variable; this file should not be distributed. Lex
+(@samp{.l}) and yacc (@samp{.y}) files can also be listed; see @ref{Yacc
+and Lex}.
Sometimes it is useful to determine the programs that are to be built at
configure time. For instance, GNU @code{cpio} only builds @code{mt} and
@section Yacc and Lex support
Automake has somewhat idiosyncratic support for Yacc and Lex.
-FIXME: describe it here.
+
+Automake assumes that the @samp{.c} file generated by yacc (or lex)
+should be named using the basename of the input file. That is, for a
+yacc source file @file{foo.y}, automake will cause the intermediate file
+to be named @file{foo.c} (as opposed to @file{y.tab.c}, which is more
+traditional).
+
+Yacc source files must end with the extension @samp{.y}. Lex source
+files must have the extension @samp{.l}. You should never explicitly
+mention the intermediate @samp{.c} file in any @samp{SOURCES} variable;
+only list the source file.
+
+The intermediate files generated by yacc (or lex) will be included in
+any distribution that is made. That way the user doesn't need to have
+yacc or lex.
+
+If a yacc source file is seen, then your @file{configure.in} must define
+the variable @samp{YACC}. This is most easily done by invoking the
+macro @samp{AC_PROG_YACC}.
+
+Similarly, if a lex source file is seen, then your @file{configure.in}
+must define the variable @samp{LEX}. You can use @samp{AC_PROG_LEX} to
+do this. Automake's lex support also requires that you use the
+@samp{AC_DECL_YYTEXT} macro -- automake needs to know the value of
+@samp{LEX_OUTPUT_ROOT}.
+
+Any program including a lex source file must be linked against
+@samp{@@LEXLIB@@}. You can do this by puttins @samp{@@LEXLIB@@} into
+the appropriate @samp{LDADD} variable.
+
+Automake makes it possible to include multiple yacc (or lex) source
+files in a single program.
@node C++