]> git.saurik.com Git - bison.git/blob - examples/calc++/local.mk
maint: de-recurse the handling of examples
[bison.git] / examples / calc++ / local.mk
1 ## Process this file with automake to produce Makefile.in -*-Makefile-*-
2
3 ## Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
4
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/>.
17
18 ## ------------ ##
19 ## Extracting. ##
20 ## ------------ ##
21
22 doc = $(top_srcdir)/doc/bison.texinfo
23 extexi = $(top_srcdir)/examples/extexi
24 # Extract in src.
25 $(top_srcdir)/examples/calc++/calc.stamp: $(doc) $(extexi)
26 $(AM_V_GEN)rm -f $@ $@.tmp
27 $(AM_V_at)touch $@.tmp
28 $(AM_V_at)cd $(top_srcdir)/examples/calc++ && \
29 $(AWK) -f ../extexi -v VERSION="$(VERSION)" \
30 ../../doc/bison.texinfo -- calc++-parser.yy \
31 calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc
32 $(AM_V_at)mv $@.tmp $@
33
34 $(calc_extracted): $(top_srcdir)/examples/calc++/calc.stamp
35
36 ## ------------------- ##
37 ## Parser generation. ##
38 ## ------------------- ##
39
40 BUILT_SOURCES += $(calc_extracted) $(calc_sources_generated)
41 CLEANFILES += $(top_srcdir)/examples/calc++/*.output *.tmp
42 MAINTAINERCLEANFILES += $(top_srcdir)/examples/calc++/*.stamp $(calc___SOURCES)
43
44 # Compile the parser and save cycles.
45 # This code comes from "Handling Tools that Produce Many Outputs",
46 # from the Automake documentation.
47 EXTRA_DIST += \
48 examples/calc++/calc++-parser.stamp \
49 examples/calc++/calc++-parser.yy \
50 examples/calc++/calc.stamp
51 # Don't depend on $(BISON) otherwise we would rebuild these files
52 # in srcdir, including during distcheck, which is forbidden.
53 $(top_srcdir)/examples/calc++/calc++-parser.stamp: $(top_srcdir)/examples/calc++/calc++-parser.yy $(BISON_IN)
54 $(AM_V_GEN)rm -f calc++-parser.tmp
55 $(AM_V_at)touch calc++-parser.tmp
56 $(AM_V_at)$(BISON) -d -ra -o $(top_srcdir)/examples/calc++/calc++-parser.cc \
57 $(top_srcdir)/examples/calc++/calc++-parser.yy
58 $(AM_V_at)mv -f calc++-parser.tmp $@
59
60 $(calc_sources_generated): $(top_srcdir)/examples/calc++/calc++-parser.stamp
61 $(AM_V_GEN)if test -f $@; then :; else \
62 rm -f $(top_srcdir)/examples/calc++/calc++-parser.stamp && \
63 $(MAKE) $(AM_MAKEFLAGS) $(top_srcdir)/examples/calc++/calc++-parser.stamp; \
64 fi
65
66
67 ## --------------------------- ##
68 ## Building & testing calc++. ##
69 ## --------------------------- ##
70
71 calc_sources_extracted = \
72 examples/calc++/calc++-scanner.ll \
73 examples/calc++/calc++.cc \
74 examples/calc++/calc++-driver.hh \
75 examples/calc++/calc++-driver.cc
76 calc_extracted = \
77 $(calc_sources_extracted) \
78 examples/calc++/calc++-parser.yy
79 calc_sources_generated = \
80 examples/calc++/stack.hh \
81 examples/calc++/position.hh \
82 examples/calc++/location.hh \
83 examples/calc++/calc++-parser.hh \
84 examples/calc++/calc++-parser.cc
85
86 if BISON_CXX_WORKS
87 check_PROGRAMS = examples/calc++/calc++
88 examples_calc___calc___SOURCES = \
89 $(calc_sources_extracted) \
90 $(calc_sources_generated)
91 examples_calc___calc___CPPFLAGS = -I$(top_srcdir)/examples/calc++
92 TESTS = examples/calc++/test
93 endif
94 EXTRA_DIST += examples/calc++/test