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' as previous test may reveal problems requiring
55 # new ChangeLog entries.
56 local-check: po-check copyright-check writable-files changelog-check
59 if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
62 echo "$(VERSION) not in ChangeLog" 1>&2; \
66 # Verify that all source files using _() are listed in po/POTFILES.in.
68 if test -f po/POTFILES.in; then \
69 grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
70 grep -E -l '\b_\(' lib/*.c src/*.c | sort > $@-2; \
71 diff -u $@-1 $@-2 || exit 1; \
75 # Check that `make alpha' will not fail at the end of the process.
77 if test -d $(release_archive_dir); then :; else \
78 mkdir $(release_archive_dir); \
80 for file in $(distdir).tar.gz $(xd-delta) \
81 $(release_archive_dir)/$(distdir).tar.gz \
82 $(release_archive_dir)/$(xd-delta); do \
83 test -e $$file || continue; \
85 || { echo ERROR: $$file is not writable; fail=1; }; \
87 test "$$fail" && exit 1 || :
89 # Make sure that the copyright date in lib/version-etc.c is up to date.
91 @if test -f lib/version-etc.c; then \
92 grep 'N_("Copyright (C) $(shell date +%Y) Free' lib/version-etc.c \
94 || { echo 'out of date copyright in $<; update it' 1>&2; exit 1; }; \
98 # Sanity checks with the CVS repository.
100 echo $(this-cvs-tag); \
101 if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
102 echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
107 if $(CVS) diff >cvs-diffs; then \
110 echo "Some files are locally modified:" 1>&2; \
115 cvs-check: cvs-diff-check cvs-tag-check
117 maintainer-distcheck: changelog-check
122 # Tag before making distribution. Also, don't make a distribution if
123 # checks fail. Also, make sure the NEWS file is up-to-date.
124 # FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
125 cvs-dist: local-check cvs-check maintainer-distcheck
127 $(CVS) tag -c $(this-cvs-tag)
130 # Use this to make sure we don't run these programs when building
131 # from a virgin tgz file, below.
132 null_AM_MAKEFLAGS = \
139 # Detect format-string/arg-list mismatches that would normally be obscured
140 # by the use of _(). The --disable-nls effectively defines away that macro,
141 # and building with CFLAGS='-Wformat -Werror' causes any format warning to be
142 # treated as a failure.
144 my-distcheck: writable-files po-check
147 GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
149 && ./configure --disable-nls \
150 && $(MAKE) CFLAGS='-Wformat -Werror' \
151 AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
155 cd $(t) && mv $(distdir) $(distdir).old \
156 && $(AMTAR) -zxf ../$(distdir).tar.gz
157 diff -ur $(t)/$(distdir).old $(t)/$(distdir)
159 @echo "========================"; \
160 echo "$(distdir).tar.gz is ready for distribution"; \
161 echo "========================"
163 # This must be the same name on both hosts.
164 # Make it a symlink that points to the right place.
165 real_dir = fetish-ftp
167 url_dir_list = $(foreach x,$(hosts),ftp://$($(x)_host)/$($(x)_url_dir))
169 tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
170 tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
171 bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
172 bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
173 tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([Mk]\).*/ \1B/')
174 bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([Mk]\).*/ \1B/')
175 xd-size = $(shell du --human $(xd-delta)|sed 's/\([Mk]\).*/ \1B/')
178 tarz=/tmp/rel-check-tarz-$$$$; \
179 md5_tmp=/tmp/rel-check-md5-$$$$; \
181 trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
182 wget -q --output-document=$$tarz $(url); \
183 echo "$(md5) -" > $$md5_tmp; \
184 md5sum -c $$md5_tmp < $$tarz
186 prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
187 xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
191 $(my_distdir).tar.bz2: $(my_distdir).tar.gz
192 $(GZIP) -dc $< > $(my_distdir).tar
194 $(BZIP2) -9 $(my_distdir).tar
196 rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
197 announcement: NEWS ChangeLog $(rel-files)
199 echo Subject: $(my_distdir) released; \
201 echo FIXME: put comments here; \
203 for url in $(url_dir_list); do \
204 echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \
205 echo " $$url/$(my_distdir).tar.bz2 ($(bz2-size))"; \
208 echo And here are xdelta-style diffs; \
210 for url in $(url_dir_list); do \
211 echo " $$url/$(xd-delta) ($(xd-size))"; \
214 echo "Here are the MD5 and SHA1 signatures for the compressed tar files:"; \
216 echo "$(tgz-md5) $(my_distdir).tar.gz"; \
217 echo "$(bz2-md5) $(my_distdir).tar.bz2"; \
218 echo "$(tgz-sha1) $(my_distdir).tar.gz"; \
219 echo "$(bz2-sha1) $(my_distdir).tar.bz2"; \
222 sed -n "/$(THIS_VERSION_REGEXP)[]:]/,/$(PREV_VERSION_REGEXP)[]:]/p" NEWS \
225 echo ChangeLog entries:; \
226 find . -name ChangeLog -maxdepth 2 \
227 | xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD \
229 | perl -ne 'm!^\+\+ (\./)?! or print,next;' \
230 -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
234 ftp-gnu = ftp://ftp.gnu.org/gnu
236 # Use mv, if you don't have/want move-if-change.
237 move_if_change ?= move-if-change
239 # The following pseudo table associates a local directory and a URL
240 # with each of the files that belongs to some other package and is
241 # regularly updated from the specified URL.
242 wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
243 $(srcdir)/src/ansi2knr.c \
244 $(srcdir)/doc/texinfo.tex
245 get-targets = $(patsubst %, get-%, $(wget_files))
247 config.guess-url_prefix = $(ftp-gnu)/config/
248 config.sub-url_prefix = $(ftp-gnu)/config/
250 ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
252 texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
254 standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
255 make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
257 target = $(patsubst get-%, %, $@)
258 url = $($(notdir $(target))-url_prefix)$(notdir $(target))
260 .PHONY: $(get-targets)
262 $(WGET) $(url) -O $(target).t \
263 && $(move_if_change) $(target).t $(target)
265 automake_repo=:pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
267 wget-update: $(get-targets)
268 for f in depcomp missing; do \
269 test -f $$f || continue; \
270 echo checking out $$f...; \
271 $(CVS) -d $(automake_repo) co -p automake/lib/$$f > $$f.t \
272 && $(move_if_change) $$f.t $$f; \
275 define emit-rsync-commands
276 echo =====================================
277 echo =====================================
278 echo 'for host in $(a_host) $(b_host); do \'
279 echo ' rsync -e ssh --pro -av $(xd-delta) $(my_distdir).tar.bz2 \'
280 echo ' $(my_distdir).tar.gz $$host:$(real_dir); done'
281 echo '# send the /tmp/announcement e-mail'
282 echo =====================================
283 echo =====================================
286 $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
287 xdelta delta -9 $^ $@ || :
292 $(MAKE) -s announcement > /tmp/announce-$(my_distdir)
293 ln $(rel-files) $(release_archive_dir)
294 chmod a-w $(rel-files)
295 echo $(VERSION) > $(prev_version_file)
296 $(CVS) ci -m. $(prev_version_file)
297 @$(emit-rsync-commands)