c++: make it clear that #define YYSTYPE is not supported
[bison.git] / cfg.mk
blob2cf2fe48a84b4fdaaff08164502a986e22452492
1 ## Customize maint.mk -*- makefile -*-
2 ## Copyright (C) 2008-2015, 2018-2021 Free Software Foundation, Inc.
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.
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/>.
17 # Update version, then recompile so that tests/bison --version be
18 # up-to-date, then compile our parser again with our up-to-date bison.
19 .PHONY: regen
20 regen: _version
21 $(MAKE) $(AM_MAKEFLAGS)
22 touch $(srcdir)/src/parse-gram.y
23 $(MAKE) $(AM_MAKEFLAGS)
25 # Used in maint.mk's web-manual rule
26 manual_title = The Yacc-compatible Parser Generator
27 gendocs_options_ = -I $(abs_top_srcdir)/doc -I $(abs_top_builddir)/doc
29 # By default, propagate -j from make to Bison's test suite.
30 TESTSUITEFLAGS = $(filter -j%,$(MAKEFLAGS))
32 # It's useful to run maintainer-check* targets during development, but we
33 # don't want to wait on a recompile because of an update to $(VERSION). Thus,
34 # override the _is-dist-target from GNUmakefile so that maintainer-check*
35 # targets are filtered out.
36 _is-dist-target = $(filter-out %clean maintainer-check%, \
37 $(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
39 url_dir_list = \
40 https://$(gnu_rel_host)/gnu/bison
42 # Tests not to run as part of "make distcheck".
43 local-checks-to-skip = \
44 sc_immutable_NEWS \
45 sc_prohibit_atoi_atof
47 # The local directory containing the checked-out copy of gnulib used in
48 # this release. Used solely to get a date for the "announcement" target.
49 gnulib_dir = $(srcdir)/gnulib
51 bootstrap-tools = autoconf,automake,flex,gettext,gnulib
53 announcement_Cc_ = \
54 bug-bison@gnu.org, bison-announce@gnu.org, \
55 coordinator@translationproject.org
57 update-copyright: update-b4-copyright update-package-copyright-year
58 update-copyright-env = \
59 UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
62 ## -------------------- ##
63 ## More syntax-checks. ##
64 ## -------------------- ##
66 # Indent only with spaces.
67 # Taken from Coreutils.
68 sc_prohibit_tab_based_indentation:
69 @prohibit='^ * ' \
70 halt='TAB in indentation; use only spaces' \
71 $(_sc_search_regexp)
73 # Prohibit the use of `...` in tests/. Use $(...) instead.
74 # Taken from Coreutils.
75 # Not ready for Bison yet.
76 #sc_prohibit_test_backticks:
77 # @prohibit='`' in_vc_files='^tests/' \
78 # halt='use $$(...), not `...` in tests/' \
79 # $(_sc_search_regexp)
81 # Enforce recommended preprocessor indentation style.
82 # Taken from Coreutils.
83 sc_preprocessor_indentation:
84 @if cppi --version >/dev/null 2>&1; then \
85 $(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c \
86 || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
87 exit 1; }; \
88 else \
89 echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
92 ###########################################################
93 # Taken from Coreutils.
94 _p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
95 _pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
96 _pre_anchored = ^\($(_pre)\)
97 _comment_and_close = [^*]\|[*][^/*]\)*[*][*]*/
98 # help font-lock mode: '
100 # A sed expression that removes ANSI C and ISO C99 comments.
101 # Derived from the one in GNU gettext's 'moopp' preprocessor.
102 _sed_remove_comments = \
103 /[/][/*]/{ \
104 ta; \
105 :a; \
106 s,$(_pre_anchored)//.*,\1,; \
107 te; \
108 s,$(_pre_anchored)/[*]\($(_comment_and_close),\1 ,; \
109 ta; \
110 /^$(_pre)[/][*]/{ \
111 s,$(_pre_anchored)/[*].*,\1 ,; \
112 tu; \
113 :u; \
114 n; \
115 s,^\($(_comment_and_close),,; \
116 tv; \
117 s,^.*$$,,; \
118 bu; \
119 :v; \
120 }; \
121 :e; \
123 # Quote all single quotes.
124 _sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
125 # help font-lock mode: '
127 _space_before_paren_exempt =? \\n\\$$
128 _space_before_paren_exempt = \
129 (^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init))
130 # Ensure that there is a space before each open parenthesis in C code.
131 sc_space_before_open_paren:
132 @if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
133 fail=0; \
134 for c in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do \
135 sed '$(_sed_rm_comments_q)' $$c 2>/dev/null \
136 | grep -i '[[:alnum:]](' \
137 | grep -vE '$(_space_before_paren_exempt)' \
138 | grep . && { fail=1; echo "*** $$c"; }; \
139 done; \
140 test $$fail = 1 && \
141 { echo '$(ME): the above files lack a space-before-open-paren' \
142 1>&2; exit 1; } || :; \
143 else :; \
146 ## -------------------------- ##
147 ## syntax-checks exceptions. ##
148 ## -------------------------- ##
150 # po-check: we use gnulib-po, so we don't need/want them in our POTFILE.
151 generated_files =
153 exclude = \
154 $(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
156 $(call exclude, \
157 bindtextdomain=^lib/main.c$$ \
158 cast_of_argument_to_free=^src/muscle-tab.c$$ \
159 error_message_uppercase=etc/bench.pl.in$$ \
160 po_check=^tests|(^po/POTFILES.in|.md)$$ \
161 preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
162 program_name=^lib/main.c$$ \
163 prohibit_always-defined_macros=^data/skeletons/yacc.c$$ \
164 prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
165 prohibit_always-defined_macros+=?|^tests/regression.at$$ \
166 prohibit_doubled_word=^tests/named-refs.at$$ \
167 prohibit_magic_number_exit=^doc/bison.texi$$ \
168 prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
169 prohibit_strcmp=^doc/bison\.texi|examples|tests \
170 prohibit_tab_based_indentation=install-icc.sh|\.(am|mk)$$|^\.git|tests/input.at|Makefile$$ \
171 require_config_h=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
172 require_config_h_first=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
173 space_before_open_paren=^data/skeletons/ \
174 two_space_separator_in_usage=^(bootstrap|build-aux/install-icc.sh) \
175 unmarked_diagnostics=^(doc/bison.texi$$|tests/c\+\+\.at$$) \