bug-bison
[Top][All Lists]
Advanced

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

Re: master: Dependencies broken


From: Akim Demaille
Subject: Re: master: Dependencies broken
Date: Fri, 24 Feb 2012 11:15:24 +0100

Le 23 févr. 2012 à 16:21, Akim Demaille a écrit :

> Le 23 févr. 2012 à 16:18, Tim Landscheidt a écrit :
> 
> Hi Tim,
> 
> yes, I know this, but before touching master again, I
> would like to know what the Hydra build farm thinks
> about my changes.  You can try them in the "next" branch.

Well, I don't know when I will be able to check with the
build farm, and I will probably by offline the whole next
week, so since it's broken already, I pushed the following
patch.  I hope it will address all your issues.

From 2191bb749b8f63b6037ca7e590ae499d0bb26db9 Mon Sep 17 00:00:00 2001
From: Akim Demaille <address@hidden>
Date: Wed, 22 Feb 2012 14:42:39 +0100
Subject: [PATCH] maint: fix example extraction issues.

calc++: don't rely on Automake to compile a C++ parser.

Basically, revert commit 609b3d8096fb0cc1fa4d908b6e1a860ced260bda,
Automake 1.11.3 is not safe enough for C++ parser.

        * examples/calc++/calc++-parser.hh: Remove.
        * examples/calc++/local.mk (examples/calc++/calc++-parser.stamp):
        New.

examples: factor the extractions into a single step

extexi had to be run in the extraction directory.  Now, it can be
given the files with expected output directory.  This allows to
use $(*_extracted) variables (before we had to list again their
members, but limited to their base names).  In turn, this also
allows fusing the extraction recipes into a single one.

Also, it is currently too hard (or requires too much duplication,
since Make wants all the occurrences of the files to be prefixed with
$(srcdir)/, which is something Automake cannot support for *_SOURCES)
to work in the source tree.  So extract, and compile scanners and parsers
in the build tree.

        * examples/extexi (basename): New.
        (BEGIN): Now "file_wanted" maps base name to extracted file name.
        * examples/calc++/local.mk, examples/mfcalc/local.mk,
        * examples/rpcalc/local.mk: Fuse extraction rules into...
        * examples/local.mk: Here.
        (extract, extracted): New.
---
 examples/calc++/.gitignore       |    5 +-
 examples/calc++/calc++-parser.hh |    4 --
 examples/calc++/local.mk         |   80 +++++++++++++++++++++++---------------
 examples/extexi                  |   16 ++++---
 examples/local.mk                |   21 +++++++++-
 examples/mfcalc/local.mk         |   23 +----------
 examples/rpcalc/local.mk         |   23 +----------
 7 files changed, 83 insertions(+), 89 deletions(-)
 delete mode 100644 examples/calc++/calc++-parser.hh

diff --git a/examples/calc++/.gitignore b/examples/calc++/.gitignore
index 2306d17..50eb5ba 100644
--- a/examples/calc++/.gitignore
+++ b/examples/calc++/.gitignore
@@ -4,10 +4,11 @@
 /calc++
 /calc++-driver.cc
 /calc++-driver.hh
+/calc++-parser.cc
+/calc++-parser.hh
 /calc++-parser.output
+/calc++-parser.stamp
 /calc++-parser.yy
-/calc++-parser.cc
-/calc++-parser.h
 /calc++-scanner.cc
 /calc++-scanner.ll
 /calc++.cc
