X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=top%2Fmaint.mk;h=c3fab9ac31c7da1821eb64a1b80d87ed99c9d29b;hb=df57f4270959d6679422896ca6f579d048777d81;hp=fb505181b2d5b98a30113375978e1cc38a5949d8;hpb=c90c5cc82c3b0c07b2dff0f135be74bbb97e0b60;p=gnulib.git diff --git a/top/maint.mk b/top/maint.mk index fb505181b..c3fab9ac3 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -21,6 +21,9 @@ # ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) ME := maint.mk +# Override this in cfg.mk if you use a non-standard build-aux directory. +build_aux ?= $(srcdir)/build-aux + # Do not save the original name or timestamp in the .tar.gz file. # Use --rsyncable if available. gzip_rsyncable := \ @@ -32,16 +35,17 @@ GIT = git VC = $(GIT) VC-tag = git tag -s -m '$(VERSION)' -u '$(gpg_key_ID)' -VC_LIST = $(srcdir)/build-aux/vc-list-files -C $(srcdir) +VC_LIST = $(build_aux)/vc-list-files -C $(srcdir) VC_LIST_EXCEPT = \ - $(VC_LIST) | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; else grep -v ChangeLog; fi + $(VC_LIST) | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \ + else grep -Ev "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi ifeq ($(origin prev_version_file), undefined) prev_version_file = $(srcdir)/.prev-version endif -PREV_VERSION := $(shell cat $(prev_version_file)) +PREV_VERSION := $(shell cat $(prev_version_file) 2>/dev/null) VERSION_REGEXP = $(subst .,\.,$(VERSION)) PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION)) @@ -59,6 +63,20 @@ my_distdir = $(PACKAGE)-$(VERSION) # Old releases are stored here. release_archive_dir ?= ../release +# 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)) + +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 + # Prevent programs like 'sort' from considering distinct strings to be equal. # Doing it here saves us from having to set LC_ALL elsewhere in this file. export LC_ALL = C @@ -67,9 +85,11 @@ export LC_ALL = C ## Sanity checks. ## ## --------------- ## +_cfg_mk := $(shell test -f $(srcdir)/cfg.mk && echo '$(srcdir)/cfg.mk') + # Collect the names of rules starting with `sc_'. -syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \ - $(srcdir)/$(ME) $(srcdir)/cfg.mk) +syntax-check-rules := $(sort $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \ + $(srcdir)/$(ME) $(_cfg_mk))) .PHONY: $(syntax-check-rules) local-checks-available = \ @@ -111,7 +131,7 @@ define _prohibit_regexp endef sc_avoid_if_before_free: - @$(srcdir)/build-aux/useless-if-before-free \ + @$(build_aux)/useless-if-before-free \ $(useless_free_options) \ $$($(VC_LIST_EXCEPT) | grep -v useless-if-before-free) && \ { echo '$(ME): found useless "if" before "free" above' 1>&2; \ @@ -150,6 +170,21 @@ sc_prohibit_strcmp: { echo '$(ME): use STREQ in place of the above uses of str''cmp' \ 1>&2; exit 1; } || : +# Pass EXIT_*, not number, to usage, exit, and error (when exiting) +# Convert all uses automatically, via these two commands: +# git grep -l '\ or "" # re: a regular expression that matches IFF something provided by $h is used. define _header_without_use - h_esc=`echo "$$h"|sed 's/\./\\./g'`; \ + dummy=; : so we do not need a semicolon before each use; \ + h_esc=`echo "$$h"|sed 's/\./\\\\./g'`; \ if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then \ files=$$(grep -l '^# *include '"$$h_esc" \ $$($(VC_LIST_EXCEPT) | grep '\.c$$')) && \ @@ -244,6 +280,10 @@ endef sc_prohibit_assert_without_use: @h='' re='\new(file => "/dev/stdin")->as_string'|sed 's/\?://g' +# Note this was produced by the above: +# _xa1 = x(alloc_(oversized|die)|([cz]|2?re)alloc|m(alloc|emdup)|strdup) +# But we can do better: +_xa1 = x(alloc_(oversized|die)|([cmz]|2?re)alloc|(mem|str)dup) +_xa2 = X([CZ]|N?M)ALLOC +sc_prohibit_xalloc_without_use: + @h='"xalloc.h"' \ + re='\<($(_xa1)|$(_xa2)) *\('\ + $(_header_without_use) + sc_prohibit_safe_read_without_use: @h='"safe-read.h"' re='(\|\ /dev/null \ + for i in $$(grep -l -F 'srcdir/$(Exit_base)' \ + $$($(VC_LIST) tests)); do \ + tail -n1 $$i | grep '^Exit .' > /dev/null \ && : || { die=1; echo $$i; } \ done; \ test $$die = 1 && \ { echo 1>&2 '$(ME): the final line in each of the above is not:'; \ - echo 1>&2 'Exit $$fail'; \ + echo 1>&2 'Exit something'; \ exit 1; } || :; \ fi @@ -484,7 +554,7 @@ sc_immutable_NEWS: # Update the hash stored above. Do this after each release and # for any corrections to old entries. update-NEWS-hash: NEWS - perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" \ + perl -pi -e 's/^(old_NEWS_hash[ \t]+:?=[ \t]+).*/$${1}'"$(NEWS_hash)/" \ $(srcdir)/cfg.mk # Ensure that we use only the standard $(VAR) notation, @@ -534,6 +604,7 @@ sc_po_check: for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \ test -r $$file || continue; \ case $$file in \ + *.m4|*.mk) continue ;; \ *.?|*.??) ;; \ *) continue;; \ esac; \ @@ -607,21 +678,6 @@ vc-diff-check: rm vc-diffs; \ fi -cvs-check: vc-diff-check - -ALL_RECURSIVE_TARGETS += maintainer-distcheck -maintainer-distcheck: - $(MAKE) distcheck - $(MAKE) taint-distcheck - $(MAKE) my-distcheck - - -# Don't make a distribution if checks fail. -# Also, make sure the NEWS file is up-to-date. -ALL_RECURSIVE_TARGETS += vc-dist -vc-dist: $(local-check) cvs-check maintainer-distcheck - XZ_OPT=-9ev $(MAKE) dist - # Use this to make sure we don't run these programs when building # from a virgin tgz file, below. null_AM_MAKEFLAGS = \ @@ -635,11 +691,12 @@ built_programs = $$(cd src && MAKEFLAGS= $(MAKE) -s built_programs.list) rel-files = $(DIST_ARCHIVES) +gnulib_dir ?= $(srcdir)/gnulib gnulib-version = $$(cd $(gnulib_dir) && git describe) bootstrap-tools ?= autoconf,automake,gnulib announcement: NEWS ChangeLog $(rel-files) - @$(srcdir)/build-aux/announce-gen \ + @$(build_aux)/announce-gen \ --release-type=$(RELEASE_TYPE) \ --package=$(PACKAGE) \ --prev=$(PREV_VERSION) \ @@ -661,7 +718,7 @@ www-gnu = http://www.gnu.org emit_upload_commands: @echo ===================================== @echo ===================================== - @echo "$(srcdir)/build-aux/gnupload $(GNUPLOADFLAGS) \\" + @echo "$(build_aux)/gnupload $(GNUPLOADFLAGS) \\" @echo " --to $(gnu_rel_host):$(PACKAGE) \\" @echo " $(rel-files)" @echo '# send the /tmp/announcement e-mail' @@ -689,15 +746,17 @@ no-submodule-changes: : ; \ fi -.PHONY: alpha beta major -ALL_RECURSIVE_TARGETS += alpha beta major -alpha beta major: $(local-check) writable-files no-submodule-changes - test $@ = major \ - && { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \ +.PHONY: alpha beta stable +ALL_RECURSIVE_TARGETS += alpha beta stable +alpha beta stable: $(local-check) writable-files no-submodule-changes + test $@ = stable \ + && { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \ || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\ || : - $(MAKE) vc-dist + $(MAKE) vc-diff-check $(MAKE) news-date-check + $(MAKE) distcheck + $(MAKE) dist XZ_OPT=-9ev $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir) if test -d $(release_archive_dir); then \ ln $(rel-files) $(release_archive_dir); \ @@ -761,3 +820,20 @@ INDENT_SOURCES ?= $(C_SOURCES) .PHONY: indent indent: indent $(INDENT_SOURCES) + +# If you want to set UPDATE_COPYRIGHT_* environment variables, +# put the assignments in this variable. +update-copyright-env ?= + +# Run this rule once per year (usually early in January) +# to update all FSF copyright year lists in your project. +# If you have an additional project-specific rule, +# add it in cfg.mk along with a line 'update-copyright: prereq'. +# By default, exclude all variants of COPYING; you can also +# add exemptions (such as ChangeLog..* for rotated change logs) +# in the file .x-update-copyright. +.PHONY: update-copyright +update-copyright: + grep -l -w Copyright \ + $$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \ + | $(update-copyright-env) xargs $(build_aux)/$@