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