X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=inline;f=top%2Fmaint.mk;h=59e9cb58ebdc39bd4239cc952c6aa4ad5173ae22;hb=ad9a24a121ab3154f30d9d38d8243f41566d151e;hp=8d3d137d8fdbd59cd4ac4844bb6079b5b88c01aa;hpb=880f2b69df57af506439d6aaf1fe185a6f960e43;p=gnulib.git diff --git a/top/maint.mk b/top/maint.mk index 8d3d137d8..59e9cb58e 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -27,7 +27,8 @@ build_aux ?= $(srcdir)/build-aux # Do not save the original name or timestamp in the .tar.gz file. # Use --rsyncable if available. gzip_rsyncable := \ - $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable) + $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null \ + && printf %s --rsyncable) GZIP_ENV = '--no-name --best $(gzip_rsyncable)' GIT = git @@ -102,6 +103,12 @@ endif # Override this in cfg.mk if you are using a different format in your # NEWS file. today = $(shell date +%Y-%m-%d) + +# Select which lines of NEWS are searched for $(news-check-regexp). +# This is a sed line number spec. The default says that we search +# lines 1..10 of NEWS for $(news-check-regexp). +# If you want to search only line 3 or only lines 20-22, use "3" or "20,22". +news-check-lines-spec ?= 1,10 news-check-regexp ?= '^\*.* $(VERSION_REGEXP) \($(today)\)' # Prevent programs like 'sort' from considering distinct strings to be equal. @@ -187,11 +194,11 @@ syntax-check: $(local-check) # By default, _sc_search_regexp does not ignore case. export ignore_case = -_ignore_case = $$(test -n "$$ignore_case" && echo -i || :) +_ignore_case = $$(test -n "$$ignore_case" && printf %s -i || :) define _sc_say_and_exit dummy=; : so we do not need a semicolon before each use; \ - { echo -e "$(ME): $$msg" 1>&2; exit 1; }; + { printf '%s\n' "$(ME): $$msg" 1>&2; exit 1; }; endef # _sc_search_regexp used to be named _prohibit_regexp. However, @@ -674,36 +681,31 @@ gl_other_headers_ ?= \ # Perl -lne code to extract "significant" cpp-defined symbols from a # gnulib header file, eliminating a few common false-positives. gl_extract_significant_defines_ = \ - /^\# *define ([^_ (][^ (]*)(\s*\(|\s+\w+)/ && $$2 !~ /(?:rpl_|_used_without_)/\ + /^\# *define ([^_ (][^ (]*)(\s*\(|\s+\w+)/\ + && $$2 !~ /(?:rpl_|_used_without_)/\ + && $$1 !~ /^(?:NSIG|ATTRIBUTE_NORETURN)$$/\ and print $$1 # Create a list of regular expressions matching the names # of macros that are guaranteed to be defined by parts of gnulib. -.re-defmac: - @gen_h=$(gl_generated_headers_); \ +define def_sym_regex + gen_h=$(gl_generated_headers_); \ (cd $(gnulib_dir)/lib; \ for f in *.in.h $(gl_other_headers_); do \ perl -lne '$(gl_extract_significant_defines_)' $$f; \ done; \ ) | sort -u \ | grep -Ev '^ATTRIBUTE_NORETURN' \ - | sed 's/^/^ *# *define /;s/$$/\\>/' \ - > $@-t - @mv $@-t $@ - -define gl_trap_ - Exit () { set +e; (exit $$1); exit $$1; }; \ - for sig in 1 2 3 13 15; do \ - eval "trap 'Exit $$(expr $$sig + 128)' $$sig"; \ - done + | sed 's/^/^ *# *(define|undef) */;s/$$/\\>/' endef # Don't define macros that we already get from gnulib header files. -sc_prohibit_always-defined_macros: .re-defmac +sc_prohibit_always-defined_macros: @if test -d $(gnulib_dir); then \ - trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0; \ - $(gl_trap_); \ - grep -f .re-defmac $$($(VC_LIST_EXCEPT)) \ + case $$(echo all: | grep -l -f - Makefile) in Makefile);; *) \ + echo '$(ME): skipping $@: you lack GNU grep' 1>&2; exit 0;; \ + esac; \ + $(def_sym_regex) | grep -E -f - $$($(VC_LIST_EXCEPT)) \ && { echo '$(ME): define the above via some gnulib .h file' \ 1>&2; exit 1; } || :; \ fi @@ -878,8 +880,8 @@ sc_makefile_at_at_check: && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || : news-check: NEWS - if head $(srcdir)/NEWS | grep -E $(news-check-regexp) \ - >/dev/null; then \ + if sed -n $(news-check-lines-spec)p $(srcdir)/NEWS \ + | grep -E $(news-check-regexp) >/dev/null; then \ :; \ else \ echo 'NEWS: $$(news-check-regexp) failed to match' 1>&2; \ @@ -979,20 +981,22 @@ sc_copyright_check: # sets PATH correctly. This is an inexpensive way to ensure that # the other init.sh-using tests also get it right. _hv_file ?= $(srcdir)/tests/help-version -_hv_regex ?= ^ *\. [^ ]*/init\.sh +_hv_regex_weak ?= ^ *\. .*/init\.sh" +_hv_regex_strong ?= ^ *\. "\$${srcdir=\.}/init\.sh" sc_cross_check_PATH_usage_in_tests: @if test -f $(_hv_file); then \ - if grep -l 'VERSION mismatch' $(_hv_file) >/dev/null \ - && grep -lE '$(_hv_regex)' $(_hv_file) >/dev/null; then \ - good=$$(grep -E '$(_hv_regex)' < $(_hv_file)); \ - grep -LFx "$$good" \ - $$(grep -lE '$(_hv_regex)' $$($(VC_LIST_EXCEPT))) \ - | grep . && \ - { echo "$(ME): the above files use path_prepend_ inconsistently" \ - 1>&2; exit 1; } || :; \ - fi; \ - else \ - echo "$@: skipped: no such file: $(_hv_file)"; \ + grep -l 'VERSION mismatch' $(_hv_file) >/dev/null \ + || { echo "$@: skipped: no such file: $(_hv_file)" 1>&2; \ + exit 0; }; \ + grep -lE '$(_hv_regex_strong)' $(_hv_file) >/dev/null \ + || { echo "$@: $(_hv_file) lacks conforming use of init.sh" 1>&2; \ + exit 1; }; \ + good=$$(grep -E '$(_hv_regex_strong)' $(_hv_file)); \ + grep -LFx "$$good" \ + $$(grep -lE '$(_hv_regex_weak)' $$($(VC_LIST_EXCEPT))) \ + | grep . && \ + { echo "$(ME): the above files use path_prepend_ inconsistently" \ + 1>&2; exit 1; } || :; \ fi # #if HAVE_... will evaluate to false for any non numeric string.