bug-automake
[Top][All Lists]
Advanced

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

Re: [Bug-gnulib] Re: CVS Bug? or User error?


From: Derek Robert Price
Subject: Re: [Bug-gnulib] Re: CVS Bug? or User error?
Date: Sat, 17 Jul 2004 15:20:34 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616

Alexandre Duret-Lutz wrote:

>| Index: lib/am/yacc.am
>| ===================================================================
>| RCS file: /cvs/automake/automake/lib/am/yacc.am,v
>| retrieving revision 1.16
>| diff -u -p -r1.16 yacc.am
>| --- lib/am/yacc.am   18 Apr 2003 08:54:34 -0000      1.16
>| +++ lib/am/yacc.am   1 Jun 2004 13:46:41 -0000
>| @@ -17,6 +17,7 @@
>|  ## 02111-1307, USA.
>|  
>|  ?GENERIC?%EXT%%DERIVED-EXT%:
>| +if MAINTAINER_MODE
>|  ?!GENERIC?%OBJ%: %SOURCE%
>|  if %?MORE-THAN-ONE%
>|  ?GENERIC?   $(SHELL) $(YLWRAP) %SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h 
>y.output %BASE%.output -- %COMPILE%
>| @@ -48,3 +49,7 @@ else !%?MORE-THAN-ONE%
>|      sed '/^#/ s|y\.tab\.c|%OBJ%|' y.tab.c >%OBJ%t && mv %OBJ%t %OBJ%
>|      rm -f y.tab.c
>|  endif !%?MORE-THAN-ONE%
>| +else !MAINTAINER_MODE
>| +    ## Skip this target unless in maintainer mode.
>| +    @:
>| +endif !MAINTAINER_MODE
>
>Hi Derek!
>
>I'm not opposed to such change, but as I have little time these
>days I'm opposed to incomplete patches :)
>
>Since you change the way MAINTAINER_MODE and yacc rules
>interact, you should update both documentation and NEWS it.  I'd
>also like a proof that it works.  Preferably a test case that
>would fail without your change.  The above patch is wrong
>because one of the two possible first line of the rule is inside
>the conditional (%OBJ%: %SOURCE%), and the other is outside
>(%EXT%%DERIVED-EXT%:).  Also in the !MAINTAINER_MODE case it
>would be nice to justify why need you keep a no-op rule instead
>of removing the rule entirely.  Finally, if yacc.am is changed,
>then lex.am should probably be changed for consistency.
>
>Hope I haven't frightened you :)
>  
>

Hi Alexandre!

My wife is out of town this weekend, so I finally got around to
rewriting this patch as you requested!  :)  New version attached.

2004-07-17  Derek R. Price  <address@hidden>
                                                                               

        * lib/am/yacc.am, lib/am/lex.am: Only compile these targets in
        maintainer mode.
        * doc/automake.texi (Yacc and Lex): Note dependence on
maintainer mode.
        * NEWS: Note same dependency.
        * tests/mmode-lexyacc.test: New file.

Derek

-- 
                *8^)

Email: address@hidden

Get CVS support at <http://ximbiot.com>!

Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.280
diff -u -p -r1.280 NEWS
--- NEWS        17 Jul 2004 14:56:15 -0000      1.280
+++ NEWS        17 Jul 2004 19:15:38 -0000
@@ -93,6 +93,9 @@ New in 1.8e:
 
   - The manual tells more about SUBDIRS vs. DIST_SUBDIRS.
     It also gives an example of nested packages using AC_CONFIG_SUBDIRS.
+
+  - Yacc and Lex intermediate files are now only built when in maintainer mode
+    once AM_MAINTAINER_MODE has been invoked.
 
 Bugs fixed in 1.8.5:
 
Index: doc/automake.texi
===================================================================
RCS file: /cvs/automake/automake/doc/automake.texi,v
retrieving revision 1.41
diff -u -p -r1.41 automake.texi
--- doc/automake.texi   17 Jul 2004 09:10:42 -0000      1.41
+++ doc/automake.texi   17 Jul 2004 19:15:48 -0000
@@ -3765,6 +3765,10 @@ When @code{lex} is invoked, it is passed
 @samp{AM_LFLAGS}.  The former is a user variable and the latter is
 intended for the @file{Makefile.am} author.
 
