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