当模式不包含配方时做出行为是不明显的

时间:2014-11-03 16:23:31

标签: makefile

当我在下面调用make all时,我收到错误消息:

没有规则来制作目标`venv / lib / python2.7 / site-packages / planar_growth / node_degree_tracker.so

我不明白为什么会这样。我希望目标$(DST_DIR)/%.so匹配DST_DIR中的所有.so文件,并从SRC_DIR复制它们。为什么不发生这种情况?

SRC_DIR := ./src/spg
DST_DIR := ./venv/lib/python2.7/site-packages/planar_growth
SRC_FILES := node_degree_tracker spatialgrowth splay data_structures
DST_FILES_CYTHON = $(patsubst %,$(DST_DIR)/%.so,$(SRC_FILES))

$(DST_DIR): 
    virtualenv --system-site-packages venv
    mkdir $(DST_DIR)

$(DST_DIR)/%.py: $(SRC_DIR)/%.py $(DST_DIR)
    cp $< $@

compile:
    cd ./src/spg && \
    python setup.py build_ext --inplace

.PHONY: $(SRC_DIR)/%.so
$(SRC_DIR)/%.so: compile

$(DST_DIR)/%.so: $(SRC_DIR)/%.so $(DST_DIR)
    cp $< $@

all: $(DST_FILES_CYTHON)
    cp $(SRC_DIR)/simulate_spg.py $(DST_DIR)/.

按照Etan的要求制作-d:

Updating goal targets....
Considering target file `all'.
 File `all' does not exist.
  Considering target file `venv/lib/python2.7/site-packages/planar_growth/node_degree_tracker.so'.
   File `venv/lib/python2.7/site-packages/planar_growth/node_degree_tracker.so' does not exist.
   Looking for an implicit rule for `venv/lib/python2.7/site-packages/planar_growth/node_degree_tracker.so'.
   Trying pattern rule with stem `node_degree_tracker'.
   Trying implicit prerequisite `src/spg/node_degree_tracker.so'.
   Trying pattern rule with stem `node_degree_tracker.so'.
   Trying implicit prerequisite `venv/lib/python2.7/site-packages/planar_growth/node_degree_tracker.so,v'.
   Trying pattern rule with stem `node_degree_tracker.so'.
   Trying implicit prerequisite `venv/lib/python2.7/site-packages/planar_growth/RCS/node_degree_tracker.so,v'.
   Trying pattern rule with stem `node_degree_tracker.so'.
   Trying implicit prerequisite `venv/lib/python2.7/site-packages/planar_growth/RCS/node_degree_tracker.so'.
   Trying pattern rule with stem `node_degree_tracker.so'.
   Trying implicit prerequisite `venv/lib/python2.7/site-packages/planar_growth/s.node_degree_tracker.so'.
   Trying pattern rule with stem `node_degree_tracker.so'.
   Trying implicit prerequisite `venv/lib/python2.7/site-packages/planar_growth/SCCS/s.node_degree_tracker.so'.
   Trying pattern rule with stem `node_degree_tracker'.
   Trying implicit prerequisite `src/spg/node_degree_tracker.so'.
   Looking for a rule with intermediate file `src/spg/node_degree_tracker.so'.
    Avoiding implicit rule recursion.
    Trying pattern rule with stem `node_degree_tracker.so'.
    Trying implicit prerequisite `src/spg/node_degree_tracker.so,v'.
    Trying pattern rule with stem `node_degree_tracker.so'.
    Trying implicit prerequisite `src/spg/RCS/node_degree_tracker.so,v'.
    Trying pattern rule with stem `node_degree_tracker.so'.
    Trying implicit prerequisite `src/spg/RCS/node_degree_tracker.so'.
    Trying pattern rule with stem `node_degree_tracker.so'.
    Trying implicit prerequisite `src/spg/s.node_degree_tracker.so'.
    Trying pattern rule with stem `node_degree_tracker.so'.
    Trying implicit prerequisite `src/spg/SCCS/s.node_degree_tracker.so'.
   No implicit rule found for `venv/lib/python2.7/site-packages/planar_growth/node_degree_tracker.so'.
   Finished prerequisites of target file `venv/lib/python2.7/site-packages/planar_growth/node_degree_tracker.so'.
  Must remake target `venv/lib/python2.7/site-packages/planar_growth/node_degree_tracker.so'.
make: *** No rule to make target `venv/lib/python2.7/site-packages/planar_growth/node_degree_tracker.so', needed by `all'. Stop.

1 个答案:

答案 0 :(得分:0)

问题在于:

$(SRC_DIR)/%.so: compile

这是没有配方的模式规则。我目前找不到参考,但这是一个问题,至少在某些版本的Make。

所以给它一个什么都不做的食谱,比如:

$(SRC_DIR)/%.so: compile
    @:

或者这个:

$(SRC_DIR)/%.so: compile;