On 2017-08-24 19:02, Kip Warner wrote: > Hey list, > > 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 aware of GNU Make's $addprefix magic. I'm also aware it's naughty > to use where portability is a concern and a different implementation of > make may be used behind Automake. I was wondering if anyone has come up > with a recipe for scenarios like this?
A portable way to do this is to do the work in configure.ac and transfer it to the Makefile with AC_SUBST. For example, with an empty Makefile.am and the following configure.ac: AC_INIT([Example], [1.0]) AM_INIT_AUTOMAKE([foreign]) m4_define([m_files_only], [a.foo b.foo c.foo]) files_only='m_files_only' files_with_path='m4_map_args_w(m_files_only, [dir/], [], [ ])' AC_SUBST([files_only]) AC_SUBST([files_with_path]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT The desired macros will appear in the resulting Makefile: files_only = a.foo b.foo c.foo files_with_path = dir/a.foo dir/b.foo dir/c.foo
signature.asc
Description: OpenPGP digital signature