[Top][All Lists]

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

Re: Target-specific variable in subdirectory problem

From: Kyle Rose
Subject: Re: Target-specific variable in subdirectory problem
Date: Thu, 3 Aug 2017 09:20:06 -0400

On Aug 3, 2017 9:00 AM, "Benjamin Cama" <address@hidden> 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.


reply via email to

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