]> git.saurik.com Git - bison.git/blob - Makefile.maint
* tests/calc.at (_AT_DATA_CALC_Y): Remove unused strcat declaration.
[bison.git] / Makefile.maint
1 # -*-Makefile-*-
2 # This Makefile fragment is shared between Autoconf and Bison.
3
4 ## Copyright (C) 2001, 2002 Free Software Foundation, Inc.
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.
20
21 # Do not save the original name or timestamp in the .tar.gz file.
22 GZIP_ENV = '--no-name --best'
23
24 CVS = cvs
25
26 prev_version_file ?= .prev-version
27
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')
31
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)
38
39 # Old releases are stored here.
40 # Used for diffs and xdeltas.
41 release_archive_dir ?= ../release
42
43
44
45 ## ---------------- ##
46 ## Updating files. ##
47 ## ---------------- ##
48
49 WGET = wget
50 ftp-gnu = ftp://ftp.gnu.org/gnu
51
52 # Use mv, if you don't have/want move-if-change.
53 move_if_change ?= move-if-change
54
55 # ------------------- #
56 # Updating PO files. #
57 # ------------------- #
58
59 po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE)
60 .PHONY: do-po-update po-update
61 do-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
70 po-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.
82 wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
83 $(srcdir)/doc/texinfo.tex
84 wget-targets = $(patsubst %, get-%, $(wget_files))
85
86 config.guess-url_prefix = $(ftp-gnu)/config/
87 config.sub-url_prefix = $(ftp-gnu)/config/
88
89 texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
90
91 standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
92 make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
93
94 target = $(patsubst get-%, %, $@)
95 url = $($(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
103 wget-update: $(wget-targets)
104
105
106 # Updating tools via CVS.
107 cvs_files ?= depcomp missing
108 cvs-targets = $(patsubst %, get-%, $(cvs_files))
109
110 automake_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
118 cvs-update: $(cvs-targets)
119
120
121 # --------------------- #
122 # Updating everything. #
123 # --------------------- #
124
125 .PHONY: update
126 update: wget-update cvs-update po-update
127
128
129
130 ## --------------- ##
131 ## Sanity checks. ##
132 ## --------------- ##
133
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
137
138 changelog-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.
147 po-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.
156 writable-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.
170 copyright-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.
179 cvs-tag-check:
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; \
183 exit 1; \
184 else :; fi
185
186 cvs-diff-check:
187 if $(CVS) diff >cvs-diffs; then \
188 rm cvs-diffs; \
189 else \
190 echo "Some files are locally modified:" 1>&2; \
191 cat cvs-diffs; \
192 exit 1; \
193 fi
194
195 cvs-check: cvs-diff-check cvs-tag-check
196
197 maintainer-distcheck: changelog-check
198 $(MAKE) distcheck
199 $(MAKE) my-distcheck
200
201
202
203 ## -------------- ##
204 ## Making dists. ##
205 ## -------------- ##
206
207
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
212 $(CVS) update po
213 $(CVS) tag -c $(this-cvs-tag)
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.
218 null_AM_MAKEFLAGS = \
219 ACLOCAL=false \
220 AUTOCONF=false \
221 AUTOM4TE=false \
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.
230 t=./=test
231 my-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
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/')
259
260 rel-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; \
265 $(WGET) -q --output-document=$$tarz $(url); \
266 echo "$(md5) -" > $$md5_tmp; \
267 md5sum -c $$md5_tmp < $$tarz
268
269 prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
270 xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
271
272 news-r1 = /^[^ ].*$(THIS_VERSION_REGEXP)[]:]/
273 news-r2 = /^[^ ].*$(PREV_VERSION_REGEXP)[]:]/
274
275 rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
276 announcement: 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; \
293 echo "Here are the MD5 and SHA1 signatures:"; \
294 echo; \
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)"; \
301 echo; \
302 echo NEWS:; \
303 sed -n "$(news-r1),$(news-r2)p" NEWS \
304 | grep -v '^\['; \
305 echo; \
306 echo ChangeLog entries:; \
307 find . -name ChangeLog -maxdepth 2 \
308 | xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD \
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
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 =====================================
321 endef
322
323 $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
324 xdelta delta -9 $^ $@ || :
325
326 alpha:
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)
333 $(CVS) ci -m. $(prev_version_file)
334 @$(emit-upload-commands)