preproc: add support for relative names in included fragments
authorPeter Rosin <peda@lysator.liu.se>
Fri, 8 Feb 2013 08:11:45 +0000 (09:11 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 14 Feb 2013 12:28:11 +0000 (13:28 +0100)
commitba25a9f1c295d7799575afa39c4c9854a85ad8e3
treeee75e29cedbe485e71800b15fd88077c0092d3a4
parent0756a43c3a77cff0e86aa8dad7f9f4ebd90b800c
preproc: add support for relative names in included fragments

The rationale for this change is that it is annoying to have
to repeat the directory name when including a Makefile fragment.
For deep directory structures these repeats can generate a lot
of bloat.  It also hinders reuse and easy directory restructuring
if all Makefile fragments have to know exactly where they live.

Suggested by Bob Friesenhahn, and later discussed in bug#13524.

In the course of discussion, the following notations were rejected:
&{reldir}& - to hard to type, {reldir} - interferes with ${reldir},
{am_reldir} - short form {D} interferes with ${D}, @am_reldir@ - short
form @D@ interferes with AC_SUBST([D]) as well as invading the
config.status turf. Other notations were also suggested...

* automake.in (read_am_file): Add third argument specifying the
relative directory of this Makefile fragment compared to the
main Makefile.  Replace %reldir% and %canon_reldir% in the
fragment with this relative directory (with slashes etc, or
canonicalized).
(read_main_am_file): Adjust.
* t/preproc-reldir.sh: New test.
* t/list-of-tests.mk: Augment.
* doc/automake.texi (Include): Document the new feature.
NEWS: Add new feature.

Co-authored-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Peter Rosin <peda@lysator.liu.se>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NEWS
automake.in
doc/automake.texi
t/list-of-tests.mk
t/preproc-reldir.sh [new file with mode: 0755]