On Thu, 2018-08-23 at 23:17 -0400, Anthony Clark wrote: > all: foo $$(OBJECTS) ; $(info OBJECTS=$(OBJECTS)) > > foo: > @$(eval OBJECTS += obj/second) > @echo "in foo, OBJECTS=$(OBJECTS)"
This won't work as you hope, because first make decides to rebuild the "all" target (as it's the first target listed in the makefile). In order to build that target, it must expand the prerequisites so that it can get a list of them. At that time, the "foo" rule hasn't been invoked yet so the eval for OBJECTS hasn't been run and $(OBJECTS) expands to just "obj/first". You may be assuming that make will walk through the prerequisites one at a time and expand (and re-parse into more prerequisites) each one then try to build it, before expanding (then re-parsing) the next prerequisite, but that's not how it works. The entire list of prerequisites is expanded first, before any of them are built. _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make