All,
Upon reading the official help for .SECONDEXPANSION: here,
https://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html,
My simple makefile below isn't doing what I expect - it could be from my
weird `$(eval ...)` use...
I'm expecting to be able to append to $(OBJECTS) in the `foo` rule and have
the final value be used in the `all` target. I know this might seem
anti-idiomatic as I see no reference for this technique anywhere.
---- Begin Makefile ----
.PHONY: foo all
.SECONDEXPANSION:
OBJECTS := obj/first
all: foo $$(OBJECTS) ; $(info OBJECTS=$(OBJECTS))
foo:
@$(eval OBJECTS += obj/second)
@echo "in foo, OBJECTS=$(OBJECTS)"
obj/%:
@echo "obj rule => $@"
---- End Makefile ----
---- Begin Output ----
$ make
in foo, OBJECTS=obj/first obj/second
obj rule => obj/first
OBJECTS=obj/first obj/second
---- End Output ----
---- Begin Expected Output ----
$ make
in foo, OBJECTS=obj/first obj/second
obj rule => obj/first
obj rule => obj/second
OBJECTS=obj/first obj/second
---- End Expected Output ----
--
Anthony G. Clark
_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make