2 # This Makefile fragment is shared between Autoconf and Bison.
4 ## Copyright (C) 2001, 2002 Free Software Foundation, Inc.
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; either version 2, or (at your option)
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ## GNU General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program; if not, write to the Free Software
18 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 # Do not save the original name or timestamp in the .tar.gz file.
22 GZIP_ENV = '--no-name --best'
26 prev_version_file ?= .prev-version
28 THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
29 PREV_VERSION := $(shell cat $(prev_version_file))
30 PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
32 tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
33 tag-this-version = $(subst .,_,$(VERSION))
34 tag-prev-version = $(subst .,_,$(PREV_VERSION))
35 this-cvs-tag = $(tag-package)-$(tag-this-version)
36 prev-cvs-tag = $(tag-package)-$(tag-prev-version)
37 my_distdir = $(PACKAGE)-$(VERSION)
39 # Old releases are stored here.
40 # Used for diffs and xdeltas.
41 release_archive_dir ?= ../release
45 ## ---------------- ##
47 ## ---------------- ##
50 ftp-gnu = ftp://ftp.gnu.org/gnu
52 # Use mv, if you don't have/want move-if-change.
53 move_if_change ?= move-if-change
55 # ------------------- #
56 # Updating PO files. #
57 # ------------------- #
59 po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE)
60 .PHONY: do-po-update po-update
62 tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
65 (cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
67 cd po && $(MAKE) update-po
71 if test -d "po"; then \
72 $(MAKE) do-po-update; \
75 # -------------------------- #
76 # Updating GNU build tools. #
77 # -------------------------- #
79 # The following pseudo table associates a local directory and a URL
80 # with each of the files that belongs to some other package and is
81 # regularly updated from the specified URL.
82 wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
83 $(srcdir)/doc/texinfo.tex
84 wget-targets = $(patsubst %, get-%, $(wget_files))
86 config.guess-url_prefix = $(ftp-gnu)/config/
87 config.sub-url_prefix = $(ftp-gnu)/config/
89 texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
91 standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
92 make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
94 target = $(patsubst get-%, %, $@)
95 url = $($(notdir $(target))-url_prefix)$(notdir $(target))
97 .PHONY: $(wget-targets)
99 $(WGET) $(url) -O $(target).t \
100 && $(move_if_change) $(target).t $(target)
103 wget-update: $(wget-targets)
106 # Updating tools via CVS.
107 cvs_files ?= depcomp missing
108 cvs-targets = $(patsubst %, get-%, $(cvs_files))
110 automake_repo = :pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
111 .PHONY: $(cvs-targets)
113 $(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
115 && $(move_if_change) $(target).t $(target);
118 cvs-update: $(cvs-targets)
121 # --------------------- #
122 # Updating everything. #
123 # --------------------- #
126 update: wget-update cvs-update po-update
130 ## --------------- ##
132 ## --------------- ##
134 # Checks that don't require cvs. Run `changelog-check' last as
135 # previous test may reveal problems requiring new ChangeLog entries.
136 local-check: po-check copyright-check writable-files changelog-check
139 if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
142 echo "$(VERSION) not in ChangeLog" 1>&2; \
146 # Verify that all source files using _() are listed in po/POTFILES.in.
148 if test -f po/POTFILES.in; then \
149 grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
150 grep -E -l '\b_\(' lib/*.c src/*.c | sort > $@-2; \
151 diff -u $@-1 $@-2 || exit 1; \
155 # Check that `make alpha' will not fail at the end of the process.
157 if test -d $(release_archive_dir); then :; else \
158 mkdir $(release_archive_dir); \
160 for file in $(distdir).tar.gz $(xd-delta) \
161 $(release_archive_dir)/$(distdir).tar.gz \
162 $(release_archive_dir)/$(xd-delta); do \
163 test -e $$file || continue; \
165 || { echo ERROR: $$file is not writable; fail=1; }; \
167 test "$$fail" && exit 1 || :
169 # Make sure that the copyright date in lib/version-etc.c is up to date.
171 @if test -f lib/version-etc.c; then \
172 grep 'N_("Copyright (C) $(shell date +%Y) Free' lib/version-etc.c \
174 || { echo 'out of date copyright in $<; update it' 1>&2; exit 1; }; \
178 # Sanity checks with the CVS repository.
180 echo $(this-cvs-tag); \
181 if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
182 echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
187 if $(CVS) diff >cvs-diffs; then \
190 echo "Some files are locally modified:" 1>&2; \
195 cvs-check: cvs-diff-check cvs-tag-check
197 maintainer-distcheck: changelog-check
208 # Tag before making distribution. Also, don't make a distribution if
209 # checks fail. Also, make sure the NEWS file is up-to-date.
210 # FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
211 cvs-dist: local-check cvs-check maintainer-distcheck
213 $(CVS) tag -c $(this-cvs-tag)
216 # Use this to make sure we don't run these programs when building
217 # from a virgin tgz file, below.
218 null_AM_MAKEFLAGS = \
226 # Detect format-string/arg-list mismatches that would normally be obscured
227 # by the use of _(). The --disable-nls effectively defines away that macro,
228 # and building with CFLAGS='-Wformat -Werror' causes any format warning to be
229 # treated as a failure.
231 my-distcheck: writable-files po-check
234 GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
236 && ./configure --disable-nls \
237 && $(MAKE) CFLAGS='-Wformat -Werror' \
238 AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
242 cd $(t) && mv $(distdir) $(distdir).old \
243 && $(AMTAR) -zxf ../$(distdir).tar.gz
244 diff -ur $(t)/$(distdir).old $(t)/$(distdir)
246 @echo "========================"; \
247 echo "$(distdir).tar.gz is ready for distribution"; \
248 echo "========================"
250 tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
251 tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
252 bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
253 bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
254 xdelta-md5 = $(shell md5sum < $(xd-delta)|sed 's/ -//')
255 xdelta-sha1 = $(shell sha1sum < $(xd-delta)|sed 's/ -//')
256 tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([MkK]\).*/ \1B/')
257 bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([MkK]\).*/ \1B/')
258 xd-size = $(shell du --human $(xd-delta)|sed 's/\([MkK]\).*/ \1B/')
261 tarz=/tmp/rel-check-tarz-$$$$; \
262 md5_tmp=/tmp/rel-check-md5-$$$$; \
264 trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
265 $(WGET) -q --output-document=$$tarz $(url); \
266 echo "$(md5) -" > $$md5_tmp; \
267 md5sum -c $$md5_tmp < $$tarz
269 prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
270 xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
272 news-r1 = /^[^ ].*$(THIS_VERSION_REGEXP)[]:]/
273 news-r2 = /^[^ ].*$(PREV_VERSION_REGEXP)[]:]/
275 rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
276 announcement: NEWS ChangeLog $(rel-files)
278 echo Subject: $(my_distdir) released; \
280 echo FIXME: put comments here; \
282 for url in $(url_dir_list); do \
283 echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \
284 echo " $$url/$(my_distdir).tar.bz2 ($(bz2-size))"; \
287 echo And here are xdelta-style diffs; \
289 for url in $(url_dir_list); do \
290 echo " $$url/$(xd-delta) ($(xd-size))"; \
293 echo "Here are the MD5 and SHA1 signatures:"; \
295 echo "$(tgz-md5) $(my_distdir).tar.gz"; \
296 echo "$(bz2-md5) $(my_distdir).tar.bz2"; \
297 echo "$(xdelta-md5) $(xd-delta)"; \
298 echo "$(tgz-sha1) $(my_distdir).tar.gz"; \
299 echo "$(bz2-sha1) $(my_distdir).tar.bz2"; \
300 echo "$(xdelta-sha1) $(xd-delta)"; \
303 sed -n "$(news-r1),$(news-r2)p" NEWS \
306 echo ChangeLog entries:; \
307 find . -name ChangeLog -maxdepth 2 \
308 | xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD \
310 | perl -ne 'm!^\+\+ (\./)?! or print,next;' \
311 -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
314 define emit-upload-commands
315 echo =====================================
316 echo =====================================
317 echo upload $(PACKAGE) $(PREV_VERSION) $(VERSION)
318 echo '# send the /tmp/announcement e-mail'
319 echo =====================================
320 echo =====================================
323 $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
324 xdelta delta -9 $^ $@ || :
329 $(MAKE) -s announcement > /tmp/announce-$(my_distdir)
330 ln $(rel-files) $(release_archive_dir)
331 chmod a-w $(rel-files)
332 echo $(VERSION) > $(prev_version_file)
333 $(CVS) ci -m. $(prev_version_file)
334 @$(emit-upload-commands)