2008-03-20 21:19:56 +08:00
|
|
|
# Customize maint.mk -*- makefile -*-
|
2010-01-01 17:56:28 +08:00
|
|
|
# Copyright (C) 2003-2010 Free Software Foundation, Inc.
|
2003-08-26 17:29:26 +08:00
|
|
|
|
2007-07-23 20:35:58 +08:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2003-08-26 17:29:26 +08:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-07-23 20:35:58 +08:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
2003-08-26 17:29:26 +08:00
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-07-23 20:35:58 +08:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2001-06-17 12:11:03 +08:00
|
|
|
|
2009-03-03 15:24:29 +08:00
|
|
|
# Used in maint.mk's web-manual rule
|
|
|
|
manual_title = Core GNU utilities
|
|
|
|
|
2006-06-19 06:06:42 +08:00
|
|
|
# Tests not to run as part of "make distcheck".
|
2009-10-02 21:48:08 +08:00
|
|
|
local-checks-to-skip =
|
2008-09-24 21:02:19 +08:00
|
|
|
|
2009-04-25 10:16:27 +08:00
|
|
|
# Tools used to bootstrap this package, used for "announcement".
|
|
|
|
bootstrap-tools = autoconf,automake,gnulib,bison
|
|
|
|
|
2009-04-16 13:03:59 +08:00
|
|
|
# Now that we have better tests, make this the default.
|
2008-04-12 15:52:42 +08:00
|
|
|
export VERBOSE = yes
|
2008-04-23 03:28:33 +08:00
|
|
|
|
2010-01-14 05:14:16 +08:00
|
|
|
old_NEWS_hash = 9518f4930d702a9fa6ac6b9fd06cca94
|
2008-12-26 19:00:18 +08:00
|
|
|
|
2010-01-08 13:15:14 +08:00
|
|
|
# Add an exemption for sc_makefile_at_at_check.
|
|
|
|
_makefile_at_at_check_exceptions = ' && !/^cu_install_program =/'
|
|
|
|
|
2008-12-26 19:00:18 +08:00
|
|
|
# Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
|
|
|
|
dd = $(srcdir)/src/dd.c
|
|
|
|
sc_dd_O_FLAGS:
|
|
|
|
@rm -f $@.1 $@.2
|
2009-03-20 22:20:09 +08:00
|
|
|
@{ echo O_FULLBLOCK; perl -nle '/^ +\| (O_\w*)$$/ and print $$1' \
|
2008-12-26 19:00:18 +08:00
|
|
|
$(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=; \
|
|
|
|
rm -f $@.1 $@.2; \
|
|
|
|
test "$$diff" \
|
|
|
|
&& { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2; \
|
|
|
|
exit 1; } || :
|
2008-12-26 22:39:41 +08:00
|
|
|
|
|
|
|
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
|
|
|
|
# with the strings from the two affected variables.
|
|
|
|
dd_c = $(srcdir)/src/dd.c
|
|
|
|
sc_dd_max_sym_length:
|
|
|
|
ifneq ($(wildcard $(dd_c)),)
|
|
|
|
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
|
|
|
|
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|
|
|
|
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
|
|
|
|
| wc --max-line-length); \
|
|
|
|
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|
|
|
|
|tr -d '"' | wc --max-line-length); \
|
|
|
|
if test "$$len" = "$$max"; then :; else \
|
|
|
|
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Many m4 macros names once began with `jm_'.
|
|
|
|
# On 2004-04-13, they were all changed to start with gl_ instead.
|
|
|
|
# Make sure that none are inadvertently reintroduced.
|
|
|
|
sc_prohibit_jm_in_m4:
|
|
|
|
@grep -nE 'jm_[A-Z]' \
|
|
|
|
$$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \
|
|
|
|
{ echo '$(ME): do not use jm_ in m4 macro names' \
|
|
|
|
1>&2; exit 1; } || :
|
|
|
|
|
|
|
|
# Ensure that each root-requiring test is run via the "check-root" rule.
|
|
|
|
sc_root_tests:
|
|
|
|
@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_$$' \
|
|
|
|
$$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \
|
|
|
|
sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \
|
|
|
|
$(srcdir)/tests/Makefile.am \
|
|
|
|
| sed 's/^ *//;/^root_tests =/d' \
|
|
|
|
| tr -s '\012\\' ' ' | fmt -1 | sort > $$t2; \
|
|
|
|
diff -u $$t1 $$t2 || diff=1 || diff=; \
|
|
|
|
rm -f $$t1 $$t2; \
|
|
|
|
test "$$diff" \
|
|
|
|
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
|
|
|
|
exit 1; } || :; \
|
|
|
|
fi
|
|
|
|
|
2009-06-08 15:42:00 +08:00
|
|
|
# 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:
|
2010-01-24 21:46:58 +08:00
|
|
|
@test "$$( ($(VC_LIST) | sed -n '/\.x-sc_/p' \
|
|
|
|
| sed 's|^$(_dot_escaped_srcdir)/||'; \
|
2009-06-08 15:42:00 +08:00
|
|
|
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; } || :;
|
|
|
|
|
2008-12-26 22:39:41 +08:00
|
|
|
headers_with_interesting_macro_defs = \
|
|
|
|
exit.h \
|
|
|
|
fcntl_.h \
|
|
|
|
fnmatch_.h \
|
|
|
|
intprops.h \
|
|
|
|
inttypes_.h \
|
|
|
|
lchown.h \
|
|
|
|
openat.h \
|
|
|
|
stat-macros.h \
|
|
|
|
stdint_.h
|
|
|
|
|
|
|
|
# Create a list of regular expressions matching the names
|
|
|
|
# of macros that are guaranteed by parts of gnulib to be defined.
|
|
|
|
.re-defmac:
|
|
|
|
@(cd $(srcdir)/lib; \
|
|
|
|
for f in $(headers_with_interesting_macro_defs); do \
|
|
|
|
test -f $$f && \
|
|
|
|
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
|
|
|
|
done; \
|
|
|
|
) | sort -u \
|
|
|
|
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
|
|
|
|
| sed 's/^/^# *define /' \
|
|
|
|
> $@-t
|
|
|
|
@mv $@-t $@
|
|
|
|
|
|
|
|
# Don't define macros that we already get from gnulib header files.
|
|
|
|
sc_always_defined_macros: .re-defmac
|
|
|
|
@if test -f $(srcdir)/src/system.h; then \
|
|
|
|
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
|
|
|
|
grep -f .re-defmac $$($(VC_LIST)) \
|
|
|
|
&& { echo '$(ME): define the above via some gnulib .h file' \
|
|
|
|
1>&2; exit 1; } || :; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Create a list of regular expressions matching the names
|
|
|
|
# of files included from system.h. Exclude a couple.
|
|
|
|
.re-list:
|
|
|
|
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
|
|
|
|
| grep -Ev 'sys/(param|file)\.h' \
|
|
|
|
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
|
|
|
|
> $@-t
|
|
|
|
@mv $@-t $@
|
|
|
|
|
|
|
|
# Files in src/ should not include directly any of
|
|
|
|
# the headers already included via system.h.
|
|
|
|
sc_system_h_headers: .re-list
|
|
|
|
@if test -f $(srcdir)/src/system.h; then \
|
|
|
|
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
|
|
|
|
grep -nE -f .re-list \
|
2008-12-17 19:30:03 +08:00
|
|
|
$$($(VC_LIST_EXCEPT) | grep '^src/') \
|
2008-12-26 22:39:41 +08:00
|
|
|
&& { echo '$(ME): the above are already included via system.h'\
|
|
|
|
1>&2; exit 1; } || :; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
sc_sun_os_names:
|
|
|
|
@grep -nEi \
|
|
|
|
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
|
|
|
|
$$($(VC_LIST_EXCEPT)) && \
|
|
|
|
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
|
|
|
|
exit 1; } || :
|
|
|
|
|
build: avoid parallel distcheck failure
* Makefile.am (ALL_RECURSIVE_TARGETS): Initialize here, too,
to please automake. Add install-root, check-root, distcheck-hook.
* cfg.mk (ALL_RECURSIVE_TARGETS): Add sc_tight_scope.
* maint.mk (ALL_RECURSIVE_TARGETS): Add patch-check,
check-AUTHORS, maintainer-distcheck, vc-dist, taint-distcheck,
my-distcheck, alpha, beta, major.
2009-04-11 20:48:49 +08:00
|
|
|
ALL_RECURSIVE_TARGETS += sc_tight_scope
|
2008-12-26 22:39:41 +08:00
|
|
|
sc_tight_scope:
|
2009-01-29 17:44:25 +08:00
|
|
|
@$(MAKE) -C src $@
|
2008-12-26 22:39:41 +08:00
|
|
|
|
2009-08-18 18:12:21 +08:00
|
|
|
ALL_RECURSIVE_TARGETS += sc_check-AUTHORS
|
|
|
|
sc_check-AUTHORS:
|
|
|
|
@$(MAKE) -C src $@
|
|
|
|
|
2010-02-12 23:19:15 +08:00
|
|
|
# Option descriptions should not start with a capital letter
|
|
|
|
# One could grep source directly as follows:
|
|
|
|
# grep -E " {2,6}-.*[^.] [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$')
|
|
|
|
# but that would miss descriptions not on the same line as the -option.
|
|
|
|
ALL_RECURSIVE_TARGETS += sc_option_desc_uppercase
|
|
|
|
sc_option_desc_uppercase:
|
|
|
|
@$(MAKE) -s -C src all_programs
|
|
|
|
@$(MAKE) -s -C man $@
|
|
|
|
|
2010-02-13 02:34:33 +08:00
|
|
|
# Ensure all man/*.[1x] files are present
|
|
|
|
ALL_RECURSIVE_TARGETS += sc_man_file_correlation
|
|
|
|
sc_man_file_correlation:
|
|
|
|
@$(MAKE) -s -C src all_programs
|
|
|
|
@$(MAKE) -s -C man $@
|
|
|
|
|
2008-12-26 22:39:41 +08:00
|
|
|
# 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
|
|
|
|
# script sneaks back in.
|
|
|
|
sc_no_exec_perl_coreutils:
|
|
|
|
@if test -f $(srcdir)/tests/Coreutils.pm; then \
|
|
|
|
grep '^exec *\$$PERL.*MCoreutils' $$($(VC_LIST) tests) && \
|
|
|
|
{ echo 1>&2 '$(ME): found anachronistic Perl-based tests'; \
|
|
|
|
exit 1; } || :; \
|
|
|
|
fi
|
|
|
|
|
2009-10-22 18:12:24 +08:00
|
|
|
# Don't use "readlink" or "readlinkat" directly
|
|
|
|
sc_prohibit_readlink:
|
|
|
|
@re='\<readlink(at)? \(' \
|
|
|
|
msg='do not use readlink(at); use via xreadlink or areadlink*' \
|
|
|
|
$(_prohibit_regexp)
|
|
|
|
|
2009-10-23 20:06:46 +08:00
|
|
|
# Don't use address of "stat" or "lstat" functions
|
|
|
|
sc_prohibit_stat_macro_address:
|
|
|
|
@re='\<l?stat '':|&l?stat\>' \
|
|
|
|
msg='stat() and lstat() may be function-like macros' \
|
|
|
|
$(_prohibit_regexp)
|
|
|
|
|
2008-12-26 22:39:41 +08:00
|
|
|
# Ensure that date's --help output stays in sync with the info
|
|
|
|
# documentation for GNU strftime. The only exception is %N,
|
|
|
|
# which date accepts but GNU strftime does not.
|
|
|
|
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
|
|
|
|
sc_strftime_check:
|
2009-01-29 17:44:25 +08:00
|
|
|
@if test -f $(srcdir)/src/date.c; then \
|
2008-12-26 22:39:41 +08:00
|
|
|
grep '^ %. ' $(srcdir)/src/date.c | sort \
|
|
|
|
| $(extract_char) > $@-src; \
|
|
|
|
{ echo N; \
|
|
|
|
info libc date calendar format | grep '^ `%.'\' \
|
|
|
|
| $(extract_char); } | sort > $@-info; \
|
|
|
|
diff -u $@-src $@-info || exit 1; \
|
|
|
|
rm -f $@-src $@-info; \
|
|
|
|
fi
|
2009-04-25 03:36:22 +08:00
|
|
|
|
2009-02-28 00:32:19 +08:00
|
|
|
# Indent only with spaces.
|
|
|
|
sc_prohibit_tab_based_indentation:
|
|
|
|
@re='^ * ' \
|
|
|
|
msg='TAB in indentation; use only spaces' \
|
|
|
|
$(_prohibit_regexp)
|
|
|
|
|
2009-06-14 20:21:02 +08:00
|
|
|
# Don't use "indent-tabs-mode: nil" anymore. No longer needed.
|
|
|
|
sc_prohibit_emacs__indent_tabs_mode__setting:
|
|
|
|
@re='^( *[*#] *)?indent-tabs-mode:' \
|
|
|
|
msg='use of emacs indent-tabs-mode: setting' \
|
|
|
|
$(_prohibit_regexp)
|
|
|
|
|
2009-10-29 21:40:40 +08:00
|
|
|
# Ensure that each file that contains fail=1 also contains fail=0.
|
|
|
|
# Otherwise, setting file=1 in the environment would make tests fail unexpectedly.
|
2009-10-30 18:09:50 +08:00
|
|
|
sc_prohibit_fail_0:
|
|
|
|
@re='\<fail=0\>' \
|
|
|
|
msg='fail=0 initialization' \
|
|
|
|
$(_prohibit_regexp)
|
2009-10-29 21:40:40 +08:00
|
|
|
|
build: consistently use freopen-safer
cat, head, ptx, shuf, tac, tail, tee, tr, and uniq used freopen
on stdout, and were potentially vulnerable. dircolors, du, and
tsort only used it on stdin, which is unaffected by freopen_safer,
but this covers all uses for consistency.
* cfg.mk (sc_require_stdio_safer): New rule.
* gl/modules/xfreopen (Depends-on): Add freopen-safer.
* gl/lib/xfreopen.c (includes): Use stdio--.h.
* src/ptx.c (includes): Likewise.
* src/shuf.c (includes): Likewise.
* src/uniq.c (includes): Likewise.
* src/dircolors.c (includes): Likewise.
* src/du.c (includes): Likewise.
* src/tsort.c (includes): Likewise.
2009-11-06 07:48:09 +08:00
|
|
|
# Ensure that "stdio--.h" is used where appropriate.
|
|
|
|
sc_require_stdio_safer:
|
|
|
|
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
|
|
|
files=$$(grep -l '\bfreopen \?(' $$($(VC_LIST_EXCEPT) \
|
|
|
|
| grep '\.[ch]$$')); \
|
|
|
|
test -n "$$files" && grep -LE 'include "stdio--.h"' $$files \
|
|
|
|
| grep . && \
|
|
|
|
{ echo '$(ME): the above files should use "stdio--.h"' \
|
|
|
|
1>&2; exit 1; } || :; \
|
|
|
|
else :; \
|
|
|
|
fi
|
|
|
|
|
2009-11-24 05:59:18 +08:00
|
|
|
# Prefer xnanosleep over other less-precise sleep methods
|
|
|
|
sc_prohibit_sleep:
|
|
|
|
@re='\<(nano|u)?sleep \(' \
|
|
|
|
msg='prefer xnanosleep over other sleep interfaces' \
|
|
|
|
$(_prohibit_regexp)
|
|
|
|
|
2009-04-25 03:36:22 +08:00
|
|
|
include $(srcdir)/dist-check.mk
|
2010-01-04 01:56:22 +08:00
|
|
|
|
|
|
|
update-copyright-env = \
|
|
|
|
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
|
|
|
|
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
|