bug-automake
[Top][All Lists]
Advanced

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

bug#13524: [PATCH 1/2] preproc: add support for relative names in includ


From: Bert Wesarg
Subject: bug#13524: [PATCH 1/2] preproc: add support for relative names in included fragments
Date: Thu, 14 Feb 2013 13:20:37 +0100

Hi,

On Thu, Feb 14, 2013 at 11:26 AM, Stefano Lattarini
<address@hidden> wrote:
> From: Peter Rosin <address@hidden>
>
> 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 <address@hidden>
> Signed-off-by: Peter Rosin <address@hidden>
> ---
>  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





reply via email to

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