From 6cc9a360808478ec724c22f130504ce4c824a4d5 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 14 Aug 2016 08:34:00 -0700 Subject: [PATCH] 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 address@hidden, and make read-only to mark as generated, and then, only if all is well, rename atomically to address@hidden 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. --- Makefile.am | 2 +- doc/local.mk | 42 ++++++++++++++++++++++++------------------ lib/local.mk | 5 +++++ 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/Makefile.am b/Makefile.am index d6459a0..8fd5656 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/doc/local.mk b/doc/local.mk index 6ef08f3..ba689cc 100644 --- a/doc/local.mk +++ b/doc/local.mk @@ -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 "@address@hidden 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 - -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) - -dist-hook-man-page: - touch $(distdir)/doc/sed.1 + echo stamp > $(srcdir)/doc/s-texi + +doc/sed.1: sed/sed .version $(srcdir)/doc/sed.x + $(AM_V_GEN)$(MKDIR_P) doc + $(AM_V_at)rm -rf address@hidden + $(AM_V_at)$(HELP2MAN) \ + --name 'stream editor for filtering and transforming text' \ + -p sed --include $(srcdir)/doc/sed.x \ + -o address@hidden $(SEDBIN) \ + && chmod a-w address@hidden \ + && mv address@hidden $@ + +# 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) diff --git a/lib/local.mk b/lib/local.mk index 9166e63..102d309 100644 --- a/lib/local.mk +++ b/lib/local.mk @@ -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 -- 2.7.4