From: Tom Tromey Date: Wed, 20 Nov 1996 02:09:10 +0000 (+0000) Subject: Fix for AIX /bin/make. Another bug fix X-Git-Tag: Release-1-1h~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4946de4b49ef2de80c782fd2d7ca8847cb692774;p=thirdparty%2Fautomake.git Fix for AIX /bin/make. Another bug fix --- diff --git a/ChangeLog b/ChangeLog index b82fb21f7..90a0cbd4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ +Tue Nov 19 19:03:30 1996 Tom Tromey + + * 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 + * 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. diff --git a/TODO b/TODO index fa7d8d24d..a251b8302 100644 --- a/TODO +++ b/TODO @@ -58,7 +58,9 @@ From Jason Molenda: * 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 diff --git a/automake.in b/automake.in index e5a680227..a14eddd54 100755 --- a/automake.in +++ b/automake.in @@ -430,8 +430,12 @@ sub generate_makefile 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'); @@ -507,6 +511,7 @@ sub generate_makefile 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; @@ -1039,6 +1044,8 @@ sub handle_lib_objects # 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 =~ /^\@.*\@$/; @@ -1046,6 +1053,7 @@ sub handle_lib_objects # means adding entries to dep_files. if ($lsearch eq '@LIBOBJS@') { + push (@dep_list, $lsearch); $seen_libobjs = 1; if (! keys %libsources) { @@ -1069,6 +1077,7 @@ sub handle_lib_objects } 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'}; @@ -2430,18 +2439,21 @@ sub handle_footer $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'); } @@ -3791,6 +3803,7 @@ sub initialize_per_input $output_rules = ''; $output_vars = ''; $output_trailer = ''; + $output_header = ''; # Suffixes found during a run. @suffixes = (); diff --git a/automake.texi b/automake.texi index 86c8e0665..e79128d62 100644 --- a/automake.texi +++ b/automake.texi @@ -663,7 +663,7 @@ This is required if any C++ source is included. @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 @@ -868,10 +868,9 @@ can share a single source file. The source file must be listed in each 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 @@ -1009,7 +1008,38 @@ This is the command used to actually link a C program. @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++