1 # Customize maint.mk -*- makefile -*-
2 # Copyright (C) 2003-2014 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 <http://www.gnu.org/licenses/>.
17 # Used in maint.mk's web-manual rule
18 manual_title
= Core GNU utilities
20 # Use the direct link. This is guaranteed to work immediately, while
21 # it can take a while for the faster mirror links to become usable.
22 url_dir_list
= http
://ftp.gnu.org
/gnu
/$(PACKAGE
)
24 # Tests not to run as part of "make distcheck".
25 local-checks-to-skip
= \
26 sc_proper_name_utf8_requires_ICONV
28 # Tools used to bootstrap this package, used for "announcement".
29 bootstrap-tools
= autoconf
,automake
,gnulib
,bison
31 # Now that we have better tests, make this the default.
34 # Comparing tarball sizes compressed using different xz presets, we see that
35 # an -8e-compressed tarball is only 9KiB larger than the -9e-compressed one.
36 # Using -8e is preferred, since that lets the decompression process use half
37 # the memory (32MiB rather than 64MiB).
38 # $ for i in {7,8,9}{e,}; do \
39 # (n=$(xz -$i < coreutils-8.15*.tar|wc -c);echo $n $i) & done |sort -nr
48 old_NEWS_hash
= 807de7c63283042c8506780fa28c5dce
50 # Add an exemption for sc_makefile_at_at_check.
51 _makefile_at_at_check_exceptions
= ' && !/^cu_install_prog/ && !/dynamic-dep/'
53 # Our help-version script is in a slightly different location.
54 _hv_file ?
= $(srcdir)/tests
/misc
/help-version
56 # Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
57 dd
= $(srcdir)/src
/dd.c
60 @
{ echo O_FULLBLOCK
; echo O_NOCACHE
; \
61 perl
-nle
'/^ +\| (O_\w*)$$/ and print $$1' $(dd
); } |
sort > $@
.1
62 @
{ echo O_NOFOLLOW
; perl
-nle
'/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
63 $(dd
); } |
sort > $@
.2
64 @diff
-u
$@
.1 $@
.2 || diff
=1 || diff
=; \
67 && { echo
'$(ME): $(dd) has inconsistent O_ flag lists'>&2; \
70 # Ensure that dd's definition of LONGEST_SYMBOL stays in sync
71 # with the strings from the two affected variables.
72 dd_c
= $(srcdir)/src
/dd.c
74 ifneq ($(wildcard $(dd_c
)),)
75 @len
=$$( (sed
-n
'/conversions\[\] =$$/,/^};/p' $(dd_c
);\
76 sed
-n
'/flags\[\] =$$/,/^};/p' $(dd_c
) ) \
77 |sed
-n
'/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
78 | wc
--max-line-length
); \
79 max
=$$(sed
-n
'/^#define LONGEST_SYMBOL /s///p' $(dd_c
) \
80 |tr
-d
'"' | wc
--max-line-length
); \
81 if
test "$$len" = "$$max"; then
:; else \
82 echo
'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
87 # Many m4 macros names once began with 'jm_'.
88 # On 2004-04-13, they were all changed to start with gl_ instead.
89 # Make sure that none are inadvertently reintroduced.
91 @grep
-nE
'jm_[A-Z]' \
92 $$($(VC_LIST
) m4 |grep
'\.m4$$'; echo
/dev
/null
) && \
93 { echo
'$(ME): do not use jm_ in m4 macro names' \
96 # Ensure that each root-requiring test is run via the "check-root" rule.
98 @t1
=sc-root.expected
; t2
=sc-root.actual
; \
99 grep
-nl
'^ *require_root_$$' `$(VC_LIST) tests` |
sort > $$t1; \
100 for t in
$(all_root_tests
); do echo
$$t; done |
sort > $$t2; \
101 st
=0; diff
-u
$$t1 $$t2 || st
=1; \
105 # Ensure that all version-controlled test cases are listed in $(all_tests).
106 sc_tests_list_consistency
:
108 test_extensions_rx
=`echo $(TEST_EXTENSIONS) \
109 | sed -e "s/ /|/g" -e "s/$$bs./$$bs$$bs./g"`; \
111 for t in
$(all_tests
); do echo
$$t; done
; \
113 $(SHELL
) build-aux
/vc-list-files tests \
114 | grep
-Ev
'^tests/(factor/(run|create-test)|init)\.sh$$' \
115 |
$(EGREP
) "$$test_extensions_rx\$$"; \
116 } |
sort | uniq
-u | grep .
&& exit
1; :
118 # Ensure that all version-controlled test scripts are executable.
120 @test_extensions_rx
=`echo $(TEST_EXTENSIONS) \
121 | sed -e "s/ / -o -name */g" -e "s/^/-name */"`; \
122 find tests
/ \
( $$test_extensions_rx \
) \
! -perm
-111 -print \
123 | sed
-e
"s/^/$(ME): Please make test executable: /" | grep . \
126 # Avoid :>file which doesn't propagate errors
127 sc_prohibit_colon_redirection
:
128 @cd
$(srcdir)/tests
&& GIT_PAGER
= git grep
-n
': *>.*||' \
129 && { echo
'$(ME): '"The leading colon in :> will hide errors" 1>&2; \
133 # Create a list of regular expressions matching the names
134 # of files included from system.h. Exclude a couple.
136 @sed
-n
'/^# *include /s///p' $(srcdir)/src
/system.h \
137 | grep
-Ev
'sys/(param|file)\.h' \
138 | sed
's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
143 Exit
() { set
+e
; (exit
$$1); exit
$$1; }; \
144 for sig in
1 2 3 13 15; do \
145 eval
"trap 'Exit $$(expr $$sig + 128)' $$sig"; \
149 # Files in src/ should not include directly any of
150 # the headers already included via system.h.
151 sc_system_h_headers
: .re-list
152 @if
test -f
$(srcdir)/src
/system.h
; then \
153 trap
'rc=$$?; rm -f .re-list; exit $$rc' 0; \
155 grep
-nE
-f .re-list \
156 $$($(VC_LIST_EXCEPT
) | grep
'^\($(srcdir)/\)\?src/') \
157 && { echo
'$(ME): the above are already included via system.h'\
158 1>&2; exit
1; } ||
:; \
161 # Files in src/ should not use '%s' notation in format strings,
162 # i.e., single quotes around %s (or similar) should be avoided.
163 sc_prohibit_quotes_notation
:
164 @cd
$(srcdir)/src
&& GIT_PAGER
= git grep
-n
"\".*[\`']%s'.*\"" *.c \
165 && { echo
'$(ME): '"Use quote() to avoid quoted '%s' notation" 1>&2; \
171 'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
172 $$($(VC_LIST_EXCEPT
)) && \
173 { echo
'$(ME): found misuse of Sun OS version numbers' 1>&2; \
176 # Ensure that the list of programs and author names is accurate.
177 # We need a UTF8 locale. If a lack of locale support or a missing
178 # translation inhibits printing of UTF-8 names, just skip this test.
179 au_dotdot
= authors-dotdot
180 au_actual
= authors-actual
181 sc_check-AUTHORS
: $(all_programs
)
182 @locale
=en_US.UTF-8
; \
183 LC_ALL
=$$locale .
/src
/cat
--version \
184 | grep
' Torbjorn ' > /dev
/null \
185 && { echo
"$@: skipping this check"; exit
0; }; \
186 rm -f
$(au_actual
) $(au_dotdot
); \
187 for i in
`ls $(all_programs) \
188 | sed -e 's,^src/,,' -e 's,$(EXEEXT)$$,,' \
190 | $(ASSORT) -u`; do \
191 test "$$i" = '[' && continue
; \
193 if
test "$$i" = install; then \
195 elif
test "$$i" = test; then \
198 LC_ALL
=$$locale .
/src
/$$exe --version \
199 | perl
-0 -p
-e
's/,\n/, /gm' \
200 | sed
-n
-e
'/Written by /{ s//'"$$i"': /;' \
201 -e
's/,* and /, /; s/\.$$//; p; }'; \
202 done
> $(au_actual
) && \
203 sed
-n
'/^[^ ][^ ]*:/p' $(srcdir)/AUTHORS
> $(au_dotdot
) \
204 && diff
$(au_actual
) $(au_dotdot
) \
205 && rm -f
$(au_actual
) $(au_dotdot
)
207 # Each program with a non-ASCII author name must link with LIBICONV.
208 sc_check-I18N-AUTHORS
:
209 @cd
$(srcdir)/src
&& \
210 for i in
$$(git grep
-l
-w proper_name_utf8
*.c|sed
's/\.c//'); do \
211 grep
-E
"^src_$${i}_LDADD"' .?= .*\$$\(LIBICONV\)' local.mk \
213 ||
{ echo
"$(ME): link rules for $$i do not include" \
214 '$$(LIBICONV)' 1>&2; exit
1; }; \
217 # Ensure %j is not used for intmax_t as it's not universally supported.
218 # There are issues on HPUX for example. But note that %ju was used between
219 # coreutils 8.13 (2011-10) and 8.20 (2012-10) without any reported issue,
220 # and the particular issue this check is associated with was for %*jx.
221 # So we may be able to relax this restriction soon.
222 sc_prohibit-j-printf-format
:
223 @cd
$(srcdir)/src
&& GIT_PAGER
= git grep
-n
'%[0*]*j[udx]' *.c \
224 && { echo
'$(ME): Use PRI*MAX instead of %j' 1>&2; exit
1; } \
227 # Ensure the alternative __attribute (keyword) form isn't used as
228 # that form is not elided where required. Also ensure that we don't
229 # directly use attributes already defined by gnulib.
230 # TODO: move the check for _GL... attributes to gnulib.
231 sc_prohibit-gl-attributes
:
232 @prohibit
='__attribute |__(unused|pure|const)__' \
233 in_vc_files
='\.[ch]$$' \
234 halt
='Use _GL... attribute macros' \
237 # Look for lines longer than 80 characters, except omit:
238 # - program-generated long lines in diff headers,
239 # - the help2man script copied from upstream,
240 # - tests involving long checksum lines, and
241 # - the 'pr' test cases.
243 FILTER_LONG_LINES
= \
244 /^
[^
:]*\.diff
:[^
:]*:@@
/ d
; \
245 \|^
[^
:]*man
/help2man
:| d
; \
246 \|^
[^
:]*tests
/misc
/sha
[0-9]*sum.
*\.pl
[-:]| d
; \
247 \|^
[^
:]*tests
/pr
/|
{ \|^
[^
:]*tests
/pr
/pr-tests
:|
!d
; };
249 @files
=$$($(VC_LIST_EXCEPT
)) \
250 halt
='line(s) with more than $(LINE_LEN_MAX) characters; reindent'; \
251 for file in
$$files; do \
252 expand
$$file | grep
-nE
'^.{$(LINE_LEN_MAX)}.' | \
253 sed
-e
"s|^|$$file:|" -e
'$(FILTER_LONG_LINES)'; \
254 done | grep .
&& { msg
="$$halt" $(_sc_say_and_exit
) } ||
:
256 # Option descriptions should not start with a capital letter.
257 # One could grep source directly as follows:
258 # grep -E " {2,6}-.*[^.] [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$')
259 # but that would miss descriptions not on the same line as the -option.
260 sc_option_desc_uppercase
: $(ALL_MANS
)
261 @grep
'^\\fB\\-' -A1 man
/*.1 | LC_ALL
=C grep
'\.1.[A-Z][a-z]' \
262 && { echo
1>&2 '$@: found initial capitals in --help'; exit
1; } ||
:
264 # Ensure all man/*.[1x] files are present.
265 sc_man_file_correlation
: check-x-vs-1 check-programs-vs-x
267 # Ensure that for each .x file in the 'man/' subdirectory, there is a
268 # corresponding .1 file in the definition of $(EXTRA_MANS).
269 # But since that expansion usually lacks programs like arch and hostname,
270 # add them here manually.
273 @PATH
=.
/src
$(PATH_SEPARATOR
)$$PATH; export PATH
; \
275 (cd
$(srcdir)/man
&& ls
-1 *.x
) \
276 | sed
's/\.x$$//' |
$(ASSORT
) > $$t; \
277 (echo
$(patsubst man
/%,%,$(ALL_MANS
)) \
278 | tr
-s
' ' '\n' | sed
's/\.1$$//') \
279 |
$(ASSORT
) -u | diff
- $$t ||
{ rm $$t; exit
1; }; \
282 # Writing a portable rule to generate a manpage like '[.1' would be
283 # a nightmare, so filter that out.
284 all-progs-but-lbracket
= $(filter-out [,$(patsubst src
/%,%,$(all_programs
)))
286 # Ensure that for each coreutils program there is a corresponding
287 # '.x' file in the 'man/' subdirectory.
288 .PHONY
: check-programs-vs-x
291 for p in dummy
$(all-progs-but-lbracket
); do \
292 case
$$p in
*.so
) continue
;; esac
; \
293 test $$p = dummy
&& continue
; \
294 test $$p = ginstall
&& p
=install ||
: ; \
295 test -f
$(srcdir)/man
/$$p.x \
296 ||
{ echo missing
$$p.x
1>&2; status
=1; }; \
300 # Ensure that the end of each release's section is marked by two empty lines.
301 sc_NEWS_two_empty_lines
:
302 @sed
-n
4,/Noteworthy
/p
$(srcdir)/NEWS \
303 | perl
-n0e
'/(^|\n)\n\n\* Noteworthy/ or exit 1' \
304 ||
{ echo
'$(ME): use two empty lines to separate NEWS sections' \
307 # With split lines, don't leave an operator at end of line.
308 # Instead, put it on the following line, where it is more apparent.
309 # Don't bother checking for "*" at end of line, since it provokes
310 # far too many false positives, matching constructs like "TYPE *".
311 # Similarly, omit "=" (initializers).
312 binop_re_ ?
= [-/+^
!<>]|
[-/+*^
!<>=]=|
&&?|\|\|?|
<<=?|
>>=?
313 sc_prohibit_operator_at_end_of_line
:
314 @prohibit
='. ($(binop_re_))$$' \
315 in_vc_files
='\.[chly]$$' \
316 halt
='found operator at end of line' \
319 # Don't use "readlink" or "readlinkat" directly
320 sc_prohibit_readlink
:
321 @prohibit
='\<readlink(at)? \(' \
322 halt
='do not use readlink(at); use via xreadlink or areadlink*' \
325 # Don't use address of "stat" or "lstat" functions
326 sc_prohibit_stat_macro_address
:
327 @prohibit
='\<l?stat '':|&l?stat\>' \
328 halt
='stat() and lstat() may be function-like macros' \
331 # Ensure that date's --help output stays in sync with the info
332 # documentation for GNU strftime. The only exception is %N,
333 # which date accepts but GNU strftime does not.
334 extract_char
= sed
's/^[^%][^%]*%\(.\).*/\1/'
336 @if
test -f
$(srcdir)/src
/date.c
; then \
337 grep
'^ %. ' $(srcdir)/src
/date.c |
sort \
338 |
$(extract_char
) > $@
-src
; \
340 info libc date calendar format
2>/dev
/null|grep
'^ `%.'\'\
341 |
$(extract_char
); } |
sort > $@
-info; \
342 if
test $$(stat
--format
%s
$@
-info) != 2; then \
343 diff
-u
$@
-src
$@
-info || exit
1; \
345 echo
'$(ME): skipping $@: libc info not installed' 1>&2; \
347 rm -f
$@
-src
$@
-info; \
350 # Indent only with spaces.
351 sc_prohibit_tab_based_indentation
:
353 halt
='TAB in indentation; use only spaces' \
356 # The SEE ALSO section of a man page should not be terminated with
357 # a period. Check the first line after each "SEE ALSO" line in man/*.x:
358 sc_prohibit_man_see_also_period
:
359 @grep
-nB1
'\.$$' $$($(VC_LIST_EXCEPT
) | grep
'man/.*\.x$$') \
360 | grep
-A1
-e
'-\[SEE ALSO\]' | grep
'\.$$' && \
361 { echo
'$(ME): do not end "SEE ALSO" section with a period' \
364 # Don't use "indent-tabs-mode: nil" anymore. No longer needed.
365 sc_prohibit_emacs__indent_tabs_mode__setting
:
366 @prohibit
='^( *[*#] *)?indent-tabs-mode:' \
367 halt
='use of emacs indent-tabs-mode: setting' \
370 # Ensure that tests don't include a redundant fail=0.
372 @prohibit
='\<fail=0\>' \
373 halt
='fail=0 initialization' \
376 # The mode part of a setfacl -m option argument must be three bytes long.
377 # I.e., an argument of user:bin:rw or user:bin:r will make Solaris 10's
378 # setfacl reject it with: "Unrecognized character found in mode field".
379 # Use hyphens to give it a length of 3: "...:rw-" or "...:r--".
380 sc_prohibit_short_facl_mode_spec
:
381 @prohibit
='\<setfacl .*-m.*:.*:[rwx-]{1,2} ' \
382 halt
='setfacl mode string length < 3; extend with hyphen(s)' \
385 # Ensure that "stdio--.h" is used where appropriate.
386 sc_require_stdio_safer
:
387 @if
$(VC_LIST_EXCEPT
) | grep
-l
'\.[ch]$$' > /dev
/null
; then \
388 files
=$$(grep
-l
'\bfreopen \?(' $$($(VC_LIST_EXCEPT
) \
389 | grep
'\.[ch]$$')); \
390 test -n
"$$files" && grep
-LE
'include "stdio--.h"' $$files \
392 { echo
'$(ME): the above files should use "stdio--.h"' \
393 1>&2; exit
1; } ||
:; \
397 sc_prohibit_perl_hash_quotes
:
398 @prohibit
="\{'[A-Z_]+' *[=}]" \
399 halt
="in Perl code, write \$$hash{KEY}, not \$$hash{'K''EY'}" \
402 # Prefer xnanosleep over other less-precise sleep methods
404 @prohibit
='\<(nano|u)?sleep \(' \
405 halt
='prefer xnanosleep over other sleep interfaces' \
408 # Use print_ver_ (from init.cfg), not open-coded $VERBOSE check.
409 sc_prohibit_verbose_version
:
410 @prohibit
='test "\$$VERBOSE" = yes && .* --version' \
411 halt
='use the print_ver_ function instead...' \
414 # Use framework_failure_, not the old name without the trailing underscore.
415 sc_prohibit_framework_failure
:
416 @prohibit
='\<framework_''failure\>' \
417 halt
='use framework_failure_ instead' \
420 # Prohibit the use of `...` in tests/. Use $(...) instead.
421 sc_prohibit_test_backticks
:
422 @prohibit
='`' in_vc_files
='^tests/' \
423 halt
='use $$(...), not `...` in tests/' \
426 # Ensure that compare is used to check empty files
427 # so that the unexpected contents are displayed
428 sc_prohibit_test_empty
:
429 @prohibit
='test -s.*&&' in_vc_files
='^tests/' \
430 halt
='use `compare /dev/null ...`, not `test -s ...` in tests/' \
433 # Programs like sort, ls, expr use PROG_FAILURE in place of EXIT_FAILURE.
434 # Others, use the EXIT_CANCELED, EXIT_ENOENT, etc. macros defined in system.h.
435 # In those programs, ensure that EXIT_FAILURE is not used by mistake.
436 sc_some_programs_must_avoid_exit_failure
:
437 @grep
-nw EXIT_FAILURE \
438 $$(git grep
-El
'[^T]_FAILURE|EXIT_CANCELED' src
) \
439 | grep
-vE
'= EXIT_FAILURE|return .* \?' | grep . \
440 && { echo
'$(ME): do not use EXIT_FAILURE in the above' \
443 # Ensure that tests call the require_ulimit_v_ function if using ulimit -v
444 sc_prohibit_test_ulimit_without_require_
:
445 @
(git grep
-l require_ulimit_v_ tests
; \
446 git grep
-l
'ulimit -v' tests
) \
447 |
sort | uniq
-u | grep .
&& { echo
"$(ME): the above test(s)"\
448 " should match require_ulimit_v_ with ulimit -v" 1>&2; exit
1; } ||
:
450 # Ensure that tests call the print_ver_ function for programs which are
451 # actually used in that test.
452 sc_prohibit_test_calls_print_ver_with_irrelevant_argument
:
453 @git grep
-w print_ver_ tests \
454 | sed
's#:print_ver_##' \
456 while read file name
; do \
457 for i in
$$name; do \
458 case
"$$i" in
install) i
=ginstall
;; esac
; \
459 grep
-w
"$$i" $$file|grep
-vw print_ver_|grep
-q . \
461 echo
"*** Test: $$file, offending: $$i." 1>&2; };\
464 test $$fail = 0 || exit
1; \
465 } ||
{ echo
"$(ME): the above test(s) call print_ver_ for" \
466 "program(s) they don't use" 1>&2; exit
1; }
468 # Exempt the contents of any usage function from the following.
469 _continued_string_col_1
= \
470 s
/^usage .
*?
\n}//ms
;/\\\n\w
/ and
print ("$$ARGV\n"),$$e=1;END
{$$e||
=0;exit
$$e}
471 # Ding any source file that has a continued string with an alphabetic in the
472 # first column of the following line. We prohibit them because they usually
473 # trigger false positives in tools that try to map an arbitrary line number
474 # to the enclosing function name. Of course, very many strings do precisely
475 # this, *when they are part of the usage function*. That is why we exempt
476 # the contents of any function named "usage".
477 sc_prohibit_continued_string_alpha_in_column_1
:
478 @perl
-0777 -ne
'$(_continued_string_col_1)' \
479 $$($(VC_LIST_EXCEPT
) | grep
'\.[ch]$$') \
480 ||
{ echo
'$(ME): continued string with word in first column' \
482 # Use this to list offending lines:
483 # git ls-files |grep '\.[ch]$' | xargs \
484 # perl -n -0777 -e 's/^usage.*?\n}//ms;/\\\n\w/ and print "$ARGV\n"' \
485 # | xargs grep -A1 '\\$'|grep '\.[ch][:-][_a-zA-Z]'
488 ###########################################################
489 _p0
= \
([^
"'/]\|"\
([^
\"]\|
[\
].\
)*"\|'\([^\']\|[\].\)*'
490 _pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\
([^
\']\|
[\
].\
)*'\)*
491 _pre_anchored = ^\($(_pre)\)
492 _comment_and_close = [^*]\|[*][^/*]\)*[*][*]*/
493 # help font-lock mode: '
495 # A sed expression that removes ANSI C and ISO C99 comments.
496 # Derived from the one in GNU gettext's 'moopp' preprocessor.
497 _sed_remove_comments
= \
501 s
,$(_pre_anchored
)//.
*,\
1,; \
503 s
,$(_pre_anchored
)/[*]\
($(_comment_and_close
),\
1 ,; \
506 s
,$(_pre_anchored
)/[*].
*,\
1 ,; \
510 s
,^\
($(_comment_and_close
),,; \
518 # Quote all single quotes.
519 _sed_rm_comments_q
= $(subst ','\'',$(_sed_remove_comments))
520 # help font-lock mode: '
522 _space_before_paren_exempt
=?
\\n
\\$$
523 _space_before_paren_exempt
= \
524 (^
*\
#|\\n\\$$|%s\(to %s|(date|group|character)\(s\))
525 # Ensure that there is a space before each open parenthesis in C code.
526 sc_space_before_open_paren
:
527 @if
$(VC_LIST_EXCEPT
) | grep
-l
'\.[ch]$$' > /dev
/null
; then \
529 for c in
$$($(VC_LIST_EXCEPT
) | grep
'\.[ch]$$'); do \
530 sed
'$(_sed_rm_comments_q)' $$c 2>/dev
/null \
531 | grep
-i
'[[:alnum:]](' \
532 | grep
-vE
'$(_space_before_paren_exempt)' \
533 | grep .
&& { fail
=1; echo
"*** $$c"; }; \
536 { echo
'$(ME): the above files lack a space-before-open-paren' \
537 1>&2; exit
1; } ||
:; \
541 # Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
542 # Use STREQ_LEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
544 @grep
-nE
'! *str''ncmp *\(|\<str''ncmp *\(.+\) *[!=]=' \
545 $$($(VC_LIST_EXCEPT
)) \
546 | grep
-vE
':# *define STR(N?EQ_LEN|PREFIX)\(' && \
547 { echo
'$(ME): use STREQ_LEN or STRPREFIX instead of str''ncmp' \
550 # Enforce recommended preprocessor indentation style.
551 sc_preprocessor_indentation
:
552 @if cppi
--version
>/dev
/null
2>&1; then \
553 $(VC_LIST_EXCEPT
) | grep
'\.[ch]$$' | xargs cppi
-a
-c \
554 ||
{ echo
'$(ME): incorrect preprocessor indentation' 1>&2; \
557 echo
'$(ME): skipping test $@: cppi not installed' 1>&2; \
560 # THANKS.in is a list of name/email pairs for people who are mentioned in
561 # commit logs (and generated ChangeLog), but who are not also listed as an
562 # author of a commit. Name/email pairs of commit authors are automatically
563 # extracted from the repository. As a very minor factorization, when
564 # someone who was initially listed only in THANKS.in later authors a commit,
565 # this rule detects that their pair may now be removed from THANKS.in.
566 sc_THANKS_in_duplicates
:
567 @
{ git log
--pretty
=format
:%aN |
sort -u
; \
568 cut
-b-36 THANKS.in | sed
'/^$$/d;s/ *$$//'; } \
569 |
sort | uniq
-d | grep . \
570 && { echo
'$(ME): remove the above names from THANKS.in' \
573 # Look for developer diagnostics that are marked for translation.
574 # This won't find any for which devmsg's format string is on a separate line.
575 sc_marked_devdiagnostics
:
576 @prohibit
='\<devmsg *\(.*_\(' \
577 halt
='found marked developer diagnostic(s)' \
580 # Ensure we keep hex constants as 4 or 8 bytes for consistency
581 # and so that make src/fs-magic-compare works consistently
583 @sed
-n
's|.*/\* \(0x[0-9A-Fa-f]\{1,\}\) .*\*/|\1|p' \
584 $(srcdir)/src
/stat.c | grep
-Ev
'^0x([0-9A-F]{4}){1,2}$$' \
585 && { echo
'$(ME): Constants in src/stat.c should be 4 or 8' \
586 'upper-case chars' 1>&2; exit
1; } ||
:
588 # Override the default Cc: used in generating an announcement.
589 announcement_Cc_
= $(translation_project_
), \
590 coreutils@gnu.org
, coreutils-announce@gnu.org
592 -include $(srcdir)/dist-check.mk
594 update-copyright-env
= \
595 UPDATE_COPYRIGHT_FORCE
=1 \
596 UPDATE_COPYRIGHT_USE_INTERVALS
=2 \
597 UPDATE_COPYRIGHT_MAX_LINE_LENGTH
=79
599 # List syntax-check exemptions.
600 exclude_file_name_regexp--sc_space_tab
= \
601 ^
(tests
/pr
/|tests
/misc
/nl\.sh
$$|gl
/.
*\.diff
$$|man
/help2man
$$)
602 exclude_file_name_regexp--sc_bindtextdomain
= \
603 ^
(gl
/.
*|lib
/euidaccess-stat|src
/make-prime-list
)\.c
$$
604 exclude_file_name_regexp--sc_trailing_blank
= ^
(tests
/pr
/|man
/help2man
)
605 exclude_file_name_regexp--sc_system_h_headers
= \
606 ^src
/((system|copy
)\.h|make-prime-list\.c
)$$
608 _src
= (false|lbracket|ls-
(dir|ls|vdir
)|tac-pipe|uname-
(arch|uname
))
609 exclude_file_name_regexp--sc_require_config_h_first
= \
610 (^lib
/buffer-lcm\.c|src
/$(_src
)\.c
)$$
611 exclude_file_name_regexp--sc_require_config_h
= \
612 $(exclude_file_name_regexp--sc_require_config_h_first
)
614 exclude_file_name_regexp--sc_po_check
= ^
(gl
/|man
/help2man
)
615 exclude_file_name_regexp--sc_prohibit_always-defined_macros
= \
616 ^src
/(seq|remove
)\.c
$$
617 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF
= ^tests
/pr
/
618 exclude_file_name_regexp--sc_program_name
= \
619 ^
(gl
/.
*|lib
/euidaccess-stat|src
/make-prime-list
)\.c
$$
620 exclude_file_name_regexp--sc_file_system
= \
621 NEWS|^
(init\.cfg|src
/df\.c|tests
/df
/df-P\.sh|tests
/df
/df-output\.sh
)$$
622 exclude_file_name_regexp--sc_prohibit_always_true_header_tests
= \
624 exclude_file_name_regexp--sc_prohibit_fail_0
= \
625 (^.
*/git-hooks
/commit-msg|^tests
/init\.sh|Makefile\.am|\.mk|.
*\.texi
)$$
626 exclude_file_name_regexp--sc_prohibit_atoi_atof
= ^lib
/euidaccess-stat\.c
$$
628 # longlong.h is maintained elsewhere.
629 _ll
= ^src
/longlong\.h
$$
630 exclude_file_name_regexp--sc_useless_cpp_parens
= $(_ll
)
631 exclude_file_name_regexp--sc_long_lines
= $(_ll
)
632 exclude_file_name_regexp--sc_space_before_open_paren
= $(_ll
)
634 tbi_1
= ^tests
/pr
/|
(^gl
/lib
/reg.
*\.c\.diff|\.mk|^man
/help2man
)$$
635 tbi_2
= ^scripts
/git-hooks
/(pre-commit|pre-applypatch|applypatch-msg
)$$
636 tbi_3
= (GNU
)?
[Mm
]akefile
(\.am
)?
$$|
$(_ll
)
637 exclude_file_name_regexp--sc_prohibit_tab_based_indentation
= \
638 $(tbi_1
)|
$(tbi_2
)|
$(tbi_3
)
640 exclude_file_name_regexp--sc_preprocessor_indentation
= \
641 ^
(gl
/lib
/rand-isaac\.
[ch
]|gl
/tests
/test-rand-isaac\.c
)$$|
$(_ll
)
642 exclude_file_name_regexp--sc_prohibit_stat_st_blocks
= \
643 ^
(src
/system\.h|tests
/du
/2g\.sh
)$$
645 exclude_file_name_regexp--sc_prohibit_continued_string_alpha_in_column_1
= \
646 ^src
/(system\.h|od\.c|printf\.c|getlimits\.c
)$$
648 exclude_file_name_regexp--sc_prohibit_test_backticks
= \
649 ^tests
/(local\.mk|
(init|misc
/stdbuf|factor
/create-test
)\.sh
)$$
651 # Exempt test.c, since it's nominally shared, and relatively static.
652 exclude_file_name_regexp--sc_prohibit_operator_at_end_of_line
= \
653 ^src
/(ptx|
test|head
)\.c
$$
655 exclude_file_name_regexp--sc_error_message_uppercase
= ^src
/factor\.c
$$
656 exclude_file_name_regexp--sc_prohibit_atoi_atof
= ^src
/make-prime-list\.c
$$
658 # Exception here as we don't want __attribute elided on non GCC
659 exclude_file_name_regexp--sc_prohibit-gl-attributes
= ^src
/libstdbuf\.c
$$
661 # Augment AM_CFLAGS to include our per-directory options:
662 AM_CFLAGS
+= $($(@D
)_CFLAGS
)
664 src_CFLAGS
= $(WARN_CFLAGS
)
665 lib_CFLAGS
= $(GNULIB_WARN_CFLAGS
)
666 gnulib-tests_CFLAGS
= $(GNULIB_TEST_WARN_CFLAGS
)
668 # Configuration to make the tight-scope syntax-check rule work with
669 # non-recursive make.
670 export _gl_TS_headers
= $(srcdir)/cfg.mk
672 _gl_TS_obj_files
= src
/*.
$(OBJEXT
)
673 _gl_TS_other_headers
= src
/*.h
675 # Tell the tight_scope rule about an exceptional "extern" variable.
676 # Normally, the rule would detect its declaration, but that uses a
677 # different name, __clz_tab.
678 _gl_TS_unmarked_extern_vars
= factor_clz_tab