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'
27 prev_version_file ?= .prev-version
29 THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
30 PREV_VERSION := $(shell cat $(prev_version_file))
31 PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
33 tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
34 tag-this-version = $(subst .,_,$(VERSION))
35 tag-prev-version = $(subst .,_,$(PREV_VERSION))
36 this-cvs-tag = $(tag-package)-$(tag-this-version)
37 prev-cvs-tag = $(tag-package)-$(tag-prev-version)
38 my_distdir = $(PACKAGE)-$(VERSION)
40 # Old releases are stored here.
41 # Used for diffs and xdeltas.
42 release_archive_dir ?= ../release
46 ## ---------------- ##
48 ## ---------------- ##
51 ftp-gnu = ftp://ftp.gnu.org/gnu
53 # Use mv, if you don't have/want move-if-change.
54 move_if_change ?= move-if-change
56 # ------------------- #
57 # Updating PO files. #
58 # ------------------- #
60 po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE)
61 .PHONY: do-po-update po-update
63 tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
66 (cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
68 cd po && $(MAKE) update-po
72 if test -d "po"; then \
73 $(MAKE) do-po-update; \
76 # -------------------------- #
77 # Updating GNU build tools. #
78 # -------------------------- #
80 # The following pseudo table associates a local directory and a URL
81 # with each of the files that belongs to some other package and is
82 # regularly updated from the specified URL.
83 wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
84 $(srcdir)/src/ansi2knr.c \
85 $(srcdir)/doc/texinfo.tex
86 wget-targets = $(patsubst %, get-%, $(wget_files))
88 config.guess-url_prefix = $(ftp-gnu)/config/
89 config.sub-url_prefix = $(ftp-gnu)/config/
91 ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
93 texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
95 standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
96 make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
98 target = $(patsubst get-%, %, $@)
99 url = $($(notdir $(target))-url_prefix)$(notdir $(target))
101 .PHONY: $(wget-targets)
103 $(WGET) $(url) -O $(target).t \
104 && $(move_if_change) $(target).t $(target)
107 wget-update: $(wget-targets)
110 # Updating tools via CVS.
111 cvs_files ?= depcomp missing
112 cvs-targets = $(patsubst %, get-%, $(cvs_files))
114 automake_repo = :pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
115 .PHONY: $(cvs-targets)
117 $(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
119 && $(move_if_change) $(target).t $(target);
122 cvs-update: $(cvs-targets)
125 # --------------------- #
126 # Updating everything. #
127 # --------------------- #
130 update: wget-update cvs-update po-update
134 ## --------------- ##
136 ## --------------- ##
138 # Checks that don't require cvs. Run `changelog-check' last as
139 # previous test may reveal problems requiring new ChangeLog entries.
140 local-check: po-check copyright-check writable-files changelog-check
143 if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
146 echo "$(VERSION) not in ChangeLog" 1>&2; \
150 # Verify that all source files using _() are listed in po/POTFILES.in.
152 if test -f po/POTFILES.in; then \
153 grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
154 grep -E -l '\b_\(' lib/*.c src/*.c | sort > $@-2; \
155 diff -u $@-1 $@-2 || exit 1; \
159 # Check that `make alpha' will not fail at the end of the process.
161 if test -d $(release_archive_dir); then :; else \
162 mkdir $(release_archive_dir); \
164 for file in $(distdir).tar.gz $(xd-delta) \
165 $(release_archive_dir)/$(distdir).tar.gz \
166 $(release_archive_dir)/$(xd-delta); do \
167 test -e $$file || continue; \
169 || { echo ERROR: $$file is not writable; fail=1; }; \
171 test "$$fail" && exit 1 || :
173 # Make sure that the copyright date in lib/version-etc.c is up to date.
175 @if test -f lib/version-etc.c; then \
176 grep 'N_("Copyright (C) $(shell date +%Y) Free' lib/version-etc.c \
178 || { echo 'out of date copyright in $<; update it' 1>&2; exit 1; }; \
182 # Sanity checks with the CVS repository.
184 echo $(this-cvs-tag); \
185 if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
186 echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
191 if $(CVS) diff >cvs-diffs; then \
194 echo "Some files are locally modified:" 1>&2; \
199 cvs-check: cvs-diff-check cvs-tag-check
201 maintainer-distcheck: changelog-check
212 # Tag before making distribution. Also, don't make a distribution if
213 # checks fail. Also, make sure the NEWS file is up-to-date.
214 # FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
215 cvs-dist: local-check cvs-check maintainer-distcheck
217 $(CVS) tag -c $(this-cvs-tag)
220 # Use this to make sure we don't run these programs when building
221 # from a virgin tgz file, below.
222 null_AM_MAKEFLAGS = \
230 # Detect format-string/arg-list mismatches that would normally be obscured
231 # by the use of _(). The --disable-nls effectively defines away that macro,
232 # and building with CFLAGS='-Wformat -Werror' causes any format warning to be
233 # treated as a failure.
235 my-distcheck: writable-files po-check
238 GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
240 && ./configure --disable-nls \
241 && $(MAKE) CFLAGS='-Wformat -Werror' \
242 AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
246 cd $(t) && mv $(distdir) $(distdir).old \
247 && $(AMTAR) -zxf ../$(distdir).tar.gz
248 diff -ur $(t)/$(distdir).old $(t)/$(distdir)
250 @echo "========================"; \
251 echo "$(distdir).tar.gz is ready for distribution"; \
252 echo "========================"
254 tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
255 tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
256 bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
257 bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
258 xdelta-md5 = $(shell md5sum < $(xd-delta)|sed 's/ -//')
259 xdelta-sha1 = $(shell sha1sum < $(xd-delta)|sed 's/ -//')
260 tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([MkK]\).*/ \1B/')
261 bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([MkK]\).*/ \1B/')
262 xd-size = $(shell du --human $(xd-delta)|sed 's/\([MkK]\).*/ \1B/')
265 tarz=/tmp/rel-check-tarz-$$$$; \
266 md5_tmp=/tmp/rel-check-md5-$$$$; \
268 trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
269 $(WGET) -q --output-document=$$tarz $(url); \
270 echo "$(md5) -" > $$md5_tmp; \
271 md5sum -c $$md5_tmp < $$tarz
273 prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
274 xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
276 news-r1 = /^[^ ].*$(THIS_VERSION_REGEXP)[]:]/
277 news-r2 = /^[^ ].*$(PREV_VERSION_REGEXP)[]:]/
279 rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
280 announcement: NEWS ChangeLog $(rel-files)
282 echo Subject: $(my_distdir) released; \
284 echo FIXME: put comments here; \
286 for url in $(url_dir_list); do \
287 echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \
288 echo " $$url/$(my_distdir).tar.bz2 ($(bz2-size))"; \
291 echo And here are xdelta-style diffs; \
293 for url in $(url_dir_list); do \
294 echo " $$url/$(xd-delta) ($(xd-size))"; \
297 echo "Here are the MD5 and SHA1 signatures:"; \
299 echo "$(tgz-md5) $(my_distdir).tar.gz"; \
300 echo "$(bz2-md5) $(my_distdir).tar.bz2"; \
301 echo "$(xdelta-md5) $(xd-delta)"; \
302 echo "$(tgz-sha1) $(my_distdir).tar.gz"; \
303 echo "$(bz2-sha1) $(my_distdir).tar.bz2"; \
304 echo "$(xdelta-sha1) $(xd-delta)"; \
307 sed -n "$(news-r1),$(news-r2)p" NEWS \
310 echo ChangeLog entries:; \
311 find . -name ChangeLog -maxdepth 2 \
312 | xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD \
314 | perl -ne 'm!^\+\+ (\./)?! or print,next;' \
315 -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
318 define emit-upload-commands
319 echo =====================================
320 echo =====================================
321 echo upload $(PACKAGE) $(PREV_VERSION) $(VERSION)
322 echo '# send the /tmp/announcement e-mail'
323 echo =====================================
324 echo =====================================
327 $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
328 xdelta delta -9 $^ $@ || :
333 $(MAKE) -s announcement > /tmp/announce-$(my_distdir)
334 ln $(rel-files) $(release_archive_dir)
335 chmod a-w $(rel-files)
336 echo $(VERSION) > $(prev_version_file)
337 $(CVS) ci -m. $(prev_version_file)
338 @$(emit-upload-commands)