【发布时间】:2014-10-21 13:17:26
【问题描述】:
我正在使用 Gnu Make 3.81,但在尝试匹配其中也包含变量的模式规则时出错。
这是我能想到的最小的例子:
YYMMDD:=$(shell date +%y%m%d)
TMP_DIR:=/tmp/$(YYMMDD)
# create a temporary directory, and put a "source" file in it
$(TMP_DIR):
mkdir $(TMP_DIR)
echo something > $(TMP_DIR)/somefile.orig
# to build an "object" file in the temp dir, process the "source" file
$(TMP_DIR)/%.new: $(TMP_DIR)/%.orig
wc -l $< > $@
atarget: $(TMP_DIR) $(TMP_DIR)/somefile.new
然后当我运行make atarget 时,我得到:
mkdir /tmp/141021
echo something > /tmp/141021/somefile.orig
make: *** No rule to make target `/tmp/141021/somefile.new', needed by `atarget'. Stop.
这不应该吗?看起来模式规则应该很好地匹配这个。
【问题讨论】: