I'm wondering if there are any potential race conditions when using evals across targets. So for example, if I have:
all1:
$(eval X:=1)
$(eval Y:=1)
@echo "[$@] X: $(X), Y: $(Y)"
all2:
$(eval Y:=2);
$(eval X:=2);
@echo "[$@] X: $(X), Y: $(Y)"
and then ran
make all all2 -j
Are X
and Y
guaranteed to be the same values for the same target, or can one instance of the target expansion potentially scribble on the other as it's expanding?
(Background -- I'm debugging an inconsistent make bug on some makefiles which use evals to set some common variables across many targets, and I'm wondering if this could be a contributing factor)
make -j
runs each job in a separate process. Variable changes don't transfer between make processes.