gnulib: update
[bison.git] / examples / local.mk
blobb43943fc604bc79d18c3e8a6e1c03c1c1b590621
1 ## Copyright (C) 2005, 2008-2015, 2018-2021 Free Software Foundation,
2 ## 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.
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program. If not, see <https://www.gnu.org/licenses/>.
18 ## Because some of our examples use
20 ## %C%_reccalc_SOURCES = %D%/parse.y
22 ## Automake ships parse.y and parse.c, and possibly parse.h when it
23 ## "understands" that there is one. This is not what we want: ship only
24 ## parser.y. Yet we still want to use Automake to compile the sources
25 ## from parser.y. The easiest seems to use
27 ## nodist_%C%_reccalc_SOURCES = %D%/parse.y
29 ## together with
31 ## dist_reccalc_DATA = %D%/parse.y %D%/scan.l %D%/Makefile %D%/README.md
33 ## which guarantees that parse.y is indeed shipped.
35 dist_noinst_SCRIPTS = %D%/extexi %D%/test
36 TEST_LOG_COMPILER = $(SHELL) $(top_srcdir)/%D%/test
38 TEST_CFLAGS = \
39 $(WARN_CFLAGS) $(WARN_CFLAGS_TEST) $(WERROR_CFLAGS)
41 AM_CXXFLAGS = \
42 $(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
44 ## ------------ ##
45 ## Extracting. ##
46 ## ------------ ##
48 doc = $(top_srcdir)/doc/bison.texi
49 extexi = $(top_srcdir)/%D%/extexi
50 if ENABLE_GCC_WARNINGS
51 EXTEXIFLAGS = --synclines
52 endif
53 extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(EXTEXIFLAGS) $(doc) --
54 extracted =
55 EXTRA_DIST += $(extracted)
56 MAINTAINERCLEANFILES += $(extracted) %D%/extracted.stamp
57 %D%/extracted.stamp: $(doc) doc/version.texi $(extexi)
58 $(AM_V_GEN)rm -f $@ $@.tmp
59 $(AM_V_at)$(MKDIR_P) %D%
60 $(AM_V_at)touch $@.tmp
61 $(AM_V_at)$(extract) $(extracted)
62 $(AM_V_at)mv $@.tmp $@
64 $(extracted): %D%/extracted.stamp
65 @test -f $@ || rm -f %D%/extracted.stamp
66 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp
69 ## ------ ##
70 ## Dist. ##
71 ## ------ ##
73 # Ship the stamp file, otherwise it will be recreated, which is what
74 # we want to avoid.
75 EXTRA_DIST += %D%/extracted.stamp
77 # Suppress the #lines from the examples when rolling the tarball, so
78 # that regular users have readable examples even before installing
79 # Bison.
80 dist-hook: examples-unline
81 .PHONY: examples-unline
82 examples-unline:
83 cd $(distdir) && \
84 perl -pi -0777 -e 's/#line.*\n//g;s{^ /\*\*/\n}{}mg' $(extracted)
87 ## ---------- ##
88 ## Examples. ##
89 ## ---------- ##
91 examplesdir = $(docdir)/examples
92 dist_examples_DATA = %D%/README.md
94 CLEANDIRS += %D%/*.dSYM
96 .PHONY: check-examples
97 check-examples: check-TESTS
99 include %D%/c/local.mk
100 include %D%/c++/local.mk
101 include %D%/d/local.mk
102 include %D%/java/local.mk