On Aug 3, 2017 9:00 AM, "Benjamin Cama" <b.c...@kerlink.fr> wrote:

Anyway, it seems that a global variable would solve my problem, and
indeed it looks a bit more right this way: I can still get the stem in
my recipe (with $*), and everything works as expected. It's just that
the global namespace is “polluted” by this variable which is used only
in my particular recipe. And this is where I may be mistaken on the use
of target-specific variable: I tend to use them as a kind of “private
namespace” feature, when I define something that will be used only in
one particular recipe.


What we do in our makefiles is to use global variable names containing
paths. E.g.,

subdir/FOO = bar

You can modularize this via some construction like:

M := subdir
...
$M/FOO = bar

Make doesn't provide a lot of structure for encapsulation (there are no
objects or directly-addressable structures, for instance), but it does give
you enough flexibility to create something manageable.

Kyle
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to