1 |
# -*-Makefile-*- |
# -*-Makefile-*- |
2 |
# This Makefile fragment is shared between fileutils, sh-utils, textutils, |
# This Makefile fragment is shared between the coreutils, |
3 |
# CPPI, Bison, and Autoconf. |
# CPPI, Bison, and Autoconf. |
4 |
|
|
5 |
## Copyright (C) 2001, 2002 Free Software Foundation, Inc. |
## Copyright (C) 2001-2003 Free Software Foundation, Inc. |
6 |
## |
## |
7 |
## This program is free software; you can redistribute it and/or modify |
## 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 |
## it under the terms of the GNU General Public License as published by |
19 |
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
20 |
## 02111-1307, USA. |
## 02111-1307, USA. |
21 |
|
|
22 |
|
# This is reported not to work with make-3.79.1 |
23 |
|
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) |
24 |
|
ME := Makefile.maint |
25 |
|
|
26 |
# Do not save the original name or timestamp in the .tar.gz file. |
# Do not save the original name or timestamp in the .tar.gz file. |
27 |
GZIP_ENV = '--no-name --best' |
GZIP_ENV = '--no-name --best --rsyncable' |
28 |
|
|
29 |
CVS = cvs |
CVS = cvs |
30 |
|
|
31 |
prev_version_file ?= .prev-version |
ifeq ($(origin prev_version_file), undefined) |
32 |
|
prev_version_file = .prev-version |
33 |
|
endif |
34 |
|
|
|
THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION)) |
|
35 |
PREV_VERSION := $(shell cat $(prev_version_file)) |
PREV_VERSION := $(shell cat $(prev_version_file)) |
|
PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g') |
|
36 |
|
|
37 |
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]') |
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]') |
38 |
tag-this-version = $(subst .,_,$(VERSION)) |
tag-this-version = $(subst .,_,$(VERSION)) |
|
tag-prev-version = $(subst .,_,$(PREV_VERSION)) |
|
39 |
this-cvs-tag = $(tag-package)-$(tag-this-version) |
this-cvs-tag = $(tag-package)-$(tag-this-version) |
|
prev-cvs-tag = $(tag-package)-$(tag-prev-version) |
|
40 |
my_distdir = $(PACKAGE)-$(VERSION) |
my_distdir = $(PACKAGE)-$(VERSION) |
41 |
|
|
42 |
# Old releases are stored here. |
# Old releases are stored here. |
43 |
# Used for diffs and xdeltas. |
# Used for diffs and xdeltas. |
44 |
release_archive_dir ?= ../release |
release_archive_dir ?= ../release |
45 |
|
|
46 |
|
# Prevent programs like 'sort' from considering distinct strings to be equal. |
47 |
|
# Doing it here saves us from having to set LC_ALL elsewhere in this file. |
48 |
|
export LC_ALL = C |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
## --------------- ## |
## --------------- ## |
58 |
# new ChangeLog entries. |
# new ChangeLog entries. |
59 |
local-check = \ |
local-check = \ |
60 |
po-check copyright-check writable-files m4-check author_mark_check \ |
po-check copyright-check writable-files m4-check author_mark_check \ |
61 |
changelog-check strftime-check header-check |
changelog-check strftime-check syntax-check makefile_path_separator_check \ |
62 |
|
makefile-check |
63 |
.PHONY: $(local-check) |
.PHONY: $(local-check) |
64 |
|
|
65 |
# Make sure C source files in src/ don't include xalloc.h directly, |
# Make sure C source files in src/ don't include xalloc.h directly, |
66 |
# since they all already include it via sys2.h. |
# since they all already include it via sys2.h. |
67 |
# It's not a big deal -- just aesthetics. |
# It's not a big deal -- just aesthetics. |
68 |
header-check: |
.PHONY: $(syntax-check-rules) |
69 |
if test -f $(srcdir)/src/sys2.h; then \ |
syntax-check-rules = \ |
70 |
|
sc_cast_of_argument_to_free \ |
71 |
|
sc_cast_of_x_alloc_return_value \ |
72 |
|
sc_changelog \ |
73 |
|
sc_error_exit_success \ |
74 |
|
sc_space_tab \ |
75 |
|
sc_sun_os_names \ |
76 |
|
sc_system_h_headers \ |
77 |
|
sc_unmarked_diagnostics \ |
78 |
|
sc_xalloc_h_in_src |
79 |
|
|
80 |
|
syntax-check: $(syntax-check-rules) |
81 |
|
# @grep -E '# *include <(limits|std(def|arg|bool))\.h>' \ |
82 |
|
# $$(find -type f -name '*.[chly]') && \ |
83 |
|
# { echo '$(ME): found conditional include' 1>&2; \ |
84 |
|
# exit 1; } || : |
85 |
|
|
86 |
|
# grep -E '^# *include <(string|stdlib)\.h>' \ |
87 |
|
# $(srcdir)/{lib,src}/*.[chy] && \ |
88 |
|
# { echo '$(ME): FIXME' 1>&2; \ |
89 |
|
# exit 1; } || : |
90 |
|
# FIXME: don't allow `#include .strings\.h' anywhere |
91 |
|
|
92 |
|
# Look for diagnostics that aren't marked for translation. |
93 |
|
# This won't find any for which error's format string is on a separate line. |
94 |
|
sc_unmarked_diagnostics: |
95 |
|
@grep --exclude=$(srcdir)/src/shred.c -E \ |
96 |
|
'\<error \([^"]*"[^"]*[a-z]{3}' $(srcdir)/{lib,src}/*.c \ |
97 |
|
| grep -v '_(' && \ |
98 |
|
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ |
99 |
|
exit 1; } || : |
100 |
|
|
101 |
|
sc_cast_of_argument_to_free: |
102 |
|
@grep -E '\<free \(\(' $(srcdir)/{lib,src}/*.[chly] && \ |
103 |
|
{ echo '$(ME): don'\''t cast free argument' 1>&2; \ |
104 |
|
exit 1; } || : |
105 |
|
|
106 |
|
sc_cast_of_x_alloc_return_value: |
107 |
|
@grep -E --exclude=$(srcdir)/lib/regex.c \ |
108 |
|
'\*\) *x(m|c|re)alloc\>' $(srcdir)/{lib,src}/*.[chy] && \ |
109 |
|
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \ |
110 |
|
exit 1; } || : |
111 |
|
|
112 |
|
sc_space_tab: |
113 |
|
@( cvsu --list ) > /dev/null 2>&1 || : && \ |
114 |
|
grep '[ ] ' \ |
115 |
|
$$(cvsu --list | grep -vEf .x-$@ ) && \ |
116 |
|
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \ |
117 |
|
1>&2; exit 1; } || : |
118 |
|
|
119 |
|
# Using EXIT_SUCCESS as the first argument to error is misleading, |
120 |
|
# since when that parameter is 0, error does not exit. Use `0' instead. |
121 |
|
sc_error_exit_success: |
122 |
|
@grep -F 'error (EXIT_SUCCESS,' \ |
123 |
|
$$(find -type f -name '*.[chly]') && \ |
124 |
|
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \ |
125 |
|
exit 1; } || : |
126 |
|
|
127 |
|
# FIXME: merge this with sc_system_h_headers below. |
128 |
|
# xalloc.h is included via system.h, so should not be included |
129 |
|
# directly by any file in src/. |
130 |
|
sc_xalloc_h_in_src: |
131 |
|
@if test -f $(srcdir)/src/sys2.h; then \ |
132 |
if grep 'xalloc\.h' $(srcdir)/src/*.c; then \ |
if grep 'xalloc\.h' $(srcdir)/src/*.c; then \ |
133 |
exit 1; \ |
exit 1; \ |
134 |
fi; \ |
fi; \ |
135 |
fi |
fi |
136 |
|
|
137 |
|
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ |
138 |
|
|
139 |
|
# Each nonempty line must start with a year number, or a TAB. |
140 |
|
sc_changelog: |
141 |
|
@grep '^[^12 ]' $$(find . -name ChangeLog -maxdepth 2) && \ |
142 |
|
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \ |
143 |
|
exit 1; } || : |
144 |
|
|
145 |
|
header_regexp = \ |
146 |
|
alloca\ |
147 |
|
|closeout\ |
148 |
|
|ctype\ |
149 |
|
|dirent\ |
150 |
|
|errno\ |
151 |
|
|fcntl\ |
152 |
|
|inttypes\ |
153 |
|
|limits\ |
154 |
|
|locale\ |
155 |
|
|pathmax\ |
156 |
|
|std(lib|bool)\ |
157 |
|
|string\ |
158 |
|
|sys/(stat|dir|time)\ |
159 |
|
|time\ |
160 |
|
|unistd\ |
161 |
|
|utime\ |
162 |
|
|version-etc\ |
163 |
|
|xalloc |
164 |
|
h_re := $(shell echo '$(header_regexp)'|tr -d ' ') |
165 |
|
|
166 |
|
# Files in src/ should not include directly any of |
167 |
|
# the headers already included via system.h. |
168 |
|
# Get list of candidates with this: |
169 |
|
# grep -h include src/sys*.h|sed 's/.*include //'|sort - |
170 |
|
sc_system_h_headers: |
171 |
|
@( cvsu --list ) > /dev/null 2>&1 || : && \ |
172 |
|
grep -E '^# *include ["<]($(h_re))\.h[">]' \ |
173 |
|
$$(cvsu --list src | grep -Ev 'sys(2|tem)\.h$$') \ |
174 |
|
&& { echo '$(ME): the above are already included via system.h'\ |
175 |
|
1>&2; exit 1; } || : |
176 |
|
|
177 |
|
sc_sun_os_names: |
178 |
|
@( cvsu --list ) > /dev/null 2>&1 || : && \ |
179 |
|
grep -Ei \ |
180 |
|
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \ |
181 |
|
$$(cvsu --list | grep -vEf .x-$@ ) && \ |
182 |
|
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \ |
183 |
|
exit 1; } || : |
184 |
|
|
185 |
# Ensure that date's --help output stays in sync with the info |
# Ensure that date's --help output stays in sync with the info |
186 |
# documentation for GNU strftime. The only exception is %N, |
# documentation for GNU strftime. The only exception is %N, |
187 |
# which date accepts but GNU strftime does not. |
# which date accepts but GNU strftime does not. |
197 |
rm -f $@-src $@-info; \ |
rm -f $@-src $@-info; \ |
198 |
fi |
fi |
199 |
|
|
200 |
|
# Ensure that we use only the standard $(VAR) notation, |
201 |
|
# not @...@ in Makefile.am, now that we can rely on automake |
202 |
|
# to emit a definition for each substituted variable. |
203 |
|
makefile-check: |
204 |
|
grep -E '@[A-Z_0-9]+@' `find . -name Makefile.am` \ |
205 |
|
&& { echo 'Makefile.maint: use $(...), not @...@' 1>&2; exit 1; } || : |
206 |
|
|
207 |
changelog-check: |
changelog-check: |
208 |
if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \ |
if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \ |
209 |
:; \ |
:; \ |
243 |
{ echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \ |
{ echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \ |
244 |
exit 1; } || : |
exit 1; } || : |
245 |
|
|
246 |
|
# Sometimes it is useful to change the PATH environment variable |
247 |
|
# in Makefiles. When doing so, it's better not to use the Unix-centric |
248 |
|
# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'. |
249 |
|
# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable, |
250 |
|
# and there probably aren't many projects with so many Makefile.am files |
251 |
|
# that we'd have to worry about limits on command line length. |
252 |
|
msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead' |
253 |
|
makefile_path_separator_check: |
254 |
|
@grep 'PATH=.*:' `find $(srcdir) -name Makefile.am` \ |
255 |
|
&& { echo $(msg) 1>&2; exit 1; } || : |
256 |
|
|
257 |
# Check that `make alpha' will not fail at the end of the process. |
# Check that `make alpha' will not fail at the end of the process. |
258 |
writable-files: |
writable-files: |
259 |
if test -d $(release_archive_dir); then :; else \ |
if test -d $(release_archive_dir); then :; else \ |
288 |
else :; fi |
else :; fi |
289 |
|
|
290 |
cvs-diff-check: |
cvs-diff-check: |
291 |
if $(CVS) diff >cvs-diffs; then \ |
if $(CVS) diff >cvs-diffs; then \ |
292 |
rm cvs-diffs; \ |
rm cvs-diffs; \ |
293 |
else \ |
else \ |
294 |
echo "Some files are locally modified:" 1>&2; \ |
echo "Some files are locally modified:" 1>&2; \ |
295 |
cat cvs-diffs; \ |
cat cvs-diffs; \ |
296 |
exit 1; \ |
exit 1; \ |
297 |
fi |
fi |
324 |
# by the use of _(). The --disable-nls effectively defines away that macro, |
# by the use of _(). The --disable-nls effectively defines away that macro, |
325 |
# and building with CFLAGS='-Wformat -Werror' causes any format warning to be |
# and building with CFLAGS='-Wformat -Werror' causes any format warning to be |
326 |
# treated as a failure. |
# treated as a failure. |
327 |
t=./=test |
TMPDIR ?= /tmp |
328 |
|
t=$(TMPDIR)/$(PACKAGE)/test |
329 |
my-distcheck: $(local-check) |
my-distcheck: $(local-check) |
330 |
-rm -rf $(t) |
-rm -rf $(t) |
331 |
mkdir $(t) |
mkdir -p $(t) |
332 |
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz |
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz |
333 |
cd $(t)/$(distdir) \ |
cd $(t)/$(distdir) \ |
334 |
&& ./configure --disable-nls \ |
&& ./configure --disable-nls \ |
337 |
&& $(MAKE) dvi \ |
&& $(MAKE) dvi \ |
338 |
&& $(MAKE) check \ |
&& $(MAKE) check \ |
339 |
&& $(MAKE) distclean |
&& $(MAKE) distclean |
340 |
cd $(t) && mv $(distdir) $(distdir).old \ |
(cd $(t) && mv $(distdir) $(distdir).old \ |
341 |
&& $(AMTAR) -zxf ../$(distdir).tar.gz |
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz |
342 |
diff -ur $(t)/$(distdir).old $(t)/$(distdir) |
diff -ur $(t)/$(distdir).old $(t)/$(distdir) |
343 |
-rm -rf $(t) |
-rm -rf $(t) |
344 |
@echo "========================"; \ |
@echo "========================"; \ |
367 |
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz |
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz |
368 |
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta |
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta |
369 |
|
|
370 |
news-r1 = /^[^ ].*$(THIS_VERSION_REGEXP)[]:]/ |
signatures ?= $(distdir).tar.bz2.asc $(distdir).tar.gz.asc |
371 |
news-r2 = /^[^ ].*$(PREV_VERSION_REGEXP)[]:]/ |
%.asc: % |
372 |
|
rm -f $@ |
373 |
rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz |
gpg --armor --detach-sign -o $@ $< |
374 |
announcement: NEWS ChangeLog $(rel-files) |
|
375 |
@( \ |
rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz $(signatures) |
376 |
echo Subject: $(my_distdir) released; \ |
announce_gen ?= ./announce-gen |
377 |
echo; \ |
announcement: NEWS ChangeLog $(rel-files) $(signatures) |
378 |
echo FIXME: put comments here; \ |
@$(announce_gen) \ |
379 |
echo; \ |
--release-type=$(RELEASE_TYPE) \ |
380 |
for url in $(url_dir_list); do \ |
--package=$(PACKAGE) \ |
381 |
echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \ |
--prev=$(PREV_VERSION) \ |
382 |
echo " $$url/$(my_distdir).tar.bz2 ($(bz2-size))"; \ |
--curr=$(VERSION) \ |
383 |
done; \ |
--release-archive-directory=$(release_archive_dir) \ |
384 |
echo; \ |
--news=NEWS \ |
385 |
echo And here are xdelta-style diffs; \ |
$(addprefix --url-dir=, $(url_dir_list)) \ |
|
echo; \ |
|
|
for url in $(url_dir_list); do \ |
|
|
echo " $$url/$(xd-delta) ($(xd-size))"; \ |
|
|
done; \ |
|
|
echo; \ |
|
|
echo "Here are the MD5 and SHA1 signatures:"; \ |
|
|
echo; \ |
|
|
echo "$(tgz-md5) $(my_distdir).tar.gz"; \ |
|
|
echo "$(bz2-md5) $(my_distdir).tar.bz2"; \ |
|
|
echo "$(xdelta-md5) $(xd-delta)"; \ |
|
|
echo "$(tgz-sha1) $(my_distdir).tar.gz"; \ |
|
|
echo "$(bz2-sha1) $(my_distdir).tar.bz2"; \ |
|
|
echo "$(xdelta-sha1) $(xd-delta)"; \ |
|
|
echo; \ |
|
|
echo NEWS:; \ |
|
|
sed -n "$(news-r1),$(news-r2)p" NEWS \ |
|
|
| grep -v '^\['; \ |
|
|
echo; \ |
|
|
echo ChangeLog entries:; \ |
|
|
find . -name ChangeLog -maxdepth 2 \ |
|
|
| xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD \ |
|
|
| sed -n 's/^+//p' \ |
|
|
| perl -ne 'm!^\+\+ (\./)?! or print,next;' \ |
|
|
-e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \ |
|
|
) |
|
386 |
|
|
387 |
|
|
388 |
## ---------------- ## |
## ---------------- ## |
457 |
$(WGET) $(url) -O $(target).t \ |
$(WGET) $(url) -O $(target).t \ |
458 |
&& $(move_if_change) $(target).t $(target) |
&& $(move_if_change) $(target).t $(target) |
459 |
|
|
460 |
cvs_files ?= $(srcdir)/config/depcomp $(srcdir)/config/missing $(srcdir)/config/mkinstalldirs \ |
cvs_files ?= $(srcdir)/config/depcomp $(srcdir)/config/missing \ |
461 |
|
$(srcdir)/config/mkinstalldirs \ |
462 |
$(srcdir)/config/install-sh $(srcdir)/src/ansi2knr.c |
$(srcdir)/config/install-sh $(srcdir)/src/ansi2knr.c |
463 |
automake_repo=:pserver:anoncvs:anoncvs@sources.redhat.com:/cvs/automake |
automake_repo=:pserver:anoncvs:anoncvs@sources.redhat.com:/cvs/automake |
464 |
.PHONY: wget-update |
.PHONY: wget-update |
466 |
|
|
467 |
.PHONY: cvs-update |
.PHONY: cvs-update |
468 |
cvs-update: |
cvs-update: |
469 |
for f in $(cvs_files); do \ |
fail=; \ |
470 |
test -f $$f || { echo "*** skipping $$f" 1>&2; continue; }; \ |
for f in $(cvs_files); do \ |
471 |
file=$$(basename $$f); \ |
test -f $$f || { echo "*** skipping $$f" 1>&2; continue; }; \ |
472 |
echo checking out $$file...; \ |
cvs diff $$f > /dev/null \ |
473 |
$(CVS) -d $(automake_repo) co -p automake/lib/$$file> $$f.t \ |
|| { echo "*** $$f is locally modified; skipping it" 1>&2; \ |
474 |
&& $(move_if_change) $$f.t $$f; \ |
fail=yes; continue; }; \ |
475 |
done |
file=$$(basename $$f); \ |
476 |
|
echo checking out $$file...; \ |
477 |
|
$(CVS) -d $(automake_repo) co -p automake/lib/$$file> $$f.t \ |
478 |
|
&& $(move_if_change) $$f.t $$f; \ |
479 |
|
done; \ |
480 |
|
test "$$fail" && exit 1 |
481 |
|
|
482 |
define emit-upload-commands |
define emit-upload-commands |
483 |
echo ===================================== |
echo ===================================== |
491 |
$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz |
$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz |
492 |
xdelta delta -9 $^ $@ || : |
xdelta delta -9 $^ $@ || : |
493 |
|
|
494 |
alpha: $(local-check) |
.PHONY: alpha beta major |
495 |
|
alpha beta major: $(local-check) |
496 |
$(MAKE) cvs-dist |
$(MAKE) cvs-dist |
497 |
$(MAKE) $(xd-delta) |
$(MAKE) $(xd-delta) |
498 |
$(MAKE) -s announcement > /tmp/announce-$(my_distdir) |
$(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir) |
499 |
ln $(rel-files) $(release_archive_dir) |
ln $(rel-files) $(release_archive_dir) |
500 |
chmod a-w $(rel-files) |
chmod a-w $(rel-files) |
501 |
echo $(VERSION) > $(prev_version_file) |
echo $(VERSION) > $(prev_version_file) |