coreutils
[Top][All Lists]
Advanced

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

[PATCH 17/22] build: don't use recursive make to build the 'man' subdire


From: Stefano Lattarini
Subject: [PATCH 17/22] build: don't use recursive make to build the 'man' subdirectory
Date: Wed, 29 Aug 2012 23:54:54 +0200

* Makefile.am: Include 'man/local.mk'.
(SUBDIRS): Remove 'man'.
* configure.ac ($MAN): Adjust to have a leading 'man/' component.
(AC_CONFIG_FILES): Remove 'man/Makefile'.
* man/Makefile.am: Rename ...
* man/local.mk: ... like this.  With further adjustments: each 'foo.1'
target renamed like 'man/foo.1', each '../src/foo.c' dependency as
'src/foo.c', and each '$(srcdir)' usage as '$(srcdir)/man'.  Also ...
(mandep): Adjust, removing the leading '../' component.
Several whitespace adjustments wile at it.
(ASSORT): Remove, it's already defined in the top-level Makefile.am.
* cfg.mk (sc_option_desc_uppercase, sc_man_file_correlation): Remove
the associated recipes, they are now directly available from the
included 'man/local.mk'.  Actually, the other changes in this commit
have made these recipes instable and not completely correct, bu that
will be fixed in later changes.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 Makefile.am                   |   3 +-
 cfg.mk                        |   2 -
 configure.ac                  |   3 +-
 man/{Makefile.am => local.mk} | 243 +++++++++++++++++++++---------------------
 4 files changed, 123 insertions(+), 128 deletions(-)
 rename man/{Makefile.am => local.mk} (43%)

diff --git a/Makefile.am b/Makefile.am
index f80c4a6..d14bf88 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,7 +17,7 @@
 
 ALL_RECURSIVE_TARGETS =
 
-SUBDIRS = lib src man po tests gnulib-tests
+SUBDIRS = lib src po tests gnulib-tests
 
 changelog_etc =                                \
   ChangeLog-2005                       \
@@ -175,3 +175,4 @@ all_programs:
        @cd ./src && $(MAKE) -s $@
 
 include $(top_srcdir)/doc/local.mk
+include $(top_srcdir)/man/local.mk
diff --git a/cfg.mk b/cfg.mk
index e6e0828..5f7193e 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -172,12 +172,10 @@ sc_long_lines:
 # but that would miss descriptions not on the same line as the -option.
 ALL_RECURSIVE_TARGETS += sc_option_desc_uppercase
 sc_option_desc_uppercase: all_programs
-       @$(MAKE) -s -C man $@
 
 # Ensure all man/*.[1x] files are present
 ALL_RECURSIVE_TARGETS += sc_man_file_correlation
 sc_man_file_correlation: all_programs
-       @$(MAKE) -s -C man $@
 
 # Ensure that the end of each release's section is marked by two empty lines.
 sc_NEWS_two_empty_lines:
diff --git a/configure.ac b/configure.ac
index bc7520d..ce8ebc9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -465,7 +465,7 @@ MAN=`
     dnl Use the autoconf-provided quadrigraph to represent "[",
     dnl otherwise we will incur in dreadful quoting issues.
     test x$p = x'@<:@' && continue
-    echo "$p.1"
+    echo "man/$p.1"
   done`
 # Normalize whitespace.
 MAN=`echo $MAN`
