automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rb10: .y.h: rules


From: Tom Tromey
Subject: Re: rb10: .y.h: rules
Date: 22 Aug 2001 23:31:34 -0600

>>>>> "Richard" == Richard Boulton <address@hidden> writes:

Richard> Whilst trying to compile evolution with automake
Richard> branch-real-1.5, I found that the rule for generating .h
Richard> files from .y sources doesn't work.

Wow, thanks for finding this.

Setting YFLAGS won't work.  Automake doesn't look at that, since it is
a user variable.  If you change the test to use AM_YFLAGS it more
closely approximates what we expect.

Of course, if you do that you'll see it still doesn't work :-).

There is already some broken code in lang_yacc_target_hook that tries
to do the right thing here.  I combined it with your patch and came up
with the appended.  I'm putting this on the trunk and the 1.5 branch.

This passes your test.

Thanks again,
Tom

Index: ChangeLog
from  Richard Boulton <address@hidden>
        Tom Tromey  <address@hidden>

        * automake.in (lang_yacc_target_hook): Make header file depend on
        .c file, not .y file.
        * lib/am/yacc.am: Non-generic rule changed to depend on %OBJ% (the
        .c file) rather than %SOURCE% (the .y file)  Removed `.y.h' rule.
        * tests/yacc7.test: New file.
        * tests/Makefile.am (TESTS): Added yacc7.test.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1170
diff -u -r1.1170 automake.in
--- automake.in 2001/08/11 00:30:27 1.1170
+++ automake.in 2001/08/23 04:56:32
@@ -5054,7 +5054,7 @@
        # 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}: $input\n";
+       $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
Index: stamp-vti
===================================================================
RCS file: /cvs/automake/automake/stamp-vti,v
retrieving revision 1.135.2.2
diff -u -r1.135.2.2 stamp-vti
--- stamp-vti 2001/08/11 22:23:56 1.135.2.2
+++ stamp-vti 2001/08/23 04:56:32
@@ -1,4 +1,4 @@
address@hidden UPDATED 2 August 2001
address@hidden UPDATED 18 August 2001
 @set UPDATED-MONTH August 2001
 @set EDITION 1.4m
 @set VERSION 1.4m
Index: version.texi
===================================================================
RCS file: /cvs/automake/automake/version.texi,v
retrieving revision 1.208.2.2
diff -u -r1.208.2.2 version.texi
--- version.texi 2001/08/11 22:23:56 1.208.2.2
+++ version.texi 2001/08/23 04:56:32
@@ -1,4 +1,4 @@
address@hidden UPDATED 2 August 2001
address@hidden UPDATED 18 August 2001
 @set UPDATED-MONTH August 2001
 @set EDITION 1.4m
 @set VERSION 1.4m
Index: lib/am/yacc.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/yacc.am,v
retrieving revision 1.5
diff -u -r1.5 yacc.am
--- lib/am/yacc.am 2001/06/24 03:38:26 1.5
+++ lib/am/yacc.am 2001/08/23 04:56:32
@@ -32,10 +32,6 @@
 endif !%?MORE-THAN-ONE%
 
 ## Also generate a dependency for the .h file.
-## FIXME: does this sort of suffix rule really work?
-if %?GENERIC%
-.%EXT%.h:
-       @:
-else !%?GENERIC%
-%BASE%.h: %SOURCE%
+if !%?GENERIC%
+%BASE%.h: %OBJ%
 endif !%?GENERIC%
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.343
diff -u -r1.343 Makefile.am
--- tests/Makefile.am 2001/08/11 00:30:28 1.343
+++ tests/Makefile.am 2001/08/23 04:56:33
@@ -326,6 +326,7 @@
 yacc4.test \
 yacc5.test \
 yacc6.test \
+yacc7.test \
 yaccpp.test \
 yaccvpath.test
 
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.in,v
retrieving revision 1.444.2.2
diff -u -r1.444.2.2 Makefile.in
--- tests/Makefile.in 2001/08/11 22:23:56 1.444.2.2
+++ tests/Makefile.in 2001/08/23 04:56:33
@@ -394,6 +394,7 @@
 yacc4.test \
 yacc5.test \
 yacc6.test \
+yacc7.test \
 yaccpp.test \
 yaccvpath.test
 
Index: tests/yacc7.test
===================================================================
RCS file: yacc7.test
diff -N yacc7.test
--- /dev/null   Tue May  5 13:32:27 1998
+++ tests/yacc7.test Wed Aug 22 21:56:33 2001
@@ -0,0 +1,42 @@
+#! /bin/sh
+
+# Test to make sure dependencies are generated correctly for .h files.
+# Report from Richard Boulton.
+
+. $srcdir/defs || exit 1
+
+$needs_gnu_make
+$needs_autoconf
+
+cat > configure.in << 'END'
+AC_INIT
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT(Makefile)
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.y
+AM_YFLAGS = -d
+END
+
+cat > foo.y << 'END'
+%%
+WORD: "up";
+%%
+END
+
+$ACLOCAL || exit 1
+$AUTOMAKE -a || exit 1
+$AUTOCONF || exit 1
+./configure || exit 1
+
+$MAKE foo.h || exit 1
+
+test -e foo.h || exit 1
+
+exit 0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]