]> git.saurik.com Git - bison.git/blob - Makefile.maint
Regen.
[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 local-check: changelog-check po-check writable-files copyright-check
55
56 changelog-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.
65 po-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.
74 writable-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.
88 copyright-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.
97 cvs-tag-check:
98 echo $(this-cvs-tag); \
99 if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
100 echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
101 exit 1; \
102 else :; fi
103
104 cvs-diff-check:
105 if $(CVS) diff >cvs-diffs; then \
106 rm cvs-diffs; \
107 else \
108 echo "Some files are locally modified:" 1>&2; \
109 cat cvs-diffs; \
110 exit 1; \
111 fi
112
113 cvs-check: cvs-diff-check cvs-tag-check
114
115 maintainer-distcheck: changelog-check
116 $(MAKE) distcheck
117 $(MAKE) my-distcheck
118
119
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.
123 cvs-dist: cvs-check maintainer-distcheck
124 $(CVS) update po
125 $(CVS) tag -c $(this-cvs-tag)
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.
130 null_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.
141 t=./=test
142 my-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.
163 real_dir = fetish-ftp
164
165 url_dir_list = $(foreach x,$(hosts),ftp://$($(x)_host)/$($(x)_url_dir))
166
167 tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
168 tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
169 bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
170 bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
171 tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([Mk]\).*/ \1B/')
172 bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([Mk]\).*/ \1B/')
173 xd-size = $(shell du --human $(xd-delta)|sed 's/\([Mk]\).*/ \1B/')
174
175 rel-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
184 prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
185 xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
186
187 GZIP = gzip
188 BZIP2 = 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
194 rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
195 announcement: 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 \
225 | xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD \
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
231 WGET = wget
232 ftp-gnu = ftp://ftp.gnu.org/gnu
233
234 # Use mv, if you don't have/want move-if-change.
235 move_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.
240 wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
241 $(srcdir)/src/ansi2knr.c \
242 $(srcdir)/doc/texinfo.tex
243 get-targets = $(patsubst %, get-%, $(wget_files))
244
245 config.guess-url_prefix = $(ftp-gnu)/config/
246 config.sub-url_prefix = $(ftp-gnu)/config/
247
248 ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
249
250 texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
251
252 standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
253 make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
254
255 target = $(patsubst get-%, %, $@)
256 url = $($(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
263 automake_repo=:pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
264 .PHONY: wget-update
265 wget-update: $(get-targets)
266 for f in depcomp missing; do \
267 test -f $$f || continue; \
268 echo checking out $$f...; \
269 $(CVS) -d $(automake_repo) co -p automake/lib/$$f > $$f.t \
270 && $(move_if_change) $$f.t $$f; \
271 done
272
273 define 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 =====================================
282 endef
283
284 $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
285 xdelta delta -9 $^ $@ || :
286
287 alpha: 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)
294 $(CVS) ci -m. $(prev_version_file)
295 @$(emit-rsync-commands)