summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPeter Rosin <peda@lysator.liu.se>2013-02-08 09:11:45 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2013-02-14 13:28:11 +0100
commitba25a9f1c295d7799575afa39c4c9854a85ad8e3 (patch)
treeee75e29cedbe485e71800b15fd88077c0092d3a4 /doc
parent0756a43c3a77cff0e86aa8dad7f9f4ebd90b800c (diff)
downloadautomake-ba25a9f1c295d7799575afa39c4c9854a85ad8e3.tar.gz
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>
Diffstat (limited to 'doc')
-rw-r--r--doc/automake.texi20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/automake.texi b/doc/automake.texi
index feae3ac80..d420d28ed 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -10519,6 +10519,26 @@ condition applies to the entire contents of that fragment.
Makefile fragments included this way are always distributed because
they are needed to rebuild @file{Makefile.in}.
+Inside a fragment, the construct @code{%reldir%} is replaced with the
+directory of the fragment relative to the base @file{Makefile.am}.
+Similarly, @code{%canon_reldir%} is replaced with the canonicalized
+(@pxref{Canonicalization}) form of @code{%reldir%}. As a convenience,
+@code{%D%} is a synonym for @code{%reldir%}, and @code{%C%}
+is a synonym for @code{%canon_reldir%}.
+
+A special feature is that if the fragment is in the same directory as
+the base @file{Makefile.am} (i.e., @code{%reldir%} is @code{.}), then
+@code{%reldir%} and @code{%canon_reldir%} will expand to the empty
+string as well as eat, if present, a following slash or underscore
+respectively.
+
+Thus, a makefile fragment might look like this:
+
+@example
+bin_PROGRAMS += %reldir%/mumble
+%canon_reldir%_mumble_SOURCES = %reldir%/one.c
+@end example
+
@node Conditionals
@chapter Conditionals