【发布时间】:2014-12-09 12:12:41
【问题描述】:
我有一个 Makefile,它从单个目录中的几个不同 Python 脚本(脚本打印到标准输出)生成 JSON,例如
/src
scriptOne.py
scriptTwo.py
scriptThree.py
将 JSON 输出到文件夹:
/templates
scriptOne.json
scriptTwo.json
scriptThree.json
我正在尝试进行重组,例如,每个脚本都位于其自己的子目录中,并且 Makefile 在其后续子目录中创建 JSON 模板,如下所示:
/src
/importantTemplates
scriptOne.py
/notSoImportantTemplates
scriptTwo.py
scriptThree.py
还有输出:
/templates
/importantTemplates
scriptOne.json
/notSoImportantTemplates
scriptTwo.json
scriptThree.json
当前的Makefile如下:
SOURCES := $(shell echo src/*.py)
TARGETS := $(patsubst src/%.py,templates/%.json,$(SOURCES))
all: $(TARGETS)
clean:
rm -f $(TARGETS)
templates/%.json: src/%.py
python2 $< > $@
我尝试更改通配符以包含每一行的子目录,例如/src/*/*.py,虽然我最终得到以下结果:
make: Nothing to be done for `all'.
【问题讨论】: