1 # Customize maint.mk -*- makefile -*-
2 # Copyright (C) 2003-2010 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 # Tests not to run as part of "make distcheck".
21 local-checks-to-skip =
23 # Tools used to bootstrap this package, used for "announcement".
24 bootstrap-tools = autoconf,automake,gnulib,bison
26 # Now that we have better tests, make this the default.
29 old_NEWS_hash = 67237f9a765e6e1af0cb89e428ed2663
31 # Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
32 dd = $(srcdir)/src/dd.c
35 @{ echo O_FULLBLOCK; perl -nle '/^ +\| (O_\w*)$$/ and print $$1' \
36 $(dd); } | sort > $@.1
37 @{ echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
38 $(dd); } | sort > $@.2
39 @diff -u $@.1 $@.2 || diff=1 || diff=; \
42 && { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2; \
45 # Ensure that dd's definition of LONGEST_SYMBOL stays in sync
46 # with the strings from the two affected variables.
47 dd_c = $(srcdir)/src/dd.c
49 ifneq ($(wildcard $(dd_c)),)
50 @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
51 sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
52 |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
53 | wc --max-line-length); \
54 max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
55 |tr -d '"' | wc --max-line-length); \
56 if test "$$len" = "$$max"; then :; else \
57 echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
62 # Many m4 macros names once began with `jm_'.
63 # On 2004-04-13, they were all changed to start with gl_ instead.
64 # Make sure that none are inadvertently reintroduced.
66 @grep -nE 'jm_[A-Z]' \
67 $$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \
68 { echo '$(ME): do not use jm_ in m4 macro names' \
71 # Ensure that each root-requiring test is run via the "check-root" rule.
74 && grep check-root tests/Makefile.am>/dev/null 2>&1; then \
75 t1=sc-root.expected; t2=sc-root.actual; \
76 grep -nl '^require_root_$$' \
77 $$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \
78 sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \
79 $(srcdir)/tests/Makefile.am \
80 | sed 's/^ *//;/^root_tests =/d' \
81 | tr -s '\012\\' ' ' | fmt -1 | sort > $$t2; \
82 diff -u $$t1 $$t2 || diff=1 || diff=; \
85 && { echo 'tests/Makefile.am: missing check-root action'>&2; \
89 # Ensure that the syntax_check_exceptions file list in Makefile.am
90 # stays in sync with corresponding files in the repository.
91 sce = syntax_check_exceptions
93 @test "$$( ($(VC_LIST) | sed -n '/^.x-sc_/p'; \
94 sed -n '/^$(sce) =[ ]*\\$$/,/[^\]$$/p' \
95 $(srcdir)/Makefile.am \
96 | sed 's/^ *//;/^$(sce) =/d' \
97 | tr -s '\012\\' ' ' | fmt -1 \
98 ) | sort | uniq -u)" \
99 && { echo 'Makefile.am: $(sce) mismatch' >&2; exit 1; } || :;
101 headers_with_interesting_macro_defs = \
112 # Create a list of regular expressions matching the names
113 # of macros that are guaranteed by parts of gnulib to be defined.
115 @(cd $(srcdir)/lib; \
116 for f in $(headers_with_interesting_macro_defs); do \
118 sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
121 | grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
122 | sed 's/^/^# *define /' \
126 # Don't define macros that we already get from gnulib header files.
127 sc_always_defined_macros: .re-defmac
128 @if test -f $(srcdir)/src/system.h; then \
129 trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
130 grep -f .re-defmac $$($(VC_LIST)) \
131 && { echo '$(ME): define the above via some gnulib .h file' \
132 1>&2; exit 1; } || :; \
135 # Create a list of regular expressions matching the names
136 # of files included from system.h. Exclude a couple.
138 @sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
139 | grep -Ev 'sys/(param|file)\.h' \
140 | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
144 # Files in src/ should not include directly any of
145 # the headers already included via system.h.
146 sc_system_h_headers: .re-list
147 @if test -f $(srcdir)/src/system.h; then \
148 trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
149 grep -nE -f .re-list \
150 $$($(VC_LIST_EXCEPT) | grep '^src/') \
151 && { echo '$(ME): the above are already included via system.h'\
152 1>&2; exit 1; } || :; \
157 'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
158 $$($(VC_LIST_EXCEPT)) && \
159 { echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
162 ALL_RECURSIVE_TARGETS += sc_tight_scope
166 ALL_RECURSIVE_TARGETS += sc_check-AUTHORS
170 # Perl-based tests used to exec perl from a #!/bin/sh script.
171 # Now they all start with #!/usr/bin/perl and the portability
172 # infrastructure is in tests/Makefile.am. Make sure no old-style
173 # script sneaks back in.
174 sc_no_exec_perl_coreutils:
175 @if test -f $(srcdir)/tests/Coreutils.pm; then \
176 grep '^exec *\$$PERL.*MCoreutils' $$($(VC_LIST) tests) && \
177 { echo 1>&2 '$(ME): found anachronistic Perl-based tests'; \
181 # Don't use "readlink" or "readlinkat" directly
182 sc_prohibit_readlink:
183 @re='\<readlink(at)? \(' \
184 msg='do not use readlink(at); use via xreadlink or areadlink*' \
187 # Don't use address of "stat" or "lstat" functions
188 sc_prohibit_stat_macro_address:
189 @re='\<l?stat '':|&l?stat\>' \
190 msg='stat() and lstat() may be function-like macros' \
193 # Ensure that date's --help output stays in sync with the info
194 # documentation for GNU strftime. The only exception is %N,
195 # which date accepts but GNU strftime does not.
196 extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
198 @if test -f $(srcdir)/src/date.c; then \
199 grep '^ %. ' $(srcdir)/src/date.c | sort \
200 | $(extract_char) > $@-src; \
202 info libc date calendar format | grep '^ `%.'\' \
203 | $(extract_char); } | sort > $@-info; \
204 diff -u $@-src $@-info || exit 1; \
205 rm -f $@-src $@-info; \
208 # Indent only with spaces.
209 sc_prohibit_tab_based_indentation:
211 msg='TAB in indentation; use only spaces' \
214 # Don't use "indent-tabs-mode: nil" anymore. No longer needed.
215 sc_prohibit_emacs__indent_tabs_mode__setting:
216 @re='^( *[*#] *)?indent-tabs-mode:' \
217 msg='use of emacs indent-tabs-mode: setting' \
220 # Ensure that each file that contains fail=1 also contains fail=0.
221 # Otherwise, setting file=1 in the environment would make tests fail unexpectedly.
224 msg='fail=0 initialization' \
227 # Ensure that "stdio--.h" is used where appropriate.
228 sc_require_stdio_safer:
229 @if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
230 files=$$(grep -l '\bfreopen \?(' $$($(VC_LIST_EXCEPT) \
231 | grep '\.[ch]$$')); \
232 test -n "$$files" && grep -LE 'include "stdio--.h"' $$files \
234 { echo '$(ME): the above files should use "stdio--.h"' \
235 1>&2; exit 1; } || :; \
239 # Prefer xnanosleep over other less-precise sleep methods
241 @re='\<(nano|u)?sleep \(' \
242 msg='prefer xnanosleep over other sleep interfaces' \
245 include $(srcdir)/dist-check.mk
247 update-copyright-env = \
248 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
249 UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79