2 # This Makefile fragment is shared between fileutils, sh-utils, textutils,
3 # CPPI, Bison, and Autoconf.
5 ## Copyright 2001 Free Software Foundation, Inc.
7 ## This program is free software; you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2, or (at your option)
12 ## This program is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ## GNU General Public License for more details.
17 ## You should have received a copy of the GNU General Public License
18 ## along with this program; if not, write to the Free Software
19 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 # Do not save the original name or timestamp in the .tar.gz file.
23 GZIP_ENV = '--no-name --best'
25 # Automake 1.4 does not define AMTAR.
30 prev_version_file ?= .prev-version
32 THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
33 PREV_VERSION := $(shell cat $(prev_version_file))
34 PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
36 tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
37 tag-this-version = $(subst .,_,$(VERSION))
38 tag-prev-version = $(subst .,_,$(PREV_VERSION))
39 this-cvs-tag = $(tag-package)-$(tag-this-version)
40 prev-cvs-tag = $(tag-package)-$(tag-prev-version)
41 my_distdir = $(PACKAGE)-$(VERSION)
43 # Old releases are stored here.
44 # Used for diffs and xdeltas.
45 release_archive_dir ?= ../release
53 # Checks that don't require cvs.
54 # Run `changelog-check' last, as previous test may reveal problems requiring
55 # new ChangeLog entries.
56 local-check: po-check copyright-check writable-files \
57 m4-check author_mark_check \
61 if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
64 echo "$(VERSION) not in ChangeLog" 1>&2; \
69 @grep 'AC_DEFUN([^[]' m4/*.m4 \
70 && { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \
73 # Verify that all source files using _() are listed in po/POTFILES.in.
75 if test -f po/POTFILES.in; then \
76 grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
77 grep -E -l '\b_\(' lib/*.[ch] src/*.[ch] | sort > $@-2; \
78 diff -u $@-1 $@-2 || exit 1; \
82 # In a definition of #define AUTHORS "... and ..." where the RHS contains
83 # the English word `and', the string must be marked with `N_ (...)' so that
84 # gettext recognizes it as a string requiring translation.
86 @grep '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
87 { echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \
90 # Check that `make alpha' will not fail at the end of the process.
92 if test -d $(release_archive_dir); then :; else \
93 mkdir $(release_archive_dir); \
95 for file in $(distdir).tar.gz $(xd-delta) \
96 $(release_archive_dir)/$(distdir).tar.gz \
97 $(release_archive_dir)/$(xd-delta); do \
98 test -e $$file || continue; \
100 || { echo ERROR: $$file is not writable; fail=1; }; \
102 test "$$fail" && exit 1 || :
104 v_etc_file = lib/version-etc.c
105 # Make sure that the copyright date in $(v_etc_file) is up to date.
107 @if test -f $(v_etc_file); then \
108 grep '"Copyright (C) $(shell date +%Y) Free' $(v_etc_file) \
110 || { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
115 # Sanity checks with the CVS repository.
117 echo $(this-cvs-tag); \
118 if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
119 echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
124 if $(CVS) diff >cvs-diffs; then \
127 echo "Some files are locally modified:" 1>&2; \
132 cvs-check: cvs-diff-check cvs-tag-check
134 maintainer-distcheck: changelog-check
139 # Tag before making distribution. Also, don't make a distribution if
140 # checks fail. Also, make sure the NEWS file is up-to-date.
141 # FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
142 cvs-dist: local-check cvs-check maintainer-distcheck
144 $(CVS) tag -c $(this-cvs-tag)
147 # Use this to make sure we don't run these programs when building
148 # from a virgin tgz file, below.
149 null_AM_MAKEFLAGS = \
156 # Detect format-string/arg-list mismatches that would normally be obscured
157 # by the use of _(). The --disable-nls effectively defines away that macro,
158 # and building with CFLAGS='-Wformat -Werror' causes any format warning to be
159 # treated as a failure.
161 my-distcheck: local-check
164 GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
166 && ./configure --disable-nls \
167 && $(MAKE) CFLAGS='-Wformat -Werror' \
168 AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
172 cd $(t) && mv $(distdir) $(distdir).old \
173 && $(AMTAR) -zxf ../$(distdir).tar.gz
174 diff -ur $(t)/$(distdir).old $(t)/$(distdir)
176 @echo "========================"; \
177 echo "$(distdir).tar.gz is ready for distribution"; \
178 echo "========================"
180 # This must be the same name on both hosts.
181 # Make it a symlink that points to the right place.
182 real_dir = fetish-ftp
184 url_dir_list = $(foreach x,$(hosts),ftp://$($(x)_host)/$($(x)_url_dir))
186 tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
187 tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
188 bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
189 bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
190 xdelta-md5 = $(shell md5sum < $(xd-delta)|sed 's/ -//')
191 xdelta-sha1 = $(shell sha1sum < $(xd-delta)|sed 's/ -//')
192 tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([Mk]\).*/ \1B/')
193 bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([Mk]\).*/ \1B/')
194 xd-size = $(shell du --human $(xd-delta)|sed 's/\([Mk]\).*/ \1B/')
197 tarz=/tmp/rel-check-tarz-$$$$; \
198 md5_tmp=/tmp/rel-check-md5-$$$$; \
200 trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
201 wget -q --output-document=$$tarz $(url); \
202 echo "$(md5) -" > $$md5_tmp; \
203 md5sum -c $$md5_tmp < $$tarz
205 prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
206 xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
210 $(my_distdir).tar.bz2: $(my_distdir).tar.gz
211 $(GZIP) -dc $< > $(my_distdir).tar
213 $(BZIP2) -9 $(my_distdir).tar
215 rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
216 announcement: NEWS ChangeLog $(rel-files)
218 echo Subject: $(my_distdir) released; \
220 echo FIXME: put comments here; \
222 for url in $(url_dir_list); do \
223 echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \
224 echo " $$url/$(my_distdir).tar.bz2 ($(bz2-size))"; \
227 echo And here are xdelta-style diffs; \
229 for url in $(url_dir_list); do \
230 echo " $$url/$(xd-delta) ($(xd-size))"; \
233 echo "Here are the MD5 and SHA1 signatures:"; \
235 echo "$(tgz-md5) $(my_distdir).tar.gz"; \
236 echo "$(bz2-md5) $(my_distdir).tar.bz2"; \
237 echo "$(xdelta-md5) $(xd-delta)"; \
238 echo "$(tgz-sha1) $(my_distdir).tar.gz"; \
239 echo "$(bz2-sha1) $(my_distdir).tar.bz2"; \
240 echo "$(xdelta-sha1) $(xd-delta)"; \
243 sed -n "/$(THIS_VERSION_REGEXP)[]:]/,/$(PREV_VERSION_REGEXP)[]:]/p" NEWS \
246 echo ChangeLog entries:; \
247 find . -name ChangeLog -maxdepth 2 \
248 | xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD \
250 | perl -ne 'm!^\+\+ (\./)?! or print,next;' \
251 -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
255 ftp-gnu = ftp://ftp.gnu.org/gnu
257 # Use mv, if you don't have/want move-if-change.
258 move_if_change ?= move-if-change
260 # The following pseudo table associates a local directory and a URL
261 # with each of the files that belongs to some other package and is
262 # regularly updated from the specified URL.
263 wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
264 $(srcdir)/src/ansi2knr.c \
265 $(srcdir)/doc/texinfo.tex
266 get-targets = $(patsubst %, get-%, $(wget_files))
268 config.guess-url_prefix = $(ftp-gnu)/config/
269 config.sub-url_prefix = $(ftp-gnu)/config/
271 ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
273 texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
275 standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
276 make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
278 target = $(patsubst get-%, %, $@)
279 url = $($(notdir $(target))-url_prefix)$(notdir $(target))
281 .PHONY: $(get-targets)
283 $(WGET) $(url) -O $(target).t \
284 && $(move_if_change) $(target).t $(target)
286 automake_repo=:pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
288 wget-update: $(get-targets)
289 for f in depcomp missing mkinstalldirs; do \
290 test -f $$f || continue; \
291 echo checking out $$f...; \
292 $(CVS) -d $(automake_repo) co -p automake/lib/$$f > $$f.t \
293 && $(move_if_change) $$f.t $$f; \
296 define emit-upload-commands
297 echo =====================================
298 echo =====================================
299 echo upload $(PACKAGE) $(PREV_VERSION) $(VERSION)
300 echo '# send the /tmp/announcement e-mail'
301 echo =====================================
302 echo =====================================
305 $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
306 xdelta delta -9 $^ $@ || :
311 $(MAKE) -s announcement > /tmp/announce-$(my_distdir)
312 ln $(rel-files) $(release_archive_dir)
313 chmod a-w $(rel-files)
314 echo $(VERSION) > $(prev_version_file)
315 $(CVS) ci -m. $(prev_version_file)
316 @$(emit-upload-commands)