diff options
author | Akim Demaille <akim@lrde.epita.fr> | 2012-09-21 14:11:18 +0200 |
---|---|---|
committer | Akim Demaille <akim@lrde.epita.fr> | 2012-09-25 11:50:52 +0200 |
commit | aca9380111bb5df9f12b1aa38b6c202f97df6ac7 (patch) | |
tree | dbdc836bd738c02c162f64582aac76e770f798ec /top | |
parent | a294088ce06e24f13c66a53966fc745709af1d20 (diff) | |
download | gnulib-aca9380111bb5df9f12b1aa38b6c202f97df6ac7.tar.gz |
maint.mk: factor the validation of RELEASE_TYPE
With help from Jim Meyering.
http://lists.gnu.org/archive/html/bug-gnulib/2012-09/msg00132.html
* top/maint.mk (_empty, _sp): Move their definition earlier.
(member-check, release-type): New.
Use the latter instead of $(RELEASE_TYPE).
Remove now useless local checks.
Diffstat (limited to 'top')
-rw-r--r-- | top/maint.mk | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/top/maint.mk b/top/maint.mk index 87bbde9ddf..1851815086 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -28,6 +28,22 @@ ifneq ($(build_aux),) set $$(_build-aux) relative to $$(srcdir) instead of $$(build_aux)") endif +# Helper variables. +_empty = +_sp = $(_empty) $(_empty) + +# 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)) + # Do not save the original name or timestamp in the .tar.gz file. # Use --rsyncable if available. gzip_rsyncable := \ @@ -91,13 +107,17 @@ my_distdir = $(PACKAGE)-$(VERSION) # Old releases are stored here. release_archive_dir ?= ../release +# Validate and return $(RELEASE_TYPE), or die. +RELEASE_TYPES = alpha beta stable +release-type = $(call member-check,RELEASE_TYPE,$(RELEASE_TYPES)) + # Override gnu_rel_host and url_dir_list in cfg.mk if these are not right. # Use alpha.gnu.org for alpha and beta releases. # Use ftp.gnu.org for stable releases. gnu_ftp_host-alpha = alpha.gnu.org gnu_ftp_host-beta = alpha.gnu.org gnu_ftp_host-stable = ftp.gnu.org -gnu_rel_host ?= $(gnu_ftp_host-$(RELEASE_TYPE)) +gnu_rel_host ?= $(gnu_ftp_host-$(release-type)) ifeq ($(gnu_rel_host),ftp.gnu.org) url_dir_list ?= http://ftpmirror.gnu.org/$(PACKAGE) @@ -570,8 +590,6 @@ sc_prohibit_c_ctype_without_use: @h='c-ctype.h' re='\<c_($(ctype_re)) *\(' \ $(_sc_header_without_use) -_empty = -_sp = $(_empty) $(_empty) # The following list was generated by running: # man signal.h|col -b|perl -ne '/bsd_signal.*;/.../sigwaitinfo.*;/ and print' \ # | perl -lne '/^\s+(?:int|void).*?(\w+).*/ and print $1' | fmt @@ -1266,7 +1284,7 @@ gpg_key_ID ?= \ translation_project_ ?= coordinator@translationproject.org # Make info-gnu the default only for a stable release. -ifeq ($(RELEASE_TYPE),stable) +ifeq ($(release-type),stable) announcement_Cc_ ?= $(translation_project_), $(PACKAGE_BUGREPORT) announcement_mail_headers_ ?= \ To: info-gnu@gnu.org \ @@ -1284,7 +1302,7 @@ announcement: NEWS ChangeLog $(rel-files) # annoucement message: it would start with " GEN announcement". $(AM_V_at)$(srcdir)/$(_build-aux)/announce-gen \ --mail-headers='$(announcement_mail_headers_)' \ - --release-type=$(RELEASE_TYPE) \ + --release-type=$(release-type) \ --package=$(PACKAGE) \ --prev=$(PREV_VERSION) \ --curr=$(VERSION) \ @@ -1386,9 +1404,7 @@ release-prep-hook ?= release-prep gl_noteworthy_news_ = * Noteworthy changes in release ?.? (????-??-??) [?] .PHONY: release-prep release-prep: - $(AM_V_GEN)case $$RELEASE_TYPE in alpha|beta|stable) ;; \ - *) echo "invalid RELEASE_TYPE: $$RELEASE_TYPE" 1>&2; exit 1;; esac - $(AM_V_at)$(MAKE) --no-print-directory -s announcement \ + $(AM_V_GEN)$(MAKE) --no-print-directory -s announcement \ > ~/announce-$(my_distdir) $(AM_V_at)if test -d $(release_archive_dir); then \ ln $(rel-files) $(release_archive_dir); \ |