summaryrefslogtreecommitdiff
path: root/maint.mk
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-02-15 21:41:24 +0100
committerAndy Wingo <wingo@pobox.com>2017-02-15 21:41:24 +0100
commit7e641595cd9b45ce7339e21c20a8ab81af9278f6 (patch)
tree8d224f14ad2cb5dc18a8375197c651e4563ec0cd /maint.mk
parent69ca2bb2217303b2556b131f3995ca4f6af81234 (diff)
downloadguile-7e641595cd9b45ce7339e21c20a8ab81af9278f6.tar.gz
Update Gnulib to v0.1-1157-gb03f418.
Diffstat (limited to 'maint.mk')
-rw-r--r--maint.mk105
1 files changed, 58 insertions, 47 deletions
diff --git a/maint.mk b/maint.mk
index aa23364a1..0cabd2f31 100644
--- a/maint.mk
+++ b/maint.mk
@@ -2,7 +2,7 @@
# This Makefile fragment tries to be general-purpose enough to be
# used by many projects via the gnulib maintainer-makefile module.
-## Copyright (C) 2001-2016 Free Software Foundation, Inc.
+## Copyright (C) 2001-2017 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
@@ -55,6 +55,10 @@ VC = $(GIT)
VC_LIST = $(srcdir)/$(_build-aux)/vc-list-files -C $(srcdir)
+# You can override this variable in cfg.mk if your gnulib submodule lives
+# in a different location.
+gnulib_dir ?= $(srcdir)/gnulib
+
# You can override this variable in cfg.mk to set your own regexp
# matching files to ignore.
VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$
@@ -437,17 +441,26 @@ sc_require_config_h:
halt='the above files do not include <config.h>' \
$(_sc_search_regexp)
+# Print each file name for which the first #include does not match
+# $(config_h_header). Like grep -m 1, this only looks at the first match.
+perl_config_h_first_ = \
+ -e 'BEGIN {$$ret = 0}' \
+ -e 'if (/^\# *include\b/) {' \
+ -e ' if (not m{^\# *include $(config_h_header)}) {' \
+ -e ' print "$$ARGV\n";' \
+ -e ' $$ret = 1;' \
+ -e ' }' \
+ -e ' \# Move on to next file after first include' \
+ -e ' close ARGV;' \
+ -e '}' \
+ -e 'END {exit $$ret}'
+
# You must include <config.h> before including any other header file.
# This can possibly be via a package-specific header, if given by cfg.mk.
sc_require_config_h_first:
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
- fail=0; \
- for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do \
- grep '^# *include\>' $$i | $(SED) 1q \
- | grep -E '^# *include $(config_h_header)' > /dev/null \
- || { echo $$i; fail=1; }; \
- done; \
- test $$fail = 1 && \
+ files=$$($(VC_LIST_EXCEPT) | grep '\.c$$') && \
+ perl -n $(perl_config_h_first_) $$files || \
{ echo '$(ME): the above files include some other header' \
'before <config.h>' 1>&2; exit 1; } || :; \
else :; \
@@ -648,17 +661,14 @@ sc_prohibit_strings_without_use:
re='\<(strn?casecmp|ffs(ll)?)\>' \
$(_sc_header_without_use)
-# Get the list of symbol names with this:
-# perl -lne '/^# *define ([A-Z]\w+)\(/ and print $1' lib/intprops.h|fmt
-_intprops_names = \
- TYPE_IS_INTEGER TYPE_SIGNED TYPE_MINIMUM TYPE_MAXIMUM \
- INT_BITS_STRLEN_BOUND INT_STRLEN_BOUND INT_BUFSIZE_BOUND \
- INT_ADD_RANGE_OVERFLOW INT_SUBTRACT_RANGE_OVERFLOW \
- INT_NEGATE_RANGE_OVERFLOW INT_MULTIPLY_RANGE_OVERFLOW \
- INT_DIVIDE_RANGE_OVERFLOW INT_REMAINDER_RANGE_OVERFLOW \
- INT_LEFT_SHIFT_RANGE_OVERFLOW INT_ADD_OVERFLOW INT_SUBTRACT_OVERFLOW \
- INT_NEGATE_OVERFLOW INT_MULTIPLY_OVERFLOW INT_DIVIDE_OVERFLOW \
- INT_REMAINDER_OVERFLOW INT_LEFT_SHIFT_OVERFLOW
+# Extract the raw list of symbol names with this:
+gl_extract_define_simple = \
+ /^\# *define ([A-Z]\w+)\(/ and print $$1
+# Filter out duplicates and convert to a space-separated list:
+_intprops_names = \
+ $(shell f=$(gnulib_dir)/lib/intprops.h; \
+ perl -lne '$(gl_extract_define_simple)' $$f | sort -u | tr '\n' ' ')
+# Remove trailing space and convert to a regular expression:
_intprops_syms_re = $(subst $(_sp),|,$(strip $(_intprops_names)))
# Prohibit the inclusion of intprops.h without an actual use.
sc_prohibit_intprops_without_use:
@@ -708,15 +718,6 @@ sc_changelog:
$(_sc_search_regexp)
# Ensure that each .c file containing a "main" function also
-# calls set_program_name.
-sc_program_name:
- @require='set_program_name *\(.*\);' \
- in_vc_files='\.c$$' \
- containing='\<main *(' \
- halt='the above files do not call set_program_name' \
- $(_sc_search_regexp)
-
-# Ensure that each .c file containing a "main" function also
# calls bindtextdomain.
sc_bindtextdomain:
@require='bindtextdomain *\(' \
@@ -953,8 +954,13 @@ perl_filename_lineno_text_ = \
-e ' print "$$ARGV:$$n:$$v\n";' \
-e ' }'
+prohibit_doubled_words_ = \
+ the then in an on if is it but for or at and do to
+# expand the regex before running the check to avoid using expensive captures
+prohibit_doubled_word_expanded_ = \
+ $(join $(prohibit_doubled_words_),$(addprefix \s+,$(prohibit_doubled_words_)))
prohibit_doubled_word_RE_ ?= \
- /\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims
+ /\b(?:$(subst $(_sp),|,$(prohibit_doubled_word_expanded_)))\b/gims
prohibit_doubled_word_ = \
-e 'while ($(prohibit_doubled_word_RE_))' \
$(perl_filename_lineno_text_)
@@ -977,10 +983,11 @@ sc_prohibit_doubled_word:
# Also prohibit a prefix matching "\w+ +".
# @pxref gets the same see/also treatment and should be parenthesized;
# presume it must *not* start a sentence.
+# POSIX spells it "timestamp" rather than "time\s+stamp", so we do, too.
bad_xref_re_ ?= (?:[\w,:;] +|(?:see|also)\s+)\@xref\{
bad_pxref_re_ ?= (?:[.!?]|(?:see|also))\s+\@pxref\{
prohibit_undesirable_word_seq_RE_ ?= \
- /(?:\bcan\s+not\b|$(bad_xref_re_)|$(bad_pxref_re_))/gims
+ /(?:\bcan\s+not\b|\btime\s+stamps?\b|$(bad_xref_re_)|$(bad_pxref_re_))/gims
prohibit_undesirable_word_seq_ = \
-e 'while ($(prohibit_undesirable_word_seq_RE_))' \
$(perl_filename_lineno_text_)
@@ -1123,6 +1130,21 @@ fix_po_file_diag = \
'you have changed the set of files with translatable diagnostics;\n\
apply the above patch\n'
+# Generate a list of files in which to search for translatable strings.
+perl_translatable_files_list_ = \
+ -e 'foreach $$file (@ARGV) {' \
+ -e ' \# Consider only file extensions with one or two letters' \
+ -e ' $$file =~ /\...?$$/ or next;' \
+ -e ' \# Ignore m4 and mk files' \
+ -e ' $$file =~ /\.m[4k]$$/ and next;' \
+ -e ' \# Ignore a .c or .h file with a corresponding .l or .y file' \
+ -e ' $$file =~ /(.+)\.[ch]$$/ && (-e "$${1}.l" || -e "$${1}.y")' \
+ -e ' and next;' \
+ -e ' \# Skip unreadable files' \
+ -e ' -r $$file or next;' \
+ -e ' print "$$file ";' \
+ -e '}'
+
# Verify that all source files using _() (more specifically, files that
# match $(_gl_translatable_string_re)) are listed in po/POTFILES.in.
po_file ?= $(srcdir)/po/POTFILES.in
@@ -1132,21 +1154,8 @@ sc_po_check:
@if test -f $(po_file); then \
grep -E -v '^(#|$$)' $(po_file) \
| grep -v '^src/false\.c$$' | sort > $@-1; \
- files=; \
- for file in $$($(VC_LIST_EXCEPT)) $(generated_files); do \
- test -r $$file || continue; \
- case $$file in \
- *.m4|*.mk) continue ;; \
- *.?|*.??) ;; \
- *) continue;; \
- esac; \
- case $$file in \
- *.[ch]) \
- base=`expr " $$file" : ' \(.*\)\..'`; \
- { test -f $$base.l || test -f $$base.y; } && continue;; \
- esac; \
- files="$$files $$file"; \
- done; \
+ files=$$(perl $(perl_translatable_files_list_) \
+ $$($(VC_LIST_EXCEPT)) $(generated_files)); \
grep -E -l '$(_gl_translatable_string_re)' $$files \
| $(SED) 's|^$(_dot_escaped_srcdir)/||' | sort -u > $@-2; \
diff -u -L $(po_file) -L $(po_file) $@-1 $@-2 \
@@ -1284,7 +1293,6 @@ vc-diff-check:
rel-files = $(DIST_ARCHIVES)
-gnulib_dir ?= $(srcdir)/gnulib
gnulib-version = $$(cd $(gnulib_dir) \
&& { git describe || git rev-parse --short=10 HEAD; } )
bootstrap-tools ?= autoconf,automake,gnulib
@@ -1494,7 +1502,10 @@ gen-coverage:
--highlight --frames --legend \
--title "$(PACKAGE_NAME)"
-coverage: init-coverage build-coverage gen-coverage
+coverage:
+ $(MAKE) init-coverage
+ $(MAKE) build-coverage
+ $(MAKE) gen-coverage
# Some projects carry local adjustments for gnulib modules via patches in
# a gnulib patch directory whose default name is gl/ (defined in bootstrap