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