我正在尝试在我的 Makefile 中执行此操作:
VAL=
TARGET1:
VAL= ... #compute value of VAL
#run some command that uses the value of VAL
TARGET2:
$(MAKE) TARGET1
#run other command that uses the value of VAL
但事实证明 VAL 的值在 TARGET 时被重置!在 TARGET2 中完成。因此,当我尝试在 TARGET2 中运行其他命令时,VAL 的计算值不可用。有什么方法可以保持在 TARGET1 中计算的值?谢谢。