glr2.cc: prefer unnamed namespace to 'static'
[bison.git] / Makefile.am
blob18218b2e84bc2019f958ace0b45756a95ed7d1f5
1 ## Process this file with automake to produce Makefile.in.
3 # Copyright (C) 2001-2015, 2018-2021 Free Software Foundation, Inc.
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.
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.
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
18 AUTOMAKE_OPTIONS = subdir-objects
19 ACLOCAL_AMFLAGS = -I m4
21 SUBDIRS = po runtime-po gnulib-po .
23 # Files installed for use by Automake.
24 aclocaldir = @aclocaldir@
25 aclocal_DATA = m4/bison-i18n.m4
27 EXTRA_DIST = .prev-version .version cfg.mk PACKAGING \
28   ChangeLog-1998 ChangeLog-2012 ChangeLog
30 dist_doc_DATA = AUTHORS COPYING NEWS README THANKS TODO
32 # Let generated files (e.g., from examples/) depend on this variable,
33 # to make sure they are regenerated when there are changes in Bison.
35 # Don't depend on $(BISON) otherwise we would rebuild these files
36 # in srcdir, including during distcheck, which is forbidden.
37 dependencies = $(BISON_IN) $(src_bison_SOURCES) $(dist_skeletons_DATA)
39 ## Running the bison from this tarball.  To generate our own parser,
40 ## but also to run the tests.  Of course, you ought to keep a sane
41 ## version of Bison nearby...
42 BISON = $(top_builddir)/tests/bison
43 BISON_IN = $(top_srcdir)/tests/bison.in
44 YACC = $(BISON) -o y.tab.c
45 AM_YFLAGS_WITH_LINES = --defines -Werror -Wall,dangling-alias --report=all
46 AM_YFLAGS = $(AM_YFLAGS_WITH_LINES) --no-lines
48 # Initialization before completion by local.mk's.
49 AM_CFLAGS = $(WARN_CFLAGS)
50 # Find builddir/src/scan-code.c etc.  For some reason "-I./lib"
51 # instead of "-Ilib" avoids infinite recursions on #include_next.
52 AM_CPPFLAGS = -I. -I./lib -I$(top_srcdir) -I$(top_srcdir)/lib
53 BUILT_SOURCES =
54 CLEANDIRS =
55 CLEANFILES =
56 DISTCLEANFILES =
57 EXTRA_DIST += $(dist_TESTS)
58 MOSTLYCLEANDIRS =
59 MOSTLYCLEANFILES =
60 SUFFIXES =
61 TESTS = $(dist_TESTS)
62 check_PROGRAMS =
63 check_SCRIPTS =
64 dist_TESTS =
65 noinst_LIBRARIES =
67 include build-aux/local.mk
68 include data/local.mk
69 include doc/local.mk
70 include etc/local.mk
71 include examples/local.mk
72 include lib/local.mk
73 include src/local.mk
74 include tests/local.mk
76 clean-local:
77         rm -rf $(CLEANDIRS)
79 .PHONY: gitsort
80 gitsort:
81         cd $(srcdir)                                                    \
82         && for i in $$(git ls-files '*.gitignore' | grep -v doc); do    \
83           LC_ALL=C sort $$i -o $$i;                                     \
84         done
86 # See comments in build-aux/git-version-gen.  However, we make .version depend
87 # on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
88 # working copy (for example, when you run autoreconf && make).  Allowing these
89 # to fall out of sync appears to have little potential to improve Bison build
90 # efficiency (even if we were to replace VERSION/PACKAGE_VERSION with .version
91 # everywhere possible).  On the other hand, it could be harmful.  For example,
92 # a developer might naively reference .version in a test case while the bison
93 # executable still compiles with VERSION, and so the test case might fail or
94 # pass incorrectly.
95 BUILT_SOURCES += $(top_srcdir)/.version
96 $(top_srcdir)/.version: configure
97         echo $(VERSION) > $@-t && mv $@-t $@
98 dist-hook: gen-ChangeLog gen-synclines
99         echo $(VERSION) > $(distdir)/.tarball-version
101 # When generating a release, include the #lines in Bison's parser.  Do it
102 # only if needed.  In particular, distcheck runs dist with read-only
103 # sources, so don't try to update src/parse-gram.c: we don't have the
104 # permissions.
105 .PHONY: gen-synclines
106 gen-synclines:
107         cd $(distdir) &&                                                \
108         if ! grep '#line' src/parse-gram.c >/dev/null 2>&1; then        \
109           $(abs_top_builddir)/tests/bison                               \
110             $(AM_YFLAGS_WITH_LINES) src/parse-gram.y                    \
111             -o src/parse-gram.c;                                        \
112         fi
114 .PHONY: update-b4-copyright update-package-copyright-year
115 update-b4-copyright:
116         $(AM_V_GEN)find $(srcdir)/data -type f          \
117           | xargs $(srcdir)/build-aux/$@
118         @echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
119 update-package-copyright-year:
120         $(AM_V_GEN)$(srcdir)/build-aux/$@ $(srcdir)/configure.ac
122 gen_start_date = 2012-01-16
123 .PHONY: gen-ChangeLog
124 gen-ChangeLog:
125         $(AM_V_GEN)if test -d $(srcdir)/.git; then      \
126           cl=$(distdir)/ChangeLog &&                    \
127           rm -f $$cl.tmp &&                             \
128           $(top_srcdir)/build-aux/gitlog-to-changelog   \
129             --strip-tab                                 \
130             --strip-cherry-pick                         \
131             --no-cluster                                \
132             --amend=$(srcdir)/build-aux/git-log-fix     \
133             --srcdir=$(srcdir)                          \
134             --since=$(gen_start_date) > $$cl.tmp &&     \
135           mv -f $$cl.tmp $$cl;                          \
136         fi
138 # Useful to debug.
139 .c.i:
140         $(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -o $@ -E $<
142 .PHONY: codespell
143 CODESPELL = codespell
144 codespell:
145         $(AM_V_GEN) cd $(srcdir) \
146         && $(CODESPELL) \
147              --regex "[\\w\\-'’\`]+\+*" \
148              --ignore-words-list "ba,circularly,cloneable,copyable,define'd,dout,froms,iff,ifset,od,ois" \
149              $$(git ls-files data doc lib src tests)