]> git.saurik.com Git - bison.git/blame - Makefile.maint
* tests/regression.at (Web2c Actions): Blindly move the actual
[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
0a3b9e5f
AD
25CVS = cvs
26
d074a105
AD
27prev_version_file ?= .prev-version
28
29THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
30PREV_VERSION := $(shell cat $(prev_version_file))
31PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
32
33tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
34tag-this-version = $(subst .,_,$(VERSION))
35tag-prev-version = $(subst .,_,$(PREV_VERSION))
36this-cvs-tag = $(tag-package)-$(tag-this-version)
37prev-cvs-tag = $(tag-package)-$(tag-prev-version)
38my_distdir = $(PACKAGE)-$(VERSION)
39
40# Old releases are stored here.
41# Used for diffs and xdeltas.
42release_archive_dir ?= ../release
43
44
45
342b8b6e
AD
46## ---------------- ##
47## Updating files. ##
48## ---------------- ##
49
50WGET = wget
51ftp-gnu = ftp://ftp.gnu.org/gnu
52
53# Use mv, if you don't have/want move-if-change.
54move_if_change ?= move-if-change
55
56# ------------------- #
57# Updating PO files. #
58# ------------------- #
59
60po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE)
61.PHONY: do-po-update po-update
62do-po-update:
63 tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
64 rm -rf $$tmppo && \
65 mkdir $$tmppo && \
66 (cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
67 cp $$tmppo/*.po po
68 cd po && $(MAKE) update-po
69 $(MAKE) po-check
70
71po-update:
72 if test -d "po"; then \
73 $(MAKE) do-po-update; \
74 fi
75
76# -------------------------- #
77# Updating GNU build tools. #
78# -------------------------- #
79
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.
83wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
84 $(srcdir)/src/ansi2knr.c \
85 $(srcdir)/doc/texinfo.tex
86wget-targets = $(patsubst %, get-%, $(wget_files))
87
88config.guess-url_prefix = $(ftp-gnu)/config/
89config.sub-url_prefix = $(ftp-gnu)/config/
90
91ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
92
93texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
94
95standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
96make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
97
98target = $(patsubst get-%, %, $@)
99url = $($(notdir $(target))-url_prefix)$(notdir $(target))
100
101.PHONY: $(wget-targets)
102$(wget-targets):
103 $(WGET) $(url) -O $(target).t \
104 && $(move_if_change) $(target).t $(target)
105
106.PHONY: wget-update
107wget-update: $(wget-targets)
108
109
110# Updating tools via CVS.
111cvs_files ?= depcomp missing
112cvs-targets = $(patsubst %, get-%, $(cvs_files))
113
114automake_repo = :pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
115.PHONY: $(cvs-targets)
116$(cvs-targets):
117 $(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
118 >$(target).t \
119 && $(move_if_change) $(target).t $(target);
120
121.PHONY: cvs-update
122cvs-update: $(cvs-targets)
123
124
125# --------------------- #
126# Updating everything. #
127# --------------------- #
128
129.PHONY: update
130update: wget-update cvs-update po-update
131
132
133
d074a105
AD
134## --------------- ##
135## Sanity checks. ##
136## --------------- ##
137
342b8b6e
AD
138# Checks that don't require cvs. Run `changelog-check' last as
139# previous test may reveal problems requiring new ChangeLog entries.
140local-check: po-check copyright-check writable-files changelog-check
d074a105
AD
141
142changelog-check:
143 if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
144 :; \
145 else \
146 echo "$(VERSION) not in ChangeLog" 1>&2; \
147 exit 1; \
148 fi
149
150# Verify that all source files using _() are listed in po/POTFILES.in.
151po-check:
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; \
156 rm -f $@-1 $@-2; \
157 fi
158
159# Check that `make alpha' will not fail at the end of the process.
160writable-files:
161 if test -d $(release_archive_dir); then :; else \
162 mkdir $(release_archive_dir); \
163 fi
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; \
168 test -w $$file \
169 || { echo ERROR: $$file is not writable; fail=1; }; \
170 done; \
171 test "$$fail" && exit 1 || :
172
173# Make sure that the copyright date in lib/version-etc.c is up to date.
174copyright-check:
175 @if test -f lib/version-etc.c; then \
176 grep 'N_("Copyright (C) $(shell date +%Y) Free' lib/version-etc.c \
177 >/dev/null \
178 || { echo 'out of date copyright in $<; update it' 1>&2; exit 1; }; \
179 fi
180
181
182# Sanity checks with the CVS repository.
183cvs-tag-check:
184 echo $(this-cvs-tag); \
0a3b9e5f 185 if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
d074a105
AD
186 echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
187 exit 1; \
188 else :; fi
189
190cvs-diff-check:
0a3b9e5f 191 if $(CVS) diff >cvs-diffs; then \
be642444 192 rm cvs-diffs; \
69b5cec4
AD
193 else \
194 echo "Some files are locally modified:" 1>&2; \
195 cat cvs-diffs; \
196 exit 1; \
d074a105
AD
197 fi
198
199cvs-check: cvs-diff-check cvs-tag-check
200
201maintainer-distcheck: changelog-check
202 $(MAKE) distcheck
203 $(MAKE) my-distcheck
204
205
342b8b6e
AD
206
207## -------------- ##
208## Making dists. ##
209## -------------- ##
210
211
d074a105
AD
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.
342b8b6e 215cvs-dist: local-check cvs-check maintainer-distcheck
0a3b9e5f
AD
216 $(CVS) update po
217 $(CVS) tag -c $(this-cvs-tag)
d074a105
AD
218 $(MAKE) dist
219
220# Use this to make sure we don't run these programs when building
221# from a virgin tgz file, below.
222null_AM_MAKEFLAGS = \
223 ACLOCAL=false \
224 AUTOCONF=false \
342b8b6e 225 AUTOM4TE=false \
d074a105
AD
226 AUTOMAKE=false \
227 AUTOHEADER=false \
228 MAKEINFO=false
229
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.
234t=./=test
235my-distcheck: writable-files po-check
236 -rm -rf $(t)
237 mkdir $(t)
238 GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
239 cd $(t)/$(distdir) \
240 && ./configure --disable-nls \
241 && $(MAKE) CFLAGS='-Wformat -Werror' \
242 AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
243 && $(MAKE) dvi \
244 && $(MAKE) check \
245 && $(MAKE) distclean
246 cd $(t) && mv $(distdir) $(distdir).old \
247 && $(AMTAR) -zxf ../$(distdir).tar.gz
248 diff -ur $(t)/$(distdir).old $(t)/$(distdir)
249 -rm -rf $(t)
250 @echo "========================"; \
251 echo "$(distdir).tar.gz is ready for distribution"; \
252 echo "========================"
253
254# This must be the same name on both hosts.
255# Make it a symlink that points to the right place.
256real_dir = fetish-ftp
257
258url_dir_list = $(foreach x,$(hosts),ftp://$($(x)_host)/$($(x)_url_dir))
259
260tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
261tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
262bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
263bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
264tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([Mk]\).*/ \1B/')
265bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([Mk]\).*/ \1B/')
266xd-size = $(shell du --human $(xd-delta)|sed 's/\([Mk]\).*/ \1B/')
267
268rel-check:
269 tarz=/tmp/rel-check-tarz-$$$$; \
270 md5_tmp=/tmp/rel-check-md5-$$$$; \
271 set -e; \
272 trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
342b8b6e 273 $(WGET) -q --output-document=$$tarz $(url); \
d074a105
AD
274 echo "$(md5) -" > $$md5_tmp; \
275 md5sum -c $$md5_tmp < $$tarz
276
277prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
278xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
279
280GZIP = gzip
281BZIP2 = bzip2
282$(my_distdir).tar.bz2: $(my_distdir).tar.gz
283 $(GZIP) -dc $< > $(my_distdir).tar
284 rm -f $@
285 $(BZIP2) -9 $(my_distdir).tar
286
287rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
288announcement: NEWS ChangeLog $(rel-files)
289 @( \
290 echo Subject: $(my_distdir) released; \
291 echo; \
292 echo FIXME: put comments here; \
293 echo; \
294 for url in $(url_dir_list); do \
295 echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \
296 echo " $$url/$(my_distdir).tar.bz2 ($(bz2-size))"; \
297 done; \
298 echo; \
299 echo And here are xdelta-style diffs; \
300 echo; \
301 for url in $(url_dir_list); do \
302 echo " $$url/$(xd-delta) ($(xd-size))"; \
303 done; \
304 echo; \
305 echo "Here are the MD5 and SHA1 signatures for the compressed tar files:"; \
306 echo; \
307 echo "$(tgz-md5) $(my_distdir).tar.gz"; \
308 echo "$(bz2-md5) $(my_distdir).tar.bz2"; \
309 echo "$(tgz-sha1) $(my_distdir).tar.gz"; \
310 echo "$(bz2-sha1) $(my_distdir).tar.bz2"; \
311 echo; \
312 echo NEWS:; \
313 sed -n "/$(THIS_VERSION_REGEXP)[]:]/,/$(PREV_VERSION_REGEXP)[]:]/p" NEWS \
314 | grep -v '^\['; \
315 echo; \
316 echo ChangeLog entries:; \
317 find . -name ChangeLog -maxdepth 2 \
0a3b9e5f 318 | xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD \
d074a105
AD
319 | sed -n 's/^+//p' \
320 | perl -ne 'm!^\+\+ (\./)?! or print,next;' \
321 -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
322 )
323
d074a105
AD
324define emit-rsync-commands
325 echo =====================================
326 echo =====================================
327 echo 'for host in $(a_host) $(b_host); do \'
328 echo ' rsync -e ssh --pro -av $(xd-delta) $(my_distdir).tar.bz2 \'
329 echo ' $(my_distdir).tar.gz $$host:$(real_dir); done'
330 echo '# send the /tmp/announcement e-mail'
331 echo =====================================
332 echo =====================================
333endef
334
335$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
336 xdelta delta -9 $^ $@ || :
337
342b8b6e 338alpha:
d074a105
AD
339 $(MAKE) cvs-dist
340 $(MAKE) $(xd-delta)
341 $(MAKE) -s announcement > /tmp/announce-$(my_distdir)
342 ln $(rel-files) $(release_archive_dir)
343 chmod a-w $(rel-files)
344 echo $(VERSION) > $(prev_version_file)
0a3b9e5f 345 $(CVS) ci -m. $(prev_version_file)
d074a105 346 @$(emit-rsync-commands)