17
17
# Used in maint.mk's web-manual rule
18
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)
20
24
# Tests not to run as part of "make distcheck".
21
25
local-checks-to-skip = \
26
sc_proper_name_utf8_requires_ICONV
24
28
# Tools used to bootstrap this package, used for "announcement".
25
29
bootstrap-tools = autoconf,automake,gnulib,bison
27
31
# Now that we have better tests, make this the default.
28
32
export VERBOSE = yes
30
old_NEWS_hash = d491296a7e0e2269b2b96dc4bd5f77a8
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 = a99128b9985b2e76bdcabf3e5d95ca1a
32
50
# Add an exemption for sc_makefile_at_at_check.
33
51
_makefile_at_at_check_exceptions = ' && !/^cu_install_program =/'
78
96
# Ensure that each root-requiring test is run via the "check-root" rule.
81
&& grep check-root tests/Makefile.am>/dev/null 2>&1; then \
82
t1=sc-root.expected; t2=sc-root.actual; \
83
grep -nl '^ *require_root_$$' \
84
$$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \
85
sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \
86
$(srcdir)/tests/Makefile.am \
87
| sed 's/^ *//;/^root_tests =/d' \
88
| tr -s '\012\\' ' ' | fmt -1 | sort > $$t2; \
89
diff -u $$t1 $$t2 || diff=1 || diff=; \
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; \
90
102
rm -f $$t1 $$t2; \
92
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
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|init)\.sh$$' \
115
| $(EGREP) "$$test_extensions_rx\$$"; \
116
} | sort | uniq -u | grep . && exit 1; :
96
118
# Create a list of regular expressions matching the names
97
119
# of files included from system.h. Exclude a couple.
128
150
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
131
ALL_RECURSIVE_TARGETS += sc_check-AUTHORS
133
@$(MAKE) -s -C src _sc_check-AUTHORS
153
# Ensure that the list of programs and author names is accurate.
154
# We need a UTF8 locale. If a lack of locale support or a missing
155
# translation inhibits printing of UTF-8 names, just skip this test.
156
au_dotdot = authors-dotdot
157
au_actual = authors-actual
158
sc_check-AUTHORS: $(all_programs)
159
@locale=en_US.UTF-8; \
160
LC_ALL=$$locale ./src/cat --version \
161
| grep ' Torbjorn ' > /dev/null \
162
&& { echo "$@: skipping this check"; exit 0; }; \
163
rm -f $(au_actual) $(au_dotdot); \
164
for i in `ls $(all_programs) \
165
| sed -e 's,^src/,,' -e 's,$(EXEEXT)$$,,' \
167
| $(ASSORT) -u`; do \
168
test "$$i" = '[' && continue; \
170
if test "$$i" = install; then \
172
elif test "$$i" = test; then \
175
LC_ALL=$$locale ./src/$$exe --version \
176
| perl -0 -pi -e 's/,\n/, /gm' \
177
| sed -n -e '/Written by /{ s//'"$$i"': /;' \
178
-e 's/,* and /, /; s/\.$$//; p; }'; \
179
done > $(au_actual) && \
180
sed -n '/^[^ ][^ ]*:/p' $(srcdir)/AUTHORS > $(au_dotdot) \
181
&& diff $(au_actual) $(au_dotdot) \
182
&& rm -f $(au_actual) $(au_dotdot)
135
184
# Look for lines longer than 80 characters, except omit:
136
185
# - program-generated long lines in diff headers,
149
198
sed -e "s|^|$$file:|" -e '$(FILTER_LONG_LINES)'; \
150
199
done | grep . && { msg="$$halt" $(_sc_say_and_exit) } || :
152
# Option descriptions should not start with a capital letter
201
# Option descriptions should not start with a capital letter.
153
202
# One could grep source directly as follows:
154
203
# grep -E " {2,6}-.*[^.] [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$')
155
204
# but that would miss descriptions not on the same line as the -option.
156
ALL_RECURSIVE_TARGETS += sc_option_desc_uppercase
157
sc_option_desc_uppercase:
158
@$(MAKE) -s -C src all_programs
159
@$(MAKE) -s -C man $@
161
# Ensure all man/*.[1x] files are present
162
ALL_RECURSIVE_TARGETS += sc_man_file_correlation
163
sc_man_file_correlation:
164
@$(MAKE) -s -C src all_programs
165
@$(MAKE) -s -C man $@
205
sc_option_desc_uppercase: $(ALL_MANS)
206
@grep '^\\fB\\-' -A1 man/*.1 | LC_ALL=C grep '\.1.[A-Z][a-z]' \
207
&& { echo 1>&2 '$@: found initial capitals in --help'; exit 1; } || :
209
# Ensure all man/*.[1x] files are present.
210
sc_man_file_correlation: check-x-vs-1 check-programs-vs-x
212
# Ensure that for each .x file in the 'man/' subdirectory, there is a
213
# corresponding .1 file in the definition of $(EXTRA_MANS).
214
# But since that expansion usually lacks programs like arch and hostname,
215
# add them here manually.
218
@PATH=./src$(PATH_SEPARATOR)$$PATH; export PATH; \
220
(cd $(srcdir)/man && ls -1 *.x) \
221
| sed 's/\.x$$//' | $(ASSORT) > $$t; \
222
(echo $(patsubst man/%,%,$(ALL_MANS)) \
223
| tr -s ' ' '\n' | sed 's/\.1$$//') \
224
| $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; }; \
227
# Writing a portable rule to generate a manpage like '[.1' would be
228
# a nightmare, so filter that out.
229
all-progs-but-lbracket = $(filter-out [,$(patsubst src/%,%,$(all_programs)))
231
# Ensure that for each coreutils program there is a corresponding
232
# '.x' file in the 'man/' subdirectory.
233
.PHONY: check-programs-vs-x
236
for p in dummy $(all-progs-but-lbracket); do \
237
case $$p in *.so) continue;; esac; \
238
test $$p = dummy && continue; \
239
test $$p = ginstall && p=install || : ; \
240
test -f $(srcdir)/man/$$p.x \
241
|| { echo missing $$p.x 1>&2; status=1; }; \
167
245
# Ensure that the end of each release's section is marked by two empty lines.
168
246
sc_NEWS_two_empty_lines:
171
249
|| { echo '$(ME): use two empty lines to separate NEWS sections' \
172
250
1>&2; exit 1; } || :
174
# Perl-based tests used to exec perl from a #!/bin/sh script.
175
# Now they all start with #!/usr/bin/perl and the portability
176
# infrastructure is in tests/Makefile.am. Make sure no old-style
177
# script sneaks back in.
178
sc_no_exec_perl_coreutils:
179
@if test -f $(srcdir)/tests/Coreutils.pm; then \
180
grep '^exec *\$$PERL.*MCoreutils' $$($(VC_LIST) tests) && \
181
{ echo 1>&2 '$(ME): found anachronistic Perl-based tests'; \
252
# With split lines, don't leave an operator at end of line.
253
# Instead, put it on the following line, where it is more apparent.
254
# Don't bother checking for "*" at end of line, since it provokes
255
# far too many false positives, matching constructs like "TYPE *".
256
# Similarly, omit "=" (initializers).
257
binop_re_ ?= [-/+^!<>]|[-/+*^!<>=]=|&&?|\|\|?|<<=?|>>=?
258
sc_prohibit_operator_at_end_of_line:
259
@prohibit='. ($(binop_re_))$$' \
260
in_vc_files='\.[chly]$$' \
261
halt='found operator at end of line' \
185
264
# Don't use "readlink" or "readlinkat" directly
186
265
sc_prohibit_readlink:
233
312
halt='use of emacs indent-tabs-mode: setting' \
234
313
$(_sc_search_regexp)
236
# Ensure that each file that contains fail=1 also contains fail=0.
237
# Otherwise, setting file=1 in the environment would make tests fail
315
# Ensure that tests don't include a redundant fail=0.
239
316
sc_prohibit_fail_0:
240
317
@prohibit='\<fail=0\>' \
241
318
halt='fail=0 initialization' \
242
319
$(_sc_search_regexp)
321
# The mode part of a setfacl -m option argument must be three bytes long.
322
# I.e., an argument of user:bin:rw or user:bin:r will make Solaris 10's
323
# setfacl reject it with: "Unrecognized character found in mode field".
324
# Use hyphens to give it a length of 3: "...:rw-" or "...:r--".
325
sc_prohibit_short_facl_mode_spec:
326
@prohibit='\<setfacl .*-m.*:.*:[rwx-]{1,2} ' \
327
halt='setfacl mode string length < 3; extend with hyphen(s)' \
244
330
# Ensure that "stdio--.h" is used where appropriate.
245
331
sc_require_stdio_safer:
246
332
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
276
362
halt='use framework_failure_ instead' \
277
363
$(_sc_search_regexp)
365
# Prohibit the use of `...` in tests/. Use $(...) instead.
366
sc_prohibit_test_backticks:
367
@prohibit='`' in_vc_files='^tests/' \
368
halt='use $$(...), not `...` in tests/' \
371
# Programs like sort, ls, expr use PROG_FAILURE in place of EXIT_FAILURE.
372
# Others, use the EXIT_CANCELED, EXIT_ENOENT, etc. macros defined in system.h.
373
# In those programs, ensure that EXIT_FAILURE is not used by mistake.
374
sc_some_programs_must_avoid_exit_failure:
375
@grep -nw EXIT_FAILURE \
376
$$(git grep -El '[^T]_FAILURE|EXIT_CANCELED' src) \
377
| grep -vE '= EXIT_FAILURE|exit \(.* \?' | grep . \
378
&& { echo '$(ME): do not use EXIT_FAILURE in the above' \
381
# Ensure that tests call the print_ver_ function for programs which are
382
# actually used in that test.
383
sc_prohibit_test_calls_print_ver_with_irrelevant_argument:
384
@git grep -w print_ver_ tests \
385
| sed 's#:print_ver_##' \
387
while read file name; do \
388
for i in $$name; do \
389
case "$$i" in install) i=ginstall;; esac; \
390
grep -w "$$i" $$file|grep -vw print_ver_|grep -q . \
392
echo "*** Test: $$file, offending: $$i." 1>&2; };\
395
test $$fail = 0 || exit 1; \
396
} || { echo "$(ME): the above test(s) call print_ver_ for" \
397
"program(s) they don't use" 1>&2; exit 1; }
399
# Exempt the contents of any usage function from the following.
400
_continued_string_col_1 = \
401
s/^usage .*?\n}//ms;/\\\n\w/ and print ("$$ARGV\n"),$$e=1;END{$$e||=0;exit $$e}
402
# Ding any source file that has a continued string with an alphabetic in the
403
# first column of the following line. We prohibit them because they usually
404
# trigger false positives in tools that try to map an arbitrary line number
405
# to the enclosing function name. Of course, very many strings do precisely
406
# this, *when they are part of the usage function*. That is why we exempt
407
# the contents of any function named "usage".
408
sc_prohibit_continued_string_alpha_in_column_1:
409
@perl -0777 -ne '$(_continued_string_col_1)' \
410
$$($(VC_LIST_EXCEPT) | grep '\.[ch]$$') \
411
|| { echo '$(ME): continued string with word in first column' \
413
# Use this to list offending lines:
414
# git ls-files |grep '\.[ch]$' | xargs \
415
# perl -n -0777 -e 's/^usage.*?\n}//ms;/\\\n\w/ and print "$ARGV\n"' \
416
# | xargs grep -A1 '\\$'|grep '\.[ch][:-][_a-zA-Z]'
279
419
###########################################################
280
420
_p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
281
421
_pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
348
488
echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
491
# THANKS.in is a list of name/email pairs for people who are mentioned in
492
# commit logs (and generated ChangeLog), but who are not also listed as an
493
# author of a commit. Name/email pairs of commit authors are automatically
494
# extracted from the repository. As a very minor factorization, when
495
# someone who was initially listed only in THANKS.in later authors a commit,
496
# this rule detects that their pair may now be removed from THANKS.in.
497
sc_THANKS_in_duplicates:
498
@{ git log --pretty=format:%aN | sort -u; \
499
cut -b-36 THANKS.in | sed '/^$$/d;s/ *$$//'; } \
500
| sort | uniq -d | grep . \
501
&& { echo '$(ME): remove the above names from THANKS.in' \
351
504
# Override the default Cc: used in generating an announcement.
352
505
announcement_Cc_ = $(translation_project_), \
353
506
coreutils@gnu.org, coreutils-announce@gnu.org
355
508
-include $(srcdir)/dist-check.mk
357
510
update-copyright-env = \
358
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
511
UPDATE_COPYRIGHT_FORCE=1 \
512
UPDATE_COPYRIGHT_USE_INTERVALS=2 \
359
513
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
361
515
# List syntax-check exemptions.
362
516
exclude_file_name_regexp--sc_space_tab = \
363
^(tests/pr/|tests/misc/nl$$|gl/.*\.diff$$)
364
exclude_file_name_regexp--sc_bindtextdomain = ^(gl/.*|lib/euidaccess-stat)\.c$$
365
exclude_file_name_regexp--sc_unmarked_diagnostics = ^build-aux/cvsu$$
366
exclude_file_name_regexp--sc_error_message_uppercase = ^build-aux/cvsu$$
517
^(tests/pr/|tests/misc/nl\.sh$$|gl/.*\.diff$$)
518
exclude_file_name_regexp--sc_bindtextdomain = \
519
^(gl/.*|lib/euidaccess-stat|src/make-prime-list)\.c$$
367
520
exclude_file_name_regexp--sc_trailing_blank = ^tests/pr/
368
521
exclude_file_name_regexp--sc_system_h_headers = \
369
^src/((system|copy)\.h|libstdbuf\.c)$$
522
^src/((system|copy)\.h|libstdbuf\.c|make-prime-list\.c)$$
371
524
_src = (false|lbracket|ls-(dir|ls|vdir)|tac-pipe|uname-(arch|uname))
372
525
exclude_file_name_regexp--sc_require_config_h_first = \
375
528
$(exclude_file_name_regexp--sc_require_config_h_first)
377
530
exclude_file_name_regexp--sc_po_check = ^gl/
378
exclude_file_name_regexp--sc_prohibit_always-defined_macros = ^src/seq\.c$$
531
exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
532
^src/(seq|remove)\.c$$
379
533
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^tests/pr/
380
exclude_file_name_regexp--sc_program_name = ^(gl/.*|lib/euidaccess-stat)\.c$$
534
exclude_file_name_regexp--sc_program_name = \
535
^(gl/.*|lib/euidaccess-stat|src/make-prime-list)\.c$$
381
536
exclude_file_name_regexp--sc_file_system = \
382
NEWS|^(tests/init\.cfg|src/df\.c|tests/misc/df-P)$$
537
NEWS|^(init\.cfg|src/df\.c|tests/df/df-P\.sh)$$
383
538
exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
384
539
^m4/stat-prog\.m4$$
385
540
exclude_file_name_regexp--sc_prohibit_fail_0 = \
386
(^tests/init\.sh|Makefile\.am|\.mk)$$
541
(^.*/git-hooks/commit-msg|^tests/init\.sh|Makefile\.am|\.mk|.*\.texi)$$
387
542
exclude_file_name_regexp--sc_prohibit_atoi_atof = ^lib/euidaccess-stat\.c$$
544
# longlong.h is maintained elsewhere.
545
_ll = ^src/longlong\.h$$
546
exclude_file_name_regexp--sc_useless_cpp_parens = $(_ll)
547
exclude_file_name_regexp--sc_long_lines = $(_ll)
548
exclude_file_name_regexp--sc_space_before_open_paren = $(_ll)
550
tbi_1 = ^tests/pr/|(^gl/lib/reg.*\.c\.diff|\.mk|^man/help2man)$$
551
tbi_2 = ^scripts/git-hooks/(pre-commit|pre-applypatch|applypatch-msg)$$
552
tbi_3 = (GNU)?[Mm]akefile(\.am)?$$|$(_ll)
388
553
exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \
389
^tests/pr/|(^gl/lib/reg.*\.c\.diff|Makefile(\.am)?|\.mk|^man/help2man)$$
554
$(tbi_1)|$(tbi_2)|$(tbi_3)
390
556
exclude_file_name_regexp--sc_preprocessor_indentation = \
391
^(gl/lib/rand-isaac\.[ch]|gl/tests/test-rand-isaac\.c)$$
557
^(gl/lib/rand-isaac\.[ch]|gl/tests/test-rand-isaac\.c)$$|$(__ll)
394
558
exclude_file_name_regexp--sc_prohibit_stat_st_blocks = \
395
^(src/system\.h|tests/du/2g)$$
559
^(src/system\.h|tests/du/2g\.sh)$$
561
exclude_file_name_regexp--sc_prohibit_continued_string_alpha_in_column_1 = \
562
^src/(system\.h|od\.c|printf\.c)$$
564
exclude_file_name_regexp--sc_prohibit_test_backticks = \
565
^tests/(init\.sh|local.mk|misc/stdbuf\.sh)$$
567
# Exempt test.c, since it's nominally shared, and relatively static.
568
exclude_file_name_regexp--sc_prohibit_operator_at_end_of_line = \
569
^src/(ptx|test|head)\.c$$
571
exclude_file_name_regexp--sc_error_message_uppercase = ^src/factor\.c$$
572
exclude_file_name_regexp--sc_prohibit_atoi_atof = ^src/make-prime-list\.c$$
574
# Augment AM_CFLAGS to include our per-directory options:
575
AM_CFLAGS += $($(@D)_CFLAGS)
577
src_CFLAGS = $(WARN_CFLAGS)
578
lib_CFLAGS = $(GNULIB_WARN_CFLAGS)
579
gnulib-tests_CFLAGS = $(GNULIB_TEST_WARN_CFLAGS)
581
# Configuration to make the tight-scope syntax-check rule work with
582
# non-recursive make.
583
export _gl_TS_headers = $(srcdir)/cfg.mk
585
_gl_TS_obj_files = src/*.$(OBJEXT)
586
_gl_TS_other_headers = src/*.h