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