【发布时间】:2010-01-27 17:16:43
【问题描述】:
我有一个看起来有点像这样的 GNU Makefile:
LIST = item1
.PHONY: targetMain targetA targetB preA preB
targetMain:
# DO all the work in here
echo $(LIST)
targetA: preA targetMain
targetB: preB targetMain
preA:
LIST += itemA
preB:
LIST += itemB
我的想法是运行 make targetA 或 make targetB。他们俩都做非常相似的事情,但项目列表不同。问题是变量不是有条件地附加到,它总是附加到,这意味着我的输出总是“item1 itemA itemB”。
如何有条件地附加到变量?
【问题讨论】:
标签: variables makefile gnu-make