platform/upstream/coreutils.git
11 years agomaint: gen-lists-of-programs.sh: fix typo from previous comment edit
Bernhard Voelker [Tue, 11 Sep 2012 06:53:56 +0000 (08:53 +0200)]
maint: gen-lists-of-programs.sh: fix typo from previous comment edit

* build-aux/gen-lists-of-programs.sh: Fix comment typo.

11 years agomaint: add more control flags to mbsalign
Pádraig Brady [Tue, 4 Sep 2012 12:12:23 +0000 (13:12 +0100)]
maint: add more control flags to mbsalign

* gl/lib/mbsalign.h: Add MBA_UNIBYTE_ONLY (to allow
faster processing).  Also add MBA_NO_LEFT_PAD, MBA_NO_RIGHT_PAD
to give greater control of padding, useful with the first
or last fields on a line.
* gl/lib/mbsalign.c (mbsalign): Implement the new flags.
* gl/tests/test-mbsalign.c (main): Test combinations
of the new flags.

11 years agomaint: allow per-directory CFLAGS settings with non-recursive make
Jim Meyering [Sat, 8 Sep 2012 19:17:32 +0000 (21:17 +0200)]
maint: allow per-directory CFLAGS settings with non-recursive make

* src/local.mk (AM_CFLAGS): Don't use $(WARN_CFLAGS) here.
* cfg.mk (src_CFLAGS, lib_CFLAGS, gnulib-tests_CFLAGS): Define here
instead.
(AM_CFLAGS): Augment using the above.
* configure.ac: Note that the configure-time option,
--enable-gcc-warnings now functions only when using GNU make.
Well, currently it does still work in gnulib-tests, but that should
soon be fixed.
Improved-by: Stefano Lattarini
11 years agomaint: gen-lists-of-programs.sh: improve comments
Jim Meyering [Mon, 10 Sep 2012 09:00:35 +0000 (11:00 +0200)]
maint: gen-lists-of-programs.sh: improve comments

* build-aux/gen-lists-of-programs.sh: Improve comments.

11 years agobuild: do not require help2man at build-from-tarball time
Jim Meyering [Sun, 9 Sep 2012 17:27:25 +0000 (19:27 +0200)]
build: do not require help2man at build-from-tarball time

But do retain full dependencies when building from a git clone.
We do this by converting the full dependency (of the .1 file on
the binary we run with --help) into a dependency on the .c file.
* Makefile.am (do-not-require-help2man): New rule.
(dist-hook): depend on it.

11 years agobuild: fix a minor man-page generation dependency error
Jim Meyering [Sun, 9 Sep 2012 17:23:11 +0000 (19:23 +0200)]
build: fix a minor man-page generation dependency error

* man/local.mk (man/dir.1): Depend on src/dir, not src/ls.

11 years agomaint: move the last coreutils-specific files from lib/ to gl/
Jim Meyering [Sat, 8 Sep 2012 13:11:20 +0000 (15:11 +0200)]
maint: move the last coreutils-specific files from lib/ to gl/

