build: move definition of 'all_programs' in cfg.mk
[platform/upstream/coreutils.git] / cfg.mk
1 # Customize maint.mk                           -*- makefile -*-
2 # Copyright (C) 2003-2012 Free Software Foundation, Inc.
3
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.
8
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.
13
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/>.
16
17 # Used in maint.mk's web-manual rule
18 manual_title = Core GNU utilities
19
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)
23
24 # Tests not to run as part of "make distcheck".
25 local-checks-to-skip =
26
27 # Tools used to bootstrap this package, used for "announcement".
28 bootstrap-tools = autoconf,automake,gnulib,bison
29
30 # Now that we have better tests, make this the default.
31 export VERBOSE = yes
32
33 # Comparing tarball sizes compressed using different xz presets, we see that
34 # an -8e-compressed tarball is only 9KiB larger than the -9e-compressed one.
35 # Using -8e is preferred, since that lets the decompression process use half
36 # the memory (32MiB rather than 64MiB).
37 # $ for i in {7,8,9}{e,}; do \
38 #     (n=$(xz -$i < coreutils-8.15*.tar|wc -c);echo $n $i) & done |sort -nr
39 # 5129388 7
40 # 5036524 7e
41 # 5017476 8
42 # 5010604 9
43 # 4923016 8e
44 # 4914152 9e
45 export XZ_OPT = -8e
46
47 old_NEWS_hash = a99128b9985b2e76bdcabf3e5d95ca1a
48
49 # Add an exemption for sc_makefile_at_at_check.
50 _makefile_at_at_check_exceptions = ' && !/^cu_install_program =/'
51
52 # Our help-version script is in a slightly different location.
53 _hv_file ?= $(srcdir)/tests/misc/help-version
54
55 # Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
56 dd = $(srcdir)/src/dd.c
57 sc_dd_O_FLAGS:
58         @rm -f $@.1 $@.2
59         @{ echo O_FULLBLOCK; echo O_NOCACHE;                            \
60           perl -nle '/^ +\| (O_\w*)$$/ and print $$1' $(dd); } | sort > $@.1
61         @{ echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
62           $(dd); } | sort > $@.2
63         @diff -u $@.1 $@.2 || diff=1 || diff=;                          \
64         rm -f $@.1 $@.2;                                                \
65         test "$$diff"                                                   \
66           && { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2;   \
67                exit 1; } || :
68
69 # Ensure that dd's definition of LONGEST_SYMBOL stays in sync
70 # with the strings from the two affected variables.
71 dd_c = $(srcdir)/src/dd.c
72 sc_dd_max_sym_length:
73 ifneq ($(wildcard $(dd_c)),)
74         @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
75                  sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) )      \
76                 |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p'         \
77               | wc --max-line-length);                          \
78         max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
79               |tr -d '"' | wc --max-line-length);               \
80         if test "$$len" = "$$max"; then :; else                 \
81           echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2;      \
82           exit 1;                                               \
83         fi
84 endif
85
86 # Many m4 macros names once began with 'jm_'.
87 # On 2004-04-13, they were all changed to start with gl_ instead.
88 # Make sure that none are inadvertently reintroduced.
89 sc_prohibit_jm_in_m4:
90         @grep -nE 'jm_[A-Z]'                                            \
91                 $$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) &&     \
92             { echo '$(ME): do not use jm_ in m4 macro names'            \
93               1>&2; exit 1; } || :
94
95 # Ensure that each root-requiring test is run via the "check-root" rule.
96 sc_root_tests:
97         @if test -d tests \
98               && grep check-root tests/Makefile.am>/dev/null 2>&1; then \
99         t1=sc-root.expected; t2=sc-root.actual;                         \
100         grep -nl '^ *require_root_$$'                                   \
101           $$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1;            \
102         sed -n '/^root_tests =[  ]*\\$$/,/[^\]$$/p'                     \
103           $(srcdir)/tests/Makefile.am                                   \
104             | sed 's/^  *//;/^root_tests =/d'                           \
105             | tr -s '\012\\' '  ' | fmt -1 | sort > $$t2;               \
106         diff -u $$t1 $$t2 || diff=1 || diff=;                           \
107         rm -f $$t1 $$t2;                                                \
108         test "$$diff"                                                   \
109           && { echo 'tests/Makefile.am: missing check-root action'>&2;  \
110                exit 1; } || :;                                          \
111         fi
112
113 # Create a list of regular expressions matching the names
114 # of files included from system.h.  Exclude a couple.
115 .re-list:
116         @sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
117           | grep -Ev 'sys/(param|file)\.h' \
118           | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
119           > $@-t
120         @mv $@-t $@
121
122 define gl_trap_
123   Exit () { set +e; (exit $$1); exit $$1; };                            \
124   for sig in 1 2 3 13 15; do                                            \
125     eval "trap 'Exit $$(expr $$sig + 128)' $$sig";                      \
126   done
127 endef
128
129 # Files in src/ should not include directly any of
130 # the headers already included via system.h.
131 sc_system_h_headers: .re-list
132         @if test -f $(srcdir)/src/system.h; then                        \
133           trap 'rc=$$?; rm -f .re-list; exit $$rc' 0;                   \
134           $(gl_trap_);                                                  \
135           grep -nE -f .re-list                                          \
136               $$($(VC_LIST_EXCEPT) | grep '^\($(srcdir)/\)\?src/')      \
137             && { echo '$(ME): the above are already included via system.h'\
138                   1>&2;  exit 1; } || :;                                \
139         fi
140
141 sc_sun_os_names:
142         @grep -nEi \
143             'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
144             $$($(VC_LIST_EXCEPT)) &&                                    \
145           { echo '$(ME): found misuse of Sun OS version numbers' 1>&2;  \
146             exit 1; } || :
147
148 ALL_RECURSIVE_TARGETS += sc_check-AUTHORS
149 sc_check-AUTHORS:
150         @$(MAKE) -s -C src _sc_check-AUTHORS
151
152 # Look for lines longer than 80 characters, except omit:
153 # - program-generated long lines in diff headers,
154 # - tests involving long checksum lines, and
155 # - the 'pr' test cases.
156 LINE_LEN_MAX = 80
157 FILTER_LONG_LINES =                                             \
158   /^[^:]*\.diff:[^:]*:@@ / d;                                   \
159   \|^[^:]*tests/misc/sha[0-9]*sum.*\.pl[-:]| d;                 \
160   \|^[^:]*tests/pr/|{ \|^[^:]*tests/pr/pr-tests:| !d; };
161 sc_long_lines:
162         @files=$$($(VC_LIST_EXCEPT))                                    \
163         halt='line(s) with more than $(LINE_LEN_MAX) characters; reindent'; \
164         for file in $$files; do                                         \
165           expand $$file | grep -nE '^.{$(LINE_LEN_MAX)}.' |             \
166           sed -e "s|^|$$file:|" -e '$(FILTER_LONG_LINES)';              \
167         done | grep . && { msg="$$halt" $(_sc_say_and_exit) } || :
168
169 # TODO: remove once the build system in 'src/' is merged with the
170 # top-level one.
171 .PHONY: all_programs
172 all_programs:
173         @cd ./src && $(MAKE) -s $@
174
175 # Option descriptions should not start with a capital letter.
176 # One could grep source directly as follows:
177 # grep -E " {2,6}-.*[^.]  [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$')
178 # but that would miss descriptions not on the same line as the -option.
179 ALL_RECURSIVE_TARGETS += sc_option_desc_uppercase
180 .PHONY: sc_option_desc_uppercase
181 sc_option_desc_uppercase:
182         @grep '^\\fB\\-' -A1 man/*.1 | LC_ALL=C grep '\.1.[A-Z][a-z]'   \
183           && { echo 1>&2 '$@: found initial capitals in --help'; exit 1; } || :
184 sc_option_desc_uppercase: $(dist_man1_MANS) \
185                           $(patsubst %,man/%.1,$(NO_INSTALL_PROGS_DEFAULT)) \
186                           all_programs
187
188 # Ensure all man/*.[1x] files are present.
189 ALL_RECURSIVE_TARGETS += sc_man_file_correlation
190 .PHONY: sc_man_file_correlation
191 sc_man_file_correlation: check-x-vs-1 check-programs-vs-x
192
193 # Ensure that for each .x file in the 'man/' subdirectory, there is a
194 # corresponding .1 file in the definition of $(dist_man1_MANS).
195 # But since that expansion usually lacks programs like arch and hostname,
196 # add them here manually.
197 .PHONY: check-x-vs-1
198 check-x-vs-1:
199         @PATH=./src$(PATH_SEPARATOR)$$PATH; export PATH;                \
200         t=$@-t;                                                         \
201         (cd $(srcdir)/man && ls -1 *.x)                                 \
202           | sed 's/\.x$$//' | $(ASSORT) > $$t;                          \
203         (echo $(patsubst man/%,%,$(dist_man1_MANS))                     \
204               $(NO_INSTALL_PROGS_DEFAULT)                               \
205           | tr -s ' ' '\n' | sed 's/\.1$$//')                           \
206           | $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; };           \
207         rm $$t
208
209 all_programs =                                                          \
210       (cd ./src && MAKEFLAGS= $(MAKE) -s all_programs.list)             \
211        | grep -v '\['
212
213 # Ensure that for each .x file in the 'man/' subdirectory, there is a
214 # corresponding coreutils program.
215 .PHONY: check-programs-vs-x
216 check-programs-vs-x: all_programs
217         @status=0;                                      \
218         for p in dummy `$(all_programs)`; do            \
219           test $$p = dummy && continue;                 \
220           test $$p = ginstall && p=install || : ;       \
221           test -f $(srcdir)/man/$$p.x                   \
222             || { echo missing $$p.x 1>&2; status=1; };  \
223         done;                                           \
224         exit $$status
225
226 # Ensure that the end of each release's section is marked by two empty lines.
227 sc_NEWS_two_empty_lines:
228         @sed -n 4,/Noteworthy/p $(srcdir)/NEWS                          \
229             | perl -n0e '/(^|\n)\n\n\* Noteworthy/ or exit 1'           \
230           || { echo '$(ME): use two empty lines to separate NEWS sections' \
231                  1>&2; exit 1; } || :
232
233 # Perl-based tests used to exec perl from a #!/bin/sh script.
234 # Now they all start with #!/usr/bin/perl and the portability
235 # infrastructure is in tests/Makefile.am.  Make sure no old-style
236 # script sneaks back in.
237 sc_no_exec_perl_coreutils:
238         @if test -f $(srcdir)/tests/Coreutils.pm; then                  \
239           grep '^exec  *\$$PERL.*MCoreutils' $$($(VC_LIST) tests) &&    \
240             { echo 1>&2 '$(ME): found anachronistic Perl-based tests';  \
241               exit 1; } || :;                                           \
242         fi
243
244 # With split lines, don't leave an operator at end of line.
245 # Instead, put it on the following line, where it is more apparent.
246 # Don't bother checking for "*" at end of line, since it provokes
247 # far too many false positives, matching constructs like "TYPE *".
248 # Similarly, omit "=" (initializers).
249 binop_re_ ?= [-/+^!<>]|[-/+*^!<>=]=|&&?|\|\|?|<<=?|>>=?
250 sc_prohibit_operator_at_end_of_line:
251         @prohibit='. ($(binop_re_))$$'                                  \
252         in_vc_files='\.[chly]$$'                                        \
253         halt='found operator at end of line'                            \
254           $(_sc_search_regexp)
255
256 # Don't use "readlink" or "readlinkat" directly
257 sc_prohibit_readlink:
258         @prohibit='\<readlink(at)? \('                                  \
259         halt='do not use readlink(at); use via xreadlink or areadlink*' \
260           $(_sc_search_regexp)
261
262 # Don't use address of "stat" or "lstat" functions
263 sc_prohibit_stat_macro_address:
264         @prohibit='\<l?stat '':|&l?stat\>'                              \
265         halt='stat() and lstat() may be function-like macros'           \
266           $(_sc_search_regexp)
267
268 # Ensure that date's --help output stays in sync with the info
269 # documentation for GNU strftime.  The only exception is %N,
270 # which date accepts but GNU strftime does not.
271 extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
272 sc_strftime_check:
273         @if test -f $(srcdir)/src/date.c; then                          \
274           grep '^  %.  ' $(srcdir)/src/date.c | sort                    \
275             | $(extract_char) > $@-src;                                 \
276           { echo N;                                                     \
277             info libc date calendar format 2>/dev/null|grep '^    `%.'\'\
278               | $(extract_char); } | sort > $@-info;                    \
279           if test $$(stat --format %s $@-info) != 2; then               \
280             diff -u $@-src $@-info || exit 1;                           \
281           else                                                          \
282             echo '$(ME): skipping $@: libc info not installed' 1>&2;    \
283           fi;                                                           \
284           rm -f $@-src $@-info;                                         \
285         fi
286
287 # Indent only with spaces.
288 sc_prohibit_tab_based_indentation:
289         @prohibit='^ *  '                                               \
290         halt='TAB in indentation; use only spaces'                      \
291           $(_sc_search_regexp)
292
293 # The SEE ALSO section of a man page should not be terminated with
294 # a period.  Check the first line after each "SEE ALSO" line in man/*.x:
295 sc_prohibit_man_see_also_period:
296         @grep -nB1 '\.$$' $$($(VC_LIST_EXCEPT) | grep 'man/.*\.x$$')    \
297             | grep -A1 -e '-\[SEE ALSO\]' | grep '\.$$' &&              \
298           { echo '$(ME): do not end "SEE ALSO" section with a period'   \
299               1>&2; exit 1; } || :
300
301 # Don't use "indent-tabs-mode: nil" anymore.  No longer needed.
302 sc_prohibit_emacs__indent_tabs_mode__setting:
303         @prohibit='^( *[*#] *)?indent-tabs-mode:'                       \
304         halt='use of emacs indent-tabs-mode: setting'                   \
305           $(_sc_search_regexp)
306
307 # Ensure that tests don't include a redundant fail=0.
308 sc_prohibit_fail_0:
309         @prohibit='\<fail=0\>'                                          \
310         halt='fail=0 initialization'                                    \
311           $(_sc_search_regexp)
312
313 # The mode part of a setfacl -m option argument must be three bytes long.
314 # I.e., an argument of user:bin:rw or user:bin:r will make Solaris 10's
315 # setfacl reject it with: "Unrecognized character found in mode field".
316 # Use hyphens to give it a length of 3: "...:rw-" or "...:r--".
317 sc_prohibit_short_facl_mode_spec:
318         @prohibit='\<setfacl .*-m.*:.*:[rwx-]{1,2} '                    \
319         halt='setfacl mode string length < 3; extend with hyphen(s)'    \
320           $(_sc_search_regexp)
321
322 # Ensure that "stdio--.h" is used where appropriate.
323 sc_require_stdio_safer:
324         @if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then    \
325           files=$$(grep -l '\bfreopen \?(' $$($(VC_LIST_EXCEPT)         \
326               | grep '\.[ch]$$'));                                      \
327           test -n "$$files" && grep -LE 'include "stdio--.h"' $$files   \
328               | grep . &&                                               \
329           { echo '$(ME): the above files should use "stdio--.h"'        \
330                 1>&2; exit 1; } || :;                                   \
331         else :;                                                         \
332         fi
333
334 sc_prohibit_perl_hash_quotes:
335         @prohibit="\{'[A-Z_]+' *[=}]"                                   \
336         halt="in Perl code, write \$$hash{KEY}, not \$$hash{'K''EY'}"   \
337           $(_sc_search_regexp)
338
339 # Prefer xnanosleep over other less-precise sleep methods
340 sc_prohibit_sleep:
341         @prohibit='\<(nano|u)?sleep \('                                 \
342         halt='prefer xnanosleep over other sleep interfaces'            \
343           $(_sc_search_regexp)
344
345 # Use print_ver_ (from init.cfg), not open-coded $VERBOSE check.
346 sc_prohibit_verbose_version:
347         @prohibit='test "\$$VERBOSE" = yes && .* --version'             \
348         halt='use the print_ver_ function instead...'                   \
349           $(_sc_search_regexp)
350
351 # Use framework_failure_, not the old name without the trailing underscore.
352 sc_prohibit_framework_failure:
353         @prohibit='\<framework_''failure\>'                             \
354         halt='use framework_failure_ instead'                           \
355           $(_sc_search_regexp)
356
357 # Prohibit the use of `...` in tests/.  Use $(...) instead.
358 sc_prohibit_test_backticks:
359         @prohibit='`' in_vc_files='^tests/'                             \
360         halt='use $$(...), not `...` in tests/'                         \
361           $(_sc_search_regexp)
362
363 # Programs like sort, ls, expr use PROG_FAILURE in place of EXIT_FAILURE.
364 # Others, use the EXIT_CANCELED, EXIT_ENOENT, etc. macros defined in system.h.
365 # In those programs, ensure that EXIT_FAILURE is not used by mistake.
366 sc_some_programs_must_avoid_exit_failure:
367         @grep -nw EXIT_FAILURE                                          \
368             $$(git grep -El '[^T]_FAILURE|EXIT_CANCELED' src)           \
369           | grep -vE '= EXIT_FAILURE|exit \(.* \?' | grep .             \
370             && { echo '$(ME): do not use EXIT_FAILURE in the above'     \
371                   1>&2; exit 1; } || :
372
373 # Ensure that tests call the print_ver_ function for programs which are
374 # actually used in that test.
375 sc_prohibit_test_calls_print_ver_with_irrelevant_argument:
376         @git grep -w print_ver_ tests                                   \
377           | sed 's#:print_ver_##'                                       \
378           | { fail=0;                                                   \
379               while read file name; do                                  \
380                 for i in $$name; do                                     \
381                   case "$$i" in install) i=ginstall;; esac;             \
382                   grep -w "$$i" $$file|grep -vw print_ver_|grep -q .    \
383                     || { fail=1;                                        \
384                          echo "*** Test: $$file, offending: $$i." 1>&2; };\
385                 done;                                                   \
386               done;                                                     \
387               test $$fail = 0 || exit 1;                                \
388             } || { echo "$(ME): the above test(s) call print_ver_ for"  \
389                     "program(s) they don't use" 1>&2; exit 1; }
390
391 # Exempt the contents of any usage function from the following.
392 _continued_string_col_1 = \
393 s/^usage .*?\n}//ms;/\\\n\w/ and print ("$$ARGV\n"),$$e=1;END{$$e||=0;exit $$e}
394 # Ding any source file that has a continued string with an alphabetic in the
395 # first column of the following line.  We prohibit them because they usually
396 # trigger false positives in tools that try to map an arbitrary line number
397 # to the enclosing function name.  Of course, very many strings do precisely
398 # this, *when they are part of the usage function*.  That is why we exempt
399 # the contents of any function named "usage".
400 sc_prohibit_continued_string_alpha_in_column_1:
401         @perl -0777 -ne '$(_continued_string_col_1)' \
402             $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$') \
403           || { echo '$(ME): continued string with word in first column' \
404                 1>&2; exit 1; } || :
405 # Use this to list offending lines:
406 # git ls-files |grep '\.[ch]$' | xargs \
407 #   perl -n -0777 -e 's/^usage.*?\n}//ms;/\\\n\w/ and print "$ARGV\n"' \
408 #     | xargs grep -A1 '\\$'|grep '\.[ch][:-][_a-zA-Z]'
409
410
411 ###########################################################
412 _p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
413 _pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
414 _pre_anchored = ^\($(_pre)\)
415 _comment_and_close = [^*]\|[*][^/*]\)*[*][*]*/
416 # help font-lock mode: '
417
418 # A sed expression that removes ANSI C and ISO C99 comments.
419 # Derived from the one in GNU gettext's 'moopp' preprocessor.
420 _sed_remove_comments =                                  \
421 /[/][/*]/{                                              \
422   ta;                                                   \
423   :a;                                                   \
424   s,$(_pre_anchored)//.*,\1,;                           \
425   te;                                                   \
426   s,$(_pre_anchored)/[*]\($(_comment_and_close),\1 ,;   \
427   ta;                                                   \
428   /^$(_pre)[/][*]/{                                     \
429     s,$(_pre_anchored)/[*].*,\1 ,;                      \
430     tu;                                                 \
431     :u;                                                 \
432     n;                                                  \
433     s,^\($(_comment_and_close),,;                       \
434     tv;                                                 \
435     s,^.*$$,,;                                          \
436     bu;                                                 \
437     :v;                                                 \
438   };                                                    \
439   :e;                                                   \
440 }
441 # Quote all single quotes.
442 _sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
443 # help font-lock mode: '
444
445 _space_before_paren_exempt =? \\n\\$$
446 _space_before_paren_exempt = \
447   (^ *\#|\\n\\$$|%s\(to %s|(date|group|character)\(s\))
448 # Ensure that there is a space before each open parenthesis in C code.
449 sc_space_before_open_paren:
450         @if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then    \
451           fail=0;                                                       \
452           for c in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do          \
453             sed '$(_sed_rm_comments_q)' $$c 2>/dev/null                 \
454               | grep -i '[[:alnum:]]('                                  \
455               | grep -vE '$(_space_before_paren_exempt)'                \
456               | grep . && { fail=1; echo "*** $$c"; };                  \
457           done;                                                         \
458           test $$fail = 1 &&                                            \
459             { echo '$(ME): the above files lack a space-before-open-paren' \
460                 1>&2; exit 1; } || :;                                   \
461         else :;                                                         \
462         fi
463
464 # Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
465 # Use STREQ_LEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
466 sc_prohibit_strncmp:
467         @grep -nE '! *str''ncmp *\(|\<str''ncmp *\(.+\) *[!=]='         \
468             $$($(VC_LIST_EXCEPT))                                       \
469           | grep -vE ':# *define STR(N?EQ_LEN|PREFIX)\(' &&             \
470           { echo '$(ME): use STREQ_LEN or STRPREFIX instead of str''ncmp' \
471                 1>&2; exit 1; } || :
472
473 # Enforce recommended preprocessor indentation style.
474 sc_preprocessor_indentation:
475         @if cppi --version >/dev/null 2>&1; then                        \
476           $(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c        \
477             || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
478                 exit 1; };                                              \
479         else                                                            \
480           echo '$(ME): skipping test $@: cppi not installed' 1>&2;      \
481         fi
482
483 # THANKS.in is a list of name/email pairs for people who are mentioned in
484 # commit logs (and generated ChangeLog), but who are not also listed as an
485 # author of a commit.  Name/email pairs of commit authors are automatically
486 # extracted from the repository.  As a very minor factorization, when
487 # someone who was initially listed only in THANKS.in later authors a commit,
488 # this rule detects that their pair may now be removed from THANKS.in.
489 sc_THANKS_in_duplicates:
490         @{ git log --pretty=format:%aN | sort -u;                       \
491             cut -b-36 THANKS.in | sed '/^$$/d;s/  *$$//'; }             \
492           | sort | uniq -d | grep .                                     \
493             && { echo '$(ME): remove the above names from THANKS.in'    \
494                   1>&2; exit 1; } || :
495
496 # Override the default Cc: used in generating an announcement.
497 announcement_Cc_ = $(translation_project_), \
498   coreutils@gnu.org, coreutils-announce@gnu.org
499
500 -include $(srcdir)/dist-check.mk
501
502 update-copyright-env = \
503   UPDATE_COPYRIGHT_FORCE=1 \
504   UPDATE_COPYRIGHT_USE_INTERVALS=2 \
505   UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
506
507 # List syntax-check exemptions.
508 exclude_file_name_regexp--sc_space_tab = \
509   ^(tests/pr/|tests/misc/nl\.sh$$|gl/.*\.diff$$)
510 exclude_file_name_regexp--sc_bindtextdomain = ^(gl/.*|lib/euidaccess-stat)\.c$$
511 exclude_file_name_regexp--sc_unmarked_diagnostics =    ^build-aux/cvsu$$
512 exclude_file_name_regexp--sc_error_message_uppercase = ^build-aux/cvsu$$
513 exclude_file_name_regexp--sc_trailing_blank = ^tests/pr/
514 exclude_file_name_regexp--sc_system_h_headers = \
515   ^src/((system|copy)\.h|libstdbuf\.c)$$
516
517 _src = (false|lbracket|ls-(dir|ls|vdir)|tac-pipe|uname-(arch|uname))
518 exclude_file_name_regexp--sc_require_config_h_first = \
519   (^lib/buffer-lcm\.c|src/$(_src)\.c)$$
520 exclude_file_name_regexp--sc_require_config_h = \
521   $(exclude_file_name_regexp--sc_require_config_h_first)
522
523 exclude_file_name_regexp--sc_po_check = ^gl/
524 exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
525   ^src/(seq|remove)\.c$$
526 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^tests/pr/
527 exclude_file_name_regexp--sc_program_name = ^(gl/.*|lib/euidaccess-stat)\.c$$
528 exclude_file_name_regexp--sc_file_system = \
529   NEWS|^(tests/init\.cfg|src/df\.c|tests/df/df-P\.sh)$$
530 exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
531   ^m4/stat-prog\.m4$$
532 exclude_file_name_regexp--sc_prohibit_fail_0 = \
533   (^.*/git-hooks/commit-msg|^tests/init\.sh|Makefile\.am|\.mk|.*\.texi)$$
534 exclude_file_name_regexp--sc_prohibit_atoi_atof = ^lib/euidaccess-stat\.c$$
535
536 tbi_1 = ^tests/pr/|(^gl/lib/reg.*\.c\.diff|Makefile(\.am)?|\.mk|^man/help2man)$$
537 tbi_2 = ^scripts/git-hooks/(pre-commit|pre-applypatch|applypatch-msg)$$
538 exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \
539   $(tbi_1)|$(tbi_2)
540
541 exclude_file_name_regexp--sc_preprocessor_indentation = \
542   ^(gl/lib/rand-isaac\.[ch]|gl/tests/test-rand-isaac\.c)$$
543 exclude_file_name_regexp--sc_prohibit_stat_st_blocks = \
544   ^(src/system\.h|tests/du/2g\.sh)$$
545
546 exclude_file_name_regexp--sc_prohibit_continued_string_alpha_in_column_1 = \
547   ^src/(system\.h|od\.c|printf\.c)$$
548
549 exclude_file_name_regexp--sc_prohibit_test_backticks = \
550   ^tests/(init\.sh|Makefile\.am|misc/stdbuf\.sh)$$
551
552 # Exempt test.c, since it's nominally shared, and relatively static.
553 exclude_file_name_regexp--sc_prohibit_operator_at_end_of_line = \
554   ^src/(ptx|test|head)\.c$$