]> git.saurik.com Git - bison.git/blame - Makefile.maint
* src/system.h: Provide default declarations for stpcpy, strndup,
[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:
df3b6776
AD
80 cvs diff | grep -v '^?' >cvs-diffs; \
81 if grep . cvs-diff >/dev/null; then \
82 echo "Some files are locally modified:" >&2; \
83 cat cvs-diffs >&2; \
d074a105 84 exit 1; \
be642444
AD
85 else \
86 rm cvs-diffs; \
d074a105
AD
87 fi
88
89cvs-check: cvs-diff-check cvs-tag-check
90
91maintainer-distcheck: changelog-check
92 $(MAKE) distcheck
93 $(MAKE) my-distcheck
94
95
96# Do not save the original name or timestamp in the .tar.gz file.
97GZIP_ENV = '--no-name --best'
98
99# Automake 1.4 does not define AMTAR.
100AMTAR ?= $(TAR)
101
102# Tag before making distribution. Also, don't make a distribution if
103# checks fail. Also, make sure the NEWS file is up-to-date.
104# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
105cvs-dist: cvs-check maintainer-distcheck
106 cvs update po
107 cvs tag -c $(this-cvs-tag)
108 $(MAKE) dist
109
110# Use this to make sure we don't run these programs when building
111# from a virgin tgz file, below.
112null_AM_MAKEFLAGS = \
113 ACLOCAL=false \
114 AUTOCONF=false \
115 AUTOMAKE=false \
116 AUTOHEADER=false \
117 MAKEINFO=false
118
119# Detect format-string/arg-list mismatches that would normally be obscured
120# by the use of _(). The --disable-nls effectively defines away that macro,
121# and building with CFLAGS='-Wformat -Werror' causes any format warning to be
122# treated as a failure.
123t=./=test
124my-distcheck: writable-files po-check
125 -rm -rf $(t)
126 mkdir $(t)
127 GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
128 cd $(t)/$(distdir) \
129 && ./configure --disable-nls \
130 && $(MAKE) CFLAGS='-Wformat -Werror' \
131 AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
132 && $(MAKE) dvi \
133 && $(MAKE) check \
134 && $(MAKE) distclean
135 cd $(t) && mv $(distdir) $(distdir).old \
136 && $(AMTAR) -zxf ../$(distdir).tar.gz
137 diff -ur $(t)/$(distdir).old $(t)/$(distdir)
138 -rm -rf $(t)
139 @echo "========================"; \
140 echo "$(distdir).tar.gz is ready for distribution"; \
141 echo "========================"
142
143# This must be the same name on both hosts.
144# Make it a symlink that points to the right place.
145real_dir = fetish-ftp
146
147url_dir_list = $(foreach x,$(hosts),ftp://$($(x)_host)/$($(x)_url_dir))
148
149tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
150tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
151bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
152bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
153tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([Mk]\).*/ \1B/')
154bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([Mk]\).*/ \1B/')
155xd-size = $(shell du --human $(xd-delta)|sed 's/\([Mk]\).*/ \1B/')
156
157rel-check:
158 tarz=/tmp/rel-check-tarz-$$$$; \
159 md5_tmp=/tmp/rel-check-md5-$$$$; \
160 set -e; \
161 trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
162 wget -q --output-document=$$tarz $(url); \
163 echo "$(md5) -" > $$md5_tmp; \
164 md5sum -c $$md5_tmp < $$tarz
165
166prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
167xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
168
169GZIP = gzip
170BZIP2 = bzip2
171$(my_distdir).tar.bz2: $(my_distdir).tar.gz
172 $(GZIP) -dc $< > $(my_distdir).tar
173 rm -f $@
174 $(BZIP2) -9 $(my_distdir).tar
175
176rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
177announcement: NEWS ChangeLog $(rel-files)
178 @( \
179 echo Subject: $(my_distdir) released; \
180 echo; \
181 echo FIXME: put comments here; \
182 echo; \
183 for url in $(url_dir_list); do \
184 echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \
185 echo " $$url/$(my_distdir).tar.bz2 ($(bz2-size))"; \
186 done; \
187 echo; \
188 echo And here are xdelta-style diffs; \
189 echo; \
190 for url in $(url_dir_list); do \
191 echo " $$url/$(xd-delta) ($(xd-size))"; \
192 done; \
193 echo; \
194 echo "Here are the MD5 and SHA1 signatures for the compressed tar files:"; \
195 echo; \
196 echo "$(tgz-md5) $(my_distdir).tar.gz"; \
197 echo "$(bz2-md5) $(my_distdir).tar.bz2"; \
198 echo "$(tgz-sha1) $(my_distdir).tar.gz"; \
199 echo "$(bz2-sha1) $(my_distdir).tar.bz2"; \
200 echo; \
201 echo NEWS:; \
202 sed -n "/$(THIS_VERSION_REGEXP)[]:]/,/$(PREV_VERSION_REGEXP)[]:]/p" NEWS \
203 | grep -v '^\['; \
204 echo; \
205 echo ChangeLog entries:; \
206 find . -name ChangeLog -maxdepth 2 \
207 | xargs cvs diff -up -r$(prev-cvs-tag) -rHEAD \
208 | sed -n 's/^+//p' \
209 | perl -ne 'm!^\+\+ (\./)?! or print,next;' \
210 -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
211 )
212
213WGET = wget
214ftp-gnu = ftp://ftp.gnu.org/gnu
215
216# Use mv, if you don't have/want move-if-change.
217move_if_change ?= move-if-change
218
219# The following pseudo table associates a local directory and a URL
220# with each of the files that belongs to some other package and is
221# regularly updated from the specified URL.
222wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
223 $(srcdir)/src/ansi2knr.c \
224 $(srcdir)/doc/texinfo.tex
225get-targets = $(patsubst %, get-%, $(wget_files))
226
227config.guess-url_prefix = $(ftp-gnu)/config/
228config.sub-url_prefix = $(ftp-gnu)/config/
229
230ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
231
232texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
233
234standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
235make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
236
237target = $(patsubst get-%, %, $@)
238url = $($(notdir $(target))-url_prefix)$(notdir $(target))
239
240.PHONY: $(get-targets)
241$(get-targets):
242 $(WGET) $(url) -O $(target).t \
243 && $(move_if_change) $(target).t $(target)
244
245automake_repo=:pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
246.PHONY: wget-update
247wget-update: $(get-targets)
248 for f in depcomp missing; do \
249 test -f $$f || continue; \
250 echo checking out $$f...; \
251 cvs -d $(automake_repo) co -p automake/lib/$$f > $$f.t \
252 && $(move_if_change) $$f.t $$f; \
253 done
254
255define emit-rsync-commands
256 echo =====================================
257 echo =====================================
258 echo 'for host in $(a_host) $(b_host); do \'
259 echo ' rsync -e ssh --pro -av $(xd-delta) $(my_distdir).tar.bz2 \'
260 echo ' $(my_distdir).tar.gz $$host:$(real_dir); done'
261 echo '# send the /tmp/announcement e-mail'
262 echo =====================================
263 echo =====================================
264endef
265
266$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
267 xdelta delta -9 $^ $@ || :
268
269alpha: local-check
270 $(MAKE) cvs-dist
271 $(MAKE) $(xd-delta)
272 $(MAKE) -s announcement > /tmp/announce-$(my_distdir)
273 ln $(rel-files) $(release_archive_dir)
274 chmod a-w $(rel-files)
275 echo $(VERSION) > $(prev_version_file)
276 cvs ci -m. $(prev_version_file)
277 @$(emit-rsync-commands)