Convert the few remaining coreutils-specific files in lib/ to
gnulib-style modules under gl/, removing their corresponding .m4
files, since the information recorded in those files is better
stored in module-description file in gl/modules/.
* bootstrap.conf (gnulib_modules): Add new modules:
fd-reopen, buffer-lcm, xfts, strnumcmp.
* gl/lib/buffer-lcm.c: Renamed from the file in lib/.
* gl/lib/buffer-lcm.h: Likewise.
* gl/lib/fd-reopen.c: Likewise.
* gl/lib/fd-reopen.h: Likewise.
* gl/lib/strintcmp.c: Likewise.
* gl/lib/strnumcmp-in.h: Likewise.
* gl/lib/strnumcmp.c: Likewise.
* gl/lib/strnumcmp.h: Likewise.
* gl/lib/xfts.c: Likewise.
* gl/lib/xfts.h: Likewise.
* gl/modules/buffer-lcm: New module-description file.
* gl/modules/fd-reopen: Likewise.
* gl/modules/strnumcmp: Likewise.
* gl/modules/xfts: Likewise.
* m4/fd-reopen.m4: Remove, no longer needed.
* m4/strnumcmp.m4: Likewise.
* m4/xfts.m4: Likewise.
* m4/prereq.m4: Do not AC_REQUIRE the m4 functions from
our just-removed m4/*.m4 files.

11 years agomaint: move gl/m4/root-dev-ino.m4 contents into its module definition
Jim Meyering [Sat, 8 Sep 2012 14:01:47 +0000 (16:01 +0200)]
maint: move gl/m4/root-dev-ino.m4 contents into its module definition

We can get the same effect using the modules file.
* gl/m4/root-dev-ino.m4: Remove file.
* gl/modules/root-dev-ino (Depends-on): Add lstat.
(Files): Remove m4/root-dev-ino.m4.
(Makefile.am) [lib_SOURCES]: Add root-dev-ino.c and root-dev-ino.h.
(configure.ac): Remove reference to gl_ROOT_DEV_INO.

11 years agomaint: adjust ChangeLog to correct Author
Jim Meyering [Fri, 7 Sep 2012 10:08:42 +0000 (12:08 +0200)]
maint: adjust ChangeLog to correct Author

* build-aux/git-log-fix: Add an entry to correct the Author:
of v8.19-111-g51a4b04.  It should be Ondrej Oprala, not me.

11 years agofactor: NEWS and tests
Jim Meyering [Tue, 4 Sep 2012 16:26:25 +0000 (18:26 +0200)]
factor: NEWS and tests

* NEWS (Bug fixes): Mention it.
* tests/misc/factor.pl: Add five of Torbjörn's tests.

11 years agofactor: don't ever declare composites to be prime
Torbjörn Granlund [Tue, 4 Sep 2012 16:38:29 +0000 (18:38 +0200)]
factor: don't ever declare composites to be prime

The multiple-precision factoring code (with HAVE_GMP) was copied from
a now-obsolete version of GMP that did not pass proper arguments to
the mpz_probab_prime_p function.  It makes that code perform no more
than 3 Miller-Rabin tests only, which is not sufficient.

A Miller-Rabin test will detect composites with at least a probability
of 3/4.  For a uniform random composite, the probability will actually
be much higher.

Or put another way, of the N-3 possible Miller-Rabin tests for checking
the composite N, there is no number N for which more than (N-3)/4 of the
tests will fail to detect the number as a composite.  For most numbers N
the number of "false witnesses" will be much, much lower.

Problem numbers are of the form N=pq, p,q prime and (p-1)/(q-1) = s,
where s is a small integer.  (There are other problem forms too,
involving 3 or more prime factors.)  When s = 2, we get the 3/4 factor.

It is easy to find numbers of that form that cause coreutils' factor to
fail:

  465658903
  2242724851
  6635692801
  17709149503
  17754345703
  20889169003
  42743470771
  54890944111
  72047131003
  85862644003
  98275842811
  114654168091
  117225546301
  ...

There are 9008992 composites of the form with s=2 below 2^64.  With 3
Miller-Rabin tests, one would expect about 9008992/64 = 140766 to be
invalidly recognized as primes in that range.

* src/factor.c (MR_REPS): Define to 25.
(factor_using_pollard_rho): Use MR_REPS, not 3.
(print_factors_multi): Likewise.
* THANKS.in: Remove my name, now that it will be automatically
included in the generated THANKS file.

11 years agotests: improve checks for setuidgid-using root-only tests
Jim Meyering [Thu, 6 Sep 2012 10:00:16 +0000 (12:00 +0200)]
tests: improve checks for setuidgid-using root-only tests

* init.cfg (setuidgid_has_perm_): New function.
(require_root_): Use it.
Improved-by: Bernhard Voelker
* NEWS (Build-related): Mention the improvement.

11 years agobuild: default to --enable-gcc-warnings for git tree
Eric Blake [Thu, 6 Sep 2012 14:20:17 +0000 (08:20 -0600)]
build: default to --enable-gcc-warnings for git tree

Anyone developing on coreutils can be assumed to have a new enough
environment, such that enabling gcc warnings by default will be
useful.  Tarballs still default to no warnings, and the defaults
can still be overridden with --disable-gcc-warnings.

* configure.ac (gl_gcc_warnings): Set default based on environment.
Suggested by Bernhard Voelker.

11 years agonproc: disallow non option command line parameters
Pádraig Brady [Thu, 6 Sep 2012 09:34:00 +0000 (10:34 +0100)]
nproc: disallow non option command line parameters

* src/nproc.c (main): Error if any non option parameters.
* NEWS: Mention the change in behavior.

11 years agotail,stat: add support for VZFS
Jim Meyering [Wed, 5 Sep 2012 20:33:44 +0000 (22:33 +0200)]
tail,stat: add support for VZFS

* src/stat.c (human_fstype): Add a case: vzfs, 0x565A4653 (local).
Reported by Jens Rosenboom in http://bugs.gnu.org/12356
* NEWS (Improvement): Mention it.

11 years agorm: be more careful when using a replacement errno value
Jim Meyering [Wed, 5 Sep 2012 14:48:50 +0000 (16:48 +0200)]
rm: be more careful when using a replacement errno value

* src/remove.c (excise): Tighten the test for when we defer to an
old errno value: instead of relying solely on an FTS_DNR (unreadable
directory) failure, also test current and replacement errno values.
This change would also have solved the problem addressed by commit
v8.19-106-g57dd067.  For more info, see http://bugs.gnu.org/12339#113

11 years agorm: avoid bogus diagnostic for a slash-decorated symlink-to-dir
Jim Meyering [Tue, 4 Sep 2012 12:40:11 +0000 (14:40 +0200)]
rm: avoid bogus diagnostic for a slash-decorated symlink-to-dir

These commands would evoke an invalid diagnostic:
    $ mkdir d && ln -s d s && env rm -r s/
    rm: cannot remove 's': Too many levels of symbolic links
remove.c was stripping trailing slashes from "s/" before passing
the name to "rm".  But a trailing slash may change the semantics,
and thus should not be stripped.
* src/remove.c (rm_fts): Do not strip trailing slashes.
* tests/rm/v-slash.sh: Adapt to new expected output.
* gnulib: Update to latest, for an improved fts.c that merely
normalizes trailing slashes.
Reported by Paul Eggert in discussion of http://bugs.gnu.org/12339

11 years agotests: depend on the programs we're testing
Jim Meyering [Tue, 4 Sep 2012 10:12:19 +0000 (12:12 +0200)]
tests: depend on the programs we're testing

* tests/local.mk ($(TEST_LOGS)): Depend on $(PROGRAMS), so that
tests are rerun when any program is rebuilt.  Technically, we could
specify precisely which few programs are dependents of each test,
but that can come later, if deemed worth the trouble and maintenance
burden.  Also, there is the issue of the primary program(s) being
tested (i.e., those itemized via print_ver_) versus those that are
tested incidentally: for example, nearly every test exercises "rm"
when its clean-up code removes files.

11 years agomaint: fix a spurious syntax-check failure
Stefano Lattarini [Sun, 2 Sep 2012 19:55:19 +0000 (21:55 +0200)]
maint: fix a spurious syntax-check failure

* cfg.mk (exclude_file_name_regexp--sc_file_system): Exempt
'init.cfg', not 'tests/init.cfg'.

11 years agotests: more resilient about tainted absolute srcdir path
Stefano Lattarini [Sun, 2 Sep 2012 19:55:18 +0000 (21:55 +0200)]
tests: more resilient about tainted absolute srcdir path

* tests/init.cfg (stty_reversible_init_): Quote '$abs_top_srcdir'
properly.
(fiemap_capable_): Quote '$abs_srcdir' properly.
(require_dirent_d_type_): Likewise.

11 years agomaint: fix syntax checks 'sc_root_tests'
Stefano Lattarini [Sun, 2 Sep 2012 19:55:17 +0000 (21:55 +0200)]
maint: fix syntax checks 'sc_root_tests'

* cfg.mk: Don't work by trying to parse the (now gone) file
'tests/Makefile.am'; rather, use the contents of the make variable,
$(all_root_tests), introduced few commits ago.
Fix a few unrelated cosmetic issues while at it.

11 years agomaint: avoid a spurious syntax-check error
Stefano Lattarini [Sun, 2 Sep 2012 19:55:16 +0000 (21:55 +0200)]
maint: avoid a spurious syntax-check error

* cfg.mk (exclude_file_name_regexp--sc_prohibit_test_backticks): Exempt
'tests/local.mk' rather than 'tests/Makefile.am'.

11 years agomaint: vc_exe_in_TESTS should actually be a syntax check
Stefano Lattarini [Sun, 2 Sep 2012 19:55:15 +0000 (21:55 +0200)]
maint: vc_exe_in_TESTS should actually be a syntax check

Because it requires the presence of the '.git' directory, that is,
can be run only for maintainers working from checked-out sources.

* tests/local.mk (vc_exe_in_TESTS): Rename and move ...
* cfg.mk (sc_tests_list_consistency): ... here, with minor adjustments.

11 years agobuild: remove two now-useless convenience targets
Stefano Lattarini [Sun, 2 Sep 2012 19:55:14 +0000 (21:55 +0200)]
build: remove two now-useless convenience targets

* src/local.mk (built_programs.list, all_programs.list): These.

11 years agotests: put test-suite.log back in 'tests/'
Stefano Lattarini [Sun, 2 Sep 2012 19:55:13 +0000 (21:55 +0200)]
tests: put test-suite.log back in 'tests/'

* tests/local.mk (TEST_SUITE_LOGS): Define to 'tests/test-suite.log'.

11 years agobuild: don't use recursive make for tests/ subdirectory
Stefano Lattarini [Sun, 2 Sep 2012 19:55:12 +0000 (21:55 +0200)]
build: don't use recursive make for tests/ subdirectory

* Makefile.am (SUBDIRS): Remove 'tests'.
(include): The '$(top_srcdir)/tests/local.mk' file.
(check-root): Remove this convenience target, it's no longer needed
now that the "real" check-root target once in 'tests/Makefile' will
land in the top-level makefile.
* configure.ac (AC_CONFIG_FILES): Remove 'tests/Makefile'.
* tests/Makefile.am: Rename ...
* tests/local.mk: ... like this, with a lot of adjustments.
* tests/init.cfg: Move ...
* init.cfg: ... here.  This is necessary, for a limitation of the
gnulib-provided 'tests/init.sh', which unconditionally look for
'init.cfg' in the $(srcdir) directory.
* tests/*/*.sh: Adjust: expect init.sh to be in '$srcdir/tests',
not in '$srcdir', and extend $PATH with './src', not with '../src'.
* tests/Coreutils.pm: Adjust similarly.
* tests/pr/pr-tests.pl ($pfx): Likewise.

