doc: update suffix regex in version sort
[platform/upstream/coreutils.git] / cfg.mk
1 # Customize maint.mk                           -*- makefile -*-
2 # Copyright (C) 2003-2009 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 # Use alpha.gnu.org for alpha and beta releases.
18 # Use ftp.gnu.org for major releases.
19 gnu_ftp_host-alpha = alpha.gnu.org
20 gnu_ftp_host-beta = alpha.gnu.org
21 gnu_ftp_host-major = ftp.gnu.org
22 gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
23
24 # Used in maint.mk's web-manual rule
25 manual_title = Core GNU utilities
26
27 url_dir_list = \
28   ftp://$(gnu_rel_host)/gnu/coreutils
29
30 # The GnuPG ID of the key used to sign the tarballs.
31 gpg_key_ID = B9AB9A16
32
33 # Tests not to run as part of "make distcheck".
34 # Exclude changelog-check here so that there's less churn in ChangeLog
35 # files -- otherwise, you'd need to have the upcoming version number
36 # at the top of the file for each `make distcheck' run.
37 local-checks-to-skip = changelog-check strftime-check
38
39 local-checks-to-skip += patch-check
40
41 # The local directory containing the checked-out copy of gnulib used in this
42 # release.  Used solely to get gnulib's SHA1 for the "announcement" target.
43 gnulib_dir = /gnulib
44
45 # Now that we have better (check.mk) tests, make this the default.
46 export VERBOSE = yes
47
48 old_NEWS_hash = fa6cba1740b3f385520c1b54d90859ca  -
49
50 # Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
51 dd = $(srcdir)/src/dd.c
52 sc_dd_O_FLAGS:
53         @rm -f $@.1 $@.2
54         @{ echo O_FULLBLOCK; perl -nle '/^ +\| (O_\w*)$$/ and print $$1' \
55           $(dd); } | sort > $@.1
56         @{ echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
57           $(dd); } | sort > $@.2
58         @diff -u $@.1 $@.2 || diff=1 || diff=;                          \
59         rm -f $@.1 $@.2;                                                \
60         test "$$diff"                                                   \
61           && { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2;   \
62                exit 1; } || :
63
64 # Ensure that dd's definition of LONGEST_SYMBOL stays in sync
65 # with the strings from the two affected variables.
66 dd_c = $(srcdir)/src/dd.c
67 sc_dd_max_sym_length:
68 ifneq ($(wildcard $(dd_c)),)
69         @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
70                  sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) )      \
71                 |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p'         \
72               | wc --max-line-length);                          \
73         max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
74               |tr -d '"' | wc --max-line-length);               \
75         if test "$$len" = "$$max"; then :; else                 \
76           echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2;      \
77           exit 1;                                               \
78         fi
79 endif
80
81 # Many m4 macros names once began with `jm_'.
82 # On 2004-04-13, they were all changed to start with gl_ instead.
83 # Make sure that none are inadvertently reintroduced.
84 sc_prohibit_jm_in_m4:
85         @grep -nE 'jm_[A-Z]'                                            \
86                 $$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) &&     \
87             { echo '$(ME): do not use jm_ in m4 macro names'            \
88               1>&2; exit 1; } || :
89
90 # Ensure that each root-requiring test is run via the "check-root" rule.
91 sc_root_tests:
92         @if test -d tests \
93               && grep check-root tests/Makefile.am>/dev/null 2>&1; then \
94         t1=sc-root.expected; t2=sc-root.actual;                         \
95         grep -nl '^require_root_$$'                                     \
96           $$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1;            \
97         sed -n '/^root_tests =[  ]*\\$$/,/[^\]$$/p'                     \
98           $(srcdir)/tests/Makefile.am                                   \
99             | sed 's/^  *//;/^root_tests =/d'                           \
100             | tr -s '\012\\' '  ' | fmt -1 | sort > $$t2;               \
101         diff -u $$t1 $$t2 || diff=1 || diff=;                           \
102         rm -f $$t1 $$t2;                                                \
103         test "$$diff"                                                   \
104           && { echo 'tests/Makefile.am: missing check-root action'>&2;  \
105                exit 1; } || :;                                          \
106         fi
107
108 headers_with_interesting_macro_defs = \
109   exit.h        \
110   fcntl_.h      \
111   fnmatch_.h    \
112   intprops.h    \
113   inttypes_.h   \
114   lchown.h      \
115   openat.h      \
116   stat-macros.h \
117   stdint_.h
118
119 # Create a list of regular expressions matching the names
120 # of macros that are guaranteed by parts of gnulib to be defined.
121 .re-defmac:
122         @(cd $(srcdir)/lib;                                             \
123           for f in $(headers_with_interesting_macro_defs); do           \
124             test -f $$f &&                                              \
125               sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f;  \
126            done;                                                        \
127          ) | sort -u                                                    \
128            | grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX'                     \
129            | sed 's/^/^# *define /'                                     \
130           > $@-t
131         @mv $@-t $@
132
133 # Don't define macros that we already get from gnulib header files.
134 sc_always_defined_macros: .re-defmac
135         @if test -f $(srcdir)/src/system.h; then                        \
136           trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15;        \
137           grep -f .re-defmac $$($(VC_LIST))                             \
138             && { echo '$(ME): define the above via some gnulib .h file' \
139                   1>&2;  exit 1; } || :;                                \
140         fi
141
142 # Create a list of regular expressions matching the names
143 # of files included from system.h.  Exclude a couple.
144 .re-list:
145         @sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
146           | grep -Ev 'sys/(param|file)\.h' \
147           | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
148           > $@-t
149         @mv $@-t $@
150
151 # Files in src/ should not include directly any of
152 # the headers already included via system.h.
153 sc_system_h_headers: .re-list
154         @if test -f $(srcdir)/src/system.h; then                        \
155           trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15;          \
156           grep -nE -f .re-list                                          \
157               $$($(VC_LIST) src |                                       \
158                  grep -Ev '((copy|system)\.h|parse-gram\.c)$$')         \
159             && { echo '$(ME): the above are already included via system.h'\
160                   1>&2;  exit 1; } || :;                                \
161         fi
162
163 sc_sun_os_names:
164         @grep -nEi \
165             'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
166             $$($(VC_LIST_EXCEPT)) &&                                    \
167           { echo '$(ME): found misuse of Sun OS version numbers' 1>&2;  \
168             exit 1; } || :
169
170 sc_tight_scope:
171         @$(MAKE) -C src $@
172
173 # Perl-based tests used to exec perl from a #!/bin/sh script.
174 # Now they all start with #!/usr/bin/perl and the portability
175 # infrastructure is in tests/Makefile.am.  Make sure no old-style
176 # script sneaks back in.
177 sc_no_exec_perl_coreutils:
178         @if test -f $(srcdir)/tests/Coreutils.pm; then                  \
179           grep '^exec  *\$$PERL.*MCoreutils' $$($(VC_LIST) tests) &&    \
180             { echo 1>&2 '$(ME): found anachronistic Perl-based tests';  \
181               exit 1; } || :;                                           \
182         fi
183
184 # Ensure that date's --help output stays in sync with the info
185 # documentation for GNU strftime.  The only exception is %N,
186 # which date accepts but GNU strftime does not.
187 extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
188 sc_strftime_check:
189         @if test -f $(srcdir)/src/date.c; then                          \
190           grep '^  %.  ' $(srcdir)/src/date.c | sort                    \
191             | $(extract_char) > $@-src;                                 \
192           { echo N;                                                     \
193             info libc date calendar format | grep '^    `%.'\'          \
194               | $(extract_char); } | sort > $@-info;                    \
195           diff -u $@-src $@-info || exit 1;                             \
196           rm -f $@-src $@-info;                                         \
197         fi