| 1 | # Customize maint.mk -*- makefile -*-
|
|---|
| 2 | # Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>.
|
|---|
| 16 |
|
|---|
| 17 | # Cause the tool(s) built by this package to be used also when running
|
|---|
| 18 | # commands via e.g., "make syntax-check". Doing this a little sooner
|
|---|
| 19 | # would have avoided a grep infloop bug.
|
|---|
| 20 | ifeq ($(build_triplet), $(host_triplet))
|
|---|
| 21 | export PATH := $(builddir)/src$(PATH_SEPARATOR)$(PATH)
|
|---|
| 22 | endif
|
|---|
| 23 |
|
|---|
| 24 | # Used in maint.mk's web-manual rule
|
|---|
| 25 | manual_title = GNU Grep: Print lines matching a pattern
|
|---|
| 26 |
|
|---|
| 27 | # Use the direct link. This is guaranteed to work immediately, while
|
|---|
| 28 | # it can take a while for the faster mirror links to become usable.
|
|---|
| 29 | url_dir_list = https://ftp.gnu.org/gnu/$(PACKAGE)
|
|---|
| 30 |
|
|---|
| 31 | # Tests not to run as part of "make distcheck".
|
|---|
| 32 | local-checks-to-skip = \
|
|---|
| 33 | sc_texinfo_acronym
|
|---|
| 34 |
|
|---|
| 35 | # Tools used to bootstrap this package, used for "announcement".
|
|---|
| 36 | bootstrap-tools = autoconf,automake,gnulib
|
|---|
| 37 |
|
|---|
| 38 | # Override the default Cc: used in generating an announcement.
|
|---|
| 39 | announcement_Cc_ = $(translation_project_), $(PACKAGE)-devel@gnu.org
|
|---|
| 40 |
|
|---|
| 41 | # The tight_scope test gets confused about inline functions.
|
|---|
| 42 | # like 'to_uchar'.
|
|---|
| 43 | _gl_TS_unmarked_extern_functions = main usage mb_clen to_uchar dfaerror dfawarn
|
|---|
| 44 |
|
|---|
| 45 | # Now that we have better tests, make this the default.
|
|---|
| 46 | export VERBOSE = yes
|
|---|
| 47 |
|
|---|
| 48 | # Comparing tarball sizes compressed using different xz presets, we see
|
|---|
| 49 | # that -6e adds only 60 bytes to the size of the tarball, yet reduces
|
|---|
| 50 | # (from -9) the decompression memory requirement from 64 MiB to 9 MiB.
|
|---|
| 51 | # Don't be tempted by -5e, since -6 and -5 use the same dictionary size.
|
|---|
| 52 | # $ for i in {4,5,6,7,8,9}{e,}; do \
|
|---|
| 53 | # (n=$(xz -$i < grep-2.11.tar|wc -c);echo $n $i) & done |sort -nr
|
|---|
| 54 | # 1236632 4
|
|---|
| 55 | # 1162564 5
|
|---|
| 56 | # 1140988 4e
|
|---|
| 57 | # 1139620 6
|
|---|
| 58 | # 1139480 7
|
|---|
| 59 | # 1139480 8
|
|---|
| 60 | # 1139480 9
|
|---|
| 61 | # 1129552 5e
|
|---|
| 62 | # 1127616 6e
|
|---|
| 63 | # 1127556 7e
|
|---|
| 64 | # 1127556 8e
|
|---|
| 65 | # 1127556 9e
|
|---|
| 66 | export XZ_OPT = -6e
|
|---|
| 67 |
|
|---|
| 68 | old_NEWS_hash = da867d7903ff4936e2ee6c173e20fb63
|
|---|
| 69 |
|
|---|
| 70 | # We prefer to spell it back-reference, as POSIX does.
|
|---|
| 71 | sc_prohibit_backref:
|
|---|
| 72 | @prohibit=back''reference \
|
|---|
| 73 | halt='spell it "back-reference"' \
|
|---|
| 74 | $(_sc_search_regexp)
|
|---|
| 75 |
|
|---|
| 76 | # Many m4 macros names once began with 'jm_'.
|
|---|
| 77 | # Make sure that none are inadvertently reintroduced.
|
|---|
| 78 | sc_prohibit_jm_in_m4:
|
|---|
| 79 | @grep -nE 'jm_[A-Z]' \
|
|---|
| 80 | $$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \
|
|---|
| 81 | { echo '$(ME): do not use jm_ in m4 macro names' \
|
|---|
| 82 | 1>&2; exit 1; } || :
|
|---|
| 83 |
|
|---|
| 84 | sc_prohibit_echo_minus_en:
|
|---|
| 85 | @prohibit='\<echo -[en]' \
|
|---|
| 86 | halt='do not use echo ''-e or echo ''-n; use printf instead' \
|
|---|
| 87 | $(_sc_search_regexp)
|
|---|
| 88 |
|
|---|
| 89 | # Look for lines longer than 80 characters, except omit:
|
|---|
| 90 | # - program-generated long lines in diff headers,
|
|---|
| 91 | # - the help2man script copied from upstream,
|
|---|
| 92 | # - tests involving long checksum lines, and
|
|---|
| 93 | # - the 'pr' test cases.
|
|---|
| 94 | LINE_LEN_MAX = 80
|
|---|
| 95 | FILTER_LONG_LINES = \
|
|---|
| 96 | /^[^:]*\.diff:[^:]*:@@ / d; \
|
|---|
| 97 | \|^[^:]*TODO:| d; \
|
|---|
| 98 | \|^[^:]*man/help2man:| d; \
|
|---|
| 99 | \|^[^:]*tests/misc/sha[0-9]*sum.*\.pl[-:]| d; \
|
|---|
| 100 | \|^[^:]*tests/pr/|{ \|^[^:]*tests/pr/pr-tests:| !d; };
|
|---|
| 101 | sc_long_lines:
|
|---|
| 102 | @files=$$($(VC_LIST_EXCEPT)) \
|
|---|
| 103 | halt='line(s) with more than $(LINE_LEN_MAX) characters; reindent'; \
|
|---|
| 104 | for file in $$files; do \
|
|---|
| 105 | expand $$file | grep -nE '^.{$(LINE_LEN_MAX)}.' | \
|
|---|
| 106 | sed -e "s|^|$$file:|" -e '$(FILTER_LONG_LINES)'; \
|
|---|
| 107 | done | grep . && { msg="$$halt" $(_sc_say_and_exit) } || :
|
|---|
| 108 |
|
|---|
| 109 | # Indent only with spaces.
|
|---|
| 110 | sc_prohibit_tab_based_indentation:
|
|---|
| 111 | @prohibit='^ * ' \
|
|---|
| 112 | halt='TAB in indentation; use only spaces' \
|
|---|
| 113 | $(_sc_search_regexp)
|
|---|
| 114 |
|
|---|
| 115 | # Don't use "indent-tabs-mode: nil" anymore. No longer needed.
|
|---|
| 116 | sc_prohibit_emacs__indent_tabs_mode__setting:
|
|---|
| 117 | @prohibit='^( *[*#] *)?indent-tabs-mode:' \
|
|---|
| 118 | halt='use of emacs indent-tabs-mode: setting' \
|
|---|
| 119 | $(_sc_search_regexp)
|
|---|
| 120 |
|
|---|
| 121 | # Ensure that the list of test file names in tests/Makefile.am is sorted.
|
|---|
| 122 | sc_sorted_tests:
|
|---|
| 123 | @perl -0777 -ne \
|
|---|
| 124 | '/^TESTS =(.*?)^$$/ms; ($$t = $$1) =~ s/[\\\s\n]+/\n/g;print $$t' \
|
|---|
| 125 | tests/Makefile.am | sort -c
|
|---|
| 126 |
|
|---|
| 127 | # THANKS.in is a list of name/email pairs for people who are mentioned in
|
|---|
| 128 | # commit logs (and generated ChangeLog), but who are not also listed as an
|
|---|
| 129 | # author of a commit. Name/email pairs of commit authors are automatically
|
|---|
| 130 | # extracted from the repository. As a very minor factorization, when
|
|---|
| 131 | # someone who was initially listed only in THANKS.in later authors a commit,
|
|---|
| 132 | # this rule detects that their pair may now be removed from THANKS.in.
|
|---|
| 133 | sc_THANKS_in_duplicates:
|
|---|
| 134 | @{ git log --pretty=format:%aN | sort -u; \
|
|---|
| 135 | cut -b-36 THANKS.in | sed '/^$$/d;s/ *$$//'; } \
|
|---|
| 136 | | sort | uniq -d | grep . \
|
|---|
| 137 | && { echo '$(ME): remove the above names from THANKS.in' \
|
|---|
| 138 | 1>&2; exit 1; } || :
|
|---|
| 139 |
|
|---|
| 140 | # Ensure that tests don't use `cmd ... && fail=1` as that hides crashes.
|
|---|
| 141 | # The "exclude" expression allows common idioms like `test ... && fail=1`
|
|---|
| 142 | # and the 2>... portion allows commands that redirect stderr and so probably
|
|---|
| 143 | # independently check its contents and thus detect any crash messages.
|
|---|
| 144 | sc_prohibit_and_fail_1:
|
|---|
| 145 | @prohibit='&& fail=1' \
|
|---|
| 146 | exclude='(stat|kill|test |EGREP|grep|compare|2> *[^/])' \
|
|---|
| 147 | halt='&& fail=1 detected. Please use: returns_ 1 ... || fail=1' \
|
|---|
| 148 | in_vc_files='^tests/' \
|
|---|
| 149 | $(_sc_search_regexp)
|
|---|
| 150 |
|
|---|
| 151 | update-copyright-env = \
|
|---|
| 152 | UPDATE_COPYRIGHT_USE_INTERVALS=1 \
|
|---|
| 153 | UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
|
|---|
| 154 |
|
|---|
| 155 | include $(abs_top_srcdir)/dist-check.mk
|
|---|
| 156 |
|
|---|
| 157 | exclude_file_name_regexp--sc_bindtextdomain = \
|
|---|
| 158 | ^tests/get-mb-cur-max\.c$$
|
|---|
| 159 |
|
|---|
| 160 | exclude_file_name_regexp--sc_prohibit_strcmp = /colorize-.*\.c$$
|
|---|
| 161 | exclude_file_name_regexp--sc_prohibit_xalloc_without_use = ^src/kwset\.c$$
|
|---|
| 162 | exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \
|
|---|
| 163 | (Makefile|\.(am|mk)$$)
|
|---|
| 164 |
|
|---|
| 165 | exclude_file_name_regexp--sc_prohibit_doubled_word = ^tests/count-newline$$
|
|---|
| 166 |
|
|---|
| 167 | exclude_file_name_regexp--sc_long_lines = ^tests/.*$$
|
|---|
| 168 |
|
|---|
| 169 | # If a test uses timeout, it must also use require_timeout_.
|
|---|
| 170 | # Grandfather-exempt the fedora test, since it ensures timeout works
|
|---|
| 171 | # as expected before using it.
|
|---|
| 172 | sc_timeout_prereq:
|
|---|
| 173 | @$(VC_LIST_EXCEPT) \
|
|---|
| 174 | | grep '^tests/' \
|
|---|
| 175 | | grep -v '^tests/fedora$$' \
|
|---|
| 176 | | xargs grep -lw timeout \
|
|---|
| 177 | | xargs grep -FLw require_timeout_ \
|
|---|
| 178 | | $(GREP) . \
|
|---|
| 179 | && { echo '$(ME): timeout withtout use of require_timeout_' \
|
|---|
| 180 | 1>&2; exit 1; } || :
|
|---|