On Fri, 2011-12-02 at 14:42 -0500, AB wrote: > 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" > > .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 > test : a.info > > 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?
Yes, it's working as expected. The variable inheritance is computed dynamically as make builds the targets, so it's not sufficient to declare a prerequisite relationship, you also have to be building the target as the result of that prerequisite in order to see its variables. -- ------------------------------------------------------------------------------- Paul D. Smith <[email protected]> Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.net "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-make
