]> git.saurik.com Git - bison.git/blame - Makefile.maint
* Makefile.maint: Sync with CVS Autoconf.
[bison.git] / Makefile.maint
CommitLineData
d074a105
AD
1# -*-Makefile-*-
2# This Makefile fragment is shared between fileutils, sh-utils, textutils,
69b5cec4
AD
3# and Autoconf.
4
5## Copyright 2001 Free Software Foundation, Inc.
6##
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)
10## any later version.
11##
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.
16##
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
20## 02111-1307, USA.
d074a105
AD
21
22prev_version_file ?= .prev-version
23
24THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
25PREV_VERSION := $(shell cat $(prev_version_file))
26PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
27
28tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
29tag-this-version = $(subst .,_,$(VERSION))
30tag-prev-version = $(subst .,_,$(PREV_VERSION))
31this-cvs-tag = $(tag-package)-$(tag-this-version)
32prev-cvs-tag = $(tag-package)-$(tag-prev-version)
33my_distdir = $(PACKAGE)-$(VERSION)
34
35# Old releases are stored here.
36# Used for diffs and xdeltas.
37release_archive_dir ?= ../release
38
39
40
41## --------------- ##
42## Sanity checks. ##
43## --------------- ##
44
45# Checks that don't require cvs.
46local-check: changelog-check po-check writable-files copyright-check
47
48changelog-check:
49 if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
50 :; \
51 else \
52 echo "$(VERSION) not in ChangeLog" 1>&2; \
53 exit 1; \
54 fi
55
56# Verify that all source files using _() are listed in po/POTFILES.in.
57po-check:
58 if test -f po/POTFILES.in; then \
59 grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
60 grep -E -l '\b_\(' lib/*.c src/*.c | sort > $@-2; \
61 diff -u $@-1 $@-2 || exit 1; \
62 rm -f $@-1 $@-2; \
63 fi
64
65# Check that `make alpha' will not fail at the end of the process.
66writable-files:
67 if test -d $(release_archive_dir); then :; else \
68 mkdir $(release_archive_dir); \
69 fi
70 for file in $(distdir).tar.gz $(xd-delta) \
71 $(release_archive_dir)/$(distdir).tar.gz \
72 $(release_archive_dir)/$(xd-delta); do \
73 test -e $$file || continue; \
74 test -w $$file \
75 || { echo ERROR: $$file is not writable; fail=1; }; \
76 done; \
77 test "$$fail" && exit 1 || :
78
79# Make sure that the copyright date in lib/version-etc.c is up to date.
80copyright-check:
81 @if test -f lib/version-etc.c; then \
82 grep 'N_("Copyright (C) $(shell date +%Y) Free' lib/version-etc.c \
83 >/dev/null \
84 || { echo 'out of date copyright in $<; update it' 1>&2; exit 1; }; \
85 fi
86
87
88# Sanity checks with the CVS repository.
89cvs-tag-check:
90 echo $(this-cvs-tag); \
91 if cvs -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
92 echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
93 exit 1; \
94 else :; fi
95
96cvs-diff-check:
69b5cec4 97 if cvs diff >cvs-diffs; then \
be642444 98 rm cvs-diffs; \
69b5cec4
AD
99 else \
100 echo "Some files are locally modified:" 1>&2; \
101 cat cvs-diffs; \
102 exit 1; \
d074a105
AD
103 fi
104
105cvs-check: cvs-diff-check cvs-tag-check
106
107maintainer-distcheck: changelog-check
108 $(MAKE) distcheck
109 $(MAKE) my-distcheck
110
111
112# Do not save the original name or timestamp in the .tar.gz file.
113GZIP_ENV = '--no-name --best'
114
115# Automake 1.4 does not define AMTAR.
116AMTAR ?= $(TAR)
117
118# Tag before making distribution. Also, don't make a distribution if
119# checks fail. Also, make sure the NEWS file is up-to-date.
120# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
121cvs-dist: cvs-check maintainer-distcheck
122 cvs update po
123 cvs tag -c $(this-cvs-tag)
124 $(MAKE) dist
125
126# Use this to make sure we don't run these programs when building
127# from a virgin tgz file, below.
128null_AM_MAKEFLAGS = \
129 ACLOCAL=false \
130 AUTOCONF=false \
131 AUTOMAKE=false \
132 AUTOHEADER=false \
133 MAKEINFO=false
134
135# Detect format-string/arg-list mismatches that would normally be obscured
136# by the use of _(). The --disable-nls effectively defines away that macro,
137# and building with CFLAGS='-Wformat -Werror' causes any format warning to be
138# treated as a failure.
139t=./=test
140my-distcheck: writable-files po-check
141 -rm -rf $(t)
142 mkdir $(t)
143 GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
144 cd $(t)/$(distdir) \
145 && ./configure --disable-nls \
146 && $(MAKE) CFLAGS='-Wformat -Werror' \
147 AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
148 && $(MAKE) dvi \
149 && $(MAKE) check \
150 && $(MAKE) distclean
151 cd $(t) && mv $(distdir) $(distdir).old \
152 && $(AMTAR) -zxf ../$(distdir).tar.gz
153 diff -ur $(t)/$(distdir).old $(t)/$(distdir)
154 -rm -rf $(t)
155 @echo "========================"; \
156 echo "$(distdir).tar.gz is ready for distribution"; \
157 echo "========================"
158
159# This must be the same name on both hosts.
160# Make it a symlink that points to the right place.
161real_dir = fetish-ftp
162
163url_dir_list = $(foreach x,$(hosts),ftp://$($(x)_host)/$($(x)_url_dir))
164
165tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
166tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
167bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
168bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
169tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([Mk]\).*/ \1B/')
170bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([Mk]\).*/ \1B/')
171xd-size = $(shell du --human $(xd-delta)|sed 's/\([Mk]\).*/ \1B/')
172
173rel-check:
174 tarz=/tmp/rel-check-tarz-$$$$; \
175 md5_tmp=/tmp/rel-check-md5-$$$$; \
176 set -e; \
177 trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
178 wget -q --output-document=$$tarz $(url); \
179 echo "$(md5) -" > $$md5_tmp; \
180 md5sum -c $$md5_tmp < $$tarz
181
182prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
183xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
184
185GZIP = gzip
186BZIP2 = bzip2
187$(my_distdir).tar.bz2: $(my_distdir).tar.gz
188 $(GZIP) -dc $< > $(my_distdir).tar
189 rm -f $@
190 $(BZIP2) -9 $(my_distdir).tar
191
192rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
193announcement: NEWS ChangeLog $(rel-files)
194 @( \
195 echo Subject: $(my_distdir) released; \
196 echo; \
197 echo FIXME: put comments here; \
198 echo; \
199 for url in $(url_dir_list); do \
200 echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \
201 echo " $$url/$(my_distdir).tar.bz2 ($(bz2-size))"; \
202 done; \
203 echo; \
204 echo And here are xdelta-style diffs; \
205 echo; \
206 for url in $(url_dir_list); do \
207 echo " $$url/$(xd-delta) ($(xd-size))"; \
208 done; \
209 echo; \
210 echo "Here are the MD5 and SHA1 signatures for the compressed tar files:"; \
211 echo; \
212 echo "$(tgz-md5) $(my_distdir).tar.gz"; \
213 echo "$(bz2-md5) $(my_distdir).tar.bz2"; \
214 echo "$(tgz-sha1) $(my_distdir).tar.gz"; \
215 echo "$(bz2-sha1) $(my_distdir).tar.bz2"; \
216 echo; \
217 echo NEWS:; \
218 sed -n "/$(THIS_VERSION_REGEXP)[]:]/,/$(PREV_VERSION_REGEXP)[]:]/p" NEWS \
219 | grep -v '^\['; \
220 echo; \
221 echo ChangeLog entries:; \
222 find . -name ChangeLog -maxdepth 2 \
223 | xargs cvs diff -up -r$(prev-cvs-tag) -rHEAD \
224 | sed -n 's/^+//p' \
225 | perl -ne 'm!^\+\+ (\./)?! or print,next;' \
226 -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
227 )
228
229WGET = wget
230ftp-gnu = ftp://ftp.gnu.org/gnu
231
232# Use mv, if you don't have/want move-if-change.
233move_if_change ?= move-if-change
234
235# The following pseudo table associates a local directory and a URL
236# with each of the files that belongs to some other package and is
237# regularly updated from the specified URL.
238wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
239 $(srcdir)/src/ansi2knr.c \
240 $(srcdir)/doc/texinfo.tex
241get-targets = $(patsubst %, get-%, $(wget_files))
242
243config.guess-url_prefix = $(ftp-gnu)/config/
244config.sub-url_prefix = $(ftp-gnu)/config/
245
246ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
247
248texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
249
250standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
251make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
252
253target = $(patsubst get-%, %, $@)
254url = $($(notdir $(target))-url_prefix)$(notdir $(target))
255
256.PHONY: $(get-targets)
257$(get-targets):
258 $(WGET) $(url) -O $(target).t \
259 && $(move_if_change) $(target).t $(target)
260
261automake_repo=:pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
262.PHONY: wget-update
263wget-update: $(get-targets)
264 for f in depcomp missing; do \
265 test -f $$f || continue; \
266 echo checking out $$f...; \
267 cvs -d $(automake_repo) co -p automake/lib/$$f > $$f.t \
268 && $(move_if_change) $$f.t $$f; \
269 done
270
271define emit-rsync-commands
272 echo =====================================
273 echo =====================================
274 echo 'for host in $(a_host) $(b_host); do \'
275 echo ' rsync -e ssh --pro -av $(xd-delta) $(my_distdir).tar.bz2 \'
276 echo ' $(my_distdir).tar.gz $$host:$(real_dir); done'
277 echo '# send the /tmp/announcement e-mail'
278 echo =====================================
279 echo =====================================
280endef
281
282$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
283 xdelta delta -9 $^ $@ || :
284
285alpha: local-check
286 $(MAKE) cvs-dist
287 $(MAKE) $(xd-delta)
288 $(MAKE) -s announcement > /tmp/announce-$(my_distdir)
289 ln $(rel-files) $(release_archive_dir)
290 chmod a-w $(rel-files)
291 echo $(VERSION) > $(prev_version_file)
292 cvs ci -m. $(prev_version_file)
293 @$(emit-rsync-commands)