]> git.saurik.com Git - bison.git/blame - examples/calc++/Makefile.am
Bind examples/calc++ to the package.
[bison.git] / examples / calc++ / Makefile.am
CommitLineData
828c373b
AD
1## Process this file with automake to produce Makefile.in -*-Makefile-*-
2## Copyright (C) 2005 Free Software Foundation, Inc.
3
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12## GNU General Public License for more details.
13
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17## 02110-1301 USA
18
19## ------------------------------------- ##
20## Running the bison from this tarball. ##
21## ------------------------------------- ##
22
23BISON = $(top_builddir)/tests/bison
24BISON_IN = $(top_srcdir)/tests/bison.in
25
26$(BISON): $(BISON_IN)
27 cd $(top_builddir)/tests && $(MAKE) $(AM_MAKEFLAGS) bison
28
29## ------------ ##
30## Extracting. ##
31## ------------ ##
32
33doc = $(top_srcdir)/doc/bison.texinfo
34extexi = $(top_srcdir)/examples/extexi
35run_extexi = gawk -f $(extexi)
36$(calc_sources_extracted): $(doc) $(extexi)
37# Extract in src.
38 cd $(srcdir) && \
39 gawk -f ../extexi ../../doc/bison.texinfo -- \
40 calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc
41
42
43## ------------------- ##
44## Parser generation. ##
45## ------------------- ##
46
47# We do not use Automake features here.
48BUILT_SOURCES = $(calc_sources_generated)
49MAINTAINERCLEANFILES = $(calc_sources_generated)
50
51# Compile the parser and save cycles.
52# This code comes from "Handling Tools that Produce Many Outputs",
53# from the Automake documentation.
54EXTRA_DIST = $(srcdir)/calc++-parser.stamp $(srcdir)/calc++-parser.yy
55# Don't depend on $(BISON) otherwise we would rebuild these files
56# in srcdir, including during distcheck, which is forbidden.
57$(srcdir)/calc++-parser.stamp: $(srcdir)/calc++-parser.yy $(BISON_IN)
58 @rm -f calc++-parser.tmp
59 @touch calc++-parser.tmp
60 $(BISON) -S lalr1.cc $(srcdir)/calc++-parser.yy -o $(srcdir)/calc++-parser.cc -d -ra
61 @mv -f calc++-parser.tmp $@
62
63$(calc_sources_generated): $(srcdir)/calc++-parser.stamp
64 @if test -f $@; then :; else x\
65 rm -f $(srcdir)/calc++-parser.stamp; \
66 $(MAKE) $(AM_MAKEFLAGS) $(srcdir)/calc++-parser.stamp; \
67 fi
68
69
70## --------------------------- ##
71## Building & testing calc++. ##
72## --------------------------- ##
73
74noinst_PROGRAMS = calc++
75
76calc_sources_extracted = $(srcdir)/calc++-scanner.ll $(srcdir)/calc++.cc \
77$(srcdir)/calc++-driver.hh $(srcdir)/calc++-driver.cc
78calc_extracted = $(calc_sources_extracted) calc++-parser.yy
79calc_sources_generated = \
80 $(srcdir)/stack.hh $(srcdir)/position.hh $(srcdir)/location.hh \
81 $(srcdir)/calc++-parser.hh $(srcdir)/calc++-parser.cc
82
83calc___SOURCES = $(calc_sources_extracted) $(calc_sources_generated)
84
85TESTS = test
86EXTRA_DIST += $(TESTS)