【发布时间】:2016-12-11 04:33:10
【问题描述】:
遵循Abort makefile if variable not set 的建议,我正在尝试使用ifndef,但它不起作用。
生成文件:
foo:
ifndef BAR
$(error "Must set BAR")
endif
但是make foo BAR=quux 不行:
Makfile:2: *** "Must set BAR". Stop.
什么给了?是空格问题吗?还是我完全误解了?
(我正在使用 GNU Make)
我也试过了:
foo:
ifndef BAR
$(error "Must set BAR")
endif
echo $(BAR)
这似乎有点工作,但如果调用 Makefile 中更下方的目标(不需要设置变量),仍然会导致调用 ifndef。
【问题讨论】:
标签: makefile