]> git.saurik.com Git - bison.git/blob - Makefile.maint
* src/complain.c: Adjust strerror_r portability issues.
[bison.git] / Makefile.maint
1 # -*-Makefile-*-
2 # This Makefile fragment is shared between fileutils, sh-utils, textutils,
3 # CPPI, Bison, and Autoconf.
4
5 prev_version_file ?= .prev-version
6
7 THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
8 PREV_VERSION := $(shell cat $(prev_version_file))
9 PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
10
11 tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
12 tag-this-version = $(subst .,_,$(VERSION))
13 tag-prev-version = $(subst .,_,$(PREV_VERSION))
14 this-cvs-tag = $(tag-package)-$(tag-this-version)
15 prev-cvs-tag = $(tag-package)-$(tag-prev-version)
16 my_distdir = $(PACKAGE)-$(VERSION)
17
18 # Old releases are stored here.
19 # Used for diffs and xdeltas.
20 release_archive_dir ?= ../release
21
22
23
24 ## --------------- ##
25 ## Sanity checks. ##
26 ## --------------- ##
27
28 # Checks that don't require cvs.
29 local-check: changelog-check po-check writable-files copyright-check
30
31 changelog-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.
40 po-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.
49 writable-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.
63 copyright-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.
72 cvs-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
79 cvs-diff-check:
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; \
84 exit 1; \
85 else \
86 rm cvs-diffs; \
87 fi
88
89 cvs-check: cvs-diff-check cvs-tag-check
90
91 maintainer-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.
97 GZIP_ENV = '--no-name --best'
98
99 # Automake 1.4 does not define AMTAR.
100 AMTAR ?= $(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.
105 cvs-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.
112 null_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.
123 t=./=test
124 my-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.
145 real_dir = fetish-ftp
146
147 url_dir_list = $(foreach x,$(hosts),ftp://$($(x)_host)/$($(x)_url_dir))
148
149 tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
150 tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
151 bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
152 bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
153 tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([Mk]\).*/ \1B/')
154 bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([Mk]\).*/ \1B/')
155 xd-size = $(shell du --human $(xd-delta)|sed 's/\([Mk]\).*/ \1B/')
156
157 rel-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
166 prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
167 xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
168
169 GZIP = gzip
170 BZIP2 = 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
176 rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz
177 announcement: 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
213 WGET = wget
214 ftp-gnu = ftp://ftp.gnu.org/gnu
215
216 # Use mv, if you don't have/want move-if-change.
217 move_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.
222 wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
223 $(srcdir)/src/ansi2knr.c \
224 $(srcdir)/doc/texinfo.tex
225 get-targets = $(patsubst %, get-%, $(wget_files))
226
227 config.guess-url_prefix = $(ftp-gnu)/config/
228 config.sub-url_prefix = $(ftp-gnu)/config/
229
230 ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
231
232 texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
233
234 standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
235 make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
236
237 target = $(patsubst get-%, %, $@)
238 url = $($(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
245 automake_repo=:pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
246 .PHONY: wget-update
247 wget-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
255 define 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 =====================================
264 endef
265
266 $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
267 xdelta delta -9 $^ $@ || :
268
269 alpha: 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)