X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=top%2Fmaint.mk;h=c9f8cc853147d21e2182641ca9aa651ea607ee66;hb=6b24f60dad0f97704ae07d9688de7f31c1923bf7;hp=26ebc379a686aec0a165a924b943e876d3012543;hpb=b9a38b4535158a96606a72d41ae3456509356935;p=gnulib.git diff --git a/top/maint.mk b/top/maint.mk index 26ebc379a..c9f8cc853 100644 --- a/top/maint.mk +++ b/top/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-2012 Free Software Foundation, Inc. +## Copyright (C) 2001-2013 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 @@ -32,17 +32,23 @@ endif _empty = _sp = $(_empty) $(_empty) -# member-check VARIABLE,VALID-VALUES +# _equal,S1,S2 +# ------------ +# If S1 == S2, return S1, otherwise the empty string. +_equal = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1))) + +# member-check,VARIABLE,VALID-VALUES # ---------------------------------- # Check that $(VARIABLE) is in the space-separated list of VALID-VALUES, and # return it. Die otherwise. -member-check = \ - $(if $($(1)), \ - $(if $(findstring $(_sp),$($(1))), \ - $(error invalid $(1): '$($(1))', expected $(2)), \ - $(or $(findstring $(_sp)$($(1))$(_sp),$(_sp)$(2)(_sp)), \ - $(error invalid $(1): '$($(1))', expected $(2)))), \ - $(error $(1) undefined)) +member-check = \ + $(strip \ + $(if $($(1)), \ + $(if $(findstring $(_sp),$($(1))), \ + $(error invalid $(1): '$($(1))', expected $(2)), \ + $(or $(findstring $(_sp)$($(1))$(_sp),$(_sp)$(2)$(_sp)), \ + $(error invalid $(1): '$($(1))', expected $(2)))), \ + $(error $(1) undefined))) # Do not save the original name or timestamp in the .tar.gz file. # Use --rsyncable if available. @@ -68,9 +74,9 @@ _dot_escaped_srcdir = $(subst .,\.,$(srcdir)) # Post-process $(VC_LIST) output, prepending $(srcdir)/, but only # when $(srcdir) is not ".". ifeq ($(srcdir),.) -_prepend_srcdir_prefix = + _prepend_srcdir_prefix = else -_prepend_srcdir_prefix = | sed 's|^|$(srcdir)/|' + _prepend_srcdir_prefix = | sed 's|^|$(srcdir)/|' endif # In order to be able to consistently filter "."-relative names, @@ -94,13 +100,13 @@ VERSION_REGEXP = $(subst .,\.,$(VERSION)) PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION)) ifeq ($(VC),$(GIT)) -this-vc-tag = v$(VERSION) -this-vc-tag-regexp = v$(VERSION_REGEXP) + this-vc-tag = v$(VERSION) + this-vc-tag-regexp = v$(VERSION_REGEXP) else -tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]') -tag-this-version = $(subst .,_,$(VERSION)) -this-vc-tag = $(tag-package)-$(tag-this-version) -this-vc-tag-regexp = $(this-vc-tag) + tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]') + tag-this-version = $(subst .,_,$(VERSION)) + this-vc-tag = $(tag-package)-$(tag-this-version) + this-vc-tag-regexp = $(this-vc-tag) endif my_distdir = $(PACKAGE)-$(VERSION) @@ -126,11 +132,9 @@ gnu_ftp_host-beta = alpha.gnu.org gnu_ftp_host-stable = ftp.gnu.org gnu_rel_host ?= $(gnu_ftp_host-$(release-type)) -ifeq ($(gnu_rel_host),ftp.gnu.org) -url_dir_list ?= http://ftpmirror.gnu.org/$(PACKAGE) -else -url_dir_list ?= ftp://$(gnu_rel_host)/gnu/$(PACKAGE) -endif +url_dir_list ?= $(if $(call _equal,$(gnu_rel_host),ftp.gnu.org), \ + http://ftpmirror.gnu.org/$(PACKAGE), \ + ftp://$(gnu_rel_host)/gnu/$(PACKAGE)) # Override this in cfg.mk if you are using a different format in your # NEWS file. @@ -151,7 +155,7 @@ export LC_ALL = C ## Sanity checks. ## ## --------------- ## -_cfg_mk := $(shell test -f $(srcdir)/cfg.mk && echo '$(srcdir)/cfg.mk') +_cfg_mk := $(wildcard $(srcdir)/cfg.mk) # Collect the names of rules starting with 'sc_'. syntax-check-rules := $(sort $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \ @@ -159,9 +163,9 @@ syntax-check-rules := $(sort $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \ .PHONY: $(syntax-check-rules) ifeq ($(shell $(VC_LIST) >/dev/null 2>&1; echo $$?),0) -local-checks-available += $(syntax-check-rules) + local-checks-available += $(syntax-check-rules) else -local-checks-available += no-vc-detected + local-checks-available += no-vc-detected no-vc-detected: @echo "No version control files detected; skipping syntax check" endif @@ -805,7 +809,7 @@ sc_prohibit_always_true_header_tests: $(_sc_search_regexp) sc_prohibit_defined_have_decl_tests: - @prohibit='#[ ]*if(n?def|.*\[ (]+HAVE_DECL_' \ + @prohibit='(#[ ]*ifn?def|\[ (]+HAVE_DECL_' \ halt='HAVE_DECL macros are always defined' \ $(_sc_search_regexp) @@ -1117,9 +1121,11 @@ fix_po_file_diag = \ 'you have changed the set of files with translatable diagnostics;\n\ apply the above patch\n' -# Verify that all source files using _() are listed in po/POTFILES.in. +# 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 generated_files ?= $(srcdir)/lib/*.[ch] +_gl_translatable_string_re ?= \b(N?_|gettext *)\([^)"]*("|$$) sc_po_check: @if test -f $(po_file); then \ grep -E -v '^(#|$$)' $(po_file) \ @@ -1139,7 +1145,7 @@ sc_po_check: esac; \ files="$$files $$file"; \ done; \ - grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$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 \ || { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; }; \ @@ -1277,7 +1283,7 @@ vc-diff-check: rel-files = $(DIST_ARCHIVES) gnulib_dir ?= $(srcdir)/gnulib -gnulib-version = $$(cd $(gnulib_dir) && git describe) +gnulib-version = $$(cd $(gnulib_dir) && git rev-parse --short HEAD) bootstrap-tools ?= autoconf,automake,gnulib # If it's not already specified, derive the GPG key ID from @@ -1291,22 +1297,25 @@ gpg_key_ID ?= \ translation_project_ ?= coordinator@translationproject.org # Make info-gnu the default only for a stable release. -ifeq ($(release-type),stable) - announcement_Cc_ ?= $(translation_project_), $(PACKAGE_BUGREPORT) - announcement_mail_headers_ ?= \ - To: info-gnu@gnu.org \ - Cc: $(announcement_Cc_) \ - Mail-Followup-To: $(PACKAGE_BUGREPORT) -else - announcement_Cc_ ?= $(translation_project_) - announcement_mail_headers_ ?= \ - To: $(PACKAGE_BUGREPORT) \ - Cc: $(announcement_Cc_) -endif - +announcement_Cc_stable = $(translation_project_), $(PACKAGE_BUGREPORT) +announcement_mail_headers_stable = \ + To: info-gnu@gnu.org \ + Cc: $(announcement_Cc_) \ + Mail-Followup-To: $(PACKAGE_BUGREPORT) + +announcement_Cc_alpha = $(translation_project_) +announcement_mail_headers_alpha = \ + To: $(PACKAGE_BUGREPORT) \ + Cc: $(announcement_Cc_) + +announcement_mail_Cc_beta = $(announcement_mail_Cc_alpha) +announcement_mail_headers_beta = $(announcement_mail_headers_alpha) + +announcement_mail_Cc_ ?= $(announcement_mail_Cc_$(release-type)) +announcement_mail_headers_ ?= $(announcement_mail_headers_$(release-type)) announcement: NEWS ChangeLog $(rel-files) # Not $(AM_V_GEN) since the output of this command serves as -# annoucement message: it would start with " GEN announcement". +# announcement message: it would start with " GEN announcement". $(AM_V_at)$(srcdir)/$(_build-aux)/announce-gen \ --mail-headers='$(announcement_mail_headers_)' \ --release-type=$(release-type) \ @@ -1361,7 +1370,8 @@ endef .PHONY: no-submodule-changes no-submodule-changes: - $(AM_V_GEN)if test -d $(srcdir)/.git; then \ + $(AM_V_GEN)if test -d $(srcdir)/.git \ + && git --version >/dev/null 2>&1; then \ diff=$$(cd $(srcdir) && git submodule -q foreach \ git diff-index --name-only HEAD) \ || exit 1; \ @@ -1379,10 +1389,12 @@ submodule-checks ?= no-submodule-changes public-submodule-commit # cannot be built from a fresh clone. .PHONY: public-submodule-commit public-submodule-commit: - $(AM_V_GEN)if test -d $(srcdir)/.git; then \ + $(AM_V_GEN)if test -d $(srcdir)/.git \ + && git --version >/dev/null 2>&1; then \ cd $(srcdir) && \ - git submodule --quiet foreach test '$$(git rev-parse $$sha1)' \ - = '$$(git merge-base origin $$sha1)' \ + git submodule --quiet foreach \ + test '"$$(git rev-parse "$$sha1")"' \ + = '"$$(git merge-base origin "$$sha1")"' \ || { echo '$(ME): found non-public submodule commit' >&2; \ exit 1; }; \ else \ @@ -1411,7 +1423,8 @@ alpha beta stable: $(local-check) writable-files $(submodule-checks) $(AM_V_at)$(MAKE) $(release-prep-hook) RELEASE_TYPE=$@ $(AM_V_at)$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@ -release: $(release-type) +release: + $(AM_V_GEN)$(MAKE) $(release-type) # Override this in cfg.mk if you follow different procedures. release-prep-hook ?= release-prep