build: fix sed.1 dependency; work with latest automake

* doc/local.mk (doc/sed.1): Depend not on sed.c, but on the binary
that help2man must run.  Also depend on .version, to be sure we
pick up a version change.  Also, be careful not to write directly
to $@: instead write to $@-t, and make read-only to mark as generated,
and then, only if all is well, rename atomically to $@.
Also, prefix commands with $(AM_V_GEN) and $(AM_V_at) and ensure
that doc/ exists via $(MKDIR_P).
(distclean-local): New target. Use this instead of ...
(dist-hook-man-page): ... this. Remove rule.
(SEDBIN): Remove unnecessary $(top_builddir)/ prefix.
(doc/sed.texi, doc/s-texi): Remove some uses of $(top_builddir).
Replace others with $(srcdir).
* Makefile (dist-hook): remove dependency on dist-hook-man-page.
* lib/local.mk (MOSTLYCLEANFILES): Arrange for lib/.deps/*.Po
to be removed as part of "make distclean", so that make distcheck
no longer fails when using latest automake.
This commit is contained in:
Jim Meyering 2016-08-14 08:34:00 -07:00
parent a2fccfc85a
commit 5b44cd088a
3 changed files with 28 additions and 17 deletions

View File

@ -50,7 +50,7 @@ BUILT_SOURCES += .version
# Arrange so that .tarball-version appears only in the distribution
# tarball, and never in a checked-out repository.
dist-hook: gen-ChangeLog dist-hook-man-page
dist-hook: gen-ChangeLog
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
gen_start_date = 2014-09-06

View File

@ -19,7 +19,7 @@ dist_man_MANS = doc/sed.1
dist_noinst_DATA = doc/config.texi doc/sed.x doc/sed-in.texi doc/s-texi
dist_noinst_SCRIPTS = doc/groupify.sed
HELP2MAN = $(top_srcdir)/build-aux/help2man
SEDBIN = $(top_builddir)/sed/sed
SEDBIN = sed/sed
AM_MAKEINFOHTMLFLAGS = --no-split
@ -27,22 +27,28 @@ AM_MAKEINFOHTMLFLAGS = --no-split
# scripts we group comments with lines following them;
# since mantaining the "@group...@end group" manually
# is a burden, we do this automatically
$(top_srcdir)/doc/sed.texi: $(top_srcdir)/doc/s-texi
$(top_srcdir)/doc/s-texi: doc/sed-in.texi $(top_srcdir)/doc/groupify.sed
sed -nf $(top_srcdir)/doc/groupify.sed \
< $(top_srcdir)/doc/sed-in.texi > $(top_srcdir)/doc/sed-tmp.texi
if cmp $(top_srcdir)/doc/sed.texi $(top_srcdir)/doc/sed-tmp.texi; then \
rm -f $(top_srcdir)/doc/sed-tmp.texi; \
doc/sed.texi: $(srcdir)/doc/s-texi
doc/s-texi: doc/sed-in.texi $(srcdir)/doc/groupify.sed
sed -nf $(srcdir)/doc/groupify.sed \
< $(srcdir)/doc/sed-in.texi > $(srcdir)/doc/sed-tmp.texi
if cmp $(srcdir)/doc/sed.texi $(srcdir)/doc/sed-tmp.texi; then \
rm -f $(srcdir)/doc/sed-tmp.texi; \
else \
mv -f $(top_srcdir)/doc/sed-tmp.texi $(top_srcdir)/doc/sed.texi; \
mv -f $(srcdir)/doc/sed-tmp.texi $(srcdir)/doc/sed.texi; \
fi
echo stamp > $(top_srcdir)/doc/s-texi
echo stamp > $(srcdir)/doc/s-texi
doc/sed.1: $(top_srcdir)/sed/sed.c $(top_srcdir)/configure.ac \
$(top_srcdir)/doc/sed.x
$(HELP2MAN) --name "stream editor for filtering and transforming text" \
-p sed --include $(top_srcdir)/doc/sed.x \
-o $(top_srcdir)/doc/sed.1 $(SEDBIN)
doc/sed.1: sed/sed .version $(srcdir)/doc/sed.x
$(AM_V_GEN)$(MKDIR_P) doc
$(AM_V_at)rm -rf $@-t
$(AM_V_at)$(HELP2MAN) \
--name 'stream editor for filtering and transforming text' \
-p sed --include $(srcdir)/doc/sed.x \
-o $@-t $(SEDBIN) \
&& chmod a-w $@-t \
&& mv $@-t $@
dist-hook-man-page:
touch $(distdir)/doc/sed.1
# Remove the generated sed.1 file, but only for a non-srcdir build.
# Without this, 'make distcheck's final comparison would fail.
distclean-local:
test x$(srcdir) = x$(builddir) || rm -f $(dist_man_MANS)

View File

@ -22,3 +22,8 @@ lib_libsed_a_CFLAGS = $(AM_CFLAGS) $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS)
lib_libsed_a_LIBADD += $(LIBOBJS) $(ALLOCA)
lib_libsed_a_DEPENDENCIES += $(LIBOBJS) $(ALLOCA)
# This is a kludge to remove lib/.deps/{getfilecon,obstack}.Po,
# which are left behind by bleeding edge automake.
# Without this, 'make distcheck's final comparison would fail.
MOSTLYCLEANFILES += lib/.deps/*.Po