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