diff --git a/examples/calc++/calc++-parser.hh b/examples/calc++/calc++-parser.hh
deleted file mode 100644
index 6f1e885..0000000
--- a/examples/calc++/calc++-parser.hh
+++ /dev/null
@@ -1,4 +0,0 @@
-// Work around an Automake 1.11.2 bug: it asks for the creation of
-// y.tab.h and then renames it as calc++-parser.h instead of
-// calc++-parser.hh.  We don't want this to show in the documentation.
-#include "calc++-parser.h"
diff --git a/examples/calc++/local.mk b/examples/calc++/local.mk
index 5d9dce0..8a03973 100644
--- a/examples/calc++/local.mk
+++ b/examples/calc++/local.mk
@@ -15,55 +15,71 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-## ------------ ##
-## Extracting.  ##
-## ------------ ##
+## ------------------- ##
+## Parser generation.  ##
+## ------------------- ##
 
-# Extract in src.
-$(top_srcdir)/examples/calc++/calc.stamp: $(doc) $(extexi)
-       $(AM_V_GEN)rm -f $@ address@hidden
+CLEANFILES += $(top_srcdir)/examples/calc++/*.output *.tmp
+MAINTAINERCLEANFILES += examples/calc++/*.stamp $(calc_sources)
+
+# Compile the parser and save cycles.
+# This code comes from "Handling Tools that Produce Many Outputs",
+# from the Automake documentation.
+EXTRA_DIST +=                                  \
+  examples/calc++/calc++-parser.stamp          \
+  examples/calc++/calc++-parser.yy             \
+  examples/calc++/calc++.stamp
+# Don't depend on $(BISON) otherwise we would rebuild these files
+# in srcdir, including during distcheck, which is forbidden.
+examples/calc++/calc++-parser.stamp: examples/calc++/calc++-parser.yy 
$(BISON_IN)
+       $(AM_V_YACC)rm -f $@
        $(AM_V_at)touch address@hidden
-       $(AM_V_at)cd $(top_srcdir)/examples/calc++ && \
-          $(AWK) -f ../extexi -v VERSION="$(VERSION)" \
-            ../../doc/bison.texinfo -- calc++-parser.yy \
-            calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc
-       $(AM_V_at)mv address@hidden $@
+       $(AM_V_at)$(YACCCOMPILE) -o examples/calc++/calc++-parser.cc    \
+         examples/calc++/calc++-parser.yy
+       $(AM_V_at)mv -f address@hidden $@
+
+$(calc_sources_generated): examples/calc++/calc++-parser.stamp
+       @test -f $@ || rm -f examples/calc++/calc++-parser.stamp
+       @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) 
examples/calc++/calc++-parser.stamp
 
-$(calc_extracted): $(top_srcdir)/examples/calc++/calc.stamp
-       $(AM_V_GEN)if test -f $@; then :; else \
-         rm -f $< && \
-         $(MAKE) $(AM_MAKEFLAGS) $<; \
-       fi
 
 ## -------------------- ##
 ## Building & testing.  ##
 ## -------------------- ##
 
-BUILT_SOURCES += $(calc_sources) examples/calc++/calc++-parser.h
+# Avoid using BUILT_SOURCES which is too global.
+$(examples_calc___calc___OBJECTS): $(calc_sources_generated)
 CLEANFILES += *.tmp
-MAINTAINERCLEANFILES += $(top_srcdir)/examples/calc++/calc.stamp 
$(calc_sources)
-EXTRA_DIST += examples/calc++/calc.stamp
+MAINTAINERCLEANFILES += $(calc_sources)
 
-calc_extracted =                               \
-  examples/calc++/calc++-scanner.ll            \
-  examples/calc++/calc++.cc                    \
-  examples/calc++/calc++-driver.hh             \
+calc_sources_extracted =                       \
   examples/calc++/calc++-driver.cc             \
+  examples/calc++/calc++-driver.hh             \
+  examples/calc++/calc++-scanner.ll            \
+  examples/calc++/calc++.cc
+calc_extracted =                               \
+  $(calc_sources_extracted)                    \
   examples/calc++/calc++-parser.yy
-calc_generated =                               \
-  examples/calc++/stack.hh                     \
+extracted += $(calc_extracted)
+calc_sources_generated =                       \
+  examples/calc++/calc++-parser.cc             \
+  examples/calc++/calc++-parser.hh             \
+  examples/calc++/location.hh                  \
   examples/calc++/position.hh                  \
-  examples/calc++/location.hh
+  examples/calc++/stack.hh
 calc_sources =                                 \
-  $(calc_extracted) $(calc_generated)
+  $(calc_sources_extracted)                    \
+  $(calc_sources_generated)
 if BISON_CXX_WORKS
 check_PROGRAMS += examples/calc++/calc++
 examples_calc___calc___SOURCES =               \
-  $(calc_sources)                              \
-  examples/calc++/y.tab.h                      \
-  examples/calc++/calc++-parser.hh
+  $(calc_sources)
 
-examples_calc___calc___CPPFLAGS = -I$(top_srcdir)/examples/calc++
+examples_calc___calc___CPPFLAGS =              \
+  -I$(top_builddir)/examples/calc++            \
+  -I$(top_srcdir)/examples/calc++
 TESTS += examples/calc++/calc++.test
 endif
-EXTRA_DIST += examples/calc++/calc++.test
+EXTRA_DIST +=                                  \
+  examples/calc++/calc++-parser.yy             \
+  examples/calc++/calc++.test
diff --git a/examples/extexi b/examples/extexi
index efce4e5..7ede7c4 100644
--- a/examples/extexi
+++ b/examples/extexi
@@ -29,7 +29,7 @@ BEGIN {
     if (ARGV[argc] == "--")
       break;
   for (i = argc + 1; i < ARGC; ++i)
-    file_wanted[ARGV[i]] = 1;
+    file_wanted[basename(ARGV[i])] = ARGV[i];
   ARGC = argc;
 }
 
@@ -43,13 +43,10 @@ BEGIN {
 }
 
 /address@hidden file: / {
-  if (!file_wanted[$3])
-    message("ignoring " $3);
+  if (file = file_wanted[$3])
+    message(" GEN " file);
   else
-    {
-      message("extracting " $3);
-      file = $3;
-    }
+    message("SKIP " $3);
 }
 
 /^@(small)?example$/, /address@hidden (small)?example$/ {
@@ -125,6 +122,11 @@ function normalize(contents,    i, lines, n, line, res) {
 }
 
 
+function basename(name,     a, n) {
+  n = split (name, a, "/");
+  return a[n];
+}
+
 function message(msg) {
   if (! message_printed[msg])
     {
diff --git a/examples/local.mk b/examples/local.mk
index 0d63202..24ad83c 100644
--- a/examples/local.mk
+++ b/examples/local.mk
@@ -13,11 +13,28 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-doc = $(top_srcdir)/doc/bison.texinfo
-extexi = $(top_srcdir)/examples/extexi
 dist_noinst_SCRIPTS = examples/extexi examples/test
 TEST_LOG_COMPILER = $(top_srcdir)/examples/test
 
+## ------------ ##
+## Extracting.  ##
+## ------------ ##
+
+doc = $(top_srcdir)/doc/bison.texinfo
+extexi = $(top_srcdir)/examples/extexi
+extract = $(AWK) -f $(extexi) -v VERSION="$(VERSION)" $(doc) --
+extracted =
+MAINTAINERCLEANFILES += $(extracted)
+examples/extracted.stamp: $(doc) $(extexi)
+       $(AM_V_GEN)rm -f $@ address@hidden
+       $(AM_V_at)touch address@hidden
+       $(AM_V_at)$(extract) $(extracted)
+       $(AM_V_at)mv address@hidden $@
+
+$(extracted): examples/extracted.stamp
+       @test -f $@ || rm -f examples/extracted.stamp
+       @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/extracted.stamp
+
 include examples/calc++/local.mk
 include examples/mfcalc/local.mk
 include examples/rpcalc/local.mk
diff --git a/examples/mfcalc/local.mk b/examples/mfcalc/local.mk
index c6d9470..8083dea 100644
--- a/examples/mfcalc/local.mk
+++ b/examples/mfcalc/local.mk
@@ -15,38 +15,19 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-## ------------ ##
-## Extracting.  ##
-## ------------ ##
-
-# Extract in src.
-$(top_srcdir)/examples/mfcalc/mfcalc.stamp: $(doc) $(extexi)
-       $(AM_V_GEN)rm -f $@ address@hidden
-       $(AM_V_at)touch address@hidden
-       $(AM_V_at)cd $(top_srcdir)/examples/mfcalc && \
-          $(AWK) -f ../extexi -v VERSION="$(VERSION)" \
-            ../../doc/bison.texinfo -- calc.h mfcalc.y
-       $(AM_V_at)mv address@hidden $@
-
-$(mfcalc_extracted): $(top_srcdir)/examples/mfcalc/mfcalc.stamp
-       $(AM_V_GEN)if test -f $@; then :; else \
-         rm -f $< && \
-         $(MAKE) $(AM_MAKEFLAGS) $<; \
-       fi
-
 ## -------------------- ##
 ## Building & testing.  ##
 ## -------------------- ##
 
 BUILT_SOURCES += $(mfcalc_sources)
-MAINTAINERCLEANFILES += $(top_srcdir)/examples/mfcalc/mfcalc.stamp 
$(mfcalc_sources)
-EXTRA_DIST += examples/mfcalc/mfcalc.stamp
+MAINTAINERCLEANFILES += $(mfcalc_sources)
 
 mfcalc_extracted =                             \
   examples/mfcalc/calc.h                       \
   examples/mfcalc/mfcalc.y
 mfcalc_sources =                               \
   $(mfcalc_extracted)
+extracted += $(mfcalc_extracted)
 
 check_PROGRAMS += examples/mfcalc/mfcalc
 examples_mfcalc_mfcalc_LDADD = -lm
diff --git a/examples/rpcalc/local.mk b/examples/rpcalc/local.mk
index c6cd7a3..844ffdf 100644
--- a/examples/rpcalc/local.mk
+++ b/examples/rpcalc/local.mk
@@ -15,37 +15,18 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-## ------------ ##
-## Extracting.  ##
-## ------------ ##
-
-# Extract in src.
-$(top_srcdir)/examples/rpcalc/rpcalc.stamp: $(doc) $(extexi)
-       $(AM_V_GEN)rm -f $@ address@hidden
-       $(AM_V_at)touch address@hidden
-       $(AM_V_at)cd $(top_srcdir)/examples/rpcalc && \
-          $(AWK) -f ../extexi -v VERSION="$(VERSION)" \
-            ../../doc/bison.texinfo -- calc.h rpcalc.y
-       $(AM_V_at)mv address@hidden $@
-
-$(rpcalc_extracted): $(top_srcdir)/examples/rpcalc/rpcalc.stamp
-       $(AM_V_GEN)if test -f $@; then :; else \
-         rm -f $< && \
-         $(MAKE) $(AM_MAKEFLAGS) $<; \
-       fi
-
 ## -------------------- ##
 ## Building & testing.  ##
 ## -------------------- ##
 
 BUILT_SOURCES += $(rpcalc_sources)
-MAINTAINERCLEANFILES += $(top_srcdir)/examples/rpcalc/rpcalc.stamp 
$(rpcalc_sources)
-EXTRA_DIST += examples/rpcalc/rpcalc.stamp
+MAINTAINERCLEANFILES += $(rpcalc_sources)
 
 rpcalc_extracted =                             \
   examples/rpcalc/rpcalc.y
 rpcalc_sources =                               \
   $(rpcalc_extracted)
+extracted += $(rpcalc_extracted)
 
 check_PROGRAMS += examples/rpcalc/rpcalc
 examples_rpcalc_rpcalc_LDADD = -lm
-- 
1.7.9





reply via email to

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