maint: post-release administrivia
[libtool.git] / cfg.mk
blob3eb7f61096e74827c435ae9c0bec89b7f44c2f70
1 # cfg.mk -- Configuration for maintainer-makefile
3 # Copyright (c) 2011-2019, 2021-2024 Free Software Foundation, Inc.
4 # Written by Gary V. Vaughan, 2011
6 # This file is part of GNU Libtool.
8 # GNU Libtool is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # GNU Libtool is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Libtool. If not, see <https://www.gnu.org/licenses/>.
21 update-copyright-env := UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
23 update-copyright: update-release-year
24 update-release-year:
25 $(AM_V_GEN)year=`date +%Y`; \
26 sed -i \
27 -e "/_LT_COPY/,+1 { /Copyright/ {s:[0-9][0-9][0-9][0-9]:$$year:} }" \
28 -e "/^Copyright/ {s:[0-9][0-9][0-9][0-9]:$$year:} " \
29 m4/libtool.m4
31 # Set format of NEWS.
32 old_NEWS_hash := d51e62d3a4268be1a7b418b089c528d0
34 manual_title = Portable Dynamic Shared Object Management
36 # Set the release announcement email addresses, maint.mk will email the
37 # translation-project instead of autotools-announce otherwise.
38 ifeq ($(RELEASE_TYPE),stable)
39 announcement_Cc_ = autotools-announce@gnu.org
40 else
41 announcement_Cc_ = autotools-announce@gnu.org, $(PACKAGE_BUGREPORT)
42 endif
44 # Don't syntax check the mail subdirectory or patches to gnulib itself.
45 VC_LIST_ALWAYS_EXCLUDE_REGEX = ^(mail|gl)/
47 local-checks-to-fix = \
48 sc_require_config_h \
49 sc_require_config_h_first
51 local-checks-to-skip = \
52 $(local-checks-to-fix) \
53 sc_GPL_version \
54 sc_cast_of_x_alloc_return_value \
55 sc_indent \
56 sc_prohibit_always-defined_macros \
57 sc_prohibit_always_true_header_tests \
58 sc_prohibit_strncpy \
59 sc_trailing_blank \
60 sc_unmarked_diagnostics
62 # GPL_version: checks for GPLv3, which we don't use
63 # cast_of_x_alloc_return_value:
64 # We support C++ compilation, which does require casting here.
65 # prohibit_always-defined_macros:
66 # we have our own argz and dirent, which use the same macros but
67 # are not always-defined in our case.
68 # prohibit_always_true_header_tests:
69 # we have our own argz and dirent, which are not *always* true,
70 # so the guards cannot be removed in our case.
71 # prohibit_strncpy:
72 # what's so bad about strncpy anyway?
73 # trailing_blank: flags valid rfc3676 separators
74 # unmarked_diagnostics: libtool isn't internationalized
77 # Check for correct usage of $cc_basename in libtool.m4.
78 sc_libtool_m4_cc_basename:
79 @$(SED) -n "/case \\\$$cc_basename in/,/esac/ { \
80 /^[ ]*[a-zA-Z][a-zA-Z0-9+]*[^*][ ]*)/p; \
81 }" '$(srcdir)/$(macro_dir)/libtool.m4' | grep . && { \
82 msg="\$$cc_basename matches should include a trailing '*'." \
83 $(_sc_say_and_exit) } || :
85 # Check for old-style `quoting'.
86 exclude_file_name_regexp--sc_old_style_quoting = (^bootstrap|^cfg.mk|\.texi)$$
87 sc_old_style_quoting:
88 @prohibit="^[^\`]*[^=]\`[^'\`]*[a-zA-Z0-9][^'\`]*'[^\`]*[^\\\`]$$" \
89 halt="quote 'like this' not \`like this' in comments and output" \
90 $(_sc_search_regexp)
92 # Check for uses of Xsed without corresponding echo "X
93 exclude_file_name_regexp--sc_prohibit_Xsed_without_X = ^cfg.mk$$
94 sc_prohibit_Xsed_without_X:
95 @files=$$($(VC_LIST_EXCEPT)); \
96 if test -n "$$files"; then \
97 grep -nE '\$$Xsed' $$files | grep -vE '(func_echo_all|\$$ECHO) \\*"X' && { \
98 msg="occurrences of '\$$Xsed' without '\$$ECHO "\""X' on the same line" \
99 $(_sc_say_and_exit) } || :; \
100 else :; \
101 fi || :
103 # Use a consistent dirname and basename idiom.
104 sc_prohibit_bare_basename:
105 @prohibit='\|[ ]*\$$(base|dir)name' \
106 halt='use '\''|$$SED "$$basename"'\'' instead of '\''|$$basename'\' \
107 $(_sc_search_regexp)
109 sc_prohibit_basename_with_dollar_sed:
110 @prohibit='(base|dir)name="?(\$$SED|sed)[ "]' \
111 halt='use '\''basename='\''s|^.*/||'\'' instead of '\''basename="$$SED...' \
112 $(_sc_search_regexp)
114 # Check for using '[' instead of 'test'.
115 exclude_file_name_regexp--sc_prohibit_bracket_as_test = ^cfg.mk$$
116 sc_prohibit_bracket_as_test:
117 @prohibit='if[ ]+\[' \
118 halt="use 'if test' instead of 'if ['" \
119 $(_sc_search_regexp)
121 # : ${foo=`bar`} is not perfectly portable (see Shellology in autoconf's manual)
122 exclude_file_name_regexp--sc_prohibit_command_in_subst = ^cfg.mk$$
123 sc_prohibit_command_in_subst:
124 @prohibit='\$$\{[^`}]*`[^`]*`[^}]*}' \
125 halt='do not use `command` in $${ } substitution`' \
126 $(_sc_search_regexp)
128 # Check for quotes within backquotes within quotes "`"bar"`"
129 exclude_file_name_regexp--sc_prohibit_nested_quotes = ^cfg.mk$$
130 sc_prohibit_nested_quotes:
131 @prohibit='"[^`"]*`[^"`]*"[^"`]*".*`[^`"]*"' \
132 halt='found nested double quotes' \
133 $(_sc_search_regexp_or_exclude)
135 # Commas in filenames are quite common, so using them routinely for sed is
136 # asking for trouble!
137 sc_prohibit_sed_s_comma:
138 @explicit='($$SED|sed)[ ]+(-e[ ]+)?['\''"]?s,' \
139 implicit='['\''";][ ]*s,[^,]*,[^,]*,g?['\''";]' \
140 literal='^[ ]*s,[^,]*,[^,]*,g?['\''";]?$$' \
141 prohibit='('$$implicit'|'$$explicit'|'$$literal')' \
142 halt='found use of comma separator in sed substitution' \
143 $(_sc_search_regexp)
145 # Check for using shift after set dummy (same or following line).
146 exclude_file_name_regexp--sc_prohibit_set_dummy_without_shift = ^cfg.mk$$
147 sc_prohibit_set_dummy_without_shift:
148 @files=$$($(VC_LIST_EXCEPT)); \
149 if test -n "$$files"; then \
150 grep -nE '(set dummy|shift)' $$files | \
151 $(SED) -n "/set[ ][ ]*dummy/{ \
152 /set.*dummy.*;.*shift/d; \
153 N; \
154 /\n.*shift/D; \
155 p; \
156 }" | grep -n . && { \
157 msg="use 'shift' after 'set dummy'" \
158 $(_sc_say_and_exit) } || :; \
159 else :; \
160 fi || :
162 # Check for using set -- instead of set dummy
163 exclude_file_name_regexp--sc_prohibit_set_minus_minus = ^cfg.mk$$
164 sc_prohibit_set_minus_minus:
165 @prohibit='set[ ]+--[ ]+' \
166 halt="use 'set dummy ...' instead of 'set -- ...'" \
167 $(_sc_search_regexp)
169 # Make sure there is no spurious whitespace before trailing semi-colons
170 sc_prohibit_space_semicolon:
171 @prohibit='[^ ][ ]+;[ ]*((do|done|elif|else|then)[ ]*)?$$' \
172 halt='found spurious whitespace before trailing semi-colon' \
173 $(_sc_search_regexp)
175 # Check for using test X"... instead of test "X...
176 exclude_file_name_regexp--sc_prohibit_test_X = ^cfg.mk$$
177 sc_prohibit_test_X:
178 @prohibit='test[ ]+(![ ])?(-.[ ]+)?[Xx]["'\'']' \
179 halt='use '\''test "X..."'\'' instead of '\''test X"'\' \
180 $(_sc_search_regexp)
182 # Check for bad binary operators.
183 sc_prohibit_test_binary_operators:
184 @prohibit='if[ ]+["'\'']?\$$[^ ]+[ ]+(=|-[lg][te]|-eq|-ne)' \
185 halt="Use 'if test \$$something =' instead of 'if \$$something ='" \
186 $(_sc_search_regexp)
188 # Check for using test $... instead of test "$...
189 exclude_file_name_regexp--sc_prohibit_test_dollar = ^cfg.mk$$
190 sc_prohibit_test_dollar:
191 @prohibit='test[ ]+(![ ])?(-.[ ]+)?X?\$$[^?#]' \
192 exclude='test \$${[A-Za-z_][A-Za-z0-9_]+\+y}' \
193 halt='use '\''test "$$..."'\'' instead of '\''test $$'\' \
194 $(_sc_search_regexp)
196 # Never use test -e.
197 exclude_file_name_regexp--sc_prohibit_test_minus_e = ^cfg.mk$$
198 sc_prohibit_test_minus_e:
199 @prohibit='test[ ]+(![ ])?-e' \
200 halt="use 'test -f' instead of 'test -e'" \
201 $(_sc_search_regexp)
203 # Check for bad unary operators.
204 sc_prohibit_test_unary_operators:
205 @prohibit='if[ ]+-[a-z]' \
206 halt="use 'if test -X' instead of 'if -X'" \
207 $(_sc_search_regexp)
209 # Don't add noisy characters on the front of the left operand of a test
210 # to prevent arguments being passed inadvertently (e.g. LHS is '-z'),
211 # when the other operand is a constant -- just swap them, and remove the
212 # spurious leading 'x'.
213 sc_prohibit_test_const_follows_var:
214 @var='[ ]+"[^$$"]*\$$[0-9A-Za-z_][^"]*"' \
215 op='[ ]+(!?=|-[lgn][et]|-eq)' \
216 const='[ ]+[^-$$][^$$; ]*' \
217 prohibit='test'$$var$$op$$const'[ ]*(&&|\|\||;|\\?$$)' \
218 halt='use '\''test a = "$$b"'\'' instead of '\''test "x$$b" = xa'\' \
219 $(_sc_search_regexp)
221 # Check for opening brace on next line in shell function definition.
222 exclude_file_name_regexp--sc_require_function_nl_brace = (^HACKING|\.[ch]|\.texi)$$
223 sc_require_function_nl_brace:
224 @for file in $$($(VC_LIST_EXCEPT)); do \
225 $(SED) -n "/^func_[^ ]*[ ]*(/{ \
226 N; \
227 /^func_[^ ]* ()\n{$$/d; \
228 p; \
229 }" $$file | grep -E . && { \
230 msg="found malformed function_definition in $$file" \
231 $(_sc_say_and_exit) } || :; \
232 done
234 sc_trailing_blank-non-rfc3676:
235 @prohibit='([^-][^-][ ][ ]*|^[ ][ ]*)$$' \
236 halt='found trailing blank(s)' \
237 $(_sc_search_regexp)
239 # Avoid useless quotes around assignments with no shell metacharacters.
240 # Backtick and dollar expansions are not resplit on the RHS of an
241 # assignment, so those metachars are not listed in the prohibit regex,
242 # although @ is listed, since it most likely indicates that something
243 # will be spliced in before the shell executes, and it may need to be
244 # quoted if it contains any metacharacters after splicing.
245 define _sc_search_regexp_or_exclude
246 files=$$($(VC_LIST_EXCEPT)); \
247 if test -n "$$files"; then \
248 grep -nE "$$prohibit" $$files | grep -v '## exclude from $@' \
249 && { msg="$$halt" $(_sc_say_and_exit) } || :; \
250 else :; \
251 fi || :;
252 endef
254 exclude_file_name_regexp--sc_useless_braces_in_variable_derefs = \
255 test-funclib-quote.sh$$
256 sc_useless_braces_in_variable_derefs:
257 @prohibit='\$${[0-9A-Za-z_]+}[^0-9A-Za-z_]' \
258 halt='found spurious braces around variable dereference' \
259 $(_sc_search_regexp)
261 sc_useless_quotes_in_assignment:
262 @prohibit='^[ ]*[A-Za-z_][A-Za-z0-9_]*="[^ !#&()*;<>?@~^{|}]*"$$' \
263 halt='found spurious quotes around assignment value' \
264 $(_sc_search_regexp_or_exclude)
266 # Avoid useless quotes around case arguments such as:
267 # case "$foo" in ...
268 exclude_file_name_regexp--sc_useless_quotes_in_case = ^cfg.mk$$
269 sc_useless_quotes_in_case:
270 @prohibit='case "[^ "]*"[ ][ ]*in' \
271 halt='found spurious quotes around case argument' \
272 $(_sc_search_regexp)
274 # List syntax-check exempted files.
275 exclude_file_name_regexp--sc_prohibit_strcmp = \
276 ^doc/libtool.texi$$
277 exclude_file_name_regexp--sc_prohibit_test_minus_ao = \
278 ^m4/libtool.m4$$
279 exclude_file_name_regexp--sc_space_tab = (\.diff|test-funclib-quote.sh)$$
280 exclude_file_name_regexp--sc_trailing_blank-non-rfc3676 = \.diff$$