希望这是关于制作模式规则的基本问题: 我想在规则的先决条件中不止一次使用通配符,即在我的Makefile中有
data/%P1.m: $(PROJHOME)/data/%/ISCAN/%P1.RAW
@echo " Writing temporary matlab file for $*"
# do something
data/%P2.m: $(PROJHOME)/data/%/ISCAN/AGP2.RAW
@echo " Writing temporary matlab file for $*"
# do something
在这个例子中,当通配符%为AG时,我尝试调用make。两个文件$(PROJHOME)/data/AG/ISCAN/AGP1.RAW和$(PROJHOME)/data/AG/ISCAN/AGP2.RAW存在。我尝试以下make命令并获得此输出:
[jshen@iLab10 gender-diffs]$ make data/AGP1.m
make: *** No rule to make target `data/AGP1.m'. Stop.
[jshen@iLab10 gender-diffs]$ make data/AGP2.m
Writing temporary matlab file for AG, part 2...
[jshen@iLab10 gender-diffs]$ ls data/AG/ISCAN/AG*
data/AG/ISCAN/AGP1.RAW data/AG/ISCAN/AGP2.RAW
如何在第一个make规则中实现同一个通配符的多个实例?
答案 0 :(得分:4)
这似乎有效:
.SECONDEXPANSION:
data/%P1.m: $(PROJHOME)/data/$$*/ISCAN/$$*P1.RAW
@echo "Writing temporary matlab file for $*, part 1..."