@@ -496,7 +496,6 @@ gt_LOCALE_FR
 AC_CONFIG_FILES(
   Makefile
   lib/Makefile
-  man/Makefile
   po/Makefile.in
   src/Makefile
   tests/Makefile
diff --git a/man/Makefile.am b/man/local.mk
similarity index 43%
rename from man/Makefile.am
rename to man/local.mk
index f7db996..7ce4bff 100644
--- a/man/Makefile.am
+++ b/man/local.mk
@@ -1,4 +1,5 @@
 # Make coreutils man pages.                            -*-Makefile-*-
+# This is included by the top-level Makefile.am.
 
 # Copyright (C) 2002-2012 Free Software Foundation, Inc.
 
@@ -19,130 +20,130 @@ dist_man1_MANS = $(MAN)
 
 man_aux = $(dist_man1_MANS:.1=.x)
 
-EXTRA_DIST = $(man_aux) help2man
-MAINTAINERCLEANFILES = $(dist_man1_MANS)
+EXTRA_DIST += $(man_aux) man/help2man
+MAINTAINERCLEANFILES += $(dist_man1_MANS)
 
-# The "$(VAR:%=%.x)" idiom is not portable according to POSIX, but in
+# 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).  In addition, since only
 # maintainers are expected to build release tarballs (and they should
 # use GNU make when doing so), it's not big deal if this won't work with
 # some dumber make implementation.
 EXTRA_DIST += \
-  $(NO_INSTALL_PROGS_DEFAULT:%=%.x) \
-  $(NO_INSTALL_PROGS_DEFAULT:%=%.1)
+  $(NO_INSTALL_PROGS_DEFAULT:%=dir/%.x) \
+  $(NO_INSTALL_PROGS_DEFAULT:%=dir/%.1)
 
-# Depend on ../.version to get version number changes.
-mandep = ../.version
+# Depend on this to get version number changes.
+mandep = .version
 
 # Note that arch depends on uname.c
-arch.1:                $(mandep)       ../src/uname.c
-
-base64.1:      $(mandep)       ../src/base64.c
-basename.1:    $(mandep)       ../src/basename.c
-cat.1:         $(mandep)       ../src/cat.c
-chcon.1:       $(mandep)       ../src/chcon.c
-chgrp.1:       $(mandep)       ../src/chgrp.c
-chmod.1:       $(mandep)       ../src/chmod.c
-chown.1:       $(mandep)       ../src/chown.c
-chroot.1:      $(mandep)       ../src/chroot.c
-cksum.1:       $(mandep)       ../src/cksum.c
-comm.1:                $(mandep)       ../src/comm.c
-cp.1:          $(mandep)       ../src/cp.c
-csplit.1:      $(mandep)       ../src/csplit.c
-cut.1:         $(mandep)       ../src/cut.c
-date.1:                $(mandep)       ../src/date.c
-dd.1:          $(mandep)       ../src/dd.c
-df.1:          $(mandep)       ../src/df.c
+man/arch.1:      $(mandep)  src/uname.c
+
+man/base64.1:    $(mandep)  src/base64.c
+man/basename.1:  $(mandep)  src/basename.c
+man/cat.1:       $(mandep)  src/cat.c
+man/chcon.1:     $(mandep)  src/chcon.c
+man/chgrp.1:     $(mandep)  src/chgrp.c
+man/chmod.1:     $(mandep)  src/chmod.c
+man/chown.1:     $(mandep)  src/chown.c
+man/chroot.1:    $(mandep)  src/chroot.c
+man/cksum.1:     $(mandep)  src/cksum.c
+man/comm.1:      $(mandep)  src/comm.c
+man/cp.1:        $(mandep)  src/cp.c
+man/csplit.1:    $(mandep)  src/csplit.c
+man/cut.1:       $(mandep)  src/cut.c
+man/date.1:      $(mandep)  src/date.c
+man/dd.1:        $(mandep)  src/dd.c
+man/df.1:        $(mandep)  src/df.c
 
 # Note that dir depends on ls.c, since that's where its --help text is.
-dir.1:         $(mandep)       ../src/ls.c
-
-dircolors.1:   $(mandep)       ../src/dircolors.c
-dirname.1:     $(mandep)       ../src/dirname.c
-du.1:          $(mandep)       ../src/du.c
-echo.1:                $(mandep)       ../src/echo.c
-env.1:         $(mandep)       ../src/env.c
-expand.1:      $(mandep)       ../src/expand.c
-expr.1:                $(mandep)       ../src/expr.c
-factor.1:      $(mandep)       ../src/factor.c
-false.1:       $(mandep)       ../src/false.c
-fmt.1:         $(mandep)       ../src/fmt.c
-fold.1:                $(mandep)       ../src/fold.c
-groups.1:      $(mandep)       ../src/groups.c
-head.1:                $(mandep)       ../src/head.c
-hostid.1:      $(mandep)       ../src/hostid.c
-hostname.1:    $(mandep)       ../src/hostname.c
-id.1:          $(mandep)       ../src/id.c
-install.1:     $(mandep)       ../src/install.c
-join.1:                $(mandep)       ../src/join.c
-kill.1:                $(mandep)       ../src/kill.c
-link.1:                $(mandep)       ../src/link.c
-ln.1:          $(mandep)       ../src/ln.c
-logname.1:     $(mandep)       ../src/logname.c
-ls.1:          $(mandep)       ../src/ls.c
-md5sum.1:      $(mandep)       ../src/md5sum.c
-mkdir.1:       $(mandep)       ../src/mkdir.c
-mkfifo.1:      $(mandep)       ../src/mkfifo.c
-mknod.1:       $(mandep)       ../src/mknod.c
-mktemp.1:      $(mandep)       ../src/mktemp.c
-mv.1:          $(mandep)       ../src/mv.c
-nice.1:                $(mandep)       ../src/nice.c
-nl.1:          $(mandep)       ../src/nl.c
-nohup.1:       $(mandep)       ../src/nohup.c
-nproc.1:       $(mandep)       ../src/nproc.c
-od.1:          $(mandep)       ../src/od.c
-paste.1:       $(mandep)       ../src/paste.c
-pathchk.1:     $(mandep)       ../src/pathchk.c
-pinky.1:       $(mandep)       ../src/pinky.c
-pr.1:          $(mandep)       ../src/pr.c
-printenv.1:    $(mandep)       ../src/printenv.c
-printf.1:      $(mandep)       ../src/printf.c
-ptx.1:         $(mandep)       ../src/ptx.c
-pwd.1:         $(mandep)       ../src/pwd.c
-readlink.1:    $(mandep)       ../src/readlink.c
-realpath.1:    $(mandep)       ../src/realpath.c
-rm.1:          $(mandep)       ../src/rm.c
-rmdir.1:       $(mandep)       ../src/rmdir.c
-runcon.1:      $(mandep)       ../src/runcon.c
-seq.1:         $(mandep)       ../src/seq.c
-sha1sum.1:     $(mandep)       ../src/md5sum.c
-sha224sum.1:   $(mandep)       ../src/md5sum.c
-sha256sum.1:   $(mandep)       ../src/md5sum.c
-sha384sum.1:   $(mandep)       ../src/md5sum.c
-sha512sum.1:   $(mandep)       ../src/md5sum.c
-shred.1:       $(mandep)       ../src/shred.c
-shuf.1:                $(mandep)       ../src/shuf.c
-sleep.1:       $(mandep)       ../src/sleep.c
-sort.1:                $(mandep)       ../src/sort.c
-split.1:       $(mandep)       ../src/split.c
-stat.1:                $(mandep)       ../src/stat.c
-stdbuf.1:      $(mandep)       ../src/stdbuf.c
-stty.1:                $(mandep)       ../src/stty.c
-sum.1:         $(mandep)       ../src/sum.c
-sync.1:                $(mandep)       ../src/sync.c
-tac.1:         $(mandep)       ../src/tac.c
-tail.1:                $(mandep)       ../src/tail.c
-tee.1:         $(mandep)       ../src/tee.c
-test.1:                $(mandep)       ../src/test.c
-timeout.1:     $(mandep)       ../src/timeout.c
-touch.1:       $(mandep)       ../src/touch.c
-tr.1:          $(mandep)       ../src/tr.c
-true.1:                $(mandep)       ../src/true.c
-truncate.1:    $(mandep)       ../src/truncate.c
-tsort.1:       $(mandep)       ../src/tsort.c
-tty.1:         $(mandep)       ../src/tty.c
-uname.1:       $(mandep)       ../src/uname.c
-unexpand.1:    $(mandep)       ../src/unexpand.c
-uniq.1:                $(mandep)       ../src/uniq.c
-unlink.1:      $(mandep)       ../src/unlink.c
-uptime.1:      $(mandep)       ../src/uptime.c
-users.1:       $(mandep)       ../src/users.c
-vdir.1:                $(mandep)       ../src/ls.c
-wc.1:          $(mandep)       ../src/wc.c
-who.1:         $(mandep)       ../src/who.c
-whoami.1:      $(mandep)       ../src/whoami.c
-yes.1:         $(mandep)       ../src/yes.c
+man/dir.1:       $(mandep)  src/ls.c
+
+man/dircolors.1: $(mandep)  src/dircolors.c
+man/dirname.1:   $(mandep)  src/dirname.c
+man/du.1:        $(mandep)  src/du.c
+man/echo.1:      $(mandep)  src/echo.c
+man/env.1:       $(mandep)  src/env.c
+man/expand.1:    $(mandep)  src/expand.c
+man/expr.1:      $(mandep)  src/expr.c
+man/factor.1:    $(mandep)  src/factor.c
+man/false.1:     $(mandep)  src/false.c
+man/fmt.1:       $(mandep)  src/fmt.c
+man/fold.1:      $(mandep)  src/fold.c
+man/groups.1:    $(mandep)  src/groups.c
+man/head.1:      $(mandep)  src/head.c
+man/hostid.1:    $(mandep)  src/hostid.c
+man/hostname.1:  $(mandep)  src/hostname.c
+man/id.1:        $(mandep)  src/id.c
+man/install.1:   $(mandep)  src/install.c
+man/join.1:      $(mandep)  src/join.c
+man/kill.1:      $(mandep)  src/kill.c
+man/link.1:      $(mandep)  src/link.c
+man/ln.1:        $(mandep)  src/ln.c
+man/logname.1:   $(mandep)  src/logname.c
+man/ls.1:        $(mandep)  src/ls.c
+man/md5sum.1:    $(mandep)  src/md5sum.c
+man/mkdir.1:     $(mandep)  src/mkdir.c
+man/mkfifo.1:    $(mandep)  src/mkfifo.c
+man/mknod.1:     $(mandep)  src/mknod.c
+man/mktemp.1:    $(mandep)  src/mktemp.c
+man/mv.1:        $(mandep)  src/mv.c
+man/nice.1:      $(mandep)  src/nice.c
+man/nl.1:        $(mandep)  src/nl.c
+man/nohup.1:     $(mandep)  src/nohup.c
+man/nproc.1:     $(mandep)  src/nproc.c
+man/od.1:        $(mandep)  src/od.c
+man/paste.1:     $(mandep)  src/paste.c
+man/pathchk.1:   $(mandep)  src/pathchk.c
+man/pinky.1:     $(mandep)  src/pinky.c
+man/pr.1:        $(mandep)  src/pr.c
+man/printenv.1:  $(mandep)  src/printenv.c
+man/printf.1:    $(mandep)  src/printf.c
+man/ptx.1:       $(mandep)  src/ptx.c
+man/pwd.1:       $(mandep)  src/pwd.c
+man/readlink.1:  $(mandep)  src/readlink.c
+man/realpath.1:  $(mandep)  src/realpath.c
+man/rm.1:        $(mandep)  src/rm.c
+man/rmdir.1:     $(mandep)  src/rmdir.c
+man/runcon.1:    $(mandep)  src/runcon.c
+man/seq.1:       $(mandep)  src/seq.c
+man/sha1sum.1:   $(mandep)  src/md5sum.c
+man/sha224sum.1: $(mandep)  src/md5sum.c
+man/sha256sum.1: $(mandep)  src/md5sum.c
+man/sha384sum.1: $(mandep)  src/md5sum.c
+man/sha512sum.1: $(mandep)  src/md5sum.c
+man/shred.1:     $(mandep)  src/shred.c
+man/shuf.1:      $(mandep)  src/shuf.c
+man/sleep.1:     $(mandep)  src/sleep.c
+man/sort.1:      $(mandep)  src/sort.c
+man/split.1:     $(mandep)  src/split.c
+man/stat.1:      $(mandep)  src/stat.c
+man/stdbuf.1:    $(mandep)  src/stdbuf.c
+man/stty.1:      $(mandep)  src/stty.c
+man/sum.1:       $(mandep)  src/sum.c
+man/sync.1:      $(mandep)  src/sync.c
+man/tac.1:       $(mandep)  src/tac.c
+man/tail.1:      $(mandep)  src/tail.c
+man/tee.1:       $(mandep)  src/tee.c
+man/test.1:      $(mandep)  src/test.c
+man/timeout.1:   $(mandep)  src/timeout.c
+man/touch.1:     $(mandep)  src/touch.c
+man/tr.1:        $(mandep)  src/tr.c
+man/true.1:      $(mandep)  src/true.c
+man/truncate.1:  $(mandep)  src/truncate.c
+man/tsort.1:     $(mandep)  src/tsort.c
+man/tty.1:       $(mandep)  src/tty.c
+man/uname.1:     $(mandep)  src/uname.c
+man/unexpand.1:  $(mandep)  src/unexpand.c
+man/uniq.1:      $(mandep)  src/uniq.c
+man/unlink.1:    $(mandep)  src/unlink.c
+man/uptime.1:    $(mandep)  src/uptime.c
+man/users.1:     $(mandep)  src/users.c
+man/vdir.1:      $(mandep)  src/ls.c
+man/wc.1:        $(mandep)  src/wc.c
+man/who.1:       $(mandep)  src/who.c
+man/whoami.1:    $(mandep)  src/whoami.c
+man/yes.1:       $(mandep)  src/yes.c
 
 # This is required so that changes to e.g., emit_bug_reporting_address
 # provoke regeneration of all $(MAN) files.
@@ -172,9 +173,9 @@ $(MAN): $(top_srcdir)/src/system.h
          && rm -rf $$t                                                 \
          && mkdir $$t                                                  \
          && (cd $$t && $(LN_S) $(abs_top_builddir)/src/$$prog $$name)  \
-         && $(PERL) -- $(srcdir)/help2man                              \
+         && $(PERL) -- $(srcdir)/man/help2man                          \
                     --source='$(PACKAGE_STRING)'                       \
-                    --include=$(srcdir)/$$name.x                       \
+                    --include=$(srcdir)/man/$$name.x                   \
                     --output=$$t/$$name.1 $$t/$$name                   \
          && sed 's|$*\.td/||g' $$t/$$name.1 > $@-t                     \
          && rm -rf $$t                                                 \
@@ -191,27 +192,23 @@ sc_option_desc_uppercase: $(dist_man1_MANS) 
$(NO_INSTALL_PROGS_DEFAULT:%=%.1)
 .PHONY: sc_man_file_correlation
 sc_man_file_correlation: check-x-vs-1 check-programs-vs-x
 
-# Sort in traditional ASCII order, regardless of the current locale;
-# otherwise we may get into trouble with distinct strings that the
-# current locale considers to be equal.
-ASSORT = LC_ALL=C sort
-
 # Ensure that for each .x file in this directory, there is a
 # corresponding .1 file in the definition of $(dist_man1_MANS) above.
 # But since that expansion usually lacks programs like arch and hostname,
 # add them here manually.
 .PHONY: check-x-vs-1
 check-x-vs-1:
-       @PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH;               \
+       @PATH=./src$(PATH_SEPARATOR)$$PATH; export PATH;                \
        t=$@-t;                                                         \
-       (cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\
+       (cd $(srcdir)/man && ls -1 *.x)                                 \
+         | sed 's/\.x$$//' | $(ASSORT) > $$t;                          \
        (echo $(dist_man1_MANS) $(NO_INSTALL_PROGS_DEFAULT)             \
          | tr -s ' ' '\n' | sed 's/\.1$$//')                           \
          | $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; };           \
        rm $$t
 
 all_programs =                                                         \
-      (cd ../src && MAKEFLAGS= $(MAKE) -s all_programs.list)           \
+      (cd ./src && MAKEFLAGS= $(MAKE) -s all_programs.list)            \
        | grep -v '\['
 
 .PHONY: check-programs-vs-x
@@ -220,7 +217,7 @@ check-programs-vs-x:
        for p in dummy `$(all_programs)`; do            \
          test $$p = dummy && continue;                 \
          test $$p = ginstall && p=install || : ;       \
-         test -f $(srcdir)/$$p.x                       \
+         test -f $(srcdir)/man/$$p.x                   \
            || { echo missing $$p.x 1>&2; status=1; };  \
        done;                                           \
        exit $$status
-- 
1.7.12




reply via email to

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