coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 11/22] build: simplify and make more portable to non-GNU make


From: Stefano Lattarini
Subject: [PATCH 11/22] build: simplify and make more portable to non-GNU make
Date: Sat, 1 Sep 2012 01:46:48 +0200

The AC_SUBST'd variable '$(NO_INSTALL_PROGS_DEFAULT)' is only used in
makefile expressions listing the manual pages that are not built by
default (but might need to be when a distribution tarball is created).
And such expressions exploited some features of make variable expansion
-- namely, $(VAR:%=dir/%.x) -- that, while seemingly quite portable in
practice, is not POSIX-conforming, and could break on lesser vendor
make implementations.  So kill two birds with one stone, by getting
rid of the $(NO_INSTALL_PROGS_DEFAULT) intermediate variable and
improving makefile portability in the process.

While at it, we also clean up some other minor naming inconsistency
and useless indirection, and fix some dependency issue.

* configure.ac (NO_INSTALL_PROGS_DEFAULT): Don't define nor AC_SUBST
anymore; instead ...
(EXTRA_MANS): ... define and AC_SUBST these.
* man/local.mk (extra_man_1): Rename ...
(EXTRA_MANS): ... like this, explicitly making clear it's AC_SUBST'd.
(extra_man_x): It's used only once, no need to define it; just inline
its only expansion where needed.
(EXTRA_DIST): Adjust.
(ALL_MANS): New, union of $(EXTRA_MANS) and $(dist_man1_MANS).
* cfg.mk (check-x-vs-1, sc_option_desc_uppercase): Rely on $(ALL_MANS)
rather than $(NO_INSTALL_PROGS_DEFAULT) and $(dist_man1_MANS).
---
 cfg.mk       |  7 ++-----
 configure.ac |  8 +++++---
 man/local.mk | 12 +++++-------
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 780e6a8..2323fa3 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -198,11 +198,9 @@ sc_long_lines:
 # One could grep source directly as follows:
 # grep -E " {2,6}-.*[^.]  [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$')
 # but that would miss descriptions not on the same line as the -option.
-sc_option_desc_uppercase:
+sc_option_desc_uppercase: $(ALL_MANS)
        @grep '^\\fB\\-' -A1 man/*.1 | LC_ALL=C grep '\.1.[A-Z][a-z]'   \
          && { echo 1>&2 '$@: found initial capitals in --help'; exit 1; } || :
-sc_option_desc_uppercase: $(dist_man1_MANS) \
-                          $(patsubst %,man/%.1,$(NO_INSTALL_PROGS_DEFAULT))
 
 # Ensure all man/*.[1x] files are present.
 sc_man_file_correlation: check-x-vs-1 check-programs-vs-x
@@ -217,8 +215,7 @@ check-x-vs-1:
        t=$@-t;                                                         \
        (cd $(srcdir)/man && ls -1 *.x)                                 \
          | sed 's/\.x$$//' | $(ASSORT) > $$t;                          \
-       (echo $(patsubst man/%,%,$(dist_man1_MANS))                     \
-             $(NO_INSTALL_PROGS_DEFAULT)                               \
+       (echo $(patsubst man/%,%,$(ALL_MANS))                           \
          | tr -s ' ' '\n' | sed 's/\.1$$//')                           \
          | $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; };           \
        rm $$t
diff --git a/configure.ac b/configure.ac
index 7c0b19c..5c3592b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -434,7 +434,9 @@ MAN=`
     echo "man/$p.1"
   done`
 
-NO_INSTALL_PROGS_DEFAULT=$no_install_progs_default
+# Not installed by "make install", but must be built when creating
+# a distribution tarball.
+EXTRA_MANS=`for p in $no_install_progs_default; do echo man/$p.1; done`
 
 # The programs built and installed by "make && make install".
 # Since this is AC_SUBST'd, Automake won't be able to perform rewrite
@@ -447,13 +449,13 @@ pkglibexec_PROGRAMS=`
 
 # Normalize whitespace.
 MAN=`echo $MAN`
-NO_INSTALL_PROGS_DEFAULT=`echo $NO_INSTALL_PROGS_DEFAULT`
+EXTRA_MANS=`echo $EXTRA_MANS`
 bin_PROGRAMS=`echo $bin_PROGRAMS`
 pkglibexec_PROGS=`echo $pkglibexec_PROGRAMS`
 
-AC_SUBST([NO_INSTALL_PROGS_DEFAULT])
 AC_SUBST([bin_PROGRAMS])        AM_SUBST_NOTMAKE([bin_PROGRAMS])
 AC_SUBST([pkglibexec_PROGRAMS]) AM_SUBST_NOTMAKE([pkglibexec_PROGRAMS])
+AC_SUBST([EXTRA_MANS])
 
 AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
 
diff --git a/man/local.mk b/man/local.mk
index 80519af..f487442 100644
--- a/man/local.mk
+++ b/man/local.mk
@@ -23,20 +23,18 @@ man_aux = $(dist_man1_MANS:.1=.x)
 EXTRA_DIST += $(man_aux) man/help2man
 MAINTAINERCLEANFILES += $(dist_man1_MANS)
 
-# The "$(VAR:%=dir/%.x)" idiom is not portable according to POSIX, but in
-# practice it works with several make implementation (GNU, BSD, CCS make
-# from Solaris 10, Sun distributed make).
-extra_man_x = $(NO_INSTALL_PROGS_DEFAULT:%=man/%.x)
-extra_man_1 = $(NO_INSTALL_PROGS_DEFAULT:%=man/%.1)
+EXTRA_MANS = @EXTRA_MANS@
 
-EXTRA_DIST += $(extra_man_1) $(extra_man_x)
+EXTRA_DIST += $(EXTRA_MANS) $(EXTRA_MANS:.1=.x)
+
+ALL_MANS = $(dist_man1_MANS) $(EXTRA_MANS)
 
 # This is required because we have subtle inter-directory dependencies:
 # in order to generate all man pages, even those for which we don't
 # install a binary, require that all programs be built at distribution
 # time.  We can't use 'dist-hook' for this, since it would run too late:
 # the manpages must be generated before the distdir is created and filled.
-$(extra_man_1): $(all_programs)
+$(EXTRA_MANS): $(all_programs)
 
 # Depend on this to get version number changes.
 mandep = .version
-- 
1.7.12




reply via email to

[Prev in Thread] Current Thread [Next in Thread]