On Wed, 2010-03-03 at 13:03 -0500, Adam Kellas wrote: > On Wed, Mar 3, 2010 at 12:27 PM, Paul Smith <[email protected]> wrote: > In fact the output explicitly does NOT show in any particular > order. > > Thanks. When you say "explicit", do you mean literally that it's > documented somewhere?
No, I don't think it's documented in the manual. > Variables are stored internally to make in a hash table, and > the -p flag > dumps the contents by walking the hash table. So, the values > are > printed in essentially random order. > > > This is somewhat surprising to me - after all, given the makefile > > CFLAGS = -g > CFLAGS = -O > all:; @echo CFLAGS=$(CFLAGS) > > the order is crucial to getting the right result. So make must keep > track of order somehow, no? And if it has that data, why not use it in > -p mode? 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. _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
