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 local-check: changelog-check po-check writable-files copyright-check
57 if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
60 echo "$(VERSION) not in ChangeLog" 1>&2; \
64 # Verify that all source files using _() are listed in po/POTFILES.in.
66 if test -f po/POTFILES.in; then \
67 grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
68 grep -E -l '\b_\(' lib/*.c src/*.c | sort > $@-2; \
69 diff -u $@-1 $@-2 || exit 1; \
73 # Check that `make alpha' will not fail at the end of the process.
75 if test -d $(release_archive_dir); then :; else \
76 mkdir $(release_archive_dir); \
78 for file in $(distdir).tar.gz $(xd-delta) \
79 $(release_archive_dir)/$(distdir).tar.gz \
80 $(release_archive_dir)/$(xd-delta); do \
81 test -e $$file || continue; \
83 || { echo ERROR: $$file is not writable; fail=1; }; \
85 test "$$fail" && exit 1 || :
87 # Make sure that the copyright date in lib/version-etc.c is up to date.
89 @if test -f lib/version-etc.c; then \
90 grep 'N_("Copyright (C) $(shell date +%Y) Free' lib/version-etc.c \
92 || { echo 'out of date copyright in $<; update it' 1>&2; exit 1; }; \
96 # Sanity checks with the CVS repository.
98 echo $(this-cvs-tag); \
99 if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
100 echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
105 if $(CVS) diff >cvs-diffs; then \
108 echo "Some files are locally modified:" 1>&2; \
113 cvs-check: cvs-diff-check cvs-tag-check
115 maintainer-distcheck: changelog-check
120 # Tag before making distribution. Also, don't make a distribution if
121 # checks fail. Also, make sure the NEWS file is up-to-date.
122 # FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
123 cvs-dist: cvs-check maintainer-distcheck
125 $(CVS) tag -c $(this-cvs-tag)
128 # Use this to make sure we don't run these programs when building
129 # from a virgin tgz file, below.
130 null_AM_MAKEFLAGS = \
137 # Detect format-string/arg-list mismatches that would normally be obscured
138 # by the use of _(). The --disable-nls effectively defines away that macro,
139 # and building with CFLAGS='-Wformat -Werror' causes any format warning to be
140 # treated as a failure.
142 my-distcheck: writable-files po-check
145 GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
147 && ./configure --disable-nls \
148 && $(MAKE) CFLAGS='-Wformat -Werror' \
149 AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
153 cd $(t) && mv $(distdir) $(distdir).old \
154 && $(AMTAR) -zxf ../$(distdir).tar.gz
155 diff -ur $(t)/$(distdir).old $(t)/$(distdir)
157 @echo "========================"; \
158 echo "$(distdir).tar.gz is ready for distribution"; \
159 echo "========================"
161 # This must be the same name on both hosts.
162 # Make it a symlink that points to the right place.
163 real_dir = fetish-ftp
165 url_dir_list = $(foreach x,$(hosts),ftp://$($(x)_host)/$($(x)_url_dir))
167 tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
168 tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
169 bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
170 bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
171 tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([Mk]\).*/ \1B/')
172 bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([Mk]\).*/ \1B/')
173 xd-size = $(shell du --human $(xd-delta)|sed 's/\([Mk]\).*/ \1B/')
176 tarz=/tmp/rel-check-tarz-$$$$; \
177 md5_tmp=/tmp/rel-check-md5-$$$$; \
179 trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
180 wget -q --output-document=$$tarz $(url); \
181 echo "$(md5) -" > $$md5_tmp; \
182 md5sum -c $$md5_tmp < $$tarz
184 prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
185 xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
189 $(my_distdir).tar.bz2: $(my_distdir).tar.gz
190 $(GZIP) -dc $< > $(my_distdir).tar
192 $(BZIP2) -9 $(my_distdir).tar
194 rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
195 announcement: NEWS ChangeLog $(rel-files)
197 echo Subject: $(my_distdir) released; \
199 echo FIXME: put comments here; \
201 for url in $(url_dir_list); do \
202 echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \
203 echo " $$url/$(my_distdir).tar.bz2 ($(bz2-size))"; \
206 echo And here are xdelta-style diffs; \
208 for url in $(url_dir_list); do \
209 echo " $$url/$(xd-delta) ($(xd-size))"; \
212 echo "Here are the MD5 and SHA1 signatures for the compressed tar files:"; \
214 echo "$(tgz-md5) $(my_distdir).tar.gz"; \
215 echo "$(bz2-md5) $(my_distdir).tar.bz2"; \
216 echo "$(tgz-sha1) $(my_distdir).tar.gz"; \
217 echo "$(bz2-sha1) $(my_distdir).tar.bz2"; \
220 sed -n "/$(THIS_VERSION_REGEXP)[]:]/,/$(PREV_VERSION_REGEXP)[]:]/p" NEWS \
223 echo ChangeLog entries:; \
224 find . -name ChangeLog -maxdepth 2 \
225 | xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD \
227 | perl -ne 'm!^\+\+ (\./)?! or print,next;' \
228 -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
232 ftp-gnu = ftp://ftp.gnu.org/gnu
234 # Use mv, if you don't have/want move-if-change.
235 move_if_change ?= move-if-change
237 # The following pseudo table associates a local directory and a URL
238 # with each of the files that belongs to some other package and is
239 # regularly updated from the specified URL.
240 wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
241 $(srcdir)/src/ansi2knr.c \
242 $(srcdir)/doc/texinfo.tex
243 get-targets = $(patsubst %, get-%, $(wget_files))
245 config.guess-url_prefix = $(ftp-gnu)/config/
246 config.sub-url_prefix = $(ftp-gnu)/config/
248 ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
250 texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
252 standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
253 make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
255 target = $(patsubst get-%, %, $@)
256 url = $($(notdir $(target))-url_prefix)$(notdir $(target))
258 .PHONY: $(get-targets)
260 $(WGET) $(url) -O $(target).t \
261 && $(move_if_change) $(target).t $(target)
263 automake_repo=:pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
265 wget-update: $(get-targets)
266 for f in depcomp missing; do \
267 test -f $$f || continue; \
268 echo checking out $$f...; \
269 $(CVS) -d $(automake_repo) co -p automake/lib/$$f > $$f.t \
270 && $(move_if_change) $$f.t $$f; \
273 define emit-rsync-commands
274 echo =====================================
275 echo =====================================
276 echo 'for host in $(a_host) $(b_host); do \'
277 echo ' rsync -e ssh --pro -av $(xd-delta) $(my_distdir).tar.bz2 \'
278 echo ' $(my_distdir).tar.gz $$host:$(real_dir); done'
279 echo '# send the /tmp/announcement e-mail'
280 echo =====================================
281 echo =====================================
284 $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
285 xdelta delta -9 $^ $@ || :
290 $(MAKE) -s announcement > /tmp/announce-$(my_distdir)
291 ln $(rel-files) $(release_archive_dir)
292 chmod a-w $(rel-files)
293 echo $(VERSION) > $(prev_version_file)
294 $(CVS) ci -m. $(prev_version_file)
295 @$(emit-rsync-commands)