help-make
[Top][All Lists]
Advanced

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

Re: does make -p dump variables in the right order?


From: Adam Kellas
Subject: Re: does make -p dump variables in the right order?
Date: Wed, 3 Mar 2010 14:45:51 -0500

On Wed, Mar 3, 2010 at 1:35 PM, Paul Smith <address@hidden> wrote:
There is no need for make to store the order: these changes are
internalized as the makefile is read in.  In your example above there
are not two different variables CFLAGS^1 and CFLAGS^2, with different
values.  There is only one variable, CFLAGS.  When make reads in the
first line, it sets the variable to the value "-g".  When make reads in
the second line, the first value is thrown away and replaced with the
new value and the variable now has the value "-O".

When make -p runs (after all the makefiles have been read in) it just
prints the current value of each variable; so in this case you'd see
"CFLAGS = -O" in the output.  There is no indication that this variable
ever had any other value.


It took me a while to figure out what was going on, since I had some actual -p output with repeated and conflicting variable settings which appeared to contradict what you say. But it turned out I generated those using "make -n -p" instead of "make -q -p". Since it's a recursive-make situation and since -n does not suppress $(MAKE) recursion, I was seeing conflicting settings derived from different Makefiles. Thanks for clarifying.

AK

reply via email to

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