+Automake only rebuilds intermediate files for Yacc and Lex sources in
+maintainer mode once AM_MAINTAINER_MODE has been invoked
+(@pxref{maintainer-mode}).
+
 
 
 @cindex ylwrap
Index: lib/am/lex.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/lex.am,v
retrieving revision 1.9
diff -u -p -r1.9 lex.am
--- lib/am/lex.am       6 Mar 2003 21:11:48 -0000       1.9
+++ lib/am/lex.am       17 Jul 2004 19:15:50 -0000
@@ -18,6 +18,7 @@
 
 ?GENERIC?%EXT%%DERIVED-EXT%:
 ?!GENERIC?%OBJ%: %SOURCE%
+if MAINTAINER_MODE
 if %?MORE-THAN-ONE%
 ?GENERIC?      $(SHELL) $(YLWRAP) %SOURCE% $(LEX_OUTPUT_ROOT).c %OBJ% -- 
%COMPILE%
 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
@@ -30,3 +31,10 @@ else !%?MORE-THAN-ONE%
        sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|%OBJ%|' $(LEX_OUTPUT_ROOT).c >%OBJ%
        rm -f $(LEX_OUTPUT_ROOT).c
 endif !%?MORE-THAN-ONE%
+else !MAINTAINER_MODE
+       @# Skip this target when not in maintainer mode (see the help on the
+       @# `--enable-maintainer-mode' option to the `configure' script).
+       @# Otherwise, the implicit build rules for .l.c built into make could
+       @# be executed for this target.
+       @:
+endif !MAINTAINER_MODE
Index: lib/am/yacc.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/yacc.am,v
retrieving revision 1.16
diff -u -p -r1.16 yacc.am
--- lib/am/yacc.am      18 Apr 2003 08:54:34 -0000      1.16
+++ lib/am/yacc.am      17 Jul 2004 19:15:50 -0000
@@ -18,6 +18,7 @@
 
 ?GENERIC?%EXT%%DERIVED-EXT%:
 ?!GENERIC?%OBJ%: %SOURCE%
+if MAINTAINER_MODE
 if %?MORE-THAN-ONE%
 ?GENERIC?      $(SHELL) $(YLWRAP) %SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h 
y.output %BASE%.output -- %COMPILE%
 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
@@ -48,3 +49,10 @@ else !%?MORE-THAN-ONE%
        sed '/^#/ s|y\.tab\.c|%OBJ%|' y.tab.c >%OBJ%t && mv %OBJ%t %OBJ%
        rm -f y.tab.c
 endif !%?MORE-THAN-ONE%
+else !MAINTAINER_MODE
+       @# Skip this target when not in maintainer mode (see the help on the
+       @# `--enable-maintainer-mode' option to the `configure' script).
+       @# Otherwise, the implicit build rules for .y.c built into make could
+       @# be executed for this target.
+       @:
+endif !MAINTAINER_MODE
Index: tests/mmode-lexyacc.test
===================================================================
RCS file: tests/mmode-lexyacc.test
diff -N tests/mmode-lexyacc.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/mmode-lexyacc.test    17 Jul 2004 19:15:52 -0000
@@ -0,0 +1,67 @@
+#! /bin/sh
+# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Contributed by Derek R. Price <address@hidden>
+
+# Test to verify that intermediate files are only built from Yacc and Lex
+# sources in maintainer mode.
+
+. ./defs || exit 1
+
+cat >> configure.in << 'END'
+AM_MAINTAINER_MODE
+AC_PROG_CC
+AM_PROG_LEX
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = zardoz.y joe.l
+LDADD = @LEXLIB@
+END
+
+# The point of this test is that it is not dependant on a working lex or yacc.
+cat > joe.c <<EOF
+int joe (int arg)
+{
+    return arg * 2;
+}
+EOF
+cat > zardoz.c <<EOF
+int joe (int arg);
+int main (int argc, char **argv)
+{
+    exit (joe (argc));
+}
+EOF
+
+# Ensure a later timestamp for our Lex & Yacc sources.
+sleep 1
+: > joe.l
+: > zardoz.y
+
+$ACLOCAL || exit 1
+$AUTOCONF || exit 1
+$AUTOMAKE || exit 1
+
+./configure
+$MAKE YACC=false LEX=false

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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