BTW I *did* make the patch apply cleanly to 1.6.1 - 1.5's notwithstanding.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NotDashEscaped: You need GnuPG to verify this message I'm not happy with the make rules stock automake emits. Whether it's considered a feature, bug, or limitation, I don't know, but having yacc-generated headers in a project is a little fragile. Stock automake spots the use of "AM_YFLAGS = -d" in Makefile.am, and emits a rule that y.tab.h (placeholder name) depends on y.tab.c; this is not formally correct. When y.tab.h is missing but y.tab.c is present (or y.tab.c is touched for some reason), make thinks it can rebuild y.tab.h from y.tab.c - a false assumption since there is no rule. I have a patch the Works For Me (tm) by unconditionally using the MORE_THAN_ONE rule - i.e. the build *always* uses ylwrap to generate files. This allows me to rebuild the header when the C parser is already up-to-date. Unfortunately, that does mean that y.tab.c and y.tab.h are generated separately, and always incur shell script overhead, but I don't know if that really matters (most projects I've seen use at most a handful of yacc parsers). Is this useful? Anyway, I'm sure someone else can do it a little better, a little cleaner. Bernd Jendrissek P.S. My employer doesn't really "get" Free Software *or* Open Source; I hope this patch is simple enough not to need any paperwork. P.S.2 I had to patch *all* the yacc tests to use $AUTOMAKE -a so that ylwrap would be copied in. diff -Nur automake-1.5/automake.in automake-1.5-bernd/automake.in --- automake-1.5/automake.in 2001-08-23 07:26:53 +++ automake-1.5-bernd/automake.in 2002-01-10 11:04:28 @@ -5470,7 +5470,6 @@ # Add a dependency for the generated header file, and arrange # for that file to be included in the distribution. # FIXME: this fails for `nodist_*_SOURCES'. - $output_rules .= "${header}: $output\n"; &push_dist_common ($header); # If the files are built in the build directory, then we want # to remove them with `make clean'. If they are in srcdir @@ -5512,10 +5511,7 @@ "`YACCFLAGS' obsolete; use `YFLAGS' instead") if variable_defined ('YACCFLAGS'); - if (count_files_for_language ('yacc') > 1) - { - &yacc_lex_finish_helper; + &yacc_lex_finish_helper; - } } # A similar hunk to force use of ylwrap instead f?lex. #@@ -5115,10 +5111,7 @@ # &am_error ("lex source seen but `AC_DECL_YYTEXT' not in `$configure_ac'"); # } # #- if (count_files_for_language ('lex') > 1) #- { #- &yacc_lex_finish_helper; #- } #+ &yacc_lex_finish_helper; # } # # diff -Nur automake-1.5/lib/am/yacc.am automake-1.5-bernd/lib/am/yacc.am --- automake-1.5/lib/am/yacc.am 2001-08-23 07:29:16 +++ automake-1.5-bernd/lib/am/yacc.am 2002-01-10 11:59:28 @@ -18,34 +18,10 @@ ?GENERIC?%EXT%%DERIVED-EXT%: ?!GENERIC?%OBJ%: %SOURCE% -if %?MORE-THAN-ONE% - $(SHELL) $(YLWRAP) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h y.output %BASE%.output -- %COMPILE% + $(SHELL) $(YLWRAP) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% y.tab.c +%OBJ% -- %COMPILE% -else !%?MORE-THAN-ONE% - %COMPILE% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% -## Edit out `#line' or `#' directives. - sed '/^#/ s|y\.tab\.c|%OBJ%|' y.tab.c >%OBJ% - rm -f y.tab.c -## Edit out Bison multiple inclusion guards. It may be BISON_Y_TAB_H, -## or Y_TAB_H depending upon the version, that's why the regexp is -## so loose. - if test -f y.tab.h; then \ - to=`echo "%BASE%_H" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ - sed "/^#/ s/Y_TAB_H/$$to/g" y.tab.h >%BASE%.ht; \ - rm -f y.tab.h; \ - if cmp -s %BASE%.ht %BASE%.h; then \ - rm -f %BASE%.ht ;\ - else \ - mv %BASE%.ht %BASE%.h; \ - fi; \ - fi - if test -f y.output; then \ - mv y.output %BASE%.output; \ - fi -endif !%?MORE-THAN-ONE% +## Try to fix the yaccity automake problem +?GENERIC?%EXT%.h: +?!GENERIC?%BASE%.h: %SOURCE% + $(SHELL) $(YLWRAP) %SOURCE% y.tab.h %BASE%.h -- %COMPILE% + -## Also generate a dependency for the .h file. -if !%?GENERIC% -%BASE%.h: %OBJ% -endif !%?GENERIC% # The test cases need to run automake with -a so ylwrap is copied. diff -Nur automake-1.5/tests/yacc.test automake-1.5-bernd/tests/yacc.test --- automake-1.5/tests/yacc.test +++ automake-1.5-bernd/tests/yacc.test @@ -16,6 +16,6 @@ END $ACLOCAL || exit 1 -$AUTOMAKE || exit 1 +$AUTOMAKE -a || exit 1 grep 'zardoz.c' Makefile.in diff -Nur automake-1.5/tests/yacc2.test automake-1.5-bernd/tests/yacc2.test --- automake-1.5/tests/yacc2.test +++ automake-1.5-bernd/tests/yacc2.test @@ -22,7 +22,7 @@ $ACLOCAL || exit 1 -$AUTOMAKE || exit 1 +$AUTOMAKE -a || exit 1 # If zardoz.h IS mentioned, fail grep 'zardoz.h' Makefile.in > /dev/null && exit 1 @@ -32,7 +32,7 @@ cp Makefile.src Makefile.am echo 'AM_YFLAGS = -d' >> Makefile.am -$AUTOMAKE || exit 1 +$AUTOMAKE -a || exit 1 # If zardoz.h is NOT mentioned, fail grep 'zardoz.h' Makefile.in > /dev/null || exit 1 @@ -42,7 +42,7 @@ cp Makefile.src Makefile.am echo 'AM_YFLAGS = ' >> Makefile.am -$AUTOMAKE || exit 1 +$AUTOMAKE -a || exit 1 # If zardoz.h IS mentioned, fail grep 'zardoz.h' Makefile.in > /dev/null && exit 1 @@ -52,7 +52,7 @@ cp Makefile.src Makefile.am echo 'YFLAGS = -d' >> Makefile.am -$AUTOMAKE || exit 1 +$AUTOMAKE -a || exit 1 # If zardoz.h is NOT mentioned, fail grep 'zardoz.h' Makefile.in > /dev/null || exit 1 @@ -62,7 +62,7 @@ cp Makefile.src Makefile.am echo 'YFLAGS = ' >> Makefile.am -$AUTOMAKE || exit 1 +$AUTOMAKE -a || exit 1 # If zardoz.h IS mentioned, fail grep 'zardoz.h' Makefile.in > /dev/null && exit 1 diff -Nur automake-1.5/tests/yacc3.test automake-1.5-bernd/tests/yacc3.test --- automake-1.5/tests/yacc3.test +++ automake-1.5-bernd/tests/yacc3.test @@ -19,7 +19,7 @@ END $ACLOCAL || exit 1 -$AUTOMAKE || exit 1 +$AUTOMAKE -a || exit 1 fgrep -v @SET_MAKE@ Makefile.in > Makefile.sed # It should not be disted here @@ -32,6 +32,6 @@ cp Save Makefile.am echo "$flag = -d" >> Makefile.am - $AUTOMAKE || exit 1 + $AUTOMAKE -a || exit 1 grep 'zardoz.h' Makefile.in || exit 1 done diff -Nur automake-1.5/tests/yacc7.test automake-1.5-bernd/tests/yacc7.test --- automake-1.5/tests/yacc7.test +++ automake-1.5-bernd/tests/yacc7.test @@ -1,6 +1,7 @@ #! /bin/sh # Test to make sure dependencies are generated correctly for .h files. +# Changed by Bernd Jendrissek to check independent regeneration of files. # Report from Richard Boulton. . $srcdir/defs || exit 1 @@ -32,8 +33,29 @@ $AUTOCONF || exit 1 ./configure || exit 1 -$MAKE foo.h || exit 1 - -test -f foo.h || exit 1 +# Test sequences: +# .h .c .h .c +# no no no no +# no yes yes no +# yes yes yes yes +# TODO: could also check that "other" file isn't unexpectedly regenerated. +$MAKE foo.h || exit 1 +# *only* foo.h must exist +test -e foo.h || exit 1 +test -e foo.c && exit 1 +$MAKE foo.c || exit 1 +# *both* foo.h and foo.c must exist +test -e foo.h || exit 1 +test -e foo.c || exit 1 +rm -f foo.c foo.h + +$MAKE foo.c || exit 1 +# *only* foo.c must exist +test -e foo.c || exit 1 +test -e foo.h && exit 1 +$MAKE foo.h || exit 1 +# *both* foo.h and foo.c must exist +test -e foo.h || exit 1 +test -e foo.c || exit 1 exit 0 diff -Nur automake-1.5/tests/yaccpp.test automake-1.5-bernd/tests/yaccpp.test --- automake-1.5/tests/yaccpp.test +++ automake-1.5-bernd/tests/yaccpp.test @@ -15,6 +15,6 @@ END $ACLOCAL || exit 1 -$AUTOMAKE || exit 1 +$AUTOMAKE -a || exit 1 grep zardoz.cc Makefile.in -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8utzS/FmLrNfLpjMRAlzLAJ4/qdTPsq4YBqrPIlWruVxs6bWZ4wCdG/5P ZpOfg8/WHarU2NbTAlt+/m4= =Xnxv -----END PGP SIGNATURE-----