# Customize maint.mk -*- makefile -*-
-# Copyright (C) 2003-2010 Free Software Foundation, Inc.
+# Copyright (C) 2003-2011 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Now that we have better tests, make this the default.
export VERBOSE = yes
-old_NEWS_hash = 27e765279d5735f99114b57fa097e6bd
+old_NEWS_hash = 60c2a8ae70e77352e301825426aee27d
# Add an exemption for sc_makefile_at_at_check.
_makefile_at_at_check_exceptions = ' && !/^cu_install_program =/'
dd = $(srcdir)/src/dd.c
sc_dd_O_FLAGS:
@rm -f $@.1 $@.2
- @{ echo O_FULLBLOCK; perl -nle '/^ +\| (O_\w*)$$/ and print $$1' \
- $(dd); } | sort > $@.1
+ @{ echo O_FULLBLOCK; echo O_NOCACHE; \
+ perl -nle '/^ +\| (O_\w*)$$/ and print $$1' $(dd); } | sort > $@.1
@{ echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
$(dd); } | sort > $@.2
@diff -u $@.1 $@.2 || diff=1 || diff=; \
@if test -d tests \
&& grep check-root tests/Makefile.am>/dev/null 2>&1; then \
t1=sc-root.expected; t2=sc-root.actual; \
- grep -nl '^require_root_$$' \
+ grep -nl '^ *require_root_$$' \
$$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \
sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \
$(srcdir)/tests/Makefile.am \
exit 1; } || :; \
fi
-# Ensure that the syntax_check_exceptions file list in Makefile.am
-# stays in sync with corresponding files in the repository.
-sce = syntax_check_exceptions
-sc_x_sc_dist_check:
- @test "$$( ($(VC_LIST) | sed -n '/\.x-sc_/p' \
- | sed 's|^$(_dot_escaped_srcdir)/||'; \
- sed -n '/^$(sce) =[ ]*\\$$/,/[^\]$$/p' \
- $(srcdir)/Makefile.am \
- | sed 's/^ *//;/^$(sce) =/d' \
- | tr -s '\012\\' ' ' | fmt -1 \
- ) | sort | uniq -u)" \
- && { echo 'Makefile.am: $(sce) mismatch' >&2; exit 1; } || :;
-
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
.re-list:
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
exit 1; } || :
-ALL_RECURSIVE_TARGETS += sc_tight_scope
-sc_tight_scope:
- @$(MAKE) -s -C src $@
-
ALL_RECURSIVE_TARGETS += sc_check-AUTHORS
sc_check-AUTHORS:
- @$(MAKE) -s -C src $@
+ @$(MAKE) -s -C src _sc_check-AUTHORS
+
+# Look for lines longer than 80 characters, except omit:
+# - program-generated long lines in diff headers,
+# - tests involving long checksum lines, and
+# - the 'pr' test cases.
+LINE_LEN_MAX = 80
+FILTER_LONG_LINES = \
+ /^[^:]*\.diff:[^:]*:@@ / d; \
+ \|^[^:]*tests/misc/sha[0-9]*sum[-:]| d; \
+ \|^[^:]*tests/pr/|{ \|^[^:]*tests/pr/pr-tests:| !d; };
+sc_long_lines:
+ @files=$$($(VC_LIST_EXCEPT)) \
+ halt='line(s) with more than $(LINE_LEN_MAX) characters; reindent'; \
+ for file in $$files; do \
+ expand $$file | grep -nE '^.{$(LINE_LEN_MAX)}.' | \
+ sed -e "s|^|$$file:|" -e '$(FILTER_LONG_LINES)'; \
+ done | grep . && { msg="$$halt" $(_sc_say_and_exit) } || :
# Option descriptions should not start with a capital letter
# One could grep source directly as follows:
@$(MAKE) -s -C src all_programs
@$(MAKE) -s -C man $@
+# Ensure that the end of each release's section is marked by two empty lines.
+sc_NEWS_two_empty_lines:
+ @sed -n 4,/Noteworthy/p $(srcdir)/NEWS \
+ | perl -n0e '/(^|\n)\n\n\* Noteworthy/ or exit 1' \
+ || { echo '$(ME): use two empty lines to separate NEWS sections' \
+ 1>&2; exit 1; } || :
+
# Perl-based tests used to exec perl from a #!/bin/sh script.
# Now they all start with #!/usr/bin/perl and the portability
# infrastructure is in tests/Makefile.am. Make sure no old-style
{ echo N; \
info libc date calendar format 2>/dev/null|grep '^ `%.'\'\
| $(extract_char); } | sort > $@-info; \
- diff -u $@-src $@-info || exit 1; \
+ if test $$(stat --format %s $@-info) != 2; then \
+ diff -u $@-src $@-info || exit 1; \
+ else \
+ echo '$(ME): skipping $@: libc info not installed' 1>&2; \
+ fi; \
rm -f $@-src $@-info; \
fi
halt='TAB in indentation; use only spaces' \
$(_sc_search_regexp)
+# The SEE ALSO section of a man page should not be terminated with
+# a period. Check the first line after each "SEE ALSO" line in man/*.x:
+sc_prohibit_man_see_also_period:
+ @grep -nB1 '\.$$' $$($(VC_LIST_EXCEPT) | grep 'man/.*\.x$$') \
+ | grep -A1 -e '-\[SEE ALSO\]' | grep '\.$$' && \
+ { echo '$(ME): do not end "SEE ALSO" section with a period' \
+ 1>&2; exit 1; } || :
+
# Don't use "indent-tabs-mode: nil" anymore. No longer needed.
sc_prohibit_emacs__indent_tabs_mode__setting:
@prohibit='^( *[*#] *)?indent-tabs-mode:' \
$(_sc_search_regexp)
# Ensure that each file that contains fail=1 also contains fail=0.
-# Otherwise, setting file=1 in the environment would make tests fail unexpectedly.
+# Otherwise, setting file=1 in the environment would make tests fail
+# unexpectedly.
sc_prohibit_fail_0:
@prohibit='\<fail=0\>' \
halt='fail=0 initialization' \
halt='prefer xnanosleep over other sleep interfaces' \
$(_sc_search_regexp)
+# Use print_ver_ (from init.cfg), not open-coded $VERBOSE check.
+sc_prohibit_verbose_version:
+ @prohibit='test "\$$VERBOSE" = yes && .* --version' \
+ halt='use the print_ver_ function instead...' \
+ $(_sc_search_regexp)
+
+# Use framework_failure_, not the old name without the trailing underscore.
+sc_prohibit_framework_failure:
+ @prohibit='\<framework_''failure\>' \
+ halt='use framework_failure_ instead' \
+ $(_sc_search_regexp)
+
###########################################################
_p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
_pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
else :; \
fi
+# Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
+# Use STREQ_LEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
+sc_prohibit_strncmp:
+ @grep -nE '! *str''ncmp *\(|\<str''ncmp *\(.+\) *[!=]=' \
+ $$($(VC_LIST_EXCEPT)) \
+ | grep -vE ':# *define STR(N?EQ_LEN|PREFIX)\(' && \
+ { echo '$(ME): use STREQ_LEN or STRPREFIX instead of str''ncmp' \
+ 1>&2; exit 1; } || :
+
+# Enforce recommended preprocessor indentation style.
+sc_preprocessor_indentation:
+ @if cppi --version >/dev/null 2>&1; then \
+ $(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c \
+ || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
+ exit 1; }; \
+ else \
+ echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
+ fi
+
# Override the default Cc: used in generating an announcement.
announcement_Cc_ = $(translation_project_), \
coreutils@gnu.org, coreutils-announce@gnu.org
-include $(srcdir)/dist-check.mk
+-include $(srcdir)/dist-check.mk
update-copyright-env = \
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
+
+# List syntax-check exemptions.
+exclude_file_name_regexp--sc_space_tab = \
+ ^(tests/pr/|tests/misc/nl$$|gl/.*\.diff$$)
+exclude_file_name_regexp--sc_bindtextdomain = ^(gl/.*|lib/euidaccess-stat)\.c$$
+exclude_file_name_regexp--sc_unmarked_diagnostics = ^build-aux/cvsu$$
+exclude_file_name_regexp--sc_error_message_uppercase = ^build-aux/cvsu$$
+exclude_file_name_regexp--sc_trailing_blank = ^tests/pr/
+exclude_file_name_regexp--sc_system_h_headers = \
+ ^src/((system|copy)\.h|libstdbuf\.c)$$
+
+_src = (false|lbracket|ls-(dir|ls|vdir)|tac-pipe|uname-(arch|uname))
+exclude_file_name_regexp--sc_require_config_h_first = \
+ (^lib/buffer-lcm\.c|src/$(_src)\.c)$$
+exclude_file_name_regexp--sc_require_config_h = \
+ $(exclude_file_name_regexp--sc_require_config_h_first)
+
+exclude_file_name_regexp--sc_po_check = ^gl/
+exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
+ ^src/(seq|remove)\.c$$
+exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^tests/pr/
+exclude_file_name_regexp--sc_program_name = ^(gl/.*|lib/euidaccess-stat)\.c$$
+exclude_file_name_regexp--sc_file_system = \
+ NEWS|^(tests/init\.cfg|src/df\.c|tests/misc/df-P)$$
+exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
+ ^m4/stat-prog\.m4$$
+exclude_file_name_regexp--sc_prohibit_fail_0 = \
+ (^scripts/git-hooks/commit-msg|^tests/init\.sh|Makefile\.am|\.mk)$$
+exclude_file_name_regexp--sc_prohibit_atoi_atof = ^lib/euidaccess-stat\.c$$
+
+tbi_1 = ^tests/pr/|(^gl/lib/reg.*\.c\.diff|Makefile(\.am)?|\.mk|^man/help2man)$$
+tbi_2 = ^scripts/git-hooks/(pre-commit|applypatch-msg)$$
+exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \
+ $(tbi_1)|$(tbi_2)
+
+exclude_file_name_regexp--sc_preprocessor_indentation = \
+ ^(gl/lib/rand-isaac\.[ch]|gl/tests/test-rand-isaac\.c)$$
+exclude_file_name_regexp--sc_prohibit_stat_st_blocks = \
+ ^(src/system\.h|tests/du/2g)$$