Follow-up Comment #3, bug #54727 (project make): It also possible to step on this "foreach + eval" bug not in a recipe.
Please consider the next example: ############ # define global variable f := g # function for defining target-specific variables # $1 - target # $2 - variable def_target_specific = $(foreach f,1,$(eval $1: $2:=$$f)) # calling in global context: M=1 $(call def_target_specific,target_X,M) # calling in target-specific context: M=g all: TMP := $(call def_target_specific,target_Y,M) all: target_X target_Y target_X target_Y:; $(info $@: M=$M) ############ result: target_X: M=1 target_Y: M=g As we can see, the variable M has different values for target_X and target_Y, which is not expected. Outer foreach variables cannot be used inside the eval context, if the call comes from a target-specific variable definition. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?54727> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/ _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make