Index: ChangeLog =================================================================== RCS file: /cvs/automake/automake/ChangeLog,v retrieving revision 1.1628 diff -c -c -r1.1628 ChangeLog *** ChangeLog 2001/10/29 22:12:39 1.1628 --- ChangeLog 2001/10/30 01:34:48 *************** *** 1,3 **** --- 1,12 ---- + 2001-10-30 Dean Povey + + * automake.in: Handle comments and blank lines in continued rules + more elegantly. Also give better error processing for syntax errors + in general, and generate an error if there are non tabs at the + start of a continued rule (and it is not a @VAR@ substitution). + * tests/comment3.test, tests/else.test, tests/dejagnu2.test: updated + to handle new error handling correctly. + 2001-10-29 Akim Demaille * m4/lispdir.m4 (AM_PATH_LISPDIR): Use AC_RUN_LOG to avoid Index: automake.in =================================================================== RCS file: /cvs/automake/automake/automake.in,v retrieving revision 1.1221 diff -c -c -r1.1221 automake.in *** automake.in 2001/10/28 14:02:18 1.1221 --- automake.in 2001/10/30 01:34:50 *************** *** 6811,6826 **** } else { ! # This isn't an error; it is probably a continued rule. ! # In fact, this is what we assume. ! $was_rule = 1; ! $output_trailer .= $comment . $spacing; ! $output_trailer .= &make_condition (@cond_stack); ! $output_trailer .= $_; ! $comment = $spacing = ''; ! file_error ($here, "`#' comment at start of rule is unportable") ! if $_ =~ /^\t\s*\#/; ! } $saw_bk = $new_saw_bk; $_ = $am_file->getline; --- 6811,6860 ---- } else { ! # This line didn't match any patterns, so: ! # See if this is a continued Makefile rule ! if ($was_rule) { ! if (!/^\t/) { ! file_error($here, ! "Expected a continued rule but no leading tab found"); ! } ! else ! { ! # Note if we saw a comment (starting in column 0) or a ! # blank line in the line preceding, then it will be omitted ! # from the output, as this doesn't work in BSD make ! ! # In addition, we ignore lines containing comments ! # immediately after a tab in a rule. This is because the ! # Tru64 Unix V5.1 system make will pass these to the ! # shell, which in turn can't find `#' as a command. ! if (!/^\t\s*\#/) { ! $output_trailer .= &make_condition (@cond_stack); ! $output_trailer .= $_; ! } ! else ! { ! file_warning($here, ! "Comments in rules are non-portable. Use ##"); ! } ! } ! } ! elsif (/address@hidden@/) ! { ! # First token could be sustituted with something sensible lets ! # hope the user got it right ! $output_trailer .= $comment . $spacing; ! $output_trailer .= &make_condition (@cond_stack); ! $output_trailer .= $_; ! } ! else ! { ! #Can't think what else it should be ! chop $_ if (substr ($_, -1, 1) eq "\n"); ! file_error ($here, "Syntax error `$_' unexpected"); ! } ! $comment = $spacing = ''; ! } $saw_bk = $new_saw_bk; $_ = $am_file->getline; Index: tests/comment3.test =================================================================== RCS file: /cvs/automake/automake/tests/comment3.test,v retrieving revision 1.2 diff -c -c -r1.2 comment3.test *** comment3.test 2001/10/20 11:17:17 1.2 --- comment3.test 2001/10/30 01:34:50 *************** *** 1,6 **** #! /bin/sh ! # Make sure that `#' after a tab is a failure. # The Tru64 Unix V5.1 system make will pass these to the # shell, which in turn can't find `#' as a command. # Sigh. Some vendors must be destroyed. --- 1,7 ---- #! /bin/sh ! # Make sure that `#' after a tab succeeds, and the comment is stripped ! # from the resulting Makefile.in # The Tru64 Unix V5.1 system make will pass these to the # shell, which in turn can't find `#' as a command. # Sigh. Some vendors must be destroyed. *************** *** 10,17 **** cat > Makefile.am << 'END' install-data-local: # Tru64 Unix must die END $ACLOCAL || exit 1 ! $AUTOMAKE && exit 1 ! exit 0 --- 11,20 ---- cat > Makefile.am << 'END' install-data-local: # Tru64 Unix must die + @echo But putting a comment at the end # should be okay + # Tru64 Unix must die END $ACLOCAL || exit 1 ! $AUTOMAKE && test x"`grep '# Tru64 Unix must die' Makefile.in`" = x && exit 0 ! exit 1 Index: tests/dejagnu2.test =================================================================== RCS file: /cvs/automake/automake/tests/dejagnu2.test,v retrieving revision 1.2 diff -c -c -r1.2 dejagnu2.test *** dejagnu2.test 2001/10/20 11:17:17 1.2 --- dejagnu2.test 2001/10/30 01:34:50 *************** *** 8,14 **** AUTOMAKE_OPTIONS = dejagnu site.exp: ! echo foo END $ACLOCAL || exit 1 --- 8,14 ---- AUTOMAKE_OPTIONS = dejagnu site.exp: ! echo foo END $ACLOCAL || exit 1 Index: tests/else.test =================================================================== RCS file: /cvs/automake/automake/tests/else.test,v retrieving revision 1.2 diff -c -c -r1.2 else.test *** else.test 2001/10/20 11:17:17 1.2 --- else.test 2001/10/30 01:34:50 *************** *** 20,23 **** $ACLOCAL || exit 1 $AUTOMAKE > out 2>&1 && exit 1 ! grep :7: out --- 20,23 ---- $ACLOCAL || exit 1 $AUTOMAKE > out 2>&1 && exit 1 ! grep :5: out