]> git.saurik.com Git - bison.git/blame - examples/calc++/Makefile.am
variant: fix the example.
[bison.git] / examples / calc++ / Makefile.am
CommitLineData
828c373b 1## Process this file with automake to produce Makefile.in -*-Makefile-*-
7d424de1 2
34136e65 3## Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
828c373b 4
f16b0819
PE
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
828c373b
AD
17
18## ------------------------------------- ##
19## Running the bison from this tarball. ##
20## ------------------------------------- ##
21
22BISON = $(top_builddir)/tests/bison
23BISON_IN = $(top_srcdir)/tests/bison.in
24
25$(BISON): $(BISON_IN)
f67c0a1c 26 $(AM_V_GEN)cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) tests/bison
828c373b
AD
27
28## ------------ ##
29## Extracting. ##
30## ------------ ##
31
32doc = $(top_srcdir)/doc/bison.texinfo
33extexi = $(top_srcdir)/examples/extexi
828c373b 34# Extract in src.
b30e18dc 35$(srcdir)/calc.stamp: $(doc) $(extexi)
f67c0a1c
AD
36 $(AM_V_GEN)rm -f $@ $@.tmp
37 $(AM_V_at)touch $@.tmp
38 $(AM_V_at)cd $(srcdir) && \
e6e704dc 39 $(AWK) -f ../extexi -v VERSION="$(VERSION)" \
0e021770 40 ../../doc/bison.texinfo -- calc++-parser.yy \
828c373b 41 calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc
f67c0a1c 42 $(AM_V_at)mv $@.tmp $@
828c373b 43
b30e18dc 44$(calc_extracted): $(srcdir)/calc.stamp
828c373b
AD
45
46## ------------------- ##
47## Parser generation. ##
48## ------------------- ##
49
ce3448d5 50DEFAULT_INCLUDES = -I. -I$(srcdir)
b34d96c1
PE
51BUILT_SOURCES = $(calc_extracted) $(calc_sources_generated)
52CLEANFILES = $(srcdir)/*.output *.tmp
53MAINTAINERCLEANFILES = $(srcdir)/*.stamp $(BUILT_SOURCES)
828c373b
AD
54
55# Compile the parser and save cycles.
56# This code comes from "Handling Tools that Produce Many Outputs",
57# from the Automake documentation.
e9690142
JD
58EXTRA_DIST = \
59 $(srcdir)/calc++-parser.stamp \
60 $(srcdir)/calc++-parser.yy \
67af7198 61 $(srcdir)/calc.stamp
828c373b
AD
62# Don't depend on $(BISON) otherwise we would rebuild these files
63# in srcdir, including during distcheck, which is forbidden.
64$(srcdir)/calc++-parser.stamp: $(srcdir)/calc++-parser.yy $(BISON_IN)
f67c0a1c
AD
65 $(AM_V_GEN)rm -f calc++-parser.tmp
66 $(AM_V_at)touch calc++-parser.tmp
67 $(AM_V_at)$(BISON) -d -ra -o $(srcdir)/calc++-parser.cc \
b34d96c1 68 $(srcdir)/calc++-parser.yy
f67c0a1c 69 $(AM_V_at)mv -f calc++-parser.tmp $@
828c373b
AD
70
71$(calc_sources_generated): $(srcdir)/calc++-parser.stamp
f67c0a1c 72 $(AM_V_GEN)if test -f $@; then :; else \
94306d52
PE
73 rm -f $(srcdir)/calc++-parser.stamp && \
74 $(MAKE) $(AM_MAKEFLAGS) $(srcdir)/calc++-parser.stamp; \
75 fi
76
828c373b
AD
77
78## --------------------------- ##
79## Building & testing calc++. ##
80## --------------------------- ##
81
6fc0c024 82check_PROGRAMS = calc++
828c373b
AD
83
84calc_sources_extracted = $(srcdir)/calc++-scanner.ll $(srcdir)/calc++.cc \
f67c0a1c 85 $(srcdir)/calc++-driver.hh $(srcdir)/calc++-driver.cc
b34d96c1 86calc_extracted = $(calc_sources_extracted) $(srcdir)/calc++-parser.yy
828c373b 87calc_sources_generated = \
f67c0a1c
AD
88 $(srcdir)/stack.hh $(srcdir)/position.hh $(srcdir)/location.hh \
89 $(srcdir)/calc++-parser.hh $(srcdir)/calc++-parser.cc
828c373b
AD
90
91calc___SOURCES = $(calc_sources_extracted) $(calc_sources_generated)
92
93TESTS = test
94EXTRA_DIST += $(TESTS)