help-make
[Top][All Lists]
Advanced

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

Clarification on Scoped variables


From: AB
Subject: Clarification on Scoped variables
Date: Fri, 2 Dec 2011 14:42:25 -0500

Hi:
I wanted to clarify if the following behavior of scoped variables
(target specific varibles) is by design. Consider the code below,
where use of the target "a.info" is for collecting meta data about,
"a" without building "a"


# Begin Code
.PHONY : a.info test

a : var_def := 1
a :
        @touch $@

# Make var_def visible to a.info
a : a.info

a.info :
        @echo VAR_INH: $(var_def)

# This does not emit the value of var_def as 1
# This potentially is because of when dependencies of a.info is resolved
# the dependency a: a.info is never looked at, which makes a.info to
never get access to var_def
test : a.info

# To emitting the value of var_def as 1 we need to have
# test : a
# but this leads to building of a, which we would like to avoid as we
just want to introspect the scoped variable.

# End Code

As I understand that when Make looks at building a target, it only
looks at dependencies that effect the target directly or indirectly.
But this eliminates any scope for looking into any inherited
variables. Is this by design?


Thanks
AB



reply via email to

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