df: add --output=file to directly output specified arguments
[coreutils.git] / cfg.mk
blob788c351344cae187a3ff65b5cf164bce698e4627
1 # Customize maint.mk -*- makefile -*-
2 # Copyright (C) 2003-2013 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.
32 export VERBOSE = yes
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
40 # 5129388 7
41 # 5036524 7e
42 # 5017476 8
43 # 5010604 9
44 # 4923016 8e
45 # 4914152 9e
46 export XZ_OPT = -8e
48 old_NEWS_hash = 6ae04dc3907ea1290f12e6b1507cc42c
50 # Add an exemption for sc_makefile_at_at_check.
51 _makefile_at_at_check_exceptions = ' && !/^cu_install_program =/'
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
58 sc_dd_O_FLAGS:
59 @rm -f $@.1 $@.2
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=; \
65 rm -f $@.1 $@.2; \
66 test "$$diff" \
67 && { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2; \
68 exit 1; } || :
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
73 sc_dd_max_sym_length:
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; \
83 exit 1; \
85 endif
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.
90 sc_prohibit_jm_in_m4:
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' \
94 1>&2; exit 1; } || :
96 # Ensure that each root-requiring test is run via the "check-root" rule.
97 sc_root_tests:
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; \
102 rm -f $$t1 $$t2; \
103 exit $$st
105 # Ensure that all version-controlled test cases are listed in $(all_tests).
106 sc_tests_list_consistency:
107 @bs="\\"; \
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; \
112 cd $(top_srcdir); \
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.
119 sc_tests_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 . \
124 && exit 1; :
126 # Create a list of regular expressions matching the names
127 # of files included from system.h. Exclude a couple.
128 .re-list:
129 @sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
130 | grep -Ev 'sys/(param|file)\.h' \
131 | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
132 > $@-t
133 @mv $@-t $@
135 define gl_trap_
136 Exit () { set +e; (exit $$1); exit $$1; }; \
137 for sig in 1 2 3 13 15; do \
138 eval "trap 'Exit $$(expr $$sig + 128)' $$sig"; \
139 done
140 endef
142 # Files in src/ should not include directly any of
143 # the headers already included via system.h.
144 sc_system_h_headers: .re-list
145 @if test -f $(srcdir)/src/system.h; then \
146 trap 'rc=$$?; rm -f .re-list; exit $$rc' 0; \
147 $(gl_trap_); \
148 grep -nE -f .re-list \
149 $$($(VC_LIST_EXCEPT) | grep '^\($(srcdir)/\)\?src/') \
150 && { echo '$(ME): the above are already included via system.h'\
151 1>&2; exit 1; } || :; \
154 sc_sun_os_names:
155 @grep -nEi \
156 'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
157 $$($(VC_LIST_EXCEPT)) && \
158 { echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
159 exit 1; } || :
161 # Ensure that the list of programs and author names is accurate.
162 # We need a UTF8 locale. If a lack of locale support or a missing
163 # translation inhibits printing of UTF-8 names, just skip this test.
164 au_dotdot = authors-dotdot
165 au_actual = authors-actual
166 sc_check-AUTHORS: $(all_programs)
167 @locale=en_US.UTF-8; \
168 LC_ALL=$$locale ./src/cat --version \
169 | grep ' Torbjorn ' > /dev/null \
170 && { echo "$@: skipping this check"; exit 0; }; \
171 rm -f $(au_actual) $(au_dotdot); \
172 for i in `ls $(all_programs) \
173 | sed -e 's,^src/,,' -e 's,$(EXEEXT)$$,,' \
174 | sed /libstdbuf/d \
175 | $(ASSORT) -u`; do \
176 test "$$i" = '[' && continue; \
177 exe=$$i; \
178 if test "$$i" = install; then \
179 exe=ginstall; \
180 elif test "$$i" = test; then \
181 exe='['; \
182 fi; \
183 LC_ALL=$$locale ./src/$$exe --version \
184 | perl -0 -p -e 's/,\n/, /gm' \
185 | sed -n -e '/Written by /{ s//'"$$i"': /;' \
186 -e 's/,* and /, /; s/\.$$//; p; }'; \
187 done > $(au_actual) && \
188 sed -n '/^[^ ][^ ]*:/p' $(srcdir)/AUTHORS > $(au_dotdot) \
189 && diff $(au_actual) $(au_dotdot) \
190 && rm -f $(au_actual) $(au_dotdot)
192 # Each program with a non-ASCII author name must link with LIBICONV.
193 sc_check-I18N-AUTHORS:
194 @cd $(srcdir)/src && \
195 for i in $$(git grep -l -w proper_name_utf8 *.c|sed 's/\.c//'); do \
196 grep -E "^src_$${i}_LDADD"' .?= .*\$$\(LIBICONV\)' local.mk \
197 > /dev/null \
198 || { echo "$(ME): link rules for $$i do not include" \
199 '$$(LIBICONV)' 1>&2; exit 1; }; \
200 done
202 # Ensure %j is not used for intmax_t as it's not universally supported.
203 # There are issues on HPUX for example. But note that %ju was used between
204 # coreutils 8.13 (2011-10) and 8.20 (2012-10) without any reported issue,
205 # and the particular issue this check is associated with was for %*jx.
206 # So we may be able to relax this restriction soon.
207 sc_prohibit-j-printf-format:
208 @cd $(srcdir)/src && GIT_PAGER= git grep -n '%[0*]*j[udx]' *.c \
209 && { echo '$(ME): Use PRI*MAX instead of %j' 1>&2; exit 1; } \
210 || :
212 # Ensure the alternative __attribute (keyword) form isn't used as
213 # that form is not elided where required. Also ensure that we don't
214 # directly use attributes already defined by gnulib.
215 # TODO: move the check for _GL... attributes to gnulib.
216 sc_prohibit-gl-attributes:
217 @cd $(srcdir) && GIT_PAGER= git grep -En \
218 "__attribute |__(unused|pure|const)__" src gl/lib/*.[ch] \
219 && { echo '$(ME): Use _GL... attribute macros' 1>&2; exit 1; } \
220 || :
222 # Look for lines longer than 80 characters, except omit:
223 # - program-generated long lines in diff headers,
224 # - the help2man script copied from upstream,
225 # - tests involving long checksum lines, and
226 # - the 'pr' test cases.
227 LINE_LEN_MAX = 80
228 FILTER_LONG_LINES = \
229 /^[^:]*\.diff:[^:]*:@@ / d; \
230 \|^[^:]*man/help2man:| d; \
231 \|^[^:]*tests/misc/sha[0-9]*sum.*\.pl[-:]| d; \
232 \|^[^:]*tests/pr/|{ \|^[^:]*tests/pr/pr-tests:| !d; };
233 sc_long_lines:
234 @files=$$($(VC_LIST_EXCEPT)) \
235 halt='line(s) with more than $(LINE_LEN_MAX) characters; reindent'; \
236 for file in $$files; do \
237 expand $$file | grep -nE '^.{$(LINE_LEN_MAX)}.' | \
238 sed -e "s|^|$$file:|" -e '$(FILTER_LONG_LINES)'; \
239 done | grep . && { msg="$$halt" $(_sc_say_and_exit) } || :
241 # Option descriptions should not start with a capital letter.
242 # One could grep source directly as follows:
243 # grep -E " {2,6}-.*[^.] [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$')
244 # but that would miss descriptions not on the same line as the -option.
245 sc_option_desc_uppercase: $(ALL_MANS)
246 @grep '^\\fB\\-' -A1 man/*.1 | LC_ALL=C grep '\.1.[A-Z][a-z]' \
247 && { echo 1>&2 '$@: found initial capitals in --help'; exit 1; } || :
249 # Ensure all man/*.[1x] files are present.
250 sc_man_file_correlation: check-x-vs-1 check-programs-vs-x
252 # Ensure that for each .x file in the 'man/' subdirectory, there is a
253 # corresponding .1 file in the definition of $(EXTRA_MANS).
254 # But since that expansion usually lacks programs like arch and hostname,
255 # add them here manually.
256 .PHONY: check-x-vs-1
257 check-x-vs-1:
258 @PATH=./src$(PATH_SEPARATOR)$$PATH; export PATH; \
259 t=$@-t; \
260 (cd $(srcdir)/man && ls -1 *.x) \
261 | sed 's/\.x$$//' | $(ASSORT) > $$t; \
262 (echo $(patsubst man/%,%,$(ALL_MANS)) \
263 | tr -s ' ' '\n' | sed 's/\.1$$//') \
264 | $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; }; \
265 rm $$t
267 # Writing a portable rule to generate a manpage like '[.1' would be
268 # a nightmare, so filter that out.
269 all-progs-but-lbracket = $(filter-out [,$(patsubst src/%,%,$(all_programs)))
271 # Ensure that for each coreutils program there is a corresponding
272 # '.x' file in the 'man/' subdirectory.
273 .PHONY: check-programs-vs-x
274 check-programs-vs-x:
275 @status=0; \
276 for p in dummy $(all-progs-but-lbracket); do \
277 case $$p in *.so) continue;; esac; \
278 test $$p = dummy && continue; \
279 test $$p = ginstall && p=install || : ; \
280 test -f $(srcdir)/man/$$p.x \
281 || { echo missing $$p.x 1>&2; status=1; }; \
282 done; \
283 exit $$status
285 # Ensure that the end of each release's section is marked by two empty lines.
286 sc_NEWS_two_empty_lines:
287 @sed -n 4,/Noteworthy/p $(srcdir)/NEWS \
288 | perl -n0e '/(^|\n)\n\n\* Noteworthy/ or exit 1' \
289 || { echo '$(ME): use two empty lines to separate NEWS sections' \
290 1>&2; exit 1; } || :
292 # With split lines, don't leave an operator at end of line.
293 # Instead, put it on the following line, where it is more apparent.
294 # Don't bother checking for "*" at end of line, since it provokes
295 # far too many false positives, matching constructs like "TYPE *".
296 # Similarly, omit "=" (initializers).
297 binop_re_ ?= [-/+^!<>]|[-/+*^!<>=]=|&&?|\|\|?|<<=?|>>=?
298 sc_prohibit_operator_at_end_of_line:
299 @prohibit='. ($(binop_re_))$$' \
300 in_vc_files='\.[chly]$$' \
301 halt='found operator at end of line' \
302 $(_sc_search_regexp)
304 # Don't use "readlink" or "readlinkat" directly
305 sc_prohibit_readlink:
306 @prohibit='\<readlink(at)? \(' \
307 halt='do not use readlink(at); use via xreadlink or areadlink*' \
308 $(_sc_search_regexp)
310 # Don't use address of "stat" or "lstat" functions
311 sc_prohibit_stat_macro_address:
312 @prohibit='\<l?stat '':|&l?stat\>' \
313 halt='stat() and lstat() may be function-like macros' \
314 $(_sc_search_regexp)
316 # Ensure that date's --help output stays in sync with the info
317 # documentation for GNU strftime. The only exception is %N,
318 # which date accepts but GNU strftime does not.
319 extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
320 sc_strftime_check:
321 @if test -f $(srcdir)/src/date.c; then \
322 grep '^ %. ' $(srcdir)/src/date.c | sort \
323 | $(extract_char) > $@-src; \
324 { echo N; \
325 info libc date calendar format 2>/dev/null|grep '^ `%.'\'\
326 | $(extract_char); } | sort > $@-info; \
327 if test $$(stat --format %s $@-info) != 2; then \
328 diff -u $@-src $@-info || exit 1; \
329 else \
330 echo '$(ME): skipping $@: libc info not installed' 1>&2; \
331 fi; \
332 rm -f $@-src $@-info; \
335 # Indent only with spaces.
336 sc_prohibit_tab_based_indentation:
337 @prohibit='^ * ' \
338 halt='TAB in indentation; use only spaces' \
339 $(_sc_search_regexp)
341 # The SEE ALSO section of a man page should not be terminated with
342 # a period. Check the first line after each "SEE ALSO" line in man/*.x:
343 sc_prohibit_man_see_also_period:
344 @grep -nB1 '\.$$' $$($(VC_LIST_EXCEPT) | grep 'man/.*\.x$$') \
345 | grep -A1 -e '-\[SEE ALSO\]' | grep '\.$$' && \
346 { echo '$(ME): do not end "SEE ALSO" section with a period' \
347 1>&2; exit 1; } || :
349 # Don't use "indent-tabs-mode: nil" anymore. No longer needed.
350 sc_prohibit_emacs__indent_tabs_mode__setting:
351 @prohibit='^( *[*#] *)?indent-tabs-mode:' \
352 halt='use of emacs indent-tabs-mode: setting' \
353 $(_sc_search_regexp)
355 # Ensure that tests don't include a redundant fail=0.
356 sc_prohibit_fail_0:
357 @prohibit='\<fail=0\>' \
358 halt='fail=0 initialization' \
359 $(_sc_search_regexp)
361 # The mode part of a setfacl -m option argument must be three bytes long.
362 # I.e., an argument of user:bin:rw or user:bin:r will make Solaris 10's
363 # setfacl reject it with: "Unrecognized character found in mode field".
364 # Use hyphens to give it a length of 3: "...:rw-" or "...:r--".
365 sc_prohibit_short_facl_mode_spec:
366 @prohibit='\<setfacl .*-m.*:.*:[rwx-]{1,2} ' \
367 halt='setfacl mode string length < 3; extend with hyphen(s)' \
368 $(_sc_search_regexp)
370 # Ensure that "stdio--.h" is used where appropriate.
371 sc_require_stdio_safer:
372 @if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
373 files=$$(grep -l '\bfreopen \?(' $$($(VC_LIST_EXCEPT) \
374 | grep '\.[ch]$$')); \
375 test -n "$$files" && grep -LE 'include "stdio--.h"' $$files \
376 | grep . && \
377 { echo '$(ME): the above files should use "stdio--.h"' \
378 1>&2; exit 1; } || :; \
379 else :; \
382 sc_prohibit_perl_hash_quotes:
383 @prohibit="\{'[A-Z_]+' *[=}]" \
384 halt="in Perl code, write \$$hash{KEY}, not \$$hash{'K''EY'}" \
385 $(_sc_search_regexp)
387 # Prefer xnanosleep over other less-precise sleep methods
388 sc_prohibit_sleep:
389 @prohibit='\<(nano|u)?sleep \(' \
390 halt='prefer xnanosleep over other sleep interfaces' \
391 $(_sc_search_regexp)
393 # Use print_ver_ (from init.cfg), not open-coded $VERBOSE check.
394 sc_prohibit_verbose_version:
395 @prohibit='test "\$$VERBOSE" = yes && .* --version' \
396 halt='use the print_ver_ function instead...' \
397 $(_sc_search_regexp)
399 # Use framework_failure_, not the old name without the trailing underscore.
400 sc_prohibit_framework_failure:
401 @prohibit='\<framework_''failure\>' \
402 halt='use framework_failure_ instead' \
403 $(_sc_search_regexp)
405 # Prohibit the use of `...` in tests/. Use $(...) instead.
406 sc_prohibit_test_backticks:
407 @prohibit='`' in_vc_files='^tests/' \
408 halt='use $$(...), not `...` in tests/' \
409 $(_sc_search_regexp)
411 # Programs like sort, ls, expr use PROG_FAILURE in place of EXIT_FAILURE.
412 # Others, use the EXIT_CANCELED, EXIT_ENOENT, etc. macros defined in system.h.
413 # In those programs, ensure that EXIT_FAILURE is not used by mistake.
414 sc_some_programs_must_avoid_exit_failure:
415 @grep -nw EXIT_FAILURE \
416 $$(git grep -El '[^T]_FAILURE|EXIT_CANCELED' src) \
417 | grep -vE '= EXIT_FAILURE|exit \(.* \?' | grep . \
418 && { echo '$(ME): do not use EXIT_FAILURE in the above' \
419 1>&2; exit 1; } || :
421 # Ensure that tests call the require_ulimit_v_ function if using ulimit -v
422 sc_prohibit_test_ulimit_without_require_:
423 @(git grep -l require_ulimit_v_ tests; \
424 git grep -l 'ulimit -v' tests) \
425 | sort | uniq -u | grep . && { echo "$(ME): the above test(s)"\
426 " should match require_ulimit_v_ with ulimit -v" 1>&2; exit 1; } || :
428 # Ensure that tests call the print_ver_ function for programs which are
429 # actually used in that test.
430 sc_prohibit_test_calls_print_ver_with_irrelevant_argument:
431 @git grep -w print_ver_ tests \
432 | sed 's#:print_ver_##' \
433 | { fail=0; \
434 while read file name; do \
435 for i in $$name; do \
436 case "$$i" in install) i=ginstall;; esac; \
437 grep -w "$$i" $$file|grep -vw print_ver_|grep -q . \
438 || { fail=1; \
439 echo "*** Test: $$file, offending: $$i." 1>&2; };\
440 done; \
441 done; \
442 test $$fail = 0 || exit 1; \
443 } || { echo "$(ME): the above test(s) call print_ver_ for" \
444 "program(s) they don't use" 1>&2; exit 1; }
446 # Exempt the contents of any usage function from the following.
447 _continued_string_col_1 = \
448 s/^usage .*?\n}//ms;/\\\n\w/ and print ("$$ARGV\n"),$$e=1;END{$$e||=0;exit $$e}
449 # Ding any source file that has a continued string with an alphabetic in the
450 # first column of the following line. We prohibit them because they usually
451 # trigger false positives in tools that try to map an arbitrary line number
452 # to the enclosing function name. Of course, very many strings do precisely
453 # this, *when they are part of the usage function*. That is why we exempt
454 # the contents of any function named "usage".
455 sc_prohibit_continued_string_alpha_in_column_1:
456 @perl -0777 -ne '$(_continued_string_col_1)' \
457 $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$') \
458 || { echo '$(ME): continued string with word in first column' \
459 1>&2; exit 1; } || :
460 # Use this to list offending lines:
461 # git ls-files |grep '\.[ch]$' | xargs \
462 # perl -n -0777 -e 's/^usage.*?\n}//ms;/\\\n\w/ and print "$ARGV\n"' \
463 # | xargs grep -A1 '\\$'|grep '\.[ch][:-][_a-zA-Z]'
466 ###########################################################
467 _p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
468 _pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
469 _pre_anchored = ^\($(_pre)\)
470 _comment_and_close = [^*]\|[*][^/*]\)*[*][*]*/
471 # help font-lock mode: '
473 # A sed expression that removes ANSI C and ISO C99 comments.
474 # Derived from the one in GNU gettext's 'moopp' preprocessor.
475 _sed_remove_comments = \
476 /[/][/*]/{ \
477 ta; \
478 :a; \
479 s,$(_pre_anchored)//.*,\1,; \
480 te; \
481 s,$(_pre_anchored)/[*]\($(_comment_and_close),\1 ,; \
482 ta; \
483 /^$(_pre)[/][*]/{ \
484 s,$(_pre_anchored)/[*].*,\1 ,; \
485 tu; \
486 :u; \
487 n; \
488 s,^\($(_comment_and_close),,; \
489 tv; \
490 s,^.*$$,,; \
491 bu; \
492 :v; \
493 }; \
494 :e; \
496 # Quote all single quotes.
497 _sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
498 # help font-lock mode: '
500 _space_before_paren_exempt =? \\n\\$$
501 _space_before_paren_exempt = \
502 (^ *\#|\\n\\$$|%s\(to %s|(date|group|character)\(s\))
503 # Ensure that there is a space before each open parenthesis in C code.
504 sc_space_before_open_paren:
505 @if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
506 fail=0; \
507 for c in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do \
508 sed '$(_sed_rm_comments_q)' $$c 2>/dev/null \
509 | grep -i '[[:alnum:]](' \
510 | grep -vE '$(_space_before_paren_exempt)' \
511 | grep . && { fail=1; echo "*** $$c"; }; \
512 done; \
513 test $$fail = 1 && \
514 { echo '$(ME): the above files lack a space-before-open-paren' \
515 1>&2; exit 1; } || :; \
516 else :; \
519 # Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
520 # Use STREQ_LEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
521 sc_prohibit_strncmp:
522 @grep -nE '! *str''ncmp *\(|\<str''ncmp *\(.+\) *[!=]=' \
523 $$($(VC_LIST_EXCEPT)) \
524 | grep -vE ':# *define STR(N?EQ_LEN|PREFIX)\(' && \
525 { echo '$(ME): use STREQ_LEN or STRPREFIX instead of str''ncmp' \
526 1>&2; exit 1; } || :
528 # Enforce recommended preprocessor indentation style.
529 sc_preprocessor_indentation:
530 @if cppi --version >/dev/null 2>&1; then \
531 $(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c \
532 || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
533 exit 1; }; \
534 else \
535 echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
538 # THANKS.in is a list of name/email pairs for people who are mentioned in
539 # commit logs (and generated ChangeLog), but who are not also listed as an
540 # author of a commit. Name/email pairs of commit authors are automatically
541 # extracted from the repository. As a very minor factorization, when
542 # someone who was initially listed only in THANKS.in later authors a commit,
543 # this rule detects that their pair may now be removed from THANKS.in.
544 sc_THANKS_in_duplicates:
545 @{ git log --pretty=format:%aN | sort -u; \
546 cut -b-36 THANKS.in | sed '/^$$/d;s/ *$$//'; } \
547 | sort | uniq -d | grep . \
548 && { echo '$(ME): remove the above names from THANKS.in' \
549 1>&2; exit 1; } || :
551 # Look for developer diagnostics that are marked for translation.
552 # This won't find any for which devmsg's format string is on a separate line.
553 sc_marked_devdiagnostics:
554 @prohibit='\<devmsg *\(.*_\(' \
555 halt='found marked developer diagnostic(s)' \
556 $(_sc_search_regexp)
558 # Override the default Cc: used in generating an announcement.
559 announcement_Cc_ = $(translation_project_), \
560 coreutils@gnu.org, coreutils-announce@gnu.org
562 -include $(srcdir)/dist-check.mk
564 update-copyright-env = \
565 UPDATE_COPYRIGHT_FORCE=1 \
566 UPDATE_COPYRIGHT_USE_INTERVALS=2 \
567 UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
569 # List syntax-check exemptions.
570 exclude_file_name_regexp--sc_space_tab = \
571 ^(tests/pr/|tests/misc/nl\.sh$$|gl/.*\.diff$$|man/help2man$$)
572 exclude_file_name_regexp--sc_bindtextdomain = \
573 ^(gl/.*|lib/euidaccess-stat|src/make-prime-list)\.c$$
574 exclude_file_name_regexp--sc_trailing_blank = ^(tests/pr/|man/help2man)
575 exclude_file_name_regexp--sc_system_h_headers = \
576 ^src/((system|copy)\.h|libstdbuf\.c|make-prime-list\.c)$$
578 _src = (false|lbracket|ls-(dir|ls|vdir)|tac-pipe|uname-(arch|uname))
579 exclude_file_name_regexp--sc_require_config_h_first = \
580 (^lib/buffer-lcm\.c|src/$(_src)\.c)$$
581 exclude_file_name_regexp--sc_require_config_h = \
582 $(exclude_file_name_regexp--sc_require_config_h_first)
584 exclude_file_name_regexp--sc_po_check = ^(gl/|man/help2man)
585 exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
586 ^src/(seq|remove)\.c$$
587 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^tests/pr/
588 exclude_file_name_regexp--sc_program_name = \
589 ^(gl/.*|lib/euidaccess-stat|src/make-prime-list)\.c$$
590 exclude_file_name_regexp--sc_file_system = \
591 NEWS|^(init\.cfg|src/df\.c|tests/df/df-P\.sh|tests/df/df-output\.sh)$$
592 exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
593 ^m4/stat-prog\.m4$$
594 exclude_file_name_regexp--sc_prohibit_fail_0 = \
595 (^.*/git-hooks/commit-msg|^tests/init\.sh|Makefile\.am|\.mk|.*\.texi)$$
596 exclude_file_name_regexp--sc_prohibit_atoi_atof = ^lib/euidaccess-stat\.c$$
598 # longlong.h is maintained elsewhere.
599 _ll = ^src/longlong\.h$$
600 exclude_file_name_regexp--sc_useless_cpp_parens = $(_ll)
601 exclude_file_name_regexp--sc_long_lines = $(_ll)
602 exclude_file_name_regexp--sc_space_before_open_paren = $(_ll)
604 tbi_1 = ^tests/pr/|(^gl/lib/reg.*\.c\.diff|\.mk|^man/help2man)$$
605 tbi_2 = ^scripts/git-hooks/(pre-commit|pre-applypatch|applypatch-msg)$$
606 tbi_3 = (GNU)?[Mm]akefile(\.am)?$$|$(_ll)
607 exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \
608 $(tbi_1)|$(tbi_2)|$(tbi_3)
610 exclude_file_name_regexp--sc_preprocessor_indentation = \
611 ^(gl/lib/rand-isaac\.[ch]|gl/tests/test-rand-isaac\.c)$$|$(_ll)
612 exclude_file_name_regexp--sc_prohibit_stat_st_blocks = \
613 ^(src/system\.h|tests/du/2g\.sh)$$
615 exclude_file_name_regexp--sc_prohibit_continued_string_alpha_in_column_1 = \
616 ^src/(system\.h|od\.c|printf\.c|getlimits\.c)$$
618 exclude_file_name_regexp--sc_prohibit_test_backticks = \
619 ^tests/(local\.mk|(init|misc/stdbuf|factor/create-test)\.sh)$$
621 # Exempt test.c, since it's nominally shared, and relatively static.
622 exclude_file_name_regexp--sc_prohibit_operator_at_end_of_line = \
623 ^src/(ptx|test|head)\.c$$
625 exclude_file_name_regexp--sc_error_message_uppercase = ^src/factor\.c$$
626 exclude_file_name_regexp--sc_prohibit_atoi_atof = ^src/make-prime-list\.c$$
628 # Augment AM_CFLAGS to include our per-directory options:
629 AM_CFLAGS += $($(@D)_CFLAGS)
631 src_CFLAGS = $(WARN_CFLAGS)
632 lib_CFLAGS = $(GNULIB_WARN_CFLAGS)
633 gnulib-tests_CFLAGS = $(GNULIB_TEST_WARN_CFLAGS)
635 # Configuration to make the tight-scope syntax-check rule work with
636 # non-recursive make.
637 export _gl_TS_headers = $(srcdir)/cfg.mk
638 _gl_TS_dir = .
639 _gl_TS_obj_files = src/*.$(OBJEXT)
640 _gl_TS_other_headers = src/*.h
642 # Tell the tight_scope rule about an exceptional "extern" variable.
643 # Normally, the rule would detect its declaration, but that uses a
644 # different name, __clz_tab.
645 _gl_TS_unmarked_extern_vars = factor_clz_tab