11 years agomaint: list of names of built programs available in the Makefiles
Stefano Lattarini [Sun, 2 Sep 2012 19:55:11 +0000 (21:55 +0200)]
maint: list of names of built programs available in the Makefiles

This is just a preparatory refactoring in view of future changes.

* configure.ac (AC_SUBST): New 'built_programs'.
* tests/Makefile.am (AM_TESTS_ENVIRONMENT): Simply define the exported
variable 'built_programs' to the expansion of the '$(built_programs)'
AC_SUBST'd make variable.
(.built-programs): Remove this now-unneeded convenience target.
(CLEANFILES, check_DATA): Delete, no longer needed.

11 years agomaint: remove anachronistic syntax-check
Stefano Lattarini [Sun, 2 Sep 2012 19:55:10 +0000 (21:55 +0200)]
maint: remove anachronistic syntax-check

* cfg.mk (sc_no_exec_perl_coreutils): This.  Our new testsuite
layout (perl tests having '.pl' suffix, shell tests having '.sh'
suffix) makes it basically impossible to run into the issue this
check guarded against.

11 years agomaint: remove duplicated declaration of the 'sc_check-AUTHORS' target
Stefano Lattarini [Sun, 2 Sep 2012 19:55:09 +0000 (21:55 +0200)]
maint: remove duplicated declaration of the 'sc_check-AUTHORS' target

* cfg.mk: Here.

11 years agotests: remove the unused 'root-hint' target
Stefano Lattarini [Sun, 2 Sep 2012 19:55:08 +0000 (21:55 +0200)]
tests: remove the unused 'root-hint' target

* tests/Makefile.am (root-hint): Here.  The interested user can see
the reasons why some tests are skipped by looking at the messages
they display on the console; here's an excerpt:

    ...
    PASS: misc/id-groups.sh
    id-setgid.sh: skipped test: must be run as root
    SKIP: misc/id-setgid.sh
    PASS: misc/md5sum.pl
    ...
    PASS: df/total-verify.sh
    2g.sh: skipped test: very expensive: disabled by default
    SKIP: du/2g.sh
    ...

Clear enough, and more specific and precise that a generic "some tests
might need to be run as root" message.  And if that user is interested
in making those tests run anyway, he'll just take a look to the README
files to look for info.  So there's no reason to pollute the stdout
with another "hint" that is subsumed by those messages, and that might
go unnoticed anyway.

Moreover, and possibly more importantly, that hint wasn't being
displayed anyway, even before this change!  That's because the
'root-hint' target was listed as prerequisite for the 'check-recursive'
target, which however was not a dependency of the 'check' target in
'tests/Makefile.am', because that file contains no $(SUBDIRS)
definition.

11 years agotests: use suffix, not exec-bit, to tell which files are tests
Stefano Lattarini [Sun, 2 Sep 2012 19:55:07 +0000 (21:55 +0200)]
tests: use suffix, not exec-bit, to tell which files are tests

* tests/Makefile.am (vc_exe_in_TESTS): Adjust to look, in the 'tests/'
subdirectory, for files that have one of the extensions listed in
$(TEST_EXTENSIONS), rather than for executable files.

11 years agomaint: make vc_exe_in_TESTS also work in VPATH builds
Stefano Lattarini [Sun, 2 Sep 2012 19:55:06 +0000 (21:55 +0200)]
maint: make vc_exe_in_TESTS also work in VPATH builds

* tests/Makefile.am (vc_exe_in_TESTS): It is easy to adjust this
recipe to also work in VPATH setups, also thanks to modifications
done by previous changes.

11 years agomaint: remove useless dependency for vc_exe_in_TESTS
Stefano Lattarini [Sun, 2 Sep 2012 19:55:05 +0000 (21:55 +0200)]
maint: remove useless dependency for vc_exe_in_TESTS

* tests/Makefile.am (vc_exe_in_TESTS): No need to depend on Makefile:
this target is .PHONY, so it is always run anyway.

11 years agomaint: avoid parsing of Makefile.am from vc_exe_in_TESTS
Stefano Lattarini [Sun, 2 Sep 2012 19:55:04 +0000 (21:55 +0200)]
maint: avoid parsing of Makefile.am from vc_exe_in_TESTS

* tests/Makefile.am (TESTS): Rename ...
(all_tests): ... like this, so that we'll still be able to know the
complete list of our tests even if the user overrides TESTS from the
command line (which he's allowed to do by the test harness API).
(root_tests): Rename ...
(all_root_tests): ... like this, for similar reasons.
(TESTS, root_tests): Redefine their defaults to to $(all_tests) and
$(all_root_tests) respectively.
(vc_exe_in_TESTS): It can now safely use $(all_tests) to get the
complete list of test cases according to the Makefile, instead of
having to resort to "parsing" of Makefile.am.
(EXTRA_DIST): Use $(all_tests), not $(TESTS).
(v_, w_): Delete, no longer needed.

11 years agobuild: use 'check-local' to extend the 'check' target
Stefano Lattarini [Sun, 2 Sep 2012 19:55:03 +0000 (21:55 +0200)]
build: use 'check-local' to extend the 'check' target

* tests/Makefile.am (check-local): Here, by making this depend
on 'vc_exe_in_TESTS' ...
(check): ... rather than making this depend on them.  While the old
usage worked, it relied on an implementation detail rather than on
documented behavior.
* src/local.mk (check-local): Similarly, make this depend on
'check-README' and 'check-duplicate-no-install' ...
(check): ... rather than on this.

11 years agoscripts: autotools-install: allow user-specified make program
Stefano Lattarini [Fri, 31 Aug 2012 13:41:38 +0000 (15:41 +0200)]
scripts: autotools-install: allow user-specified make program

* scripts/autotools-install: Honor $MAKE.  This might be useful
on systems where the make implementation available in $PATH
by default is limited (Solaris) or broken (HP-UX).

11 years agoscripts: autotools-install: style and portability fixes
Stefano Lattarini [Fri, 31 Aug 2012 13:41:18 +0000 (15:41 +0200)]
scripts: autotools-install: style and portability fixes

* scripts/autotools-install: Here.

11 years agotouch: line up long option in --help text
Benno Schulenberg [Sat, 18 Aug 2012 10:18:37 +0000 (12:18 +0200)]
touch: line up long option in --help text

* src/touch.c (usage): Indent --time=... to line up with all of the
other long options.

11 years agomaint: disable sc_proper_name_utf8_requires_ICONV test
Jim Meyering [Sun, 2 Sep 2012 11:46:17 +0000 (13:46 +0200)]
maint: disable sc_proper_name_utf8_requires_ICONV test

It would still pass, but would print many diagnostics like this:
  Can't open src/Makefile.am: No such file or directory.
* cfg.mk (local-checks-to-skip): Temporarily disable a test.
This test will need to be adapted to work with a non-recursive
build set-up, in which there is no Makefile.am alongside each program.
Reported by Bernhard Voelker.

11 years agomaint: accommodate upcoming, expanded list of warnings from gnulib
Jim Meyering [Sun, 2 Sep 2012 11:42:39 +0000 (13:42 +0200)]
maint: accommodate upcoming, expanded list of warnings from gnulib

* configure.ac: Disable a new gcc warning, -Wsuggest-attribute=format,
since it triggers on copy.c (which I'm not inclined to adjust) and
factor.c's use of vfprintf which would appear to require a change
to stdio.h.

11 years agomaint: fix build_programs definition not to use "make -C src ..."
Stefano Lattarini [Sat, 1 Sep 2012 10:15:59 +0000 (12:15 +0200)]
maint: fix build_programs definition not to use "make -C src ..."

* dist-check.mk (built_programs): There's no need to issue recursive
make calls in 'src/' to define this (in fact, that works no longer
now that 'src/Makefile.am' is gone).  Simply define this to the sorted
contents of $(bin_PROGRAMS), with the 'src/' prefix and the $(EXEEXT)
suffix (if any) removed.  Reported by Jim Meyering.

11 years agobuild: restore handling of space-tainted build directory name
Jim Meyering [Sat, 1 Sep 2012 09:44:39 +0000 (11:44 +0200)]
build: restore handling of space-tainted build directory name

* man/local.mk: With commit v8.19-84-g08cf455, man page creation
would fail when using a build directory name containing e.g.,
spaces.

11 years agobuild: make each man/prog.1 depend on src/prog, not src/prog.c
Jim Meyering [Sat, 1 Sep 2012 08:00:26 +0000 (10:00 +0200)]
build: make each man/prog.1 depend on src/prog, not src/prog.c

* man/local.mk: Creating a prog.1 man page requires running
src/prog --help.
List the exceptions, e.g., install.1 depends on src/ginstall
and arch.1 depends on src/uname.

11 years agomaint: check-programs-vs-x: avoid a new syntax-check failure
Jim Meyering [Fri, 31 Aug 2012 18:05:29 +0000 (20:05 +0200)]
maint: check-programs-vs-x: avoid a new syntax-check failure

* cfg.mk (check-programs-vs-x): The new variable,
$(all-progs-but-lbracket) contains libstdbuf.so, and it does
not have a corresponding .x file, so exempt it.

11 years agomaint: avoid distcheck failure by properly cleaning $(ALL_MANS)
Jim Meyering [Fri, 31 Aug 2012 23:46:59 +0000 (01:46 +0200)]
maint: avoid distcheck failure by properly cleaning $(ALL_MANS)

* man/local.mk (distclean-local): Remove $(ALL_MANS) when doing
a VPATH build.  If it's not done, generated manpages can be left
around in the build directory after a "make distclean", causing
failures in "make distcheck".

11 years agomaint: port manpages generation to VPATH builds
Stefano Lattarini [Fri, 31 Aug 2012 23:46:58 +0000 (01:46 +0200)]
maint: port manpages generation to VPATH builds

* man/local.mk (.x.1): Use '$(MKDIR_P)' rather than bare 'mkdir'
where appropriate.  Reported by Jim Meyering.

11 years agobuild: fix VPATH issues in C compilation
Jim Meyering [Fri, 31 Aug 2012 23:46:57 +0000 (01:46 +0200)]
build: fix VPATH issues in C compilation

* src/local.mk (AM_CPPFLAGS): Add 'src' to the directories that
are searched for #include'd files.

11 years agomaint: simplify declaration of "libexec" programs
Stefano Lattarini [Fri, 31 Aug 2012 23:46:54 +0000 (01:46 +0200)]
maint: simplify declaration of "libexec" programs

* configure.ac: No need to use 'gl_ADD_PROG' and an indirection
variable '$optional_pkglib_progs' to declare the 'libstdbuf.so'
"libexec" program; the decision to whether compile that program
is not up to the user, but it only and simply depends on whether
the 'stdbuf' "bin" program is to be built or not.

11 years agobuild: $(mandeps): new, to factor out man pages dependencies
Stefano Lattarini [Fri, 31 Aug 2012 23:46:53 +0000 (01:46 +0200)]
build: $(mandeps): new, to factor out man pages dependencies

* man/local.mk (mandpep): Rename ...
(mandeps): ... like this.  Make $(ALL_MANS) depend on its
content.  List 'src/system.h' in here, instead of making
$(ALL_MANS) depend on it explicitly.
(man/*.1): No need to list $(mandep) among the dependencies
any longer.

11 years agobuild: enhance man pages cleaning and dependencies
Stefano Lattarini [Fri, 31 Aug 2012 23:46:52 +0000 (01:46 +0200)]
build: enhance man pages cleaning and dependencies

* man/local.mk: All of the manpages should depend on 'src/system.h',
and all of them should be cleaned by "make maintainer-clean", that
is, added to MAINTAINERCLEANFILES.  Make it be so.
Some minor cosmetic tweakings and reorderings while at it.

11 years agobuild: simplify: get rid of yet some more indirection variables
Stefano Lattarini [Fri, 31 Aug 2012 23:46:51 +0000 (01:46 +0200)]
build: simplify: get rid of yet some more indirection variables

* configure.ac: Adjust and improve few comments.
(MAN): Rename ...
(man1_MANS): ... to this.
Ensure it isn't initialized in all Makefiles (which would lead
to spurious errors), by calling AM_SUBST_NOTMAKE on it.
Also call AM_SUBST_NOTMAKE on 'EXTRA_MANS', for consistency.
* man/local.mk (man1_MANS): Simply define to '@man1_MANS@'.

11 years agobuild: rename dist_man1_MANS -> man1_MANS
Stefano Lattarini [Fri, 31 Aug 2012 23:46:50 +0000 (01:46 +0200)]
build: rename dist_man1_MANS -> man1_MANS

And list $(man1_MANS) directly in $(EXTRA_DIST) instead.
This is similar to what is done for $(EXTRA_MANS), thus
improving consistency and readability.

* man/local.mk (dist_man1_MANS): Rename ...
(man1_MANS): ... like this.
(EXTRA_DIST): Add its contents.
* cfg.mk (check-x-vs-1): Fix a botched comment.

11 years agobuild: one less unneeded make variable
Stefano Lattarini [Fri, 31 Aug 2012 23:46:49 +0000 (01:46 +0200)]
build: one less unneeded make variable

* man/local.mk (man_aux): This was used only once, so inline its
expansion at its sole point of use ...
(EXTRA_DIST): ... here.

11 years agobuild: simplify and make more portable to non-GNU make
Stefano Lattarini [Fri, 31 Aug 2012 23:46:48 +0000 (01:46 +0200)]
build: simplify and make more portable to non-GNU make

The AC_SUBST'd variable '$(NO_INSTALL_PROGS_DEFAULT)' is only used in
makefile expressions expanding the list of manual pages that are not
built by default (but might need to be when a distribution tarball
is created). Such expressions exploited a feature 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.

* configure.ac (NO_INSTALL_PROGS_DEFAULT): Don't define or 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 on $(NO_INSTALL_PROGS_DEFAULT) and $(dist_man1_MANS).

11 years agobuild: simplify: get rid of some indirection variables
Stefano Lattarini [Fri, 31 Aug 2012 23:46:47 +0000 (01:46 +0200)]
build: simplify: get rid of some indirection variables

The code deciding which coreutils programs to build (depending on
defaults, system capabilities, and user requests) is overly complex
and rather confusing.  Let's begin simplifying it by removing some
non-strictly-necessary indirection variables.

* configure.ac: Adjust and improve few comments.
(OPTIONAL_BIN_PROGS, OPTIONAL_PKGLIB_PROGS): Rename ...
(bin_PROGRAMS, pkglibexec_PROGRAMS): ... like these, respectively.
Ensure they aren't initialized in all Makefiles (which would lead
to spurious errors), by calling AM_SUBST_NOTMAKE on them.
* src/local.mk: Adjust and improve few comments.
(bin_PROGRAMS, pkglibexec_PROGRAMS): Simply define
to the corresponding '@substitution@'.

11 years agomaint: update gitignore entries
Stefano Lattarini [Fri, 31 Aug 2012 23:46:46 +0000 (01:46 +0200)]
maint: update gitignore entries

* src/.gitignore: Here, adding the '.dirstamp' file generated
by the C compilation rules.

11 years agomaint: fix one stray reference to src/Makefile.am
Stefano Lattarini [Fri, 31 Aug 2012 23:46:45 +0000 (01:46 +0200)]
maint: fix one stray reference to src/Makefile.am

* build-aux/gen-lists-of-programs.sh: In heading comments here.

11 years agomaint: fix and simplify maintainer checks
Stefano Lattarini [Fri, 31 Aug 2012 23:46:44 +0000 (01:46 +0200)]
maint: fix and simplify maintainer checks

Some of them can be simplified after the previous changes, some
of them have been downright broken by them, and need fixing.

* src/local.mk: Adjust some comments.
(EXTRA_DIST): Avoid SPACE-TAB sequences.
(src/dircolors.h, src/fs.h src/fs-is-local.h): Avoid 8-SPACES
indentation.
(_sc_check-AUTHORS): Move ...
* cfg.mk (sc_check-AUTHORS): ... here (superseding the old rule
with the same name, that was just a recursive invocation to it).
Adjust the paths of the invoked coreutils programs, to account
for the fact that this rule now runs in the top-level build dir,
not in the 'src/' subdir.  Other minor cosmetic adjustments.
(ALL_RECURSIVE_TARGETS): Remove 'sc_option_desc_uppercase' and
'sc_man_file_correlation', since they no longer entail any
recursive make invocation.
(sc_option_desc_uppercase): Remove dependency from $(all_programs):
it isn't actually needed.
(check-programs-vs-x): Likewise.  Also, fix heading comments to
truly reflect what this check does.
(all-progs-but-lbracket): Strip the 'src/' prefix from each entry
in the list of programs; this avoids a spurious failure in the
'check-programs-vs-x' recipe.
(.PHONY): No need to list targets 'sc_man_file_correlation' and
'sc_option_desc_uppercase': they are automatically declared phony
by 'maint.mk', being recognized as syntax checks.

11 years agomaint: remove unused target 'install-root'
Stefano Lattarini [Fri, 31 Aug 2012 23:46:43 +0000 (01:46 +0200)]
maint: remove unused target 'install-root'

It was unneeded and broken since the removal of 'su' from GNU
coreutils, in commit v8.17-16-g928dd73 of 2012-06-06, "su: remove
program (util-linux is now the best source for it)".

* Makefile.am (install-root): Remove.
(ALL_RECURSIVE_TARGETS): Update.

11 years agomaint: improve remake rules for maintainers
Stefano Lattarini [Fri, 31 Aug 2012 23:46:42 +0000 (01:46 +0200)]
maint: improve remake rules for maintainers

This is a follow up on today's commit v8.19-60-g4f2e62b".

* Makefile.am ($(top_srcdir)/m4/cu-progs.m4,
$(srcdir)/src/cu-progs.mk): New, generate these files from the
'build-aux/gen-lists-of-programs.sh', the same way it's done
from the bootstrap script.
* bootstrap.conf (bootstrap_post_import_hook): Add comment about
the necessity to keep those new rules synced with the commands
here.  Enhance those commands so to that the generated files are
set read-only.

11 years agobuild: fix generation of manpages for programs not built by default
Stefano Lattarini [Fri, 31 Aug 2012 23:46:41 +0000 (01:46 +0200)]
build: fix generation of manpages for programs not built by default

* src/local.mk (dist-hook): Don't use this to ensure all the
programs, even the ones disabled by default or by the user, are
built (doing so is required to ensure the distributed manpages
are properly built).  This would build those programs too late
anyway, causing errors like:

    $ make dist
    make  dist-xz am__post_remove_distdir='@:'
    make[1]: Entering directory `~/src/coreutils'
      GEN      man/arch.1
    help2man: can't get '--help' info from man/arch.td/arch
    make[1]: *** [man/arch.1] Error 127
    make[1]: Leaving directory `~/src/coreutils'
    make: *** [dist] Error 2

Instead, ...
* man/local.mk (extra_man_x, extra_man_1): define these ...
($(extra_man_1)): ... and make this depend on $(all_programs).
(EXTRA_DIST): Adjust.
Adjust some comments as well.

11 years agobuild: don't use recursive make to build the 'src' subdirectory
Stefano Lattarini [Fri, 31 Aug 2012 23:46:40 +0000 (01:46 +0200)]
build: don't use recursive make to build the 'src' subdirectory

* Makefile.am (SUBDIRS): Remove 'src'.  Ensure '.' is listed before
'tests' and 'gnulib-tests'.
(dist-hook): Adjust: we must now tweak the top-level Makefile.in
in $(distdir), not the one in the 'src/' subdir (which is gone).
(include): The '$(top_srcdir)/src/local.mk' file.
* build-aux/gen-lists-of-programs.sh: Adjust the generation of the
automake input fragment.
* tests/Makefile.am (.built-programs): Adjust.
* cfg.mk (all_programs): Remove this convenience rule; it's no
longer needed, now that we can rely directly on the contents of
$(all_programs).
(sc_option_desc_uppercase, check-programs-vs-x:): Adjust lists
of prerequisites accordingly.
(all-progs-but-lbracket): Simplify definition accordingly.
* configure.ac ($OPTIONAL_BIN_PROGS): Adjust definition.
($OPTIONAL_PKGLIB_PROGS): Likewise.
($NO_INSTALL_PROGS_DEFAULT): Tweak definition, for consistency.
(AC_CONFIG_FILES): Remove 'src/Makefile'.
* src/Makefile.am: Rename ...
* src/local.mk: ... like this, with a lot of adjustments.  In
addition ...
(all_programs): ... remove this now-unneeded convenience target.

11 years agobuild: refactor how lists of coreutils programs are defined
Stefano Lattarini [Fri, 31 Aug 2012 23:46:39 +0000 (01:46 +0200)]
build: refactor how lists of coreutils programs are defined

This is in preparation of future changes.  Still, this patch
leaves the build system in a better shape; true, with more
indirections, but also with less convoluted and brittle hacks.

Unfortunately, this commit also makes some rebuild rules
incomplete; that will son be fixed by follow-up patches.

* build-aux/gen-lists-of-programs.sh: New, generates autoconf
and automake input fragments that define "lists" of all coreutils
programs, with further distinctions about how and when these
programs should be built (by default; if the system is capable
enough; only if the user asks for them explicitly).  This is
useful to avoid duplicating the definitions of these lists among
several files (at least 'configure.ac' 'src/Makefile.am'); such
duplication had proved a source of inconsistencies and bugs in
the past.  And the pre-existing way to avoid such duplication,
as implemented in 'configure.ac' before this patch, was overly
complex and brittle.
* Makefile.am (EXTRA_DIST): Distribute the new script.
* bootstrap.conf (bootstrap_post_import_hook): Run the new script
to generate 'm4/cu-progs.m4' and 'src/cu-progs.mk'.
* .gitignore: Ignore those files.
* configure.ac: Include 'm4/cu-progs.m4', and decidedly simplify
most of the program lists definition and processing accordingly.
* src/Makefile.am: Similarly include 'src/cu-progs.mk', containing
definition of variables $(default__progs), $(no_install__progs)
and $(build_if_possible__progs).  Accordingly ...
(no_install__progs, build_if_possible__progs): ... remove.
(EXTRA_DIST): Adjust definition.
Adjust a comment.

11 years agomaint: add our 'bootstrap_post_import_hook' function
Stefano Lattarini [Fri, 31 Aug 2012 23:46:38 +0000 (01:46 +0200)]
maint: add our 'bootstrap_post_import_hook' function

This is in preparation of future changes.

* bootstrap.conf (bootstrap_post_import_hook): New, will be executed
by bootstrap after gnulib-tool but before the autotools.
Move creation of dummy ChangeLog into it.

11 years agobuild: work with new glibc when not optimizing
Eric Blake [Fri, 31 Aug 2012 19:07:54 +0000 (12:07 -0700)]
build: work with new glibc when not optimizing

Starting with glibc 2.15, the system headers refuse to compile
unconditional use of FORTIFY_SOURCE if optimization is disabled
but -Werror is in effect.

* configure.ac (FORTIFY_SOURCE): Make conditional.

11 years agoscripts: fix the Signed-off-by:-prohibiting hook to actually work
Jim Meyering [Fri, 31 Aug 2012 10:52:08 +0000 (12:52 +0200)]
scripts: fix the Signed-off-by:-prohibiting hook to actually work

* scripts/git-hooks/commit-msg: Fix new test: we're searching a
multi-line buffer, so add the //m modifier.

11 years agomaint: make required gettext version consistent
Stefano Lattarini [Fri, 31 Aug 2012 10:29:22 +0000 (12:29 +0200)]
maint: make required gettext version consistent

* bootstrap.conf ($buildreq): Require gettext >= 0.18.1, consistently
with the call to AM_GNU_GETTEXT_VERSION in configure.ac.

11 years agomaint: get rid of obsolete script 'cvsu'
Stefano Lattarini [Thu, 30 Aug 2012 16:19:58 +0000 (18:19 +0200)]
maint: get rid of obsolete script 'cvsu'

It was useful only back when coreutils used CVS as its version
control system.

* build-aux/cvsu: Delete.
* Makefile.am (EXTRA_DIST): Remove it.
* cfg.mk: Remove the two exemptions for this removed file.

11 years agobuild: don't use '$<' in non-suffix rules
Stefano Lattarini [Thu, 30 Aug 2012 16:19:57 +0000 (18:19 +0200)]
build: don't use '$<' in non-suffix rules

* src/Makefile.am (fs-def): Here: it's not portable to some non-GNU
make implementations.

11 years agomaint: more uses of $(ASSORT)
Stefano Lattarini [Thu, 30 Aug 2012 16:19:56 +0000 (18:19 +0200)]
maint: more uses of $(ASSORT)

* src/Makefile.am (fs-kernel-magic, fs-magic): Here, instead of
inlining its expansion "LC_ALL=C sort".

11 years agomaint: remove unused variable in src/Makefile.am
Stefano Lattarini [Thu, 30 Aug 2012 16:19:55 +0000 (18:19 +0200)]
maint: remove unused variable in src/Makefile.am

* src/Makefile.am (editpl): This.

11 years agobuild: don't use foo_LDADD if there's no foo program
Stefano Lattarini [Thu, 30 Aug 2012 16:19:54 +0000 (18:19 +0200)]
build: don't use foo_LDADD if there's no foo program

For example, instead of factoring out the extra linker flags needed
by 'cp', 'mv' ind 'install' into a '$(copy_LDADD)' variable, factor
them out in a '$(copy_ldadd)' variable.

Partly a minor cleanup, partly a preparation for future changes.

* src/Makefile.am (copy_LDADD): Rename ...
(copy_ldadd): ... like this.
(remove_LDADD): Rename ...
(remove_ldadd): ... like this.
All uses adjusted.  Some comments updated.

11 years agobuild: some refactorings in cfg.mk
Stefano Lattarini [Thu, 30 Aug 2012 16:19:53 +0000 (18:19 +0200)]
build: some refactorings in cfg.mk

Partly a minor cleanup, partly a preparation for future changes.

* Makefile.am (all_programs): Rename ...
(all-progs-but-lbracket): ... like this, and re-define it to expand
at make time rather than only at recipe time (i.e., using $(shell ...)
instead of `...`).
(check-programs-vs-x): Adjust.

11 years agobuild: move definition of 'all_programs' in cfg.mk
Stefano Lattarini [Thu, 30 Aug 2012 16:19:52 +0000 (18:19 +0200)]
build: move definition of 'all_programs' in cfg.mk

* Makefile.am: Move definition of target 'all_programs' from here ...
* cfg.mk: ... to here, which is the only file where it is used.

11 years agobuild: reenable just-moved/broken syntax-check rule
Jim Meyering [Fri, 31 Aug 2012 10:08:49 +0000 (12:08 +0200)]
build: reenable just-moved/broken syntax-check rule

* cfg.mk (sc_option_desc_uppercase): Now that this rule lives in cfg.mk,
we must search man/*.1, not "*.1".
Reported by Bernhard Voelker.

11 years agomaint: fixup: don't try to distribute a now-removed file
Stefano Lattarini [Fri, 31 Aug 2012 07:59:31 +0000 (09:59 +0200)]
maint: fixup: don't try to distribute a now-removed file

* tests/Makefile.am (EXTRA_DIST): Drop 'check.mk', which has been
removed (being merged into 'tests/Makefile.am') by recent changes.

11 years agodoc: escape double quotes in autotools-install --help
Erik Auerswald [Fri, 31 Aug 2012 09:01:58 +0000 (11:01 +0200)]
doc: escape double quotes in autotools-install --help

* scripts/autotools-install: Fix --help so that we actually print
the double quotes around "make check", in two places.

11 years agoscripts: add autotools-install, for those stuck with outdated tools
Jim Meyering [Fri, 31 Aug 2012 08:55:03 +0000 (10:55 +0200)]
scripts: add autotools-install, for those stuck with outdated tools

* scripts/autotools-install: New script, so you can always build
from git-cloned sources, even when they require bleeding edge
m4, autoconf, automake, etc.

11 years agobuild: fix syntax-check rules broken by test-added .sh/pl suffixes
Bernhard Voelker [Fri, 31 Aug 2012 08:07:54 +0000 (10:07 +0200)]
build: fix syntax-check rules broken by test-added .sh/pl suffixes

* cfg.mk: We exempt a few test files that would otherwise trigger
false-positive matches in syntax-check rules.  The recent change
that added a .sh or .pl suffix to each test script made it so
some of the exclusion regexps would no longer match.
Include the required \.sh suffix in each such regexp, too.

11 years agotests: get rid of the 'shell-or-perl' auxiliary script
Stefano Lattarini [Thu, 30 Aug 2012 12:13:13 +0000 (14:13 +0200)]
tests: get rid of the 'shell-or-perl' auxiliary script

It's now easier and faster to simply run the perl ans shell test
scripts directly with the appropriate interpreter and options.

* tests/shell-or-perl: Delete.
* tests/Makefile.am (EXTRA_DIST): Remove it.
(SH_LOG_COMPILER): Re-define to invoke the correct shell.
(PL_LOG_COMPILER): Re-define to invoke the correct perl
interpreter ...
(TESTSUITE_PERL_OPTIONS): ... with the correct options.
(XPL_LOG_COMPILER): Use those options instead of inlining
their expansion.
(LOG_COMPILER): Delete, no longer needed.

11 years agotests: add .sh and .pl suffixes to shell and perl tests, respectively
Stefano Lattarini [Thu, 30 Aug 2012 12:13:12 +0000 (14:13 +0200)]
tests: add .sh and .pl suffixes to shell and perl tests, respectively

Not only this shrinks the size of the generated Makefile (from > 6300
lines to ~3000), but will allow further simplifications in future
changes.

* tests/Makefile.am (TEST_EXTENSIONS): Add '.sh' and '.pl'.
(PL_LOG_COMPILER, SH_LOG_COMPILER): New, still defined simply to
$(LOG_COMPILER) for the time being.
(TESTS, root_tests): Adjust as described.
* All tests: Rename as described.

11 years agotests: detect missing perl at configure runtime
Stefano Lattarini [Thu, 30 Aug 2012 12:13:11 +0000 (14:13 +0200)]
tests: detect missing perl at configure runtime

* configure.ac (AM_CONDITIONAL): Set the conditional 'HAVE_PERL' to
true if the configure-time checks (as run by gl_PERL) have been able
to find a working perl.
* tests/no-perl: New script, report a diagnostic about "missing perl"
and exit with status 77.
* tests/Makefile.am (EXTRA_DIST): Distribute it.
(TESTSUITE_PERL): New, define to '$(PERL)' if a perl interpreter has
been found at configure time (i.e., if the 'HAVE_PERL' automake
conditional is true), and to '$(srcdir)/no-perl' otherwise.
(LOG_COMPILER): Use $(TESTSUITE_PERL) instead of $(PERL).
(XPL_LOG_COMPILER): Likewise.
* tests/shell-or-perl: Simplify: no need to actually check whether
perl is working.

11 years agotests: avoid use of '-T' in shebang line to enable perl taint mode
Stefano Lattarini [Thu, 30 Aug 2012 12:13:10 +0000 (14:13 +0200)]
tests: avoid use of '-T' in shebang line to enable perl taint mode

* tests/rm/fail-eperm: Rename ...
* tests/rm/fail-eperm.xpl: ... like this
* tests/Makefile.am (TESTS): Adjust.
(TEST_EXTENSIONS): New, list '.xpl'.
(XPL_TEST_LOGS): New, run a perl test in tainted mode.
* tests/shell-or-perl: Simplify this script: we no longer need to
parse the shebang line and adjust the flags in the perl invocation
accordingly.

11 years agobuild: require Automake >= 1.11.2
Stefano Lattarini [Thu, 30 Aug 2012 14:58:14 +0000 (16:58 +0200)]
build: require Automake >= 1.11.2

Now that we use AM_TESTS_ENVIRONMENT, we must require
Automake >= 1.11.2.
* configure.ac (AM_INIT_AUTOMAKE): Bump version requirement to 1.11.2.
* bootstrap.conf ($buildreq): Likewise.

11 years agotests: prefer AM_TESTS_ENVIRONMENT over TESTS_ENVIRONMENT
Stefano Lattarini [Thu, 30 Aug 2012 12:13:08 +0000 (14:13 +0200)]
tests: prefer AM_TESTS_ENVIRONMENT over TESTS_ENVIRONMENT

The latter should be reserved for user overrides.

* tests/Makefile.am (TESTS_ENVIRONMENT): Rename ...
(AM_TESTS_ENVIRONMENT): ... like this.

11 years agotests: merge tests/check.mk into tests/Makefile.am
Stefano Lattarini [Thu, 30 Aug 2012 12:13:07 +0000 (14:13 +0200)]
tests: merge tests/check.mk into tests/Makefile.am

The separation has become unnecessary after all the ancient
'tests/*/Makefile.am' makefiles have been merged into the
"more-top-level" one 'tests/Makefile.am'.

* tests/check.mk: Merge ...
* tests/Makefile.am: ... in here.  Some comments tweaking while
at it.

11 years agobuild: enable the 'subdir-objects' Automake option globally
Stefano Lattarini [Thu, 30 Aug 2012 13:27:47 +0000 (15:27 +0200)]
build: enable the 'subdir-objects' Automake option globally

This is not strictly required now (it will be once we make more
parts of the coreutils build system non-recursive), but enabling
it early helps to ensure that we don't unwittingly introduce any
incompatibility or subtle breakage later.

* configure.ac (AM_INIT_AUTOMAKE): Add  'subdir-objects'.

11 years agomaint: update gitignore entries
Stefano Lattarini [Wed, 29 Aug 2012 16:01:02 +0000 (18:01 +0200)]
maint: update gitignore entries

* doc/.gitinore: Here, adding the '.dirstamp' file generated by
the Texinfo rules.

11 years agobuild: factor out a little more re list of *.texi files
Jim Meyering [Wed, 29 Aug 2012 15:59:48 +0000 (17:59 +0200)]
build: factor out a little more re list of *.texi files

We may well want to switch from checking all *.texi to
checking only version-controlled .texi files, so encapsulate
this concept in one place.

* doc/local.mk (doc_srcdir): Delete.  Use this instead:
(texi_files): Define.  All usages adjusted.

11 years agomaint: adjust syntax check 'sc_option_desc_uppercase'
Stefano Lattarini [Wed, 29 Aug 2012 15:57:45 +0000 (17:57 +0200)]
maint: adjust syntax check 'sc_option_desc_uppercase'

* cfg.mk (sc_option_desc_uppercase): Here, by grafting the 'man/'
prefix to the manpages obtained from $(NO_INSTALL_PROGS_DEFAULT)
and listed as prerequisites for this rule.

11 years agomaint: adjust syntax check 'check-x-vs-1'
Stefano Lattarini [Wed, 29 Aug 2012 15:50:34 +0000 (17:50 +0200)]
maint: adjust syntax check 'check-x-vs-1'

* cfg.mk (check-x-vs-1): Here, by stripping 'man/' prefix from
$(dist_man1_MANS) entries before comparing them with the list of
expected programs.

11 years agomaint: move man-related syntax checks in cfg.mk
Stefano Lattarini [Wed, 29 Aug 2012 15:37:35 +0000 (17:37 +0200)]
maint: move man-related syntax checks in cfg.mk

This is more natural, now that the top-level Makefile has access to
all the variables and rules once defined only in 'man/Makefile.am'

* man/local.mk (all_programs, sc_option_desc_uppercase,
sc_man_file_correlation check-x-vs-1, check-programs-vs-x): Move
from here ...
* cfg.mk: ... to here.  Adjust some comments in the process.

11 years agobuild: don't use recursive make to build the 'man' subdirectory
Stefano Lattarini [Wed, 29 Aug 2012 14:37:24 +0000 (16:37 +0200)]
build: don't use recursive make to build the 'man' subdirectory

* Makefile.am: Include 'man/local.mk'.
(SUBDIRS): Remove 'man'.
* configure.ac ($MAN): Adjust so that each of its entries has 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 while 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, but that
will be fixed in later changes.

11 years agobuild: rework some recipes in man/Makefile.am, for future changes
Stefano Lattarini [Wed, 29 Aug 2012 19:31:57 +0000 (21:31 +0200)]
build: rework some recipes in man/Makefile.am, for future changes

This change is merely required to make future changes easier.

In particular, since we are going to merge the contents of
'man/Makefile.am' into the top-level Makefile, we need to avoid
conflicts with the rules and variables in 'dist-check.mk', and
to prepare for changes in the value of the '$*' variable as used
in the recipe of the '.x -> .1' suffix rule.

* man/Makefile.am (t, mapped_name): Delete, inlining their use ...
(.1.x): ... in the recipe of this suffix rule.  Other adjustments
to prepare to changes in the value of the '$*' automatic variable.
While at it, made more resilient about unlikely but possible failure.
Adjust and reorder few comments.

11 years agobuild: provide convenience target 'all_programs' also at top-level
Stefano Lattarini [Wed, 29 Aug 2012 14:57:41 +0000 (16:57 +0200)]
build: provide convenience target 'all_programs' also at top-level

This will be mostly useful in future changes.

* Makefile.am (all_programs): New, simply work by delegating to
the same-named target in the 'src/' subdirectory.
* cfg.mk (sc_option_desc_uppercase): Take advantage of it.
(sc_man_file_correlation): Likewise.

11 years agobuild: make a rule less dependent on exact source tree layout
Stefano Lattarini [Wed, 29 Aug 2012 14:22:38 +0000 (16:22 +0200)]
build: make a rule less dependent on exact source tree layout

This is mostly a preparatory change in view of future ones.

* man/Makefile.am (.x.1): Use '$(abs_top_builddir)/src' to access
the 'src' directory.

11 years agobuild: rely on VPATH capabilities in man/Makefile
Stefano Lattarini [Wed, 29 Aug 2012 14:13:35 +0000 (16:13 +0200)]
build: rely on VPATH capabilities in man/Makefile

* man/Makefile.am: In all the 'foo.1' targets, no need to depend
explicitly on '$(srcdir)/foo.x': the '.x.1' suffix rule takes care
of that automatically.

11 years agomaint: typofix: s/it's/its/
Stefano Lattarini [Wed, 29 Aug 2012 13:57:22 +0000 (15:57 +0200)]
maint: typofix: s/it's/its/

* man/Makefile.am: Here.

11 years agobuild: rename common_dep -> mandep in man/Makefile
Stefano Lattarini [Wed, 29 Aug 2012 13:56:47 +0000 (15:56 +0200)]
build: rename common_dep -> mandep in man/Makefile

This is mostly a preparatory refactoring in view of future changes.

* man/Makefile.am (common_dep): Rename ...
(mandep): ... like this.
All usages adjusted.

11 years agobuild: fix a stray usage of uninitialized $(ME)
Stefano Lattarini [Wed, 29 Aug 2012 13:55:54 +0000 (15:55 +0200)]
build: fix a stray usage of uninitialized $(ME)

* man/Makefile.am (sc_option_desc_uppercase): Here.