Hi, On Thu, Feb 14, 2013 at 11:26 AM, Stefano Lattarini <stefano.lattar...@gmail.com> wrote: > From: Peter Rosin <p...@lysator.liu.se> > > 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.lattar...@gmail.com> > Signed-off-by: Peter Rosin <p...@lysator.liu.se> > --- > NEWS | 12 +++++ > automake.in | 26 ++++++++--- > doc/automake.texi | 20 ++++++++ > t/list-of-tests.mk | 1 + > t/preproc-reldir.sh | 129 > ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 182 insertions(+), 6 deletions(-) > create mode 100755 t/preproc-reldir.sh > > diff --git a/NEWS b/NEWS > index 6dcce72..e27e0cf 100644 > --- a/NEWS > +++ b/NEWS > @@ -100,6 +100,18 @@ New in 1.13.2: > be longer necessary, so we deprecate it with runtime warnings. It will > likely be removed altogether in Automake 1.14. > > +* Relative directory in Makefile fragments: > + > + - The special Automake-time substitutions '%reldir%' and '%canon_reldir%' > + (and their short versions, '%D%' and '%C%' respectively) can now be used > + in an included Makefile fragment. The former is substituted with the > + relative directory of the included fragment (compared to the top level > + including Makefile), and the latter with the canonicalized version of > + the same relative directory: > + > + bin_PROGRAMS += %reldir%/foo > + %canon_reldir%_foo_SOURCES = {reldir}/bar.c
the rejected '{reldir}' is still used in this example. Does this substition happens in the whole file, or only in specific syntactic constructs? What definitily will not work ist something like this, right? here = %reldir% target = %canon_reldir%/foo bin_PROGRAMS += ${here}/foo ${target}_SOURCES = ${here}/bar.c Speaking of 'here' wouldn't that also an candidate instead of 'reldir'? and %.% as the shortform of %reldir% does sound: bin_PROGRAMS += %.%/foo %canon_here%_foo_SOURCES = %.%/bar.c Regards, Bert