maint: fix example extraction issues.

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

Basically, revert commit 609b3d8096,
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.
This commit is contained in:
Akim Demaille
2012-02-22 14:42:39 +01:00
parent f518dbaf46
commit 2191bb749b
7 changed files with 84 additions and 90 deletions

View File

@@ -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 $@ $@.tmp
$(AM_V_at)touch $@.tmp
$(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 $@.tmp $@
$(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