automake
[Top][All Lists]
Advanced

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

Re: Portable $addprefix


From: Nick Bowler
Subject: Re: Portable $addprefix
Date: Fri, 25 Aug 2017 11:33:19 -0400

Hello,

On 8/24/17, Kip Warner <address@hidden> wrote:
> I'd like to transform the following variable in my Makefile.am from...
>
>     files_only = a.foo b.foo c.foo d.foo ...
>
> Into...
>
>     files_with_path = dir/a.foo dir/b.foo dir/c.foo dir/d.foo ...

I'm not aware of any truly portable way to do this directly in make.

But your example looks like a pretty static list (i.e., this list won't
be changed by the user after the package is generated), so the portable
way is to just generate both lists in advance, at the same time you run
automake (perhaps with a perl script that postprocesses Makefile.in).

If the list depends on configure results then another possibility is
to have configure generate both lists.

Finally, while not portable to all make implementations, expansions
like this:

  $(files_only:%:dir/%)

do work in multiple implementations other than GNU make.

Cheers,
  Nick



reply